Skip to content
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

[mono] Fix loader incompatibility w.r.t. Resolving event #54815

Merged
merged 1 commit into from
Jul 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/mono/mono/metadata/assembly.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,8 @@ netcore_load_reference (MonoAssemblyName *aname, MonoAssemblyLoadContext *alc, M
*
* 7. If this is a satellite request, call the ALC ResolveSatelliteAssembly method.
*
* 8. Call the ALC Resolving event.
* 8. Call the ALC Resolving event. If the ALC is not the default and this is not
* a satellite request, call the Resolving event in the default ALC first.
*
* 9. Call the ALC AssemblyResolve event (except for corlib satellite assemblies).
*
Expand Down Expand Up @@ -1138,6 +1139,15 @@ netcore_load_reference (MonoAssemblyName *aname, MonoAssemblyLoadContext *alc, M
}
}

// For compatibility with CoreCLR, invoke the Resolving event in the default ALC first whenever loading
lambdageek marked this conversation as resolved.
Show resolved Hide resolved
// a non-satellite assembly into a non-default ALC. See: https://github.com/dotnet/runtime/issues/54814
if (!is_default && !is_satellite) {
reference = mono_alc_invoke_resolve_using_resolving_event_nofail (mono_alc_get_default (), aname);
if (reference) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Assembly found with the Resolving event (default ALC): '%s'.", aname->name);
goto leave;
}
}
reference = mono_alc_invoke_resolve_using_resolving_event_nofail (alc, aname);
if (reference) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Assembly found with the Resolving event: '%s'.", aname->name);
Expand Down