-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[loader] Call managed resolving events for the default ALC #56398
Conversation
Refine the work in dotnet@f70b5b7 The issue is that even if we know that the ALC gchandle points to null in native, we can't automatically skip the call to the managed resolving event (for native library, for example) because the native event is indirectly responsible for creating the default ALC managed object. Instead, check in native if the gchandle is equal to the default ALC's gchandle (which is initially allocated with a null target) and if so pass IntPtr.Zero to the managed code, which will call `AssemblyLoadContext.GEtAssemblyLoadContext (IntPtr gch)` which in turn will construct the managed object for the default ALC. Fixes dotnet#55921
Tagging subscribers to this area: Issue DetailsRefine the work in f70b5b7 The issue is that even if we know that the ALC gchandle points to null in native, we can't automatically skip the call to the managed resolving event (for native library, for example) because the native event is indirectly responsible for creating the default ALC managed object. Instead, check in native if the gchandle is equal to the default ALC's gchandle (which is initially allocated with a null target) and if so pass Fixes #55921
|
@uweigand can you try this on the s390 port and check whether it resolves the issue? Also do you know what might be a good way to do a standalone repro? |
Sure, I'll try this (latest version) and let you know ...
Unfortunately not really, I was only seeing this with roslyn analzers. Not sure what exactly those do to trigger the issue ... |
@lambdageek This patch does indeed fix the problem I was seeing, thanks! |
/backport to release/6.0-preview7 |
Started backporting to release/6.0-preview7: https://github.com/dotnet/runtime/actions/runs/1072400612 |
Refine the work in f70b5b7
The issue is that even if we know that the ALC gchandle points to null in native, we can't automatically skip the call to the managed resolving event (for native library, for example) because the native event is indirectly responsible for creating the default ALC managed object.
Instead, check in native if the gchandle is equal to the default ALC's gchandle (which is initially allocated with a null target) and if so pass
IntPtr.Zero
to the managed code, which will callAssemblyLoadContext.GetAssemblyLoadContext (IntPtr gch)
which in turn will construct the managed object for the default ALC.Fixes #55921