當前位置: 首頁>>代碼示例>>C#>>正文


C# System.AppDomain類代碼示例

本文整理匯總了C#中System.AppDomain的典型用法代碼示例。如果您正苦於以下問題:C# AppDomain類的具體用法?C# AppDomain怎麽用?C# AppDomain使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AppDomain類屬於System命名空間,在下文中一共展示了AppDomain類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RegisterAppDomainUnhandledExceptionHandler

        public static void RegisterAppDomainUnhandledExceptionHandler(this ExceptionlessClient client, AppDomain appDomain = null) {
            if (appDomain == null)
                appDomain = AppDomain.CurrentDomain;

            if (_onAppDomainUnhandledException == null)
                _onAppDomainUnhandledException = (sender, args) => {
                    var exception = args.ExceptionObject as Exception;
                    if (exception == null)
                        return;

                    var contextData = new ContextData();
                    contextData.MarkAsUnhandledError();
                    contextData.SetSubmissionMethod("AppDomainUnhandledException");

                    exception.ToExceptionless(contextData, client).Submit();

                    // process queue immediately since the app is about to exit.
                    client.ProcessQueue();
                };

            try {
                appDomain.UnhandledException -= _onAppDomainUnhandledException;
                appDomain.UnhandledException += _onAppDomainUnhandledException;
            } catch (Exception ex) {
                client.Configuration.Resolver.GetLog().Error(typeof(ExceptionlessClientExtensions), ex, "An error occurred while wiring up to the unhandled exception event. This will happen when you are not running under full trust.");
            }
        }
開發者ID:megakid,項目名稱:Exceptionless.Net,代碼行數:27,代碼來源:ExceptionlessClientExtensions.cs

示例2: Dispose

 public void Dispose()
 {
     _extActivator.Dispose();
     _extActivator = null;
     AppDomain.Unload(_appdomain);
     _appdomain = null;
 }
開發者ID:huoxudong125,項目名稱:ServerX,代碼行數:7,代碼來源:SafeExtensionLoader.cs

示例3: FrameworkDriver

 /// <summary>
 /// Construct a FrameworkDriver for a particular assembly in a domain,
 /// and associate some settings with it. The assembly must reference
 /// the NUnit framework so that we can remotely create the FrameworkController.
 /// </summary>
 /// <param name="assemblyPath">The path to the test assembly</param>
 /// <param name="testDomain">The domain in which the assembly will be loaded</param>
 /// <param name="settings">A dictionary of load and run settings</param>
 public FrameworkDriver(string assemblyPath, AppDomain testDomain, IDictionary<string, object> settings)
 {
     this.testDomain = testDomain;
     this.assemblyPath = assemblyPath;
     this.settings = settings;
     this.testController = CreateObject(CONTROLLER_TYPE, assemblyPath, settings);
 }
開發者ID:TannerBaldus,項目名稱:test_accelerator,代碼行數:15,代碼來源:FrameworkDriver.cs

示例4: BuildChildDomain

 /// <summary>
 /// Creates a new child domain and copies the evidence from a parent domain.
 /// </summary>
 /// <param name="parentDomain">The parent domain.</param>
 /// <returns>The new child domain.</returns>
 /// <remarks>
 /// Grabs the <paramref name="parentDomain"/> evidence and uses it to construct the new
 /// <see cref="AppDomain"/> because in a ClickOnce execution environment, creating an
 /// <see cref="AppDomain"/> will by default pick up the partial trust environment of 
 /// the AppLaunch.exe, which was the root executable. The AppLaunch.exe does a 
 /// create domain and applies the evidence from the ClickOnce manifests to 
 /// create the domain that the application is actually executing in. This will 
 /// need to be Full Trust for Composite Application Library applications.
 /// </remarks>
 protected virtual AppDomain BuildChildDomain(AppDomain parentDomain)
 {
     Evidence evidence = new Evidence(parentDomain.Evidence);
     AppDomainSetup setup = parentDomain.SetupInformation;
     var domain = AppDomain.CreateDomain("DiscoveryRegion", evidence, setup);
     return domain;
 }
開發者ID:christal1980,項目名稱:wingsoa,代碼行數:21,代碼來源:DirectoryModuleCatalog.cs

