libgit2 / libgit2/libgit2sharp
System.BadImageFormatException: Method has no body on CentOS
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- C#
- Estrelas
- 3.5k
- Forks
- 925
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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)
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece inspecionando LibGit2Sharp.Core.Proxy.git_repository_open e o construtor de Repository mostrado no stack trace. Reproduza a falha com LibGit2Sharp v0.25.3 no CentOS 7.5 usando Mono 5.16.0.187 e compare o comportamento do método nativo com o do projeto de teste vinculado. A tarefa estará concluída quando for possível criar uma instância de Repository com sucesso sem BadImageFormatException.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- csharp
- Domínio
- backend, operating-systems
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 30/100