C
C#7mo ago
jborean

AssemblyLoadContext LoadfromAssemblyPath vs LoadFromNativeImagePath

What is the difference between LoadfromAssemblyPath and LoadFromNativeImagePath? When would I ever need/want to use the latter?
5 Replies
jborean
jboreanOP7mo ago
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?
reflectronic
reflectronic7mo ago
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
jborean
jboreanOP7mo ago
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?
reflectronic
reflectronic7mo ago
yes, e.g. there was System.Private.CoreLib.dll and System.Private.CoreLib.ni.dll
jborean
jboreanOP7mo ago
Thanks, appreciate the explanation!
Want results from more Discord servers?
Add your server