Exemple #1
0
            public void Dispose()
            {
                AppDomain separateAppDomain = this._separateAppDomain;

                if (separateAppDomain != null)
                {
                    AppDomain.Unload(separateAppDomain);
                    this._separateAppDomain = null;
                }
                this._regexCompilationProxy = null;
            }
Exemple #2
0
 public RegexCompilationProxyWrapper(bool alwaysCompileRegexInSeparateAppDomain)
 {
     if (alwaysCompileRegexInSeparateAppDomain)
     {
         AppDomain separateAppDomain = this._separateAppDomain = AppDomain.CreateDomain("RegexCompiler Isolation AppDomain", null, AppDomain.CurrentDomain.SetupInformation);
         Assembly  assembly          = Assembly.GetExecutingAssembly();
         if (!assembly.GlobalAssemblyCache)
         {
             separateAppDomain.AssemblyResolve += delegate(object sender, ResolveEventArgs e)
             {
                 Assembly executingAssembly = Assembly.GetExecutingAssembly();
                 return((e.Name == executingAssembly.FullName) ? executingAssembly : null);
             };
         }
         this._regexCompilationProxy = (RegexCompilationProxy)separateAppDomain.CreateInstanceAndUnwrap(assembly.FullName, typeof(RegexCompilationProxy).FullName);
     }
     else
     {
         this._regexCompilationProxy = new RegexCompilationProxy();
     }
 }
Exemple #3
0
			public void Dispose()
			{
				AppDomain separateAppDomain = this._separateAppDomain;
				if (separateAppDomain != null)
				{
					AppDomain.Unload(separateAppDomain);
					this._separateAppDomain = null;
				}
				this._regexCompilationProxy = null;
			}
Exemple #4
0
			public RegexCompilationProxyWrapper(bool alwaysCompileRegexInSeparateAppDomain)
			{
				if (alwaysCompileRegexInSeparateAppDomain)
				{
					AppDomain separateAppDomain = this._separateAppDomain = AppDomain.CreateDomain("RegexCompiler Isolation AppDomain", null, AppDomain.CurrentDomain.SetupInformation);
					Assembly assembly = Assembly.GetExecutingAssembly();
					if (!assembly.GlobalAssemblyCache)
					{
						separateAppDomain.AssemblyResolve += delegate(object sender, ResolveEventArgs e)
						{
							Assembly executingAssembly = Assembly.GetExecutingAssembly();
							return (e.Name == executingAssembly.FullName) ? executingAssembly : null;
						};
					}
					this._regexCompilationProxy = (RegexCompilationProxy)separateAppDomain.CreateInstanceAndUnwrap(assembly.FullName, typeof(RegexCompilationProxy).FullName);
				}
				else
				{
					this._regexCompilationProxy = new RegexCompilationProxy();
				}
			}