From 19d909c77de206e31b1ba06848823512128647b3 Mon Sep 17 00:00:00 2001 From: Simon Cropp <simon.cropp@gmail.com> Date: Thu, 9 Jan 2025 23:06:33 +1100 Subject: [PATCH 1/3] remove destructor pattern from LogMessageListener --- .../Execution/LogMessageListener.cs | 25 +++---------------- 1 file changed, 3 insertions(+), 22 deletions(-) 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); - } - /// <summary> /// Gets logger output. /// </summary> @@ -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; } From 3ee505e6384e5789ad82f86df1225b1ac9c25fa4 Mon Sep 17 00:00:00 2001 From: Simon Cropp <simon.cropp@gmail.com> Date: Thu, 23 Jan 2025 13:19:15 +1100 Subject: [PATCH 2/3] Update PublicAPI.Shipped.txt --- src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt b/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt index d8c0db21dd..1a24faebf6 100644 --- a/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt +++ b/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt @@ -5,7 +5,6 @@ const Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.MSTestSettings.Sett const Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel.TestMethod.TotalHierarchyLevels = 4 -> int const Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.RunConfigurationSettings.SettingsName = "RunConfiguration" -> string! Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.LogMessageListener -Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.LogMessageListener.~LogMessageListener() -> void Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.LogMessageListener.DebugTrace.get -> string? Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.LogMessageListener.Dispose() -> void Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.LogMessageListener.GetAndClearDebugTrace() -> string? From fc863cb4b2704a6d2e4068545e0e3beb97f5169f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= <amauryleve@microsoft.com> Date: Thu, 23 Jan 2025 17:54:48 +0100 Subject: [PATCH 3/3] Fix public API --- src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt | 1 + src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Unshipped.txt | 1 + .../PublicAPI/uap10.0.16299/PublicAPI.Unshipped.txt | 1 + 3 files changed, 3 insertions(+) diff --git a/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt b/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt index 1a24faebf6..d8c0db21dd 100644 --- a/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt +++ b/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt @@ -5,6 +5,7 @@ const Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.MSTestSettings.Sett const Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel.TestMethod.TotalHierarchyLevels = 4 -> int const Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.RunConfigurationSettings.SettingsName = "RunConfiguration" -> string! Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.LogMessageListener +Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.LogMessageListener.~LogMessageListener() -> void Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.LogMessageListener.DebugTrace.get -> string? Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.LogMessageListener.Dispose() -> void Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.LogMessageListener.GetAndClearDebugTrace() -> string? diff --git a/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Unshipped.txt b/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Unshipped.txt index 7dc5c58110..871e104b0f 100644 --- a/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Unshipped.txt +++ b/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Unshipped.txt @@ -1 +1,2 @@ #nullable enable +*REMOVED*Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.LogMessageListener.~LogMessageListener() -> void diff --git a/src/Adapter/MSTest.TestAdapter/PublicAPI/uap10.0.16299/PublicAPI.Unshipped.txt b/src/Adapter/MSTest.TestAdapter/PublicAPI/uap10.0.16299/PublicAPI.Unshipped.txt index 7dc5c58110..871e104b0f 100644 --- a/src/Adapter/MSTest.TestAdapter/PublicAPI/uap10.0.16299/PublicAPI.Unshipped.txt +++ b/src/Adapter/MSTest.TestAdapter/PublicAPI/uap10.0.16299/PublicAPI.Unshipped.txt @@ -1 +1,2 @@ #nullable enable +*REMOVED*Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.LogMessageListener.~LogMessageListener() -> void