platformio-core: Debugger does not honor selected environment

The new environment switch in the status bar is a welcome enhancement. Unfortunately, it is not honored by the debugger. Instead, the debugger uses the first environment or the one selected by default_envs.

As the environment switch applies to IntelliSense and the Build and Upload actions in the status bar, users expect that the debugger behaves the same. I did so too.

In my case it even lead to a very confusing situation:

  • Clicking the green arrow the debugger pane started a rebuild of the project (debug configuration) – as expected.
  • After that, nothing happened anymore.
  • It took me quite some time until I remembered to switch to the DEBUG CONSOLE. I found an error basically saying unexpected idcode: 0x0bb11477, expected 1 of 1: 0x2ba01477.
  • It took me even more time to figure out that this error message was not due to a Chinese clone of the STM32 chip, but rather due to a mismatch between the environment use by the debugger and the board connected to my computer.

I see two options to fix it:

  • Honor the currently select environment when starting the debugger (preferred)
  • Label the debug configuration (launch.json) such that it is obvious which one is used

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (11 by maintainers)

Most upvoted comments

@dzid26, thanks, I reproduced this issue. This is a bug and is different from this issue. Could I ask you to open a new issue at https://github.com/platformio/platformio-core/issues to track this problem?