Inheritance: System.MarshalByRefObject, IDisposable
        public IsolatedApplicationRunner()
        {
            var setup = new AppDomainSetup
            {
                ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
                ApplicationName = "Net IDE"
            };

            var appDomain = AppDomain.CreateDomain(
                setup.ApplicationName,
                AppDomain.CurrentDomain.Evidence,
                setup
            );

            try
            {
                _application = (ApplicationRunner)appDomain.CreateInstanceAndUnwrap(
                    typeof(ApplicationRunner).Assembly.FullName,
                    typeof(ApplicationRunner).FullName
                );

                _appDomain = appDomain;
            }
            catch
            {
                AppDomain.Unload(appDomain);

                throw;
            }
        }
Beispiel #2
0
        public IsolatedApplicationRunner()
        {
            var setup = new AppDomainSetup
            {
                ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
                ApplicationName = "Net IDE"
            };

            var appDomain = AppDomain.CreateDomain(
                setup.ApplicationName,
                AppDomain.CurrentDomain.Evidence,
                setup
                );

            try
            {
                _application = (ApplicationRunner)appDomain.CreateInstanceAndUnwrap(
                    typeof(ApplicationRunner).Assembly.FullName,
                    typeof(ApplicationRunner).FullName
                    );

                _appDomain = appDomain;
            }
            catch
            {
                AppDomain.Unload(appDomain);

                throw;
            }
        }
        public void Dispose()
        {
            if (!_disposed)
            {
                if (_application != null)
                {
                    _application.Dispose();
                    _application = null;
                }

                if (_appDomain != null)
                {
                    AppDomain.Unload(_appDomain);
                    _appDomain = null;
                }

                _disposed = true;
            }
        }
Beispiel #4
0
        public void Dispose()
        {
            if (!_disposed)
            {
                if (_application != null)
                {
                    _application.Dispose();
                    _application = null;
                }

                if (_appDomain != null)
                {
                    AppDomain.Unload(_appDomain);
                    _appDomain = null;
                }

                _disposed = true;
            }
        }