Open<
9A3F
/div>
Description
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
- Create a project using
dotnet new webapi
and add it to a solution - Replace
launchSettings.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"
}
}
}
}
- Add
var inputFolder = builder.Configuration["InputFolder"];
toProgram.cs
and set a breakpoint just after it. - Open the "Run and Debug" panel in VS Code
- In the dropdown, select "C#: ..."
- In the chooser that pops up, select "C#: projectname [linux]"
- 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