Skip to content
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

Fix: Set DOTNET_ROOT to DOTNET_ROOT_USER during test execution #76819

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

deepakrathore33
Copy link
Contributor

Summary

This PR addresses the issue where the DOTNET_ROOT environment variable is set to an empty string during test execution, leading to failures when running external processes.

Related to dotnet/vscode-csharp#6295

@deepakrathore33 deepakrathore33 requested a review from a team as a code owner January 20, 2025 13:09
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 20, 2025
@@ -58,7 +58,7 @@ public async Task<RunTestsPartialResult[]> HandleRequestAsync(RunTestsParams req
EnvironmentVariables = new()
{
// Reset dotnet root so that vs test console can find the right runtimes.
{ DotnetCliHelper.DotnetRootEnvVar, string.Empty },
{ DotnetCliHelper.DotnetRootEnvVar, Environment.GetEnvironmentVariable("DOTNET_ROOT_USER") },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing actually - we should only set this to DOTNET_ROOT_USER if it isn't EMPTY - https://github.com/dotnet/vscode-csharp/blob/main/src/lsptoolshost/dotnetRuntimeExtensionResolver.ts#L83C60-L83C65

Otherwise we'll be putting an invalid value in DOTNET_ROOT_USER

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right! I've also added an additional check using string.IsNullOrEmpty(Environment.GetEnvironmentVariable("DOTNET_ROOT_USER")). Is this approach fine, or would you prefer we remove it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants