libgit2 / libgit2/libgit2sharp

System.BadImageFormatException: Method has no body on CentOS

Ouverte
#1,637 15 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

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 use CAKE to automate build process. I run my build script on CentOS and it throws an exception

To reproduce the issue, try to create an instance of the 'Repository' class.
I've created a test project reproducing similar error, but on MacOS.

I also use CAKE script, but the original one is more complex than the test one, but in any way the library also throws similar exception related to native methods.

...
var repo = new Repository("./.git");
...
Actual behavior
Error: System.AggregateException: One or more errors occurred. ---> System.BadImageFormatException: Method has no body
  at LibGit2Sharp.Core.Proxy.git_repository_open (System.String path) [0x00008] in <b59d5da32f8541b2a767004d8bddc22b>:0 
  at LibGit2Sharp.Repository..ctor (System.String path, LibGit2Sharp.RepositoryOptions options, LibGit2Sharp.Repository+RepositoryRequiredParameter requiredParameter) [0x002ee] in <b59d5da32f8541b2a767004d8bddc22b>:0 
  at LibGit2Sharp.Repository..ctor (System.String path) [0x00000] in <b59d5da32f8541b2a767004d8bddc22b>:0 
  at Submission#0.<<Initialize>>b__0_3 () [0x0000d] in <c937322efd9e45229071df73bf4f662f>:0 
  at Cake.Core.CakeTaskBuilderExtensions+<>c__DisplayClass17_0.<Does>b__0 (Cake.Core.ICakeContext context) [0x00000] in <1a12afcf649f4de8ab5d15d82d4f6310>:0 
  at Cake.Core.CakeTaskBuilderExtensions+<>c__DisplayClass20_0.<Does>b__0 (Cake.Core.ICakeContext x) [0x00000] in <1a12afcf649f4de8ab5d15d82d4f6310>:0 
  at Cake.Core.CakeTask.Execute (Cake.Core.ICakeContext context) [0x00066] in <1a12afcf649f4de8ab5d15d82d4f6310>:0 
  at Cake.Core.DefaultExecutionStrategy.ExecuteAsync (Cake.Core.CakeTask task, Cake.Core.ICakeContext context) [0x000ee] in <1a12afcf649f4de8ab5d15d82d4f6310>:0 
  at Cake.Core.CakeEngine.ExecuteTaskAsync (Cake.Core.ICakeContext context, Cake.Core.IExecutionStrategy strategy, System.Diagnostics.Stopwatch stopWatch, Cake.Core.CakeTask task, Cake.Core.CakeReport report) [0x00131] in <1a12afcf649f4de8ab5d15d82d4f6310>:0 
  at Cake.Core.CakeEngine.RunTask (Cake.Core.ICakeContext context, Cake.Core.IExecutionStrategy strategy, Cake.Core.CakeTask task, System.String target, System.Diagnostics.Stopwatch stopWatch, Cake.Core.CakeReport report) [0x00124] in <1a12afcf649f4de8ab5d15d82d4f6310>:0 
  at Cake.Core.CakeEngine.RunTargetAsync (Cake.Core.ICakeContext context, Cake.Core.IExecutionStrategy strategy, Cake.Core.ExecutionSettings settings) [0x00338] in <1a12afcf649f4de8ab5d15d82d4f6310>:0 
  at Cake.Scripting.BuildScriptHost.RunTargetAsync (System.String target) [0x0009f] in <52bc22bce5254240ba373b3cf23da1ab>:0 
  at Cake.Core.Scripting.ScriptHost.RunTarget (System.String target) [0x0000d] in <1a12afcf649f4de8ab5d15d82d4f6310>:0 
  at Submission#0+<<Initialize>>d__0.MoveNext () [0x00150] in <c937322efd9e45229071df73bf4f662f>:0 
  at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult] (System.Collections.Immutable.ImmutableArray`1[T] precedingExecutors, System.Func`2[T,TResult] currentExecutor, System.Runtime.CompilerServices.StrongBox`1[T] exceptionHolderOpt, System.Func`2[T,TResult] catchExceptionOpt, System.Threading.CancellationToken cancellationToken) [0x00186] in <3ee4bd870c1146d59b98317e4bbdcbe8>:0 
  at Microsoft.CodeAnalysis.Scripting.Script`1[T].RunSubmissionsAsync (Microsoft.CodeAnalysis.Scripting.ScriptExecutionState executionState, System.Collections.Immutable.ImmutableArray`1[T] precedingExecutors, System.Func`2[T,TResult] currentExecutor, System.Func`2[T,TResult] catchExceptionOpt, System.Threading.CancellationToken cancellationToken) [0x000a8] in <3ee4bd870c1146d59b98317e4bbdcbe8>:0 
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <3d1438d9da1e4fe0b915f807d1ba56bd>:0 
  at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <3d1438d9da1e4fe0b915f807d1ba56bd>:0 
  at System.Threading.Tasks.Task.Wait () [0x00000] in <3d1438d9da1e4fe0b915f807d1ba56bd>:0 
  at Cake.Scripting.Roslyn.RoslynScriptSession.Execute (Cake.Core.Scripting.Script script) [0x001a7] in <52bc22bce5254240ba373b3cf23da1ab>:0 
  at Cake.Core.Scripting.ScriptRunner.Run (Cake.Core.Scripting.IScriptHost host, Cake.Core.IO.FilePath scriptPath, System.Collections.Generic.IDictionary`2[TKey,TValue] arguments) [0x00358] in <1a12afcf649f4de8ab5d15d82d4f6310>:0 
  at Cake.Commands.BuildCommand.Execute (Cake.CakeOptions options) [0x0003f] in <52bc22bce5254240ba373b3cf23da1ab>:0 
  at Cake.CakeApplication.Run (Cake.CakeOptions options) [0x00015] in <52bc22bce5254240ba373b3cf23da1ab>:0 
  at Cake.Program.Main () [0x000d1] in <52bc22bce5254240ba373b3cf23da1ab>:0 
---> (Inner Exception #0) System.BadImageFormatException: Method has no body
File name: 'LibGit2Sharp'
  at LibGit2Sharp.Core.Proxy.git_repository_open (System.String path) [0x00008] in <b59d5da32f8541b2a767004d8bddc22b>:0 
  at LibGit2Sharp.Repository..ctor (System.String path, LibGit2Sharp.RepositoryOptions options, LibGit2Sharp.Repository+RepositoryRequiredParameter requiredParameter) [0x002ee] in <b59d5da32f8541b2a767004d8bddc22b>:0 
  at LibGit2Sharp.Repository..ctor (System.String path) [0x00000] in <b59d5da32f8541b2a767004d8bddc22b>:0 
  at Submission#0.<<Initialize>>b__0_3 () [0x0000d] in <c937322efd9e45229071df73bf4f662f>:0 
  at Cake.Core.CakeTaskBuilderExtensions+<>c__DisplayClass17_0.<Does>b__0 (Cake.Core.ICakeContext context) [0x00000] in <1a12afcf649f4de8ab5d15d82d4f6310>:0 
  at Cake.Core.CakeTaskBuilderExtensions+<>c__DisplayClass20_0.<Does>b__0 (Cake.Core.ICakeContext x) [0x00000] in <1a12afcf649f4de8ab5d15d82d4f6310>:0 
  at Cake.Core.CakeTask.Execute (Cake.Core.ICakeContext context) [0x00066] in <1a12afcf649f4de8ab5d15d82d4f6310>:0 
  at Cake.Core.DefaultExecutionStrategy.ExecuteAsync (Cake.Core.CakeTask task, Cake.Core.ICakeContext context) [0x000ee] in <1a12afcf649f4de8ab5d15d82d4f6310>:0 
  at Cake.Core.CakeEngine.ExecuteTaskAsync (Cake.Core.ICakeContext context, Cake.Core.IExecutionStrategy strategy, System.Diagnostics.Stopwatch stopWatch, Cake.Core.CakeTask task, Cake.Core.CakeReport report) [0x00131] in <1a12afcf649f4de8ab5d15d82d4f6310>:0 
  at Cake.Core.CakeEngine.RunTask (Cake.Core.ICakeContext context, Cake.Core.IExecutionStrategy strategy, Cake.Core.CakeTask task, System.String target, System.Diagnostics.Stopwatch stopWatch, Cake.Core.CakeReport report) [0x00124] in <1a12afcf649f4de8ab5d15d82d4f6310>:0 
  at Cake.Core.CakeEngine.RunTargetAsync (Cake.Core.ICakeContext context, Cake.Core.IExecutionStrategy strategy, Cake.Core.ExecutionSettings settings) [0x00338] in <1a12afcf649f4de8ab5d15d82d4f6310>:0 
  at Cake.Scripting.BuildScriptHost.RunTargetAsync (System.String target) [0x0009f] in <52bc22bce5254240ba373b3cf23da1ab>:0 
  at Cake.Core.Scripting.ScriptHost.RunTarget (System.String target) [0x0000d] in <1a12afcf649f4de8ab5d15d82d4f6310>:0 
  at Submission#0+<<Initialize>>d__0.MoveNext () [0x00150] in <c937322efd9e45229071df73bf4f662f>:0 
  at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult] (System.Collections.Immutable.ImmutableArray`1[T] precedingExecutors, System.Func`2[T,TResult] currentExecutor, System.Runtime.CompilerServices.StrongBox`1[T] exceptionHolderOpt, System.Func`2[T,TResult] catchExceptionOpt, System.Threading.CancellationToken cancellationToken) [0x00186] in <3ee4bd870c1146d59b98317e4bbdcbe8>:0 
  at Microsoft.CodeAnalysis.Scripting.Script`1[T].RunSubmissionsAsync (Microsoft.CodeAnalysis.Scripting.ScriptExecutionState executionState, System.Collections.Immutable.ImmutableArray`1[T] precedingExecutors, System.Func`2[T,TResult] currentExecutor, System.Func`2[T,TResult] catchExceptionOpt, System.Threading.CancellationToken cancellationToken) [0x000a8] in <3ee4bd870c1146d59b98317e4bbdcbe8>:0 <---
Expected behavior

The constructor returns an instance of the Repository

Version of LibGit2Sharp (release number or SHA1)

v0.25.3

Operating system(s) tested; .NET runtime tested
  • CentOS Linux release 7.5.1804 (Core)
  • Mono
Mono JIT compiler version 5.16.0.187 (tarball Mon Oct  8 08:52:21 UTC 2018)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	Interpreter:   yes
	LLVM:          yes(3.6.0svn-mono-/)
	GC:            sgen (concurrent by default)

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par inspecter LibGit2Sharp.Core.Proxy.git_repository_open et le constructeur de Repository indiqué dans la stack trace. Reproduisez l’échec avec LibGit2Sharp v0.25.3 sur CentOS 7.5 en utilisant Mono 5.16.0.187 et comparez le comportement de la méthode native avec celui du projet de test lié. C’est terminé lorsqu’une instance de Repository peut être créée avec succès sans BadImageFormatException.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
csharp
Domaine
backend, operating-systems
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
30/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.