You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[6.0.100-preview.4.21178.2] Package LibGit2Sharp not working with 6.0.100-preview.4.21178.2 #50410
var p = Repository.Discover(@"PROJECT PATH WITH GIT FOLDER");
Console.WriteLine(p);
Expected Result:
Should return git folder path for the given project
Actual Result:
Returns empty string
Findings
We think, it doesn't load native git library : git2-106a5f2.dll, it causes this issue.
.NET 6 SDK 6.0.100-preview.4.21178.2 breaks the package LibGit2Sharp and caused 3 global tools failed in AppCompat lab,
We verified this issue again today:
Main branch (dotnet-sdk-6.0.100-preview.4.21180.17): still failing
Preview 3 branch (dotnet-sdk-6.0.100-preview.3.21180.8): All passed
So it should be an issue which only happens in main branch.
LibGit2Sharp is passing a sequential layout class (GitBuf) to native, updating it, and expecting the changes to be propagated. I think this is a change in behaviour as a result of #50137.
Basic scenario is:
[StructLayout(LayoutKind.Sequential)]internalclassTestClass{publicIntPtrptr;publicUIntPtrsize;}privatestaticunsafeclassNativeLib{[DllImport(nameof(NativeLib),CallingConvention=CallingConvention.Cdecl)]publicstaticexternvoidupdate_test_class(TestClassbuf);}staticvoidMain(string[]_){varc=newTestClass();NativeLib.update_test_class(c);// Use c.ptr / c.size, expecting that c was updated by update_test_class}
Before: the updates made to the class in native would be received by the managed caller.
Now: either TestClass must be marked sealed or the P/Invoke must specify the OutAttribute on the parameter.
While we do have some (kind of buried) documentation pointing out the need for the OutAttribute, I fear this may have been an unintentional breaking change that may affect many use cases and should require more consideration.
We should make the code imply default (no In or Out) as In and Out for this particular marhsaler. We can rename and modify the outImpliesIn variable in the MarshalInfo constructor to do this (It's only used in this case).
This issue is verified as fixed with latest main branch build: dotnet-sdk-6.0.100-preview.4.21205.8. Most of the tests passed, and 1 test failed with new failure, see new issue #50841
ghost locked as resolved and limited conversation to collaborators on May 7, 2021
Activity
jiangzeng01 commentedon Mar 31, 2021
We verified this issue again today:
Main branch (dotnet-sdk-6.0.100-preview.4.21180.17): still failing
Preview 3 branch (dotnet-sdk-6.0.100-preview.3.21180.8): All passed
So it should be an issue which only happens in main branch.
AaronRobinsonMSFT commentedon Mar 31, 2021
/cc @jkoritzinsky @elinor-fung
elinor-fung commentedon Apr 2, 2021
LibGit2Sharp is passing a sequential layout class (
GitBuf) to native, updating it, and expecting the changes to be propagated. I think this is a change in behaviour as a result of #50137.Basic scenario is:
Before: the updates made to the class in native would be received by the managed caller.
Now: either
TestClassmust be markedsealedor the P/Invoke must specify theOutAttributeon the parameter.While we do have some (kind of buried) documentation pointing out the need for the
OutAttribute, I fear this may have been an unintentional breaking change that may affect many use cases and should require more consideration.Thoughts, @jkoritzinsky and @AaronRobinsonMSFT?
jkoritzinsky commentedon Apr 2, 2021
We should make the code imply default (no In or Out) as In and Out for this particular marhsaler. We can rename and modify the
outImpliesInvariable in the MarshalInfo constructor to do this (It's only used in this case).jkoritzinsky commentedon Apr 2, 2021
Can you or @AaronRobinsonMSFT update my servicing PR with this fix (and fix master)? #50138
jiangzeng01 commentedon Apr 7, 2021
This issue is verified as fixed with latest main branch build: dotnet-sdk-6.0.100-preview.4.21205.8. Most of the tests passed, and 1 test failed with new failure, see new issue #50841