protected override JitAsmResultScope JitCompileAndGetMethods(MemoryStream assemblyStream) { CustomAssemblyLoadContext?context = null; try { context = new CustomAssemblyLoadContext(shouldShareAssembly: _ => true); var assembly = context.LoadFromStream(assemblyStream); var results = IsolatedJitAsmDecompilerCore.JitCompileAndGetMethods(assembly); return(new JitAsmResultScope(results, context)); } catch { context?.Dispose(); throw; } }
public static IReadOnlyList <MethodJitResult> GetCompiledMethods(byte[] assemblyBytes) { var assembly = Assembly.Load(assemblyBytes); return(IsolatedJitAsmDecompilerCore.JitCompileAndGetMethods(assembly)); }