diff --git a/src/Adapter/MSTest.TestAdapter/Execution/LogMessageListener.cs b/src/Adapter/MSTest.TestAdapter/Execution/LogMessageListener.cs index 7e3dc95d39..b7a7c6a09c 100644 --- a/src/Adapter/MSTest.TestAdapter/Execution/LogMessageListener.cs +++ b/src/Adapter/MSTest.TestAdapter/Execution/LogMessageListener.cs @@ -87,11 +87,6 @@ public LogMessageListener(bool captureDebugTraces) } } - ~LogMessageListener() - { - Dispose(false); - } - /// /// Gets logger output. /// @@ -108,17 +103,9 @@ public LogMessageListener(bool captureDebugTraces) [SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Part of the public API")] public string? DebugTrace => s_redirectedDebugTrace?.ToString(); - public string? GetAndClearStandardOutput() - { - string? output = _redirectedStandardOutput.ToStringAndClear(); - return output; - } + public string? GetAndClearStandardOutput() => _redirectedStandardOutput.ToStringAndClear(); - public string? GetAndClearStandardError() - { - string? output = _redirectedStandardError.ToStringAndClear(); - return output; - } + public string? GetAndClearStandardError() => _redirectedStandardError.ToStringAndClear(); [SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Part of the public API")] public string? GetAndClearDebugTrace() @@ -126,13 +113,7 @@ public LogMessageListener(bool captureDebugTraces) public void Dispose() { - Dispose(true); - GC.SuppressFinalize(this); - } - - private void Dispose(bool disposing) - { - if (!disposing || _isDisposed) + if (_isDisposed) { return; }