libgit2 / libgit2sharp

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

Unusable due to exceptions in both Linux and Windows #2054

Open tomer-ds opened 11 months ago

tomer-ds commented 11 months ago

Hi, I have been attempting to use your very nice looking tool. Unfortunately I continiualy get different exceptions basedon OS

Windows:

PS C:\Git\OM2\om2-github-actions> Find-GitRepository
format-default: Exception has been thrown by the target of an invocation.

Ubuntu running PWSH

PS /mnt/c/Git/OM2/om2-github-actions> Import-Module LibGit2
MethodInvocationException: Exception calling "Register" with "1" argument(s): "The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception."

An error has occurred that was not properly handled. Additional information is shown below. The PowerShell process will exit.
Unhandled exception. System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.
 ---> System.DllNotFoundException: Unable to load shared library 'git2-15e1193' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: 
/opt/microsoft/powershell/7/git2-15e1193.so: cannot open shared object file: No such file or directory
/home/tomer/.local/share/powershell/Modules/LibGit2/0.9.1/bin/git2-15e1193.so: cannot open shared object file: No such file or directory
/opt/microsoft/powershell/7/libgit2-15e1193.so: cannot open shared object file: No such file or directory
/home/tomer/.local/share/powershell/Modules/LibGit2/0.9.1/bin/libgit2-15e1193.so: cannot open shared object file: No such file or directory
/opt/microsoft/powershell/7/git2-15e1193: cannot open shared object file: No such file or directory
/home/tomer/.local/share/powershell/Modules/LibGit2/0.9.1/bin/git2-15e1193: cannot open shared object file: No such file or directory
/opt/microsoft/powershell/7/libgit2-15e1193: cannot open shared object file: No such file or directory
/home/tomer/.local/share/powershell/Modules/LibGit2/0.9.1/bin/libgit2-15e1193: cannot open shared object file: No such file or directory

   at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
   at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor()
   at LibGit2Sharp.Core.NativeMethods..cctor()
   --- End of inner exception stack trace ---
   at LibGit2Sharp.Core.NativeMethods.RemoveHandle()
   at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject.Finalize()
[1]    9021 IOT instruction  pwsh

I get the feeling I am missing something

ethomson commented 11 months ago

Hi @tomer-ds - I moved this issue over to the LibGit2Sharp repository since that's a slightly better fit. But I think that you're actually using the GitAutomation PowerShell module (formerly known as LibGit2.PowerShell). Your question might be better over there!