-
Notifications
You must be signed in to change notification settings - Fork 899
Libgit2 dll naming #430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Libgit2 dll naming #430
Conversation
I originally started with a T4 template, but it appears that the template doesn't re-build its target even on a clean build. I moved the (rather simple) content of the generated file into the powershell script, so it's totally guaranteed to be updated when you build libgit2 with that script. |
@@ -258,6 +259,9 @@ | |||
<ItemGroup> | |||
<EmbeddedResource Include="libgit2sharp_hash.txt" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a letfover from the T4 tryout. You're right, it should be removed.
Hmmm. Thinking a bit about this, I don't think this would actually be easy to tackle (or even makes sense) because of the linking between the Maybe would it be easier, for now, to add a processor directive in
and pass Thoughts? |
An even better proposal may be to rely on the Mono provided <configuration>
<dllmap os="!windows,osx" dll="git2_b641c00" target="git2.so"/>
<dllmap os="osx" dll="git2_b641c00" target="git2.dylib"/>
<dllmap os="windows" dll="git2_b641c00" target="git2_b641c00.dll"/>
</configuration> Provided this is the chosen solution, References: |
Another counter proposal: Tweak the libgit2 CMakeList to make it accept an optional suffix. This would make CMake generate /cc @carlosmn |
Ok. I've pushed a counter proposal in Can anyone please give a test at this and confirm that this fixes the issue? /cc @xpaulbettsx @martinwoodward |
✨ |
So proposed plan is:
|
Working on this now, will report back soonish |
No dice, here's what I did:
Here's what shows up in the logs: 2013-05-13 15:49:17.9926 - WARN: Couldn't read status for repo: C:\Users\Paul\GitHub\SaveAllTheTime
EXCEPTION: System.Runtime.InteropServices.MarshalDirectiveException: FilePathMarshaler must be used on a FilePath.
at LibGit2Sharp.Core.FilePathMarshaler.MarshalManagedToNative(Object managedObj)
at System.StubHelpers.MngdRefCustomMarshaler.ConvertContentsToNative(IntPtr pMarshalState, Object& pManagedHome, IntPtr pNativeHome)
at LibGit2Sharp.Core.NativeMethods.git_repository_open(RepositorySafeHandle& repository, FilePath path)
at LibGit2Sharp.Core.Proxy.git_repository_open(String path)
at LibGit2Sharp.Repository..ctor(String path, RepositoryOptions options)
at SaveAllTheTime.Models.GitRepoOps.<>c__DisplayClass9.<GetStatus>b__8() We're definitely loading both versions of libgit2 though:
|
Let's supplement the |
If anyone wants to give this a try, follow my steps on SaveAllTheTime, make sure to follow step 6 above. You also need to install the VSIX (i.e. rather than just hitting F5) because Git for VS won't be in the Experimental instance |
Paul, Would you mind reproing that MarshalDirectiveException again and having the debugger break when that exception is thrown (sxe clr)? I would love to take a look at a full minidump. Thanks, |
@phkelley Sure, though tbh it's really easy to hit, just follow the steps above and you'll have a live repro |
"@ | ||
|
||
sc -Encoding UTF8 .\Libgit2sharp\Core\NativeDllName.cs $dllNameClass | ||
sc -Encoding UTF8 .\Lib\Libgit2sharp.dll.config $dllMap | ||
sc -Encoding UTF8 libgit2sharp\libgit2_hash.txt $sha |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make this one ASCII?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made them all ASCII. BOMs suck, man.
Thanks Paul for providing the dump. I took a look at the issue and my initial appraisal is that it is probably a CLR bug with the construction of custom marshalers. The dump I got has the custom marshaler already created (since we are already to the point of throwing the MarshalDirectiveException), and it has the wrong MDs on it. We might entertain workarounds such as: Not using custom marshalers, or using custom marshalers that bind by string type names rather than Types. We could also see if we can get CLR to fix the issue for their next release or even for a GDR. I will be taking a deeper look on Monday -- I am traveling this week. |
This is confirmed as a bug in the CLR and it has been filed with them. |
If |
@ben Manually merged. Thanks for all your help! ❤️ |
As I mentioned somewhere else (or maybe just in my head), we still need to fix this in libgit2sharp. Waiting on a CLR Hotfix is a non-starter, especially since non-security updates are marked as Optional in Windows Update (i.e. nobody installs them). |
@xpaulbettsx I agree. This one has been closed because it was scoped to making LibGit2Sharp run against a non generically named Main marshaling issue is still dealt with as part of #241. |
This adds automation and marshaling junk so that two different versions of Libgit2Sharp won't have conflicting copies of git2.dll in memory at the same time. This should help with #241.