Visual Studio Code/OmniSharp on Ubuntu 18.04: DllNotFoundException
See original GitHub issueVisual Studio Code/OmniSharp fails to properly load .csproj
projects which contain a reference to NerdBank.GitVersioning. I’ve tried with the latest version of the 3.0 series of nbgv, both from NuGet and the CI feed.
Don’t have much time to deep dive into this at the moment. Here are a couple of things I’ve noticed:
- Compiling using
dotnet build
works properly. - I’m a bit confused by the
lib/
part in the path (lib/linux-x64/libgit2-572e4d8.so
) linux-x64/libgit2-572e4d8.so
should load fine on my platform, see theldd
output below.
Here’s the full stack error:
[fail]: OmniSharp.MSBuild.ProjectLoader
The "Nerdbank.GitVersioning.Tasks.GetBuildVersion" task failed unexpectedly.
System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: lib/linux-x64/libgit2-572e4d8.so assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
at LibGit2Sharp.Core.NativeMethods.InitializeNativeLibrary () [0x00002] in <5eedf8e7a87843a29f618ebab30cacf5>:0
at LibGit2Sharp.Core.NativeMethods..cctor () [0x00045] in <5eedf8e7a87843a29f618ebab30cacf5>:0
--- End of inner exception stack trace ---
at LibGit2Sharp.Core.Proxy.git_libgit2_opts_set_search_path (LibGit2Sharp.ConfigurationLevel level, System.String path) [0x00000] in <5eedf8e7a87843a29f618ebab30cacf5>:0
at LibGit2Sharp.GlobalSettings.SetConfigSearchPaths (LibGit2Sharp.ConfigurationLevel level, System.String[] paths) [0x0001a] in <5eedf8e7a87843a29f618ebab30cacf5>:0
at Nerdbank.GitVersioning.GitExtensions.OpenGitRepo (System.String pathUnderGitRepo, System.Boolean useDefaultConfigSearchPaths) [0x00025] in <e6b3f9410fa9409c8eeff285038f1773>:0
at Nerdbank.GitVersioning.VersionOracle.Create (System.String projectDirectory, System.String gitRepoDirectory, Nerdbank.GitVersioning.ICloudBuild cloudBuild, System.Nullable`1[T] overrideBuildNumberOffset, System.String projectPathRelativeToGitRepoRoot) [0x00017] in <e6b3f9410fa9409c8eeff285038f1773>:0
at Nerdbank.GitVersioning.Tasks.GetBuildVersion.ExecuteInner () [0x000c5] in <0c993f0ed37445e28de1993f9f821a67>:0
at MSBuildExtensionTask.ContextAwareTask.Execute () [0x0005e] in <0c993f0ed37445e28de1993f9f821a67>:0
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <b695b16788dd418cbe8b4d98f7a92ff3>:0
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002a9] in <b695b16788dd418cbe8b4d98f7a92ff3>:0
Here’s the ldd output:
$ ldd ~/.nuget/packages/nerdbank.gitversioning/3.0.41/build/runtimes/linux-x64/native/libgit2-572e4d8.so
linux-vdso.so.1 (0x00007fffb69b1000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f7ee672a000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7ee650b000)
libssl.so.1.0.0 => /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f7ee62a3000)
libcrypto.so.1.0.0 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f7ee5e60000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7ee5a6f000)
/lib64/ld-linux-x86-64.so.2 (0x00007f7ee6c5d000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7ee586b000)
Leaving this here in case anyone else sees a similar problem (or even better, knows how to fix it).
Issue Analytics
- State:
- Created 4 years ago
- Reactions:9
- Comments:36 (8 by maintainers)
Top Results From Across the Web
Issue with Intellisense for VSCode for Unity on Ubuntu ...
I am trying to use Unity on Ubuntu 18.04 using Visual Studio Code. ... VSCode output this error in the Omnisharp terminal:.
Read more >Visual Studio Code failed to load C# Extension on Ubuntu
So I installed the latest Ubuntu 19.04 and Visual Studio Code 1.34.0. ... is changing the configuration of C# extension — OmniSharp: Use...
Read more >How can I fix this VS Code / .NET Core SDK issue?
Running on Ubuntu 18.04. According to this website only Microsoft version of VS supports debugging github.com/OmniSharp/omnisharp-vscode/wiki/…
Read more >No Intellisense in VS Code on Linux : r/dotnet
After installing omnisharp extension there is no changes. Intellisense won't output any .net types and its members.
Read more >Visual Studio Code failed to find .Net Framework at ...
Unity: I am using an Appimage File downloaded from the official Website .Net: I followed this Tutorial; Visual Studio Code: via Ubuntu Software ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Or maybe should we be poking Omnisharp to move to .NET Core instead of Mono?
Yep, this basically breaks using VS Code for C# projects that use GitVersioning, because the project load failure means no Intellisense, no F12, etc.