示例5: BuildChildDomain

 /// <summary>
 /// Creates a new child domain and copies the evidence from a parent domain.
 /// </summary>
 /// <param name="parentDomain">The parent domain.</param>
 /// <returns>The new child domain.</returns>
 /// <remarks>
 /// Grabs the <paramref name="parentDomain"/> evidence and uses it to construct the new
 /// <see cref="AppDomain"/> because in a ClickOnce execution environment, creating an
 /// <see cref="AppDomain"/> will by default pick up the partial trust environment of 
 /// the AppLaunch.exe, which was the root executable. The AppLaunch.exe does a 
 /// create domain and applies the evidence from the ClickOnce manifests to 
 /// create the domain that the application is actually executing in. This will 
 /// need to be Full Trust for Composite Application Library applications.
 /// </remarks>
 public static AppDomain BuildChildDomain(AppDomain parentDomain)
 {
     if (parentDomain == null) throw new ArgumentNullException("parentDomain");
     var evidence = new Evidence(parentDomain.Evidence);
     AppDomainSetup setup = parentDomain.SetupInformation;
     return AppDomain.CreateDomain("DiscoveryRegion", evidence, setup);
 }
開發者ID:DavidMoore,項目名稱:Foundation,代碼行數:21,代碼來源:DiscoverTypes.cs

示例6: LoadDecisionModule

        /// <summary>
        /// Loads the decision module based on the decision metadata
        /// </summary>
        /// <param name="decisionMetadata">The decision metadata.</param>
        /// <param name="workspaceWrapper">The workspace wrapper.</param>
        /// <param name="componentsAppDomain">The components app domain is the app domain which decision assembly is going to be loaded into.</param>
        /// <returns>Loaded decision</returns>
        internal static ILoopDecisionModule LoadDecisionModule(LoopScopeMetadata loopMetadata, IWorkspaceInternal workspaceWrapper,
                                                                                AppDomain componentsAppDomain)
        {
            DecisionLoader loader = ConstructDecisionModuleInComponentsAppDomain(loopMetadata, workspaceWrapper, componentsAppDomain);

            return (ILoopDecisionModule)loader.LoadedDecisionModule;
        }
開發者ID:jira-sarec,項目名稱:ICSE-2012-TraceLab,代碼行數:14,代碼來源:DecisionModuleFactory.cs

示例7: Dispose

 public void Dispose()
 {
     var dir = Domain.BaseDirectory;
       AppDomain.Unload(Domain);
       Directory.Delete(dir, true);
       Domain = null;
 }
開發者ID:ErikRydgren,項目名稱:PluginFramework,代碼行數:7,代碼來源:MockDomain.cs

示例8: AssemblyEmitter

		public AssemblyEmitter( string assemblyName, bool canSave )
		{
			m_AssemblyName = assemblyName;

			m_AppDomain = AppDomain.CurrentDomain;

			m_AssemblyBuilder = m_AppDomain.DefineDynamicAssembly(
				new AssemblyName( assemblyName ),
				canSave ? AssemblyBuilderAccess.RunAndSave : AssemblyBuilderAccess.Run
			);

			if ( canSave )
			{
				m_ModuleBuilder = m_AssemblyBuilder.DefineDynamicModule(
					assemblyName,
					String.Format( "{0}.dll", assemblyName.ToLower() ),
					false
				);
			}
			else
			{
				m_ModuleBuilder = m_AssemblyBuilder.DefineDynamicModule(
					assemblyName,
					false
				);
			}
		}
開發者ID:nick12344356,項目名稱:The-Basement,代碼行數:27,代碼來源:Emitter.cs

示例9: Print

        // Private Methods 

        private static void Print(AppDomain defaultAppDomain)
        {
            Assembly[] loadedAssemblies = defaultAppDomain.GetAssemblies();
            Console.WriteLine("Here are the assemblies loaded in {0}\n", defaultAppDomain.FriendlyName);
            foreach (Assembly a in loadedAssemblies)
                PrintAssemblyName(a.GetName());
        }
開發者ID:exaphaser,項目名稱:cs2php,代碼行數:9,代碼來源:ApplicationDomains.cs

