• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# System.AppDomain类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.AppDomain的典型用法代码示例。如果您正苦于以下问题:C# AppDomain类的具体用法?C# AppDomain怎么用?C# AppDomain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AppDomain类属于System命名空间,在下文中一共展示了AppDomain类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: RegisterAllAssemblies

 public static void RegisterAllAssemblies(IExecutionContext context, AppDomain domain)
 {
     foreach(Assembly assembly in domain.GetAssemblies())
     {
         context.RegisterAssembly(assembly);
     }
 }
开发者ID:redxdev,项目名称:DScript,代码行数:7,代码来源:ContextUtilities.cs


示例17: LoadFrom

        public void LoadFrom(string path)
        {
            if (_domain != null)
            {
                _scanner.Teardown();
                AppDomain.Unload(_domain);
            }

            var name = Path.GetFileNameWithoutExtension(path);
            var dirPath = Path.GetFullPath(Path.GetDirectoryName(path));

            var setup = new AppDomainSetup
            {
                ApplicationBase = AppDomain.CurrentDomain.BaseDirectory,
                PrivateBinPath = dirPath,
                ShadowCopyFiles = "true",
                ShadowCopyDirectories = dirPath,
            };

            _domain = AppDomain.CreateDomain(name + "Domain", AppDomain.CurrentDomain.Evidence, setup);

            var scannerType = typeof(Scanner);
            _scanner = (Scanner)_domain.CreateInstanceAndUnwrap(scannerType.Assembly.FullName, scannerType.FullName);
            _scanner.Load(name);
            _scanner.Setup();
        }
开发者ID:robert-impey,项目名称:PluginDemo,代码行数:26,代码来源:AssemblyManager.cs


示例18: GetDriver

        /// <summary>
        /// Gets a driver for a given test assembly and a framework
        /// which the assembly is already known to reference.
        /// </summary>
        /// <param name="domain">The domain in which the assembly will be loaded</param>
        /// <param name="assemblyName">The name of the test framework reference</param>
        /// <param name="version">The version of the test framework reference</param>
        /// <returns></returns>
        public IFrameworkDriver GetDriver(AppDomain domain, string assemblyName, Version version)
        {
            if (!IsSupportedTestFramework(assemblyName, version))
                throw new ArgumentException("Invalid framework name", "frameworkAssemblyName");

            return _driverNode.CreateExtensionObject(domain) as IFrameworkDriver;
        }
开发者ID:roboticai,项目名称:nunit,代码行数:15,代码来源:NUnit2DriverFactory.cs


示例19: Load

        static void Load()
        {
            if (AppDomain.CurrentDomain.FriendlyName != "OnlineVideosSiteUtilDlls")
            {
                if (useSeperateDomain)
                {
                    domain = AppDomain.CreateDomain("OnlineVideosSiteUtilDlls", null, null, null, true);

                    pluginLoader = (PluginLoader)domain.CreateInstanceAndUnwrap(
                      typeof(PluginLoader).Assembly.FullName,
                      typeof(PluginLoader).FullName);

                    domain.SetData(typeof(PluginLoader).FullName, pluginLoader);
                }
                else
                {
                    domain = AppDomain.CurrentDomain;
                    pluginLoader = new PluginLoader();
                }
            }
            else
            {
                domain = AppDomain.CurrentDomain;
                pluginLoader = (PluginLoader)AppDomain.CurrentDomain.GetData(typeof(PluginLoader).FullName);
            }
        }
开发者ID:pilehave,项目名称:headweb-mp,代码行数:26,代码来源:HeadWebAppDomain.cs


示例20: Main

        static void Main()
        {
            try
            {
                Trace.CurrentTrace.SetLogFile(__logFile, LogOptions.None);
                //Trace.WriteLine("runsource_launch.Program.Main()");

                object runSourceRestartParameters = null;
                while (true)
                {
                    UpdateRunSourceFiles();
                    Run(runSourceRestartParameters);
                    // attention récupérer RunSourceRestartParameters avant UpdateRunSourceFiles(), UpdateRunSourceFiles() fait AppDomain.Unload()
                    runSourceRestartParameters = __domain.GetData(__domainRestartParametersName);
                    //UpdateRunSourceFiles();
                    if (runSourceRestartParameters == null)
                        break;
                    //__domain.DomainUnload += domain_DomainUnload;
                    //Trace.WriteLine("__domain.IsFinalizingForUnload() : {0}", __domain.IsFinalizingForUnload());
                    //Trace.WriteLine("AppDomain.Unload(__domain)");
                    AppDomain.Unload(__domain);
                    __domain = null;
                    //Trace.WriteLine("__domain.IsFinalizingForUnload() : {0}", __domain.IsFinalizingForUnload());
                }
            }
            catch (Exception ex)
            {
                zerrf.ErrorMessageBox(ex);
            }
        }
开发者ID:labeuze,项目名称:source,代码行数:30,代码来源:runsource.launch.cs



注:本文中的System.AppDomain类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# System.AppDomainHandle类代码示例发布时间:2022-05-26
下一篇:
C# System.App类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap