Skip to content

Commit 1f296cb

Browse files
committed
Enable SA1643: Destructor summary documentation should begin with standard text
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1643.md
1 parent bb4a0f4 commit 1f296cb

File tree

10 files changed

+32
-40
lines changed

10 files changed

+32
-40
lines changed

.globalconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,7 @@ dotnet_diagnostic.SA1641.severity = none
15311531
dotnet_diagnostic.SA1642.severity = none
15321532

15331533
# SA1643: Destructor summary documentation should begin with standard text
1534-
dotnet_diagnostic.SA1643.severity = none
1534+
dotnet_diagnostic.SA1643.severity = warning
15351535

15361536
# SA1648: inheritdoc should be used with inheriting class
15371537
dotnet_diagnostic.SA1648.severity = none

src/Microsoft.PowerShell.ConsoleHost/WindowsTaskbarJumpList/PropVariant.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void Dispose()
5151
}
5252

5353
/// <summary>
54-
/// Finalizer.
54+
/// Finalizes an instance of the <see cref="PropVariant"/> class.
5555
/// </summary>
5656
~PropVariant()
5757
{

src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,14 +1194,6 @@ private void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArg
11941194
ui.WriteLine();
11951195
}
11961196

1197-
/// <summary>
1198-
/// Finalizes the instance.
1199-
/// </summary>
1200-
~ConsoleHost()
1201-
{
1202-
Dispose(false);
1203-
}
1204-
12051197
/// <summary>
12061198
/// Disposes of this instance, per the IDisposable pattern.
12071199
/// </summary>
@@ -1260,6 +1252,14 @@ private void Dispose(bool isDisposingNotFinalizing)
12601252
_isDisposed = true;
12611253
}
12621254

1255+
/// <summary>
1256+
/// Finalizes an instance of the <see cref="ConsoleHost"/> class.
1257+
/// </summary>
1258+
~ConsoleHost()
1259+
{
1260+
Dispose(false);
1261+
}
1262+
12631263
/// <summary>
12641264
/// Indicates if the session should be terminated or not. Typically set by the break handler for Close, Logoff, and
12651265
/// Shutdown events. Note that the only valid transition for this property is from false to true: it is not legal to

src/System.Management.Automation/engine/EventManager.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,6 +1544,14 @@ public void Dispose(bool disposing)
15441544
}
15451545
}
15461546
}
1547+
1548+
/// <summary>
1549+
/// Finalizes an instance of the <see cref="PSLocalEventManager"/> class.
1550+
/// </summary>
1551+
~PSLocalEventManager()
1552+
{
1553+
Dispose(false);
1554+
}
15471555
}
15481556

15491557
/// <summary>

src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ public void Dispose()
12511251
}
12521252

12531253
/// <summary>
1254-
/// Ensure we release the worker thread.
1254+
/// Finalizes an instance of the <see cref="PipelineThread"/> class.
12551255
/// </summary>
12561256
~PipelineThread()
12571257
{

src/System.Management.Automation/engine/remoting/fanin/BaseTransportManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ internal virtual void PrepareForConnect()
972972
#region Clean up
973973

974974
/// <summary>
975-
/// Finalizer.
975+
/// Finalizes an instance of the <see cref="BaseClientTransportManager"/> class.
976976
/// </summary>
977977
~BaseClientTransportManager()
978978
{

src/System.Management.Automation/engine/remoting/fanin/WSManNativeAPI.cs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -687,18 +687,6 @@ internal WSManData_ManToUn(string data)
687687
Marshal.StructureToPtr(_internalData, _marshalledObject, false);
688688
}
689689

690-
/// <summary>
691-
/// Finalizer
692-
///
693-
/// Note: Do not depend on the finalizer! This object should be
694-
/// properly disposed of when no longer needed via a direct call
695-
/// to Dispose().
696-
/// </summary>
697-
~WSManData_ManToUn()
698-
{
699-
Dispose(false);
700-
}
701-
702690
/// <summary>
703691
/// Gets the type of data.
704692
/// </summary>
@@ -747,6 +735,14 @@ private void Dispose(bool isDisposing)
747735
}
748736
}
749737

738+
/// <summary>
739+
/// Finalizes an instance of the <see cref="WSManData_ManToUn"/> class.
740+
/// </summary>
741+
~WSManData_ManToUn()
742+
{
743+
Dispose(false);
744+
}
745+
750746
/// <summary>
751747
/// Implicit IntPtr conversion.
752748
/// </summary>

src/System.Management.Automation/engine/remoting/fanin/WSManPluginFacade.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,7 @@ private void Dispose(bool disposing)
234234
}
235235

236236
/// <summary>
237-
/// Use C# destructor syntax for finalization code.
238-
/// This destructor will run only if the Dispose method
239-
/// does not get called.
240-
/// It gives your base class the opportunity to finalize.
241-
/// Do not provide destructors in types derived from this class.
237+
/// Finalizes an instance of the <see cref="WSManPluginEntryDelegates"/> class.
242238
/// </summary>
243239
~WSManPluginEntryDelegates()
244240
{
@@ -766,11 +762,7 @@ private void Dispose(bool disposing)
766762
}
767763

768764
/// <summary>
769-
/// Use C# destructor syntax for finalization code.
770-
/// This destructor will run only if the Dispose method
771-
/// does not get called.
772-
/// It gives your base class the opportunity to finalize.
773-
/// Do not provide destructors in types derived from this class.
765+
/// Finalizes an instance of the <see cref="WSManPluginManagedEntryInstanceWrapper"/> class.
774766
/// </summary>
775767
~WSManPluginManagedEntryInstanceWrapper()
776768
{

src/System.Management.Automation/engine/remoting/fanin/WSManPluginShellSession.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,7 @@ protected virtual void Dispose(bool disposing)
111111
}
112112

113113
/// <summary>
114-
/// Use C# destructor syntax for finalization code.
115-
/// This destructor will run only if the Dispose method
116-
/// does not get called.
117-
/// It gives your base class the opportunity to finalize.
118-
/// Do not provide destructors in types derived from this class.
114+
/// Finalizes an instance of the <see cref="WSManPluginServerSession"/> class.
119115
/// </summary>
120116
~WSManPluginServerSession()
121117
{

src/System.Management.Automation/help/CabinetNativeApi.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected override void Dispose(bool disposing)
8484
}
8585

8686
/// <summary>
87-
/// Finalizer to ensure destruction of unmanaged resources.
87+
/// Finalizes an instance of the <see cref="CabinetExtractor"/> class.
8888
/// </summary>
8989
~CabinetExtractor()
9090
{

0 commit comments

Comments
 (0)