libgit2 / libgit2/libgit2sharp

TypeInitializationException - unable to load shared library git2-106a5f2

Open
#1,994 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

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)
  • 0.26.2
  • 0.27.0-preview-0182
Operating system(s) tested; .NET runtime tested
  • OS: Linux Mint
  • Kernel: 5.15.0-41
  • .NET SDK / runtime: 6.0.110

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Repository constructor and follow the NativeMethods.InitializeNativeLibrary() path shown in the stack trace, reproducing on Linux Mint with .NET 6 and the listed LibGit2Sharp versions. Investigate why the git2-106a5f2 shared library cannot be loaded; done means the provided Repository creation no longer crashes on the reported environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.