private static void LaunchHelper( LaunchTestStandApplicationInNewDomain.MainEntryPointDelegate entryPoint, LaunchTestStandApplicationInNewDomain.MainEntryPointDelegateWithArgs entryPointWithArgs, string[] args, bool parseArgs) { if (parseArgs) LaunchTestStandApplicationInNewDomain.SetEngineEnvironment(TSHelper.ParseEnvironmentPathFromArgs(ref args, false, (string) null)); Engine engine = (Engine) new EngineClass(); try { AppDomain domain = AppDomain.CreateDomain("TestStandAppDomain"); LaunchTestStandApplicationInNewDomain.TestStandApplication instanceFromAndUnwrap = domain.CreateInstanceFromAndUnwrap(Assembly.GetExecutingAssembly().Location, typeof (LaunchTestStandApplicationInNewDomain.TestStandApplication).FullName) as LaunchTestStandApplicationInNewDomain.TestStandApplication; if (entryPoint != null) instanceFromAndUnwrap.CallEntryPoint(entryPoint); else instanceFromAndUnwrap.CallEntryPoint(entryPointWithArgs, args); AppDomain.Unload(domain); } finally { LaunchTestStandApplicationInNewDomain.CleanUpAfterNewAppDomainFinished(engine); } }