System.Diagnostics.RemoteExecutorTestBase.RemoteInvokeHandle.Dispose C# (CSharp) Method

Dispose() public method

public Dispose ( ) : void
return void
            public void Dispose()
            {
                if (Process != null)
                {
                    // A bit unorthodox to do throwing operations in a Dispose, but by doing it here we avoid
                    // needing to do this in every derived test and keep each test much simpler.
                    try
                    {
                        Assert.True(Process.WaitForExit(Options.TimeOut));
                        if (Options.CheckExitCode)
                            Assert.Equal(SuccessExitCode, Process.ExitCode);
                    }
                    finally
                    {
                        // Cleanup
                        try { Process.Kill(); }
                        catch { } // ignore all cleanup errors

                        Process.Dispose();
                        Process = null;
                    }
                }
            }
        }
RemoteExecutorTestBase.RemoteInvokeHandle