vscode-csharp icon indicating copy to clipboard operation
vscode-csharp copied to clipboard

DOTNET_ROOT variable is removed during test execution

Open moteus opened this issue 2 years ago • 1 comments

Issue Description

When test run via buttuns like Run test/Debug test the debuggee process has empy DOTNET_ROOT env variable but instead this it has the DOTNET_ROOT_USER variable set. As result I've got error when run extenrnal process (sqlpackage in my case). For now I copy value from the DOTNET_ROOT_USER to the DOTNET_ROOT by hand in my test.

Steps to Reproduce

Run NUnit test with check Assert.IsNotEmpty(Environment.GetEnvironmentVariable("DOTNET_ROOT"))

Expected Behavior

Tested process should have value for the DOTNET_ROOT variable the same as VSCode process.

Actual Behavior

DOTNET_ROOT variable contains empty string

Logs

Environment information

VSCode version: 1.81.1 C# Extension: 2.0.436 Using OmniSharp: false

Dotnet Information

Host: Version: 7.0.10 Architecture: x64 Commit: a6dbb800a4

.NET SDKs installed: No SDKs were found.

.NET runtimes installed: Microsoft.NETCore.App 7.0.10 [/home/amelnichuk/.config/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.10/shared/Microsoft.NETCore.App]

Other architectures found: None

Environment variables: DOTNET_ROOT [/home/amelnichuk/devtools/dotnet]

global.json file: /home/amelnichuk/repos/crtb/global.json

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

Visual Studio Code Extensions
Extension Author Version Folder Name
apache-netbeans-java asf 19.0.0 asf.apache-netbeans-java-19.0.0
code-runner formulahendry 0.12.0 formulahendry.code-runner-0.12.0
csharp ms-dotnettools 2.0.436 ms-dotnettools.csharp-2.0.436-linux-x64
data-workspace-vscode ms-mssql 0.5.0 ms-mssql.data-workspace-vscode-0.5.0
dotnet formulahendry 0.0.4 formulahendry.dotnet-0.0.4
esbuild-problem-matchers connor4312 0.0.2 connor4312.esbuild-problem-matchers-0.0.2
gradle-language naco-siren 0.2.3 naco-siren.gradle-language-0.2.3
isort ms-python 2023.10.1 ms-python.isort-2023.10.1
jestRunIt vespa-dev-works 0.6.0 vespa-dev-works.jestrunit-0.6.0
jupyter ms-toolsai 2023.7.1002162226 ms-toolsai.jupyter-2023.7.1002162226-linux-x64
lua sumneko 3.7.0 sumneko.lua-3.7.0-linux-x64
lua-debug devCAT 1.1.1 devcat.lua-debug-1.1.1
lua-mobdebug AlexeyMelnichuk 0.0.5 alexeymelnichuk.lua-mobdebug-0.0.5
mssql ms-mssql 1.20.1 ms-mssql.mssql-1.20.1
python ms-python 2023.14.0 ms-python.python-2023.14.0
remote-containers ms-vscode-remote 0.304.0 ms-vscode-remote.remote-containers-0.304.0
remote-explorer ms-vscode 0.4.1 ms-vscode.remote-explorer-0.4.1
remote-server ms-vscode 1.4.3 ms-vscode.remote-server-1.4.3
remote-ssh ms-vscode-remote 0.102.0 ms-vscode-remote.remote-ssh-0.102.0
remote-ssh-edit ms-vscode-remote 0.86.0 ms-vscode-remote.remote-ssh-edit-0.86.0
remote-wsl ms-vscode-remote 0.81.0 ms-vscode-remote.remote-wsl-0.81.0
sql-bindings-vscode ms-mssql 0.4.0 ms-mssql.sql-bindings-vscode-0.4.0
sql-database-projects-vscode ms-mssql 1.2.0 ms-mssql.sql-database-projects-vscode-1.2.0
trxviewer scabana 1.0.3 scabana.trxviewer-1.0.3
vscode-docker ms-azuretools 1.26.0 ms-azuretools.vscode-docker-1.26.0
vscode-dotnet-runtime ms-dotnettools 1.7.2 ms-dotnettools.vscode-dotnet-runtime-1.7.2
vscode-eslint dbaeumer 2.4.2 dbaeumer.vscode-eslint-2.4.2
vscode-gradle vscjava 3.12.7 vscjava.vscode-gradle-3.12.7
vscode-gradle-extension-pack richardwillis 0.0.4 richardwillis.vscode-gradle-extension-pack-0.0.4
vscode-icons vscode-icons-team 12.5.0 vscode-icons-team.vscode-icons-12.5.0
vscode-jupyter-cell-tags ms-toolsai 0.1.8 ms-toolsai.vscode-jupyter-cell-tags-0.1.8
vscode-jupyter-slideshow ms-toolsai 0.1.5 ms-toolsai.vscode-jupyter-slideshow-0.1.5
vscode-language-babel mgmcdermott 0.0.39 mgmcdermott.vscode-language-babel-0.0.39
vscode-npm fknop 3.3.0 fknop.vscode-npm-3.3.0
vscode-npm-scripts traBpUkciP 0.2.1 trabpukcip.vscode-npm-scripts-0.2.1
vscode-proto3 zxh404 0.5.5 zxh404.vscode-proto3-0.5.5
vscode-pylance ms-python 2023.8.50 ms-python.vscode-pylance-2023.8.50
vscode-remote-extensionpack ms-vscode-remote 0.24.0 ms-vscode-remote.vscode-remote-extensionpack-0.24.0
yarn-lock-syntax mariusschulz 0.2.0 mariusschulz.yarn-lock-syntax-0.2.0

moteus avatar Sep 06 '23 13:09 moteus

Any news on this? I still have the same issue

moteus avatar Dec 22 '23 17:12 moteus

https://github.com/dotnet/roslyn/blob/main/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Testing/RunTestsHandler.cs#L61C35-L61C51 likely needs to be reset to DOTNET_ROOT_USER instead of an empty string

dibarbet avatar Nov 27 '24 21:11 dibarbet

resolved in https://github.com/dotnet/roslyn/pull/76819

dibarbet avatar May 19 '25 20:05 dibarbet