internal ContextualReflectionScope(AssemblyLoadContext?activating) { _predecessor = AssemblyLoadContext.CurrentContextualReflectionContext; AssemblyLoadContext.SetCurrentContextualReflectionContext(activating); _activated = activating; _initialized = true; }
public void Dispose() { if (_initialized) { // Do not clear initialized. Always restore the _predecessor in Dispose() // _initialized = false; AssemblyLoadContext.SetCurrentContextualReflectionContext(_predecessor); } }