Update the sample to include the option to use Assembly.LoadFile
The Assembly.LoadFile API uses an anonymous AssemblyLoadContext to load the assembly file.
But it maintains a cache to guarantee that the same assembly instance is returned for the same assembly file path.
For details, see the .NET code at https://source.dot.net/#System.Private.CoreLib/Assembly.cs,239.
So, it's OK to use Assembly.LoadFile as a simpler version of the same technique.
Update the sample to include the option to use
Assembly.LoadFile
The
Assembly.LoadFile
API uses an anonymousAssemblyLoadContext
to load the assembly file. But it maintains a cache to guarantee that the same assembly instance is returned for the same assembly file path. For details, see the .NET code at https://source.dot.net/#System.Private.CoreLib/Assembly.cs,239.So, it's OK to use
Assembly.LoadFile
as a simpler version of the same technique.