/// <summary> /// Initializes a new instance of the <see cref="AssemblySandbox"/> class. /// </summary> public AssemblySandbox() { _appDomain = AppDomainManager.CreateUniqueAppDomain(); _assemblyManager = CreateInstanceMarshalByRefObject <AssemblyManager>(Logger.Instance, Localization.LocalizationHelper.GetCurrentCulture()); Reflection = CreateInstanceMarshalByRefObject <FastReflection>(this); }
/// <summary> /// Should be called when the object is being disposed. /// </summary> /// <param name="disposing">Was Dispose() called or did we get here from the finalizer?</param> private void OnDispose(bool disposing) { if (disposing) { if (!IsDisposed) { Reflection.Dispose(); _assemblyManager.Dispose(); AppDomainManager.UnloadAppDomain(_appDomain); } } IsDisposed = true; }