LibGit2Sharp-ssh.dll throw exception : System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods'

-1

Using LibGit2Sharp-SSH.1.0.22.dll in my C# project (.net version 4.5.2 visual studio 2015 update 3) The app throw the following exception :

System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor() in c:\projects\libgit2sharp\LibGit2Sharp\Core\NativeMethods.cs:line 35 at LibGit2Sharp.Core.NativeMethods..cctor() in c:\projects\libgit2sharp\LibGit2Sharp\Core\NativeMethods.cs:line 81 --- End of inner exception stack trace --- at LibGit2Sharp.Core.NativeMethods.git_repository_open(git_repository*& repository, FilePath path) at LibGit2Sharp.Core.Proxy.git_repository_open(String path) in c:\projects\libgit2sharp\LibGit2Sharp\Core\Proxy.cs:line 2537 at LibGit2Sharp.Repository..ctor(String path, RepositoryOptions options, RepositoryRequiredParameter requiredParameter) in c:\projects\libgit2sharp\LibGit2Sharp\Repository.cs:line 193 at LibGit2Sharp.Repository..ctor(String path) in c:\projects\libgit2sharp\LibGit2Sharp\Repository.cs:line 68

The only solution i found online was about changing the MSBuild argument : p:GenerateBuildInfoConfigFile=false .

i successfully rebuild the project using command line: msbuild C:\solution.sln /t:MyProject:rebuild /p:GenerateBuildInfoConfigFile=false

unfortunately, i still getting this exception !.

Also ,my app was using the older version 0.22.0 of the library without any problems .

c#
ssh
libgit2sharp
libgit2sharp-ssh
asked on Stack Overflow Jul 25, 2018 by rotem_wolfovich

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0