示例10: Load

		public override bool Load( TestPackage package )
		{
			Unload();

            log.Info("Loading " + package.Name);
			try
			{
				if ( this.domain == null )
					this.domain = Services.DomainManager.CreateDomain( package );

                if (this.agent == null)
                {
                    this.agent = DomainAgent.CreateInstance(domain);
                    this.agent.Start();
                }
            
				if ( this.TestRunner == null )
					this.TestRunner = this.agent.CreateRunner( this.ID );

                log.Info(
                    "Loading tests in AppDomain, see {0}_{1}.log", 
                    domain.FriendlyName, 
                    Process.GetCurrentProcess().Id);

				return TestRunner.Load( package );
			}
			catch
			{
                log.Error("Load failure");
				Unload();
				throw;
			}
		}
開發者ID:Vernathic,項目名稱:ic-AutoTest.NET4CTDD,代碼行數:33,代碼來源:TestDomain.cs

示例11: AppDomainTypeResolver

        protected AppDomainTypeResolver(AppDomain domain, string baseDir)
        {
            _domain = domain;
            this.baseDir = baseDir;

            domain.AssemblyResolve += new ResolveEventHandler(domain_AssemblyResolve);
        }
開發者ID:JaysonJG,項目名稱:Catel,代碼行數:7,代碼來源:AppDomainTypeResolver.cs

示例12: CreateRemoteHost

		protected override HostedService CreateRemoteHost(AppDomain appDomain)
		{
			appDomain.SetData("ConnectionString",_connectionString);
			appDomain.DoCallBack(SetConnectionStringInAppDomain);
			var service = base.CreateRemoteHost(appDomain);
			return service;
		}
開發者ID:Teleopti,項目名稱:Rhino.ServiceBus.SqlQueues,代碼行數:7,代碼來源:SqlRemoteAppDomainHost.cs

示例13: Init

		public virtual void Init()
		{
			serverDomain = AppDomainFactory.Create("server");
			clientDomain = AppDomainFactory.Create("client");

			serverContainer = CreateRemoteContainer(serverDomain, GetServerConfigFile());
		}
開發者ID:nats,項目名稱:castle-1.0.3-mono,代碼行數:7,代碼來源:AbstractRemoteTestCase.cs

示例14: RemoteDebugger

        public RemoteDebugger()
        {
            // Create a new debugger session
            mSessionId = Guid.NewGuid().ToString();

            Evidence evidence = new Evidence(AppDomain.CurrentDomain.Evidence);
            AppDomainSetup appDomainSetup = AppDomain.CurrentDomain.SetupInformation;

            mAppDomain = AppDomain.CreateDomain(String.Format("Debugger-{0}", mSessionId), evidence, appDomainSetup);

            /*
            Type assemblyLoaderType = typeof(AssemblyLoader);
            AssemblyLoader loader = mAppDomain.CreateInstanceAndUnwrap(assemblyLoaderType.Assembly.GetName().Name, assemblyLoaderType.FullName) as AssemblyLoader;

            foreach (String assemblyPath in Directory.GetFiles(DebuggerConfig.ApplicationPath, "Tridion*.dll"))
            {
                loader.LoadAssembly(assemblyPath);
            }
            */
            Type debuggerHostType = typeof(DebugEngineServer);

            mDebuggerHost = mAppDomain.CreateInstanceAndUnwrap(
                debuggerHostType.Assembly.GetName().Name,
                debuggerHostType.FullName,
                true,
                BindingFlags.Default,
                null,
                new Object[] { mSessionId },
                null,
                null) as DebugEngineServer;
        }
開發者ID:mvlasenko,項目名稱:TridionVSRazorExtension,代碼行數:31,代碼來源:RemoteDebugger.cs

示例15: AppDomainEvidenceFactory

        internal AppDomainEvidenceFactory(AppDomain target)
        { 
            Contract.Assert(target != null);
            Contract.Assert(target == AppDomain.CurrentDomain, "AppDomainEvidenceFactory should not be used across domains."); 
 
            m_targetDomain = target;
        } 
開發者ID:sjyanxin,項目名稱:WPFSource,代碼行數:7,代碼來源:AppDomainEvidenceFactory.cs


注:本文中的System.AppDomain類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。