From b302feafb78e3021c5d0a47b8ebcd3110811188e Mon Sep 17 00:00:00 2001
From: xtqqczze <45661989+xtqqczze@users.noreply.github.com>
Date: Mon, 10 Feb 2020 14:08:09 +0000
Subject: [PATCH 1/6] Fix IDisposable implementation by defining Dispose method
as virtual
https://rules.sonarsource.com/csharp/RSPEC-3881
---
.../CimCommandBase.cs | 2 +-
.../engine/hostifaces/PSDataCollection.cs | 2 +-
.../engine/remoting/client/ClientRemotePowerShell.cs | 2 +-
.../engine/remoting/client/remotingprotocolimplementation.cs | 2 +-
.../engine/remoting/commands/ReceiveJob.cs | 2 +-
.../engine/remoting/commands/RemoveJob.cs | 2 +-
.../engine/remoting/commands/StopJob.cs | 2 +-
.../engine/remoting/commands/newrunspacecommand.cs | 2 +-
src/System.Management.Automation/utils/CryptoUtils.cs | 2 +-
9 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs
index 2488490c514..9ec7702bb13 100644
--- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs
+++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs
@@ -635,7 +635,7 @@ public void Dispose()
///
///
/// Whether it is directly called.
- protected void Dispose(bool disposing)
+ protected virtual void Dispose(bool disposing)
{
// Check to see if Dispose has already been called.
if (!this.disposed)
diff --git a/src/System.Management.Automation/engine/hostifaces/PSDataCollection.cs b/src/System.Management.Automation/engine/hostifaces/PSDataCollection.cs
index 51d74dcc269..7ccdd99ed17 100644
--- a/src/System.Management.Automation/engine/hostifaces/PSDataCollection.cs
+++ b/src/System.Management.Automation/engine/hostifaces/PSDataCollection.cs
@@ -1777,7 +1777,7 @@ public void Dispose()
/// Release all the resources.
///
/// If true, release all managed resources.
- protected void Dispose(bool disposing)
+ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
diff --git a/src/System.Management.Automation/engine/remoting/client/ClientRemotePowerShell.cs b/src/System.Management.Automation/engine/remoting/client/ClientRemotePowerShell.cs
index 4f966f5bdba..b5a9f020f43 100644
--- a/src/System.Management.Automation/engine/remoting/client/ClientRemotePowerShell.cs
+++ b/src/System.Management.Automation/engine/remoting/client/ClientRemotePowerShell.cs
@@ -951,7 +951,7 @@ public void Dispose()
/// Release all resources.
///
/// If true, release all managed resources.
- protected void Dispose(bool disposing)
+ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
diff --git a/src/System.Management.Automation/engine/remoting/client/remotingprotocolimplementation.cs b/src/System.Management.Automation/engine/remoting/client/remotingprotocolimplementation.cs
index 8615bf3398a..c40d7ee628f 100644
--- a/src/System.Management.Automation/engine/remoting/client/remotingprotocolimplementation.cs
+++ b/src/System.Management.Automation/engine/remoting/client/remotingprotocolimplementation.cs
@@ -752,7 +752,7 @@ public void Dispose()
/// Release all resources.
///
/// If true, release all managed resources.
- protected void Dispose(bool disposing)
+ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
diff --git a/src/System.Management.Automation/engine/remoting/commands/ReceiveJob.cs b/src/System.Management.Automation/engine/remoting/commands/ReceiveJob.cs
index aa804f68691..6bd0ec17f42 100644
--- a/src/System.Management.Automation/engine/remoting/commands/ReceiveJob.cs
+++ b/src/System.Management.Automation/engine/remoting/commands/ReceiveJob.cs
@@ -633,7 +633,7 @@ public void Dispose()
///
///
///
- protected void Dispose(bool disposing)
+ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
diff --git a/src/System.Management.Automation/engine/remoting/commands/RemoveJob.cs b/src/System.Management.Automation/engine/remoting/commands/RemoveJob.cs
index 2eed427a6ff..bfffc1b2ee7 100644
--- a/src/System.Management.Automation/engine/remoting/commands/RemoveJob.cs
+++ b/src/System.Management.Automation/engine/remoting/commands/RemoveJob.cs
@@ -1035,7 +1035,7 @@ public void Dispose()
///
///
///
- protected void Dispose(bool disposing)
+ protected virtual void Dispose(bool disposing)
{
if (!disposing) return;
foreach (var pair in _cleanUpActions)
diff --git a/src/System.Management.Automation/engine/remoting/commands/StopJob.cs b/src/System.Management.Automation/engine/remoting/commands/StopJob.cs
index 7890bdc54f0..0613f8e11a6 100644
--- a/src/System.Management.Automation/engine/remoting/commands/StopJob.cs
+++ b/src/System.Management.Automation/engine/remoting/commands/StopJob.cs
@@ -278,7 +278,7 @@ public void Dispose()
///
///
///
- protected void Dispose(bool disposing)
+ protected virtual void Dispose(bool disposing)
{
if (!disposing) return;
foreach (var pair in _cleanUpActions)
diff --git a/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs b/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs
index 5645272bbe2..f05a6c41eef 100644
--- a/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs
+++ b/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs
@@ -1200,7 +1200,7 @@ private string GetRunspaceName(int rsIndex, out int rsId)
///
/// Whether method is called
/// from Dispose or destructor
- protected void Dispose(bool disposing)
+ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
diff --git a/src/System.Management.Automation/utils/CryptoUtils.cs b/src/System.Management.Automation/utils/CryptoUtils.cs
index f860bdd4b15..9e7c34176fc 100644
--- a/src/System.Management.Automation/utils/CryptoUtils.cs
+++ b/src/System.Management.Automation/utils/CryptoUtils.cs
@@ -612,7 +612,7 @@ public void Dispose()
}
// [SecurityPermission(SecurityAction.Demand, UnmanagedCode=true)]
- protected void Dispose(bool disposing)
+ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
From 6313896648aff74e7ec4c4ab9b7f331831fb5fb7 Mon Sep 17 00:00:00 2001
From: xtqqczze <45661989+xtqqczze@users.noreply.github.com>
Date: Mon, 10 Feb 2020 19:37:52 +0000
Subject: [PATCH 2/6] Define Dispose as protected virtual instead of private in
unsealed classes
---
.../utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs | 2 +-
.../utility/FormatAndOutput/OutGridView/OutWindowProxy.cs | 2 +-
.../commands/utility/ShowCommand/ShowCommand.cs | 2 +-
.../FormatAndOutput/common/BaseCommand.cs | 2 +-
.../engine/remoting/commands/ConnectPSSession.cs | 2 +-
.../engine/remoting/commands/DisconnectPSSession.cs | 2 +-
.../engine/remoting/commands/InvokeCommandCommand.cs | 2 +-
.../engine/remoting/commands/StartJob.cs | 2 +-
.../engine/remoting/commands/WaitJob.cs | 2 +-
.../engine/remoting/common/throttlemanager.cs | 2 +-
.../engine/remoting/fanin/WSManNativeAPI.cs | 2 +-
.../engine/runtime/Operations/MiscOps.cs | 2 +-
src/System.Management.Automation/utils/PlatformInvokes.cs | 2 +-
13 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs
index b95e9968c5c..edd8ec32afa 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs
@@ -472,7 +472,7 @@ internal override void ProcessInputObject(PSObject input)
/// Implements IDisposable logic.
///
/// True if being called from Dispose.
- private void Dispose(bool isDisposing)
+ protected virtual void Dispose(bool isDisposing)
{
if (isDisposing)
{
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutWindowProxy.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutWindowProxy.cs
index 55158034368..1e9113d1fbc 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutWindowProxy.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutWindowProxy.cs
@@ -242,7 +242,7 @@ internal void BlockUntillClosed()
/// Implements IDisposable logic.
///
/// True if being called from Dispose.
- private void Dispose(bool isDisposing)
+ protected virtual void Dispose(bool isDisposing)
{
if (isDisposing)
{
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs
index 701508ed4ff..c1d618acb8c 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs
@@ -479,7 +479,7 @@ private void Error_DataAdded(object sender, DataAddedEventArgs e)
/// Implements IDisposable logic.
///
/// True if being called from Dispose.
- private void Dispose(bool isDisposing)
+ protected virtual void Dispose(bool isDisposing)
{
if (isDisposing)
{
diff --git a/src/System.Management.Automation/FormatAndOutput/common/BaseCommand.cs b/src/System.Management.Automation/FormatAndOutput/common/BaseCommand.cs
index e03b4ae61eb..45f18f626de 100644
--- a/src/System.Management.Automation/FormatAndOutput/common/BaseCommand.cs
+++ b/src/System.Management.Automation/FormatAndOutput/common/BaseCommand.cs
@@ -386,7 +386,7 @@ public void Dispose()
GC.SuppressFinalize(this);
}
- private void Dispose(bool disposing)
+ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
diff --git a/src/System.Management.Automation/engine/remoting/commands/ConnectPSSession.cs b/src/System.Management.Automation/engine/remoting/commands/ConnectPSSession.cs
index 5f66afdfac1..ebc0b9de7cc 100644
--- a/src/System.Management.Automation/engine/remoting/commands/ConnectPSSession.cs
+++ b/src/System.Management.Automation/engine/remoting/commands/ConnectPSSession.cs
@@ -1063,7 +1063,7 @@ public void Dispose()
///
/// Whether method is called
/// from Dispose or destructor
- private void Dispose(bool disposing)
+ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
diff --git a/src/System.Management.Automation/engine/remoting/commands/DisconnectPSSession.cs b/src/System.Management.Automation/engine/remoting/commands/DisconnectPSSession.cs
index 0b9cfeb2d6e..87460b1c7c2 100644
--- a/src/System.Management.Automation/engine/remoting/commands/DisconnectPSSession.cs
+++ b/src/System.Management.Automation/engine/remoting/commands/DisconnectPSSession.cs
@@ -537,7 +537,7 @@ public void Dispose()
///
/// Whether method is called
/// from Dispose or destructor
- private void Dispose(bool disposing)
+ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
diff --git a/src/System.Management.Automation/engine/remoting/commands/InvokeCommandCommand.cs b/src/System.Management.Automation/engine/remoting/commands/InvokeCommandCommand.cs
index daef292017f..5b728b67933 100644
--- a/src/System.Management.Automation/engine/remoting/commands/InvokeCommandCommand.cs
+++ b/src/System.Management.Automation/engine/remoting/commands/InvokeCommandCommand.cs
@@ -2033,7 +2033,7 @@ public void Dispose()
/// Internal dispose method which does the actual disposing.
///
/// Whether called from dispose or finalize.
- private void Dispose(bool disposing)
+ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
diff --git a/src/System.Management.Automation/engine/remoting/commands/StartJob.cs b/src/System.Management.Automation/engine/remoting/commands/StartJob.cs
index 29e6640279f..7c830220073 100644
--- a/src/System.Management.Automation/engine/remoting/commands/StartJob.cs
+++ b/src/System.Management.Automation/engine/remoting/commands/StartJob.cs
@@ -805,7 +805,7 @@ public void Dispose()
/// Internal dispose method which does the actual disposing.
///
/// Whether called from dispose or finalize.
- private void Dispose(bool disposing)
+ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
diff --git a/src/System.Management.Automation/engine/remoting/commands/WaitJob.cs b/src/System.Management.Automation/engine/remoting/commands/WaitJob.cs
index f023ca168a7..06409d97f93 100644
--- a/src/System.Management.Automation/engine/remoting/commands/WaitJob.cs
+++ b/src/System.Management.Automation/engine/remoting/commands/WaitJob.cs
@@ -413,7 +413,7 @@ public void Dispose()
///
/// if true, release all the managed objects.
///
- private void Dispose(bool disposing)
+ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
diff --git a/src/System.Management.Automation/engine/remoting/common/throttlemanager.cs b/src/System.Management.Automation/engine/remoting/common/throttlemanager.cs
index 9fa2233153f..8c01f65a392 100644
--- a/src/System.Management.Automation/engine/remoting/common/throttlemanager.cs
+++ b/src/System.Management.Automation/engine/remoting/common/throttlemanager.cs
@@ -653,7 +653,7 @@ public void Dispose()
///
/// If method is called from
/// disposing of destructor
- private void Dispose(bool disposing)
+ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
diff --git a/src/System.Management.Automation/engine/remoting/fanin/WSManNativeAPI.cs b/src/System.Management.Automation/engine/remoting/fanin/WSManNativeAPI.cs
index 1b1fe2b2163..40e8fe6f89f 100644
--- a/src/System.Management.Automation/engine/remoting/fanin/WSManNativeAPI.cs
+++ b/src/System.Management.Automation/engine/remoting/fanin/WSManNativeAPI.cs
@@ -729,7 +729,7 @@ public void Dispose()
GC.SuppressFinalize(this);
}
- private void Dispose(bool isDisposing)
+ protected virtual void Dispose(bool isDisposing)
{
// Managed objects should not be deleted when this is called via the finalizer
// because they may have been collected already. To prevent leaking the marshalledBuffer
diff --git a/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs b/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs
index 7077ebeacbe..30f8d8802d6 100644
--- a/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs
+++ b/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs
@@ -1236,7 +1236,7 @@ public void Dispose()
GC.SuppressFinalize(this);
}
- private void Dispose(bool disposing)
+ protected virtual void Dispose(bool disposing)
{
if (_disposed)
return;
diff --git a/src/System.Management.Automation/utils/PlatformInvokes.cs b/src/System.Management.Automation/utils/PlatformInvokes.cs
index 8e99cdff4b0..523f9932218 100644
--- a/src/System.Management.Automation/utils/PlatformInvokes.cs
+++ b/src/System.Management.Automation/utils/PlatformInvokes.cs
@@ -564,7 +564,7 @@ public void Dispose()
/// Dispose.
///
///
- private void Dispose(bool disposing)
+ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
From 34b75355add6312dfecdf6567be6f400f2c1a782 Mon Sep 17 00:00:00 2001
From: xtqqczze <45661989+xtqqczze@users.noreply.github.com>
Date: Fri, 10 Apr 2020 23:45:50 +0100
Subject: [PATCH 3/6] Revert changes to non-public classes
---
.../utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs | 2 +-
.../utility/FormatAndOutput/OutGridView/OutWindowProxy.cs | 2 +-
.../commands/utility/ShowCommand/ShowCommand.cs | 2 +-
.../engine/remoting/commands/newrunspacecommand.cs | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs
index edd8ec32afa..b95e9968c5c 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs
@@ -472,7 +472,7 @@ internal override void ProcessInputObject(PSObject input)
/// Implements IDisposable logic.
///
/// True if being called from Dispose.
- protected virtual void Dispose(bool isDisposing)
+ private void Dispose(bool isDisposing)
{
if (isDisposing)
{
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutWindowProxy.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutWindowProxy.cs
index 1e9113d1fbc..55158034368 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutWindowProxy.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutWindowProxy.cs
@@ -242,7 +242,7 @@ internal void BlockUntillClosed()
/// Implements IDisposable logic.
///
/// True if being called from Dispose.
- protected virtual void Dispose(bool isDisposing)
+ private void Dispose(bool isDisposing)
{
if (isDisposing)
{
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs
index c1d618acb8c..701508ed4ff 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs
@@ -479,7 +479,7 @@ private void Error_DataAdded(object sender, DataAddedEventArgs e)
/// Implements IDisposable logic.
///
/// True if being called from Dispose.
- protected virtual void Dispose(bool isDisposing)
+ private void Dispose(bool isDisposing)
{
if (isDisposing)
{
diff --git a/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs b/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs
index f05a6c41eef..5645272bbe2 100644
--- a/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs
+++ b/src/System.Management.Automation/engine/remoting/commands/newrunspacecommand.cs
@@ -1200,7 +1200,7 @@ private string GetRunspaceName(int rsIndex, out int rsId)
///
/// Whether method is called
/// from Dispose or destructor
- protected virtual void Dispose(bool disposing)
+ protected void Dispose(bool disposing)
{
if (disposing)
{
From f56f9ec13d01f947c316c04692781acdf76ec273 Mon Sep 17 00:00:00 2001
From: xtqqczze
Date: Thu, 9 Jul 2020 22:13:55 +0100
Subject: [PATCH 4/6] revert addition of `virtual`
---
.../CimCommandBase.cs | 2 +-
.../FormatAndOutput/common/BaseCommand.cs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs
index 9ec7702bb13..2488490c514 100644
--- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs
+++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs
@@ -635,7 +635,7 @@ public void Dispose()
///
///
/// Whether it is directly called.
- protected virtual void Dispose(bool disposing)
+ protected void Dispose(bool disposing)
{
// Check to see if Dispose has already been called.
if (!this.disposed)
diff --git a/src/System.Management.Automation/FormatAndOutput/common/BaseCommand.cs b/src/System.Management.Automation/FormatAndOutput/common/BaseCommand.cs
index 45f18f626de..e03b4ae61eb 100644
--- a/src/System.Management.Automation/FormatAndOutput/common/BaseCommand.cs
+++ b/src/System.Management.Automation/FormatAndOutput/common/BaseCommand.cs
@@ -386,7 +386,7 @@ public void Dispose()
GC.SuppressFinalize(this);
}
- protected virtual void Dispose(bool disposing)
+ private void Dispose(bool disposing)
{
if (disposing)
{
From 3ef70974ab391b701ae666328be8aa7cabc69c84 Mon Sep 17 00:00:00 2001
From: xtqqczze
Date: Thu, 9 Jul 2020 22:16:24 +0100
Subject: [PATCH 5/6] Seal classes not meant to be derived from
address @PaulHigin review
---
.../engine/remoting/client/ClientRemotePowerShell.cs | 4 ++--
.../engine/remoting/client/remotingprotocolimplementation.cs | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/System.Management.Automation/engine/remoting/client/ClientRemotePowerShell.cs b/src/System.Management.Automation/engine/remoting/client/ClientRemotePowerShell.cs
index b5a9f020f43..2bd125ede6f 100644
--- a/src/System.Management.Automation/engine/remoting/client/ClientRemotePowerShell.cs
+++ b/src/System.Management.Automation/engine/remoting/client/ClientRemotePowerShell.cs
@@ -15,7 +15,7 @@ namespace System.Management.Automation.Runspaces.Internal
/// PowerShell client side proxy base which handles invocation
/// of powershell on a remote machine.
///
- internal class ClientRemotePowerShell : IDisposable
+ internal sealed class ClientRemotePowerShell : IDisposable
{
#region Tracer
@@ -951,7 +951,7 @@ public void Dispose()
/// Release all resources.
///
/// If true, release all managed resources.
- protected virtual void Dispose(bool disposing)
+ private void Dispose(bool disposing)
{
if (disposing)
{
diff --git a/src/System.Management.Automation/engine/remoting/client/remotingprotocolimplementation.cs b/src/System.Management.Automation/engine/remoting/client/remotingprotocolimplementation.cs
index c40d7ee628f..212ae03e21b 100644
--- a/src/System.Management.Automation/engine/remoting/client/remotingprotocolimplementation.cs
+++ b/src/System.Management.Automation/engine/remoting/client/remotingprotocolimplementation.cs
@@ -13,7 +13,7 @@ namespace System.Management.Automation.Remoting
///
/// Implements ServerRemoteSessionDataStructureHandler.
///
- internal class ClientRemoteSessionDSHandlerImpl : ClientRemoteSessionDataStructureHandler, IDisposable
+ internal sealed class ClientRemoteSessionDSHandlerImpl : ClientRemoteSessionDataStructureHandler, IDisposable
{
[TraceSourceAttribute("CRSDSHdlerImpl", "ClientRemoteSessionDSHandlerImpl")]
private static PSTraceSource s_trace = PSTraceSource.GetTracer("CRSDSHdlerImpl", "ClientRemoteSessionDSHandlerImpl");
@@ -752,7 +752,7 @@ public void Dispose()
/// Release all resources.
///
/// If true, release all managed resources.
- protected virtual void Dispose(bool disposing)
+ private void Dispose(bool disposing)
{
if (disposing)
{
From 39a233c11d93f5b1da40f997677e8db1aa8c0fff Mon Sep 17 00:00:00 2001
From: xtqqczze <45661989+xtqqczze@users.noreply.github.com>
Date: Fri, 17 Jan 2025 22:24:45 +0000
Subject: [PATCH 6/6] revert addition of virtual
---
src/System.Management.Automation/utils/CryptoUtils.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/System.Management.Automation/utils/CryptoUtils.cs b/src/System.Management.Automation/utils/CryptoUtils.cs
index 9161f27b115..2441d416a4d 100644
--- a/src/System.Management.Automation/utils/CryptoUtils.cs
+++ b/src/System.Management.Automation/utils/CryptoUtils.cs
@@ -583,7 +583,7 @@ public void Dispose()
System.GC.SuppressFinalize(this);
}
- protected virtual void Dispose(bool disposing)
+ private void Dispose(bool disposing)
{
if (disposing)
{