Пример #1
0
 static EmptyExecutionContext()
 {
     using (var t = ExecutionContextLessThread.Create())
     {
         empty = t.CallFunc(ExecutionContext.Capture);
     }
 }
Пример #2
0
        public void RegisterCleanupPath(string path)
        {
            var caller = new RegisterCleanupHelper()
            {
                Helper = _helper, Path = path
            };

            ExecutionContextLessThread.DefaultCallAction(caller.RegisterCleanupPath);
        }
Пример #3
0
        public CrossAppDomainCleanUp(AppDomain toWatch, IPrinter printer)
        {
            if (toWatch == null)
            {
                throw new ArgumentNullException("toWatch");
            }
            if (printer == null)
            {
                throw new ArgumentNullException("printer");
            }

            (new PermissionSet(PermissionState.Unrestricted)).Assert();
            var current = toWatch;

            AppDomainSetup adSetup = new AppDomainSetup();

            adSetup.ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;

            //#if RAZOR4 // currently not signed!
            var strongNames = new StrongName[0];

            //#else
            //            var strongNames = new[] {
            //                FromAssembly(typeof(RazorEngine.Templating.RazorEngineService).Assembly),
            //                FromAssembly(typeof(System.Web.Razor.RazorTemplateEngine).Assembly)
            //            };
            //#endif

            _domain = AppDomain.CreateDomain(
                "CleanupHelperDomain_" + Guid.NewGuid().ToString(), null,
                current.SetupInformation, new PermissionSet(PermissionState.Unrestricted),
                strongNames);

            var initHelper = new InitHelper()
            {
                Domain = _domain, Current = current
            };

            _helper = ExecutionContextLessThread.DefaultCallFunc(new Func <CleanupHelper>(initHelper.CreateHelper));
        }
Пример #4
0
 public void Dispose()
 {
     ExecutionContextLessThread.DefaultCallAction(_helper.Dispose);
 }