libgit2 / libgit2/libgit2sharp
TypeInitializationException on M1 chip
Personne n'a encore pris cette issue.
- Langage dominant
- C#
- Étoiles
- 3.5k
- Forks
- 925
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
Reproduction steps
I had a bug report on my project about this.
this is the code that's failing on an M1 chip.
public static void GitSetup(string solutionDirectory)
{
GitBuilder.CreateGitIgnore(solutionDirectory);
Repository.Init(solutionDirectory);
var repo = new Repository(solutionDirectory);
string[] allFiles = Directory.GetFiles(solutionDirectory, "*.*", SearchOption.AllDirectories);
Commands.Stage(repo, allFiles);
var author = new Signature("Craftsman", "craftsman", DateTimeOffset.Now);
repo.Commit("Initial Commit", author, author);
}
Expected behavior
I should have a new repo created and an initial commit made. This works fine on my intel chip.
Actual behavior
This is the exception that gets thrown
TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an
exception.
In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment
variable: dlopen(libgit2-106a5f2, 0x0001): tried: 'libgit2-106a5f2' (no such file),
'/usr/local/lib/libgit2-106a5f2' (no such file), '/usr/lib/libgit2-106a5f2' (no such file),
'/Users/me/Desktop/code/csharp/libgit2-106a5f2' (no such file),
'/usr/local/lib/libgit2-106a5f2' (no such file), '/usr/lib/libgit2-106a5f2' (no such file)
at git_libgit2_init()
at InitializeNativeLibrary()
at cctor()
at git_repository_init_ext(git_repository*& repository, FilePath path, GitRepositoryInitOptions options)
at git_repository_init_ext(FilePath workdirPath, FilePath gitdirPath, Boolean isBare)
at Init(String path, Boolean isBare)
at Init(String path)
at GitSetup(String solutionDirectory) in Utilities.cs:393
at CreateNewDomainProject(String domainDirectory, IFileSystem fileSystem, DomainProject domainProject)
in NewDomainProjectCommand.cs:115
at Run(String buildSolutionDirectory, IFileSystem fileSystem) in NewExampleCommand.cs:41
Version of LibGit2Sharp (release number or SHA1)
Release: 0.26.2
Operating system(s) tested; .NET runtime tested
OS + .NET version
.NET SDK (reflecting any global.json):
Version: 6.0.101
Commit: ef49f6213a
Runtime Environment:
OS Name: Mac OS X
OS Version: 12.1
OS Platform: Darwin
RID: osx.12-arm64
Base Path: /usr/local/share/dotnet/sdk/6.0.101/
Host (useful for support):
Version: 6.0.1
Commit: 3a25a7f1cc
.NET SDKs installed:
6.0.101 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
git version
❯ git --version
git version 2.34.1
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Reproduisez l’échec dans l’environnement macOS 12.1 arm64 signalé à l’aide de GitSetup dans Utilities.cs, puis inspectez LibGit2Sharp.Core.NativeMethods et le chemin d’appel passant par NewDomainProjectCommand.cs et NewExampleCommand.cs. Le travail est terminé lorsque Repository.Init et le commit initial s’achèvent correctement sur une puce M1 sans la TypeInitializationException.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- csharp
- Domaine
- tooling
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 35/100