Skip to content

Debug Console uses different environment than Terminal #4597

Closed

Description

@dzid26

Configuration

Operating system:
Windows 11
PlatformIO Version (platformio --version):
6.1.6

Description of the problem

Debug console uses an environment from default_envs rather than one containing build_type = debug and the whole thing builds twice

Steps to Reproduce

  1. Clone https://github.com/dzid26/StepperServoCAN/tree/40397a218978ff0f77b2964e72a9b1478b8d6af4/firmware
  2. Replace platformio.ini with the one provided here Debugger does not honor selected environment #4098 (comment)
  3. Environment switcher is set to Default (Auto).
  4. Run debug (F5)

Actual Results

Terminal builds ServoCAN_debug env.
Debug console clears build folder and build ServoCAN env

Expected Results

Both terminal and debug console should build ServoCAN_debug env when debugging is run because ServoCAN_debug contains build_type = debug directive.

If problems with PlatformIO Build System:

Additional info

If I change the default env on the toolbar or modify "projectEnvName": to "ServoCAN_debug" manually then both terminal and debug_console build the same thing.

I used Python debugger to figure out what was going on.
So far I noticed that the terminal uses the following to determine the environment name,

for env in default_envs:
if config.get("env:" + env, "build_type") == "debug":
return env
for env in all_envs:
if config.get("env:" + env, "build_type") == "debug":
return env
return default_envs[0] if default_envs else all_envs[0]

while Debug console uses
environment and env not in environment,
not environment and default_envs and env not in default_envs,
logic for some reason.

I think both should use the same determination logic.

Activity

  1. added this to the 6.1.7 milestone on Apr 12, 2023
  2. ivankravets commented on Apr 12, 2023

    @ivankravets
    Member

    Thanks for the report. Please re-test with pio upgrade --dev.

  3. added a commit that references this issue on May 28, 2024
    66fe556
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions