public static void LoadRefEmitAssembly() { Init(); // Scenario 1 - Generate a non-collectible dynamic assembly that triggers load of a static assembly RefEmitLoadContext refEmitLCRun = new RefEmitLoadContext(); LoadRefEmitAssemblyInLoadContext(refEmitLCRun, AssemblyBuilderAccess.Run); // Scenario 2 - Generate a collectible dynamic assembly that triggers load of a static assembly RefEmitLoadContext refEmitLCRunAndCollect = new RefEmitLoadContext(); LoadRefEmitAssemblyInLoadContext(refEmitLCRunAndCollect, AssemblyBuilderAccess.RunAndCollect); }
public static void LoadRefEmitAssembly() { Init(); // Scenario 1 - Generate a non-collectible dynamic assembly that triggers load of a static assembly RefEmitLoadContext refEmitLCRun = new RefEmitLoadContext(); LoadRefEmitAssemblyInLoadContext(refEmitLCRun, AssemblyBuilderAccess.Run); // Scenario 2 - Generate a collectible dynamic assembly that triggers load of a static assembly RefEmitLoadContext refEmitLCRunAndCollect = new RefEmitLoadContext(); LoadRefEmitAssemblyInLoadContext(refEmitLCRunAndCollect, AssemblyBuilderAccess.RunAndCollect); }