public void Dispose()
 {
     _locator = null;
     if (_childDomain != null)
     {
         AppDomain.Unload(_childDomain);
     }
 }
        public SystemReflectionProvider(string assembly)
        {
            try
            {
                var domainSetup = new AppDomainSetup
                                      {
                    ApplicationBase = Path.GetDirectoryName(assembly),
                    ApplicationName = AppDomain.CurrentDomain.SetupInformation.ApplicationName,
                    LoaderOptimization = LoaderOptimization.MultiDomainHost
                };
                _childDomain = AppDomain.CreateDomain("Type locator app domain", null, domainSetup);

                // Create an instance of the runtime in the second AppDomain. 
                // A proxy to the object is returned.
                _locator = (ISystemReflectionProvider_Internal)_childDomain.CreateInstanceFromAndUnwrap(Assembly.GetExecutingAssembly().Location, typeof(SystemReflectionProvider_Internal).FullName);
                _locator.Load(assembly);
            }
            catch (Exception ex)
            {
                Logging.Logger.Write(ex);
            }
        }
        public SystemReflectionProvider(string assembly)
        {
            try
            {
                var domainSetup = new AppDomainSetup
                {
                    ApplicationBase    = Path.GetDirectoryName(assembly),
                    ApplicationName    = AppDomain.CurrentDomain.SetupInformation.ApplicationName,
                    LoaderOptimization = LoaderOptimization.MultiDomainHost
                };
                _childDomain = AppDomain.CreateDomain("Type locator app domain", null, domainSetup);

                // Create an instance of the runtime in the second AppDomain.
                // A proxy to the object is returned.
                _locator = (ISystemReflectionProvider_Internal)_childDomain.CreateInstanceFromAndUnwrap(Assembly.GetExecutingAssembly().Location, typeof(SystemReflectionProvider_Internal).FullName);
                _locator.Load(assembly);
            }
            catch (Exception ex)
            {
                Logging.Logger.Write(ex);
            }
        }
 public void Dispose()
 {
     _locator = null;
     if (_childDomain != null)
         AppDomain.Unload(_childDomain);
 }