You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version: 7.0.101
Commit: bb24aafa11
Runtime Environment:
OS Name: Mac OS X
OS Version: 13.3
OS Platform: Darwin
RID: osx.13-arm64
Base Path: /usr/local/share/dotnet/sdk/7.0.101/
Host:
Version: 7.0.1
Architecture: arm64
Commit: 97203d38ba
.NET SDKs installed:
7.0.101 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
VS Code version:
C# Extension version: 2.0.328
OmniSharp log
Steps to reproduce
Create a .env file with value set that is not set in global path (ex MY_TEST_VAR=this-should-display
In VSCode settings set "csharp.unitTestDebuggingOptions": { "envFile": "${workspaceFolder}/.testing.env" }
Create XUnit Fact with System.Environment.GetEnvironmentVariable<string>("MY_TEST_VAR")
Add Breakpoint after getting this env var
Run Debug Test
Check value at breakpoint (should be set but is null
Expected behavior
With the Roslyn editor there should still be a way to set and change environment variables for test runs/debugging. Ideally existing config from previous versions of vscode-csharp would be able to be migrated or configs would still work with existing keys. Otherwise, the replacement or changes to this behavior should be documented (previously documented in the wiki)
Actual behavior
The envFile value from csharp.unitTestDebuggingOptions is no longer loaded for unit tests with version >2.0.320 and when using Roslyn language server.
Thanks - yup csharp.unitTestDebuggingOptions is one of the reasons #5719 is not closed. Added a mention of these here - #5719 (comment)
Note - technically csharp.unitTestDebuggingOptions doesn't list support for an envFile option as a valid property - it happened to work in O# due to how O# started test debugging, but it will not work in the new version (O# launched the test host process itself so could set env vars, in the new version we delegate that work to the dotnet test platform).
@dibarbet when the release versions of this and devkit support runsettings for tests: is there a .envFile equivalent for only tests in a full SLN using .runsettings?
Our team has been on Netcore with Rider and VScode exclusively for the lifecycle of our project and making a 1:1 comparison with OG VS docs can sometimes be tricky.
For more context, our team has committed VSCode config but we use an extensive set of non-committed .env files to make sure we're not committing secrets or configs that may vary between individual team members
Ah if you're using devkit, then I think there's likely a different way of configuring unit test settings (my change only applies if you're using C# w/out devkit).
Tagging @peterwald to advise on how to configure unit test settings in devkit
Environment data
dotnet --info
output:VS Code version:
C# Extension version: 2.0.328
OmniSharp log
Steps to reproduce
.env
file with value set that is not set in global path (exMY_TEST_VAR=this-should-display
"csharp.unitTestDebuggingOptions": { "envFile": "${workspaceFolder}/.testing.env" }
System.Environment.GetEnvironmentVariable<string>("MY_TEST_VAR")
Debug Test
Expected behavior
With the Roslyn editor there should still be a way to set and change environment variables for test runs/debugging. Ideally existing config from previous versions of
vscode-csharp
would be able to be migrated or configs would still work with existing keys. Otherwise, the replacement or changes to this behavior should be documented (previously documented in the wiki)Actual behavior
The
envFile
value fromcsharp.unitTestDebuggingOptions
is no longer loaded for unit tests with version >2.0.320 and when using Roslyn language server.Additional context
This config has been working and is still documented in the Wiki with no replacement docs or functionality: https://github.com/dotnet/vscode-csharp/wiki/How-to-run-and-debug-unit-tests
The text was updated successfully, but these errors were encountered: