question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Debug Test can't receive `DYLD_LIBRARY_PATH` variable in macOS.

See original GitHub issue

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:

  1. I have not set the CUSTOM_VAR in the zshrc, then run the dotnet test, It’s can print the DYLD_LIBRARY_PATH variable value.
  2. I set the CUSTOM_VAR in the zshrc, then restart the vscode and click Debut Test, Now in terminal we can see the CUSTOM_VAR variable, but DYLD_LIBRARY_PATH is null.
  3. use dotnet test, I can get both environment variable value.

https://user-images.githubusercontent.com/26156999/160542063-cf23a55a-9de8-4837-ab27-434286b7c298.mov

Steps to Reproduce

  1. write the export DYLD_LIBRARY_PATH="xxx" in the ~/.zshrc
  2. restart the viscose
  3. click the debug test with code:
   [Fact]
    public void TestGETENV()
    {
        // var env = System.Environment.GetEnvironmentVariables();
        // foreach (var k in env.Keys)
        // {
        //     System.Console.WriteLine(k + ": " + env[k]);
        // }
        System.Console.WriteLine("Get DYLD_LIBRARY_PATH : " + System.Environment.GetEnvironmentVariable("DYLD_LIBRARY_PATH"));
        System.Console.WriteLine("Get CUSTOM_VAR : " + System.Environment.GetEnvironmentVariable("CUSTOM_VAR"));
    }

Expected Behavior

will print the Get DYLD_LIBRARY_PATH : xxx

Actual Behavior

Get DYLD_LIBRARY_PATH :

Logs

OmniSharp log

Post the output from Output--> [info]: OmniSharp.DotNetTest.VSTestManager read: {"MessageType":"TestSession.Connected","Payload":null} [info]: OmniSharp.DotNetTest.VSTestManager read: {"MessageType":"ProtocolVersion","Payload":1} [info]: OmniSharp.DotNetTest.DebugSessionManager Debug session started. [info]: OmniSharp.DotNetTest.DebugSessionManager Debug session ended.

C# log

Post the output from Output-->C# here

Environment information

VSCode version: 1.65.2 C# Extension: 1.24.1

Mono Information OmniSharp using built-in mono
Dotnet Information .NET SDK (reflecting any global.json): Version: 6.0.201 Commit: ef40e6aa06

Runtime 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
Extension Author Version
better-comments aaron-bond 2.1.0
change-case wmaurer 1.0.0
clang-format xaver 1.9.0
codestream CodeStream 12.13.0
copilot GitHub 1.9.5350
csharp ms-dotnettools 1.24.1
doxdocgen cschlosser 1.4.0
file-icons file-icons 1.0.29
gitlens eamodio 12.0.5
hexeditor ms-vscode 1.9.5
icons-carbon antfu 0.2.4
increment-selection albymor 0.2.0
material-theme zhuangtongfa 3.13.20
remote-ssh ms-vscode-remote 0.76.1
remote-ssh-edit ms-vscode-remote 0.76.1
test-adapter-converter ms-vscode 0.1.5
todo-tree Gruntfuggly 0.0.215
vscode-clangd llvm-vs-code-extensions 0.1.15
vscode-lldb vadimcn 1.7.0
vscode-test-explorer hbenl 2.21.1
vscode-wakatime WakaTime 18.0.8
vscode-yaml redhat 1.5.1
vscodeintellicode VisualStudioExptTeam 1.2.17

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
nohwndcommented, Apr 1, 2022

@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.

0reactions
zhen8838commented, Apr 1, 2022

@nohwnd Thank you very much for your help! 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hardened Runtime: dyld: Library not loaded - Apple Developer
I saw an issue another application ran into, which suggests the problem was with @executable_path, and that they were able to solve their...
Read more >
Where do I set DYLD_LIBRARY_PATH on Mac OS X, and is it ...
It's an environment variable and as such is usually set in Terminal by export DYLD_LIBRARY_PATH=someValue. man dyld says: DYLD_LIBRARY_PATH.
Read more >
DYLD_LIBRARY_PATH not being respected on OS X #962
In my case I'm trying to work with custom C library which is built somewhere in my home directory. Expected result. Given libexample.dylib...
Read more >
macos - dyld: Library not loaded ... Reason: Image not found
On OS X, this is as simple as setting the DYLD_LIBRARY_PATH environment variable.
Read more >
Debugger not starting: dyld library not loaded : GO-9981
Please add the env command to the dlvLauncher.sh script and debug tests in IDE. The script will print its environment variables, please attach...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found