0

I have a .NET 4.6 web app running in an Azure App Service in 64 bit. When I hit a controller that calls LibGit2Sharp, I get the following exception:

[BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)]

And this is the stack trace:

LibGit2Sharp.Core.NativeMethods.git_repository_new(git_repository*& repo):-1
 LibGit2Sharp.Core.Proxy.git_repository_new() in c:\Git\LibGit2Sharp-2\LibGit2Sharp\Core\Proxy.cs:2553
 LibGit2Sharp.Repository.ListRemoteReferences(String url, CredentialsHandler credentialsProvider) in c:\Git\LibGit2Sharp-2\LibGit2Sharp\Repository.cs:633

This code works fine locally, so I just can't figure out what's going wrong.

Dan O'Leary
  • 2,660
  • 6
  • 24
  • 50
  • That look like a 32/64 bitness issue. How do you depend on LibGit2Sharp (NuGet, xcopy,...)? What's the version of LibGit2Sharp you're using? Does this work if you switch your web app config to 32bits? – nulltoken Mar 22 '17 at 20:46
  • I've changed the web app to run in 32 bit, and that's working now. LibGit2Sharp is a Nuget dependency - should that make a difference? I'd rather run the app in 64 bit - do you know of any particular problems with LibGit2Sharp? – Dan O'Leary Mar 22 '17 at 22:04

0 Answers0