/// <inheritdoc /> public HostSetup GetHostSetup() { lock (syncRoot) { ThrowIfDisposed(); return(hostSetup.Copy()); } }
private static HostSetup ForceProcessorArchitectureAndRuntimeVersionIfRequired(HostSetup hostSetup, NCoverVersion version) { hostSetup = hostSetup.Copy(); NCoverTool tool = NCoverTool.GetInstance(version, hostSetup.ProcessorArchitecture); hostSetup.ProcessorArchitecture = tool.NegotiateProcessorArchitecture(hostSetup.ProcessorArchitecture); hostSetup.RuntimeVersion = tool.NegotiateRuntimeVersion(hostSetup.RuntimeVersion); return hostSetup; }
/// <inheritdoc /> public IHost CreateHost(HostSetup hostSetup, ILogger logger) { if (hostSetup == null) throw new ArgumentNullException("hostSetup"); if (logger == null) throw new ArgumentNullException("logger"); HostSetup canonicalHostSetup = hostSetup.Copy(); canonicalHostSetup.Canonicalize(null); return CreateHostImpl(canonicalHostSetup, logger); }
private void CreateTemporaryConfigurationFile() { try { HostSetup patchedSetup = HostSetup.Copy(); patchedSetup.Configuration.AddAssemblyBinding(new AssemblyBinding(typeof(IsolatedProcessHost).Assembly)); temporaryConfigurationFilePath = patchedSetup.WriteTemporaryConfigurationFile(); } catch (Exception ex) { throw new HostException("Could not write the temporary configuration file.", ex); } }
/// <inheritdoc /> public IHost CreateHost(HostSetup hostSetup, ILogger logger) { if (hostSetup == null) { throw new ArgumentNullException("hostSetup"); } if (logger == null) { throw new ArgumentNullException("logger"); } HostSetup canonicalHostSetup = hostSetup.Copy(); canonicalHostSetup.Canonicalize(null); return(CreateHostImpl(canonicalHostSetup, logger)); }
/// <summary> /// Forces the processor architecture and runtime version if required. /// </summary> /// <param name="hostSetup">The host setup.</param> /// <returns>The modified host setup.</returns> private static HostSetup ForceProcessorArchitectureAndRuntimeVersionIfRequired(HostSetup hostSetup) { if (hostSetup == null) throw new ArgumentNullException("hostSetup"); hostSetup = hostSetup.Copy(); hostSetup.ProcessorArchitecture = PartCoverTool.NegotiateProcessorArchitecture(hostSetup.ProcessorArchitecture); hostSetup.RuntimeVersion = PartCoverTool.NegotiateRuntimeVersion(hostSetup.RuntimeVersion); return hostSetup; }
public void Copy() { HostSetup setup = new HostSetup { ApplicationBaseDirectory = @"C:\AppBase", Configuration = { ConfigurationXml = "<xml/>" }, ConfigurationFileLocation = ConfigurationFileLocation.AppBase, ProcessorArchitecture = ProcessorArchitecture.Amd64, ShadowCopy = true, DebuggerSetup = new DebuggerSetup(), RuntimeVersion = "2.0.50727", Elevated = true, WorkingDirectory = @"C:\WorkingDir", }; setup.AddHintDirectory("Abc"); setup.AddProperty("abc", "def"); HostSetup copy = setup.Copy(); Assert.AreEqual(setup.ApplicationBaseDirectory, copy.ApplicationBaseDirectory); Assert.AreEqual(setup.Configuration.ConfigurationXml, copy.Configuration.ConfigurationXml); Assert.AreEqual(setup.ConfigurationFileLocation, copy.ConfigurationFileLocation); Assert.AreEqual(setup.ProcessorArchitecture, copy.ProcessorArchitecture); Assert.AreEqual(setup.ShadowCopy, copy.ShadowCopy); Assert.AreEqual(setup.Elevated, copy.Elevated); Assert.IsNotNull(copy.DebuggerSetup); Assert.AreEqual(setup.RuntimeVersion, copy.RuntimeVersion); Assert.AreEqual(setup.WorkingDirectory, copy.WorkingDirectory); Assert.AreEqual(setup.HintDirectories, copy.HintDirectories); Assert.AreEqual(setup.Properties, copy.Properties); }