Skip to content

Commit 4c476ee

Browse files
remove destructor pattern from LogMessageListener (#4585)
Co-authored-by: Amaury Levé <[email protected]>
1 parent 9151e75 commit 4c476ee

File tree

3 files changed

+5
-22
lines changed

3 files changed

+5
-22
lines changed

src/Adapter/MSTest.TestAdapter/Execution/LogMessageListener.cs

+3-22
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ public LogMessageListener(bool captureDebugTraces)
8787
}
8888
}
8989

90-
~LogMessageListener()
91-
{
92-
Dispose(false);
93-
}
94-
9590
/// <summary>
9691
/// Gets logger output.
9792
/// </summary>
@@ -108,31 +103,17 @@ public LogMessageListener(bool captureDebugTraces)
108103
[SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Part of the public API")]
109104
public string? DebugTrace => s_redirectedDebugTrace?.ToString();
110105

111-
public string? GetAndClearStandardOutput()
112-
{
113-
string? output = _redirectedStandardOutput.ToStringAndClear();
114-
return output;
115-
}
106+
public string? GetAndClearStandardOutput() => _redirectedStandardOutput.ToStringAndClear();
116107

117-
public string? GetAndClearStandardError()
118-
{
119-
string? output = _redirectedStandardError.ToStringAndClear();
120-
return output;
121-
}
108+
public string? GetAndClearStandardError() => _redirectedStandardError.ToStringAndClear();
122109

123110
[SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Part of the public API")]
124111
public string? GetAndClearDebugTrace()
125112
=> s_redirectedDebugTrace?.ToStringAndClear();
126113

127114
public void Dispose()
128115
{
129-
Dispose(true);
130-
GC.SuppressFinalize(this);
131-
}
132-
133-
private void Dispose(bool disposing)
134-
{
135-
if (!disposing || _isDisposed)
116+
if (_isDisposed)
136117
{
137118
return;
138119
}
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
#nullable enable
2+
*REMOVED*Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.LogMessageListener.~LogMessageListener() -> void
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
#nullable enable
2+
*REMOVED*Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.LogMessageListener.~LogMessageListener() -> void

0 commit comments

Comments
 (0)