8000 [BUG] Debugging does not use environment variables from the selected launch profile · Issue #2019 · microsoft/vscode-dotnettools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[BUG] Debugging does not use environment variables from the selected launch profile #2019
Open< 9A3F /div>
@jesperkristensen

Description

@jesperkristensen

Describe the Issue

Debugger uses environment variables from the first launch profile in launchSettings.json instead of the selected launch profile.

It worked a few weeks ago, then after an update of C# Dev Kit extension the ability to select a profile in the list was removed, then with the update of the extension today it came back but is now not working.

Steps To Reproduce

  1. Create a project using dotnet new webapi and add it to a solution
  2. ReplacelaunchSettings.json with this:
{
  "$schema": "http://json.schemastore.org/launchsettings.json",
  "profiles": {
    "windows": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "applicationUrl": "http://localhost:5050",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development",
        "InputFolder": "C:\\workspace\\inputs"
      }
    },
    "linux": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "applicationUrl": "http://localhost:5050",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development",
        "InputFolder": "/workspace/inputs"
      }
    }
  }
}
  1. Add var inputFolder = builder.Configuration["InputFolder"]; to Program.cs and set a breakpoint just after it.
  2. Open the "Run and Debug" panel in VS Code
  3. In the dropdown, select "C#: ..."
  4. In the chooser that pops up, select "C#: projectname [linux]"
  5. Click the "Start Debugging" triangle

Expected Behavior

The value of inputFolder in the debugger is "C:\workspace\inputs" which comes from the first launch profile in launchSettings.json. It should have been the value from the launch profile I just selected.

Environment Information

Ubuntu in remote WSL.
VS Code 1.100.0
C# Dev Kit 1.19.63
.NET SDK 8

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0