-
Notifications
You must be signed in to change notification settings - Fork 676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
csharp.unitTestDebuggingOptions.env
broken as of 1.24.2
#5309
Comments
This is "by design" as I think the way to do what you are trying to do is with a .runsettings file. Documentation: https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file?view=vs-2022 |
Then at the very least, the docs two lines down from that are wrong - any launch.json option is not valid. I figured that's where it was getting overridden, which is why I linked to the commit that changed the behavior. I'd like to challenge the idea that this is by design based on the docs. It seems like the intent actually was to allow launch.json stuff to work... And it did for a while! It seems like it still could if the environment got merged with the settings rather than completely overridden. If I do end up having to use .runsettings, how do I set that so it only gets used during test debugging? I didn't see a specific option to indicate a .runsettings file in the unit test debugging options. Maybe I missed it? It was admittedly a bit confusing that the .runsettings page says it works for VS but specifically shows VS Code as not being supported. Stale docs? |
We intentionally do not allow |
Fair enough. Can you point me to how to specify a .runsettings in the unitTestDebuggingOptions? |
I only know the debugging side of things, but you would use |
Ah! Excellent. I'll give that a shot. I appreciate the help and the pointers! |
Issue Description
Prior to v1.24.2 you could specify environment variables to use during unit test debugging in your
settings.json
undercsharp.unitTestDebuggingOptions
(which says anylauch.json
option is available).As of v1.24.2, environment variables provided via
csharp.unitTestDebuggingOptions
no longer show up in the unit test debugging environment.If I had to guess, it has to do with this commit which changed the way environment variables get passed during the debug operation.
Steps to Reproduce
In
settings.json
, add an environment variable to use during unit testing:Create a unit test that tries to read that variable.
Use the Code Lens to debug that test.
Expected Behavior
I expect the test to pass - the environment variable should be there because it was provided in the debugging options.
Actual Behavior
The test fails - the environment variable is not present.
Logs
OmniSharp log
No relevant logs are captured.
C# log
No relevant logs are captured.
Environment information
VSCode version: 1.69.1
C# Extension: 1.24.1
Mono Information
OmniSharp using built-in monoDotnet Information
.NET SDK (reflecting any global.json): Version: 6.0.301 Commit: 43f9b18481Runtime Environment:
OS Name: Mac OS X
OS Version: 12.4
OS Platform: Darwin
RID: osx.12-x64
Base Path: /usr/local/share/dotnet/sdk/6.0.301/
Host (useful for support):
Version: 6.0.6
Commit: 7cca709db2
.NET SDKs installed:
3.1.413 [/usr/local/share/dotnet/sdk]
5.0.400 [/usr/local/share/dotnet/sdk]
6.0.301 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.19 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.19 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
Visual Studio Code Extensions
The text was updated successfully, but these errors were encountered: