public void BasicEnvTest() { // as the attribute says, this test requires 5.0-rc1 or newer. This has been tested locally on // an rc1 build and passes. It is equivalent to the dotnet/runtime version of this test. TestRunner runner = new TestRunner(CommonHelper.GetTraceePathWithArgs(targetFramework: "net5.0"), output); string testKey = "FOO"; string testVal = "BAR"; runner.AddEnvVar(testKey, testVal); runner.Start(3000); DiagnosticsClient client = new DiagnosticsClient(runner.Pid); Dictionary <string, string> env = client.GetProcessEnvironment(); Assert.True(env.ContainsKey(testKey) && env[testKey].Equals(testVal)); runner.Stop(); }
/// <summary> /// A simple test that collects process environment. /// </summary> private async Task BasicEnvTestCore(bool useAsync) { // as the attribute says, this test requires 5.0-rc1 or newer. This has been tested locally on // an rc1 build and passes. It is equivalent to the dotnet/runtime version of this test. using TestRunner runner = new TestRunner(CommonHelper.GetTraceePathWithArgs(targetFramework: "net5.0"), output); string testKey = "FOO"; string testVal = "BAR"; runner.AddEnvVar(testKey, testVal); runner.Start(timeoutInMSPipeCreation: 3000); var clientShim = new DiagnosticsClientApiShim(new DiagnosticsClient(runner.Pid), useAsync); Dictionary <string, string> env = await clientShim.GetProcessEnvironment(); Assert.True(env.ContainsKey(testKey) && env[testKey].Equals(testVal)); runner.Stop(); }
public static void SuspendDefaultDiagnosticPort(this TestRunner runner) { runner.AddEnvVar(DefaultDiagnosticPortSuspendEnvName, "1"); }
public static void AddReversedServer(this TestRunner runner, string transportName) { runner.AddEnvVar("DOTNET_DiagnosticsMonitorAddress", transportName); runner.AddEnvVar("DOTNET_DiagnosticPorts", $"{transportName},nosuspend;"); }
public static void SetDiagnosticPort(this TestRunner runner, string transportName, bool suspend) { string suspendArgument = suspend ? "suspend" : "nosuspend"; runner.AddEnvVar(DiagnosticPortsEnvName, $"{transportName},connect,{suspendArgument};"); }