libgit2 / libgit2sharp

Git + .NET = ❤
http://libgit2.github.com
MIT License
3.13k stars 879 forks source link

TypeInitializationException - unable to load shared library git2-106a5f2 #1994

Open Miepee opened 1 year ago

Miepee commented 1 year ago

Reproduction steps

Repository repo = new Repository();

Expected behavior

Program should not crash

Actual behavior

Program crashes with the following text:

An exception of type 'System.TypeInitializationException' occured in LibGit2Sharp.dll but was not handled in user code: 'The type initializer for 'LibGit2Sharp.Core.Nativemethods' threw an exception.'
libgit2-106a5f2: cannot open shared object file: No such file or directory
at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
at LibGit2Sharp.Core.NativeMethods.InitializeNativeLibrary()
at LibGit2Sharp.Core.NativeMethods..cctor()

Version of LibGit2Sharp (release number or SHA1)

Operating system(s) tested; .NET runtime tested

kboom commented 1 year ago

Same for me, but on Windows 11, and it works intermittently. I'm using that in the vsix package for visual studio.

Miepee commented 1 year ago

I also managed to get this reproduced on macOS.

luislhg commented 1 month ago

Same for me, but on Windows 11, and it works intermittently. I'm using that in the vsix package for visual studio.

Have you managed to use libgit2sharp inside a visual studio extension project?