AssemblyLoadContext LoadfromAssemblyPath vs LoadFromNativeImagePath
What is the difference between LoadfromAssemblyPath and LoadFromNativeImagePath? When would I ever need/want to use the latter?
5 Replies
I can see both end up calling AssemblyNative_LoadFromPath where the
assemblyPath
arg is the pwzILPath
and nativeImagePath
is pwzNIPath
but it seems like the latter is not used at all in that situation?it was for original crossgen images which did not use the ReadyToRun format, they were in a separate .ni.dll file
those have not been produced by tools for a very long time and the associated code in the runtime to use those is now deleted
i suspect that’s why the code is sus
Ah ok, explains why
pwzNIPath
was never actually used there. So there were cases where you could have had 2 files for an assembly to load?yes, e.g. there was System.Private.CoreLib.dll and System.Private.CoreLib.ni.dll
Thanks, appreciate the explanation!