-
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
Debug Test can't receive DYLD_LIBRARY_PATH
variable in macOS.
#5131
Comments
When you run In your workspace settings.json
in runsettings.runsettings <RunSettings>
<RunConfiguration>
<EnvironmentVariables>
<DYLD_LIBRARY_PATH>AA</DYLD_LIBRARY_PATH>
</EnvironmentVariables>
</RunConfiguration>
</RunSettings> in UnitTest1.cs using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
namespace mstest6;
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
var v = Environment.GetEnvironmentVariable("DYLD_LIBRARY_PATH");
Assert.AreEqual("AA", v);
}
} The env value is read and fails the test because I expect empty string instead:
|
@nohwnd Thank you for your patient reply, but I encountered a problem in the process of a.a.a.a.2022-03-30.23.09.45.movMaybe when debug Test,It's not accept the |
You are right :) I thought I tried that, but my original example was using failing assertion to write the value to the screen, so I might have mistaken the failing assertion message, and overlook the actual failure. The error seems to be here: Debugger uses custom launcher, so test platform responds with info that says how testhost should be started, instead of starting it by itself. The environment variables arrive on the request, but are not passed on. |
@zhen8838 Yet again this is closed. We currently have a release pending. This will be in the next one, which is usually once a month. A possible workaround, if feasible for you, is setting the env variable in a console / terminal, and start VSCode from there. That way the whole process tree including the debugger and omnisharp server will inherit it. It is little less dynamic than providing a settings file, but should work nonetheless. |
@nohwnd Thank you very much for your help! 👍 |
@zhen8838 I had hard time not including it in the release, so I just included it. The artifacts are now being uploaded. And there should be new version available soon, with this fix, 1.24.2. |
Issue Description
I set the
DYLD_LIBRARY_PATH
in the zshrc, then run dotnet test print the env variable value. but when I use debug Test , It can not get the variable value.I record a video:
CUSTOM_VAR
in the zshrc, then run the dotnet test, It's can print theDYLD_LIBRARY_PATH
variable value.CUSTOM_VAR
in the zshrc, then restart the vscode and clickDebut Test
, Now in terminal we can see theCUSTOM_VAR
variable, butDYLD_LIBRARY_PATH
is null.a.a.a.a.2022-03-29.13.24.57.mov
Steps to Reproduce
export DYLD_LIBRARY_PATH="xxx"
in the~/.zshrc
Expected Behavior
will print the
Get DYLD_LIBRARY_PATH : xxx
Actual Behavior
Get DYLD_LIBRARY_PATH :
Logs
OmniSharp log
C# log
Environment information
VSCode version: 1.65.2
C# Extension: 1.24.1
Mono Information
OmniSharp using built-in monoDotnet Information
.NET SDK (reflecting any global.json): Version: 6.0.201 Commit: ef40e6aa06Runtime Environment:
OS Name: Mac OS X
OS Version: 12.3
OS Platform: Darwin
RID: osx.12-arm64
Base Path: /usr/local/share/dotnet/sdk/6.0.201/
Host (useful for support):
Version: 6.0.3
Commit: c24d9a9c91
.NET SDKs installed:
6.0.201 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.3 [/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: