diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2021-07-13 23:42:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-13 23:42:47 +0300 |
commit | 39152805901172400f1aad2ce511719663aa4e52 (patch) | |
tree | 21566a434d00370d6cea3f06a5b29ea2461eb89c /src | |
parent | a13f713a25e5d2890f28e2394b508b4cc5fd909b (diff) |
[mono] Fix loader incompatibility w.r.t. Resolving event (#54815)
* When loading a non-satellite assembly into a non-default ALC,
invoke the Resolving event in the default ALC first.
* Fixes https://github.com/dotnet/runtime/issues/54814
Diffstat (limited to 'src')
-rw-r--r-- | src/mono/mono/metadata/assembly.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mono/mono/metadata/assembly.c b/src/mono/mono/metadata/assembly.c index e98264a2f93..8a52e63bc85 100644 --- a/src/mono/mono/metadata/assembly.c +++ b/src/mono/mono/metadata/assembly.c @@ -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). * @@ -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 + // 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); |