Debian: type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception
lytico opened this issue · 8 comments
See
libgit2#1533 (comment)
and
dotdevelop/dotdevelop#52 (comment)
the branch to fix it is this: https://github.com/dotdevelop/libgit2sharp/tree/dd/issues/2
the git hash for libgit is 6777db8e8343014d57c41b335e0c60af44d4e9f2 ->
so, according to @Molytho , the problem is in the mismatch from
to
libgit2sharp/LibGit2Sharp/Core/GitStatusOptions.cs
Lines 6 to 20 in 3a544af
calling
I started testing and I think I found a solution/workaround. I don't know how to set the project up properly to use a self build nuget for libgit2-sharp so I changed it to a project reference so this might not be 100% accurate.
First I compiled it with a clean clone of this repo. It didn't work.
Then I added the line
public unsafe void* Baseline = (void*)0;
to the end of the GitStatusOptions class. After that it worked fine.
It's surprising that this mis-match hasn't caused problems long before now! It seems to be in the current master
and latest release (maint/v0.26
) branches of github/libgit2/libgit2sharp
, and not just the mono/dotdevelop
forks.
Well tracked down @Molytho!
maybe it has to do with a more sever (and saver) memory access control in recent versions of mono?
and, yes, @Molytho did a great job, and he should upstream that error in the github/libgit2/libgit2sharp - repo.
Could the LibGit2Sharp.NativeBinaries be updated with this change, together with the dotdevelop build, please (even though the 'no TLS stream' issue is still outstanding)? Thanks.
Yes. Done..
The fix got merged to upstream:
libgit2@b78b290