The call from native code is made before the manifest module was created, causing errors if the
hook tried to access Assembly.ManifestModule.
Fixes https://github.com/dotnet/runtime/issues/84771.
return InvokeResolveEvent(AssemblyResolve, assembly, assemblyFullName);
}
+ internal static void InvokeAssemblyLoadEvent(Assembly assembly)
+ {
+ AssemblyLoad?.Invoke(AppDomain.CurrentDomain, new AssemblyLoadEventArgs(assembly));
+ }
+
[UnconditionalSuppressMessage("SingleFile", "IL3000: Avoid accessing Assembly file path when publishing as a single file",
Justification = "The code handles the Assembly.Location equals null")]
private static RuntimeAssembly? InvokeResolveEvent(ResolveEventHandler? eventHandler, RuntimeAssembly? assembly, string name)
// Netcore only allows one module per assembly
manifest_module = new RuntimeModuleBuilder(this, "RefEmit_InMemoryManifestModule");
modules = new RuntimeModuleBuilder[] { manifest_module };
+
+ AssemblyLoadContext.InvokeAssemblyLoadEvent (this);
}
public override bool ReflectionOnly
if (!method)
goto exit;
+ if (assembly->dynamic)
+ /* Called by RuntimeAssemblyBuilder:.ctor () after the manifest module has been created */
+ goto exit;
+
MonoReflectionAssemblyHandle assembly_handle;
assembly_handle = mono_assembly_get_object_handle (assembly, error);
goto_if_nok (error, exit);