private static IIsolatedEnvironment InternalCreateIsolatedEnvironment(AppDomain appDomain, string runtimePath) { Type initializerType = typeof(IsolatedInitializer); Assembly initializerAssembly = initializerType.Assembly; IsolatedInitializer initializer; try { try { initializer = (IsolatedInitializer) appDomain.CreateInstanceAndUnwrap(initializerAssembly.FullName, initializerType.FullName); } catch (Exception) { string initializerAssemblyPath = LoaderUtils.GetAssemblyPath(initializerAssembly); initializer = (IsolatedInitializer) appDomain.CreateInstanceFromAndUnwrap(initializerAssemblyPath, initializerType.FullName); } } catch (Exception ex) { throw new LoaderException("Failed to load the loader into the remote AppDomain.", ex); } var environment = new IsolatedEnvironment(appDomain, runtimePath, initializer); environment.Initialize(); return(environment); }
private static string GetVSTSDirectoryPath() { return(Path.GetDirectoryName(LoaderUtils.GetAssemblyPath(typeof(ITestAdapter).Assembly))); }