当前位置: 首页>>代码示例>>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;未经允许,请勿转载。