Skip to content

Commit ea67269

Browse files
committed
1 parent 5b72eb5 commit ea67269

File tree

7 files changed

+13
-9
lines changed

7 files changed

+13
-9
lines changed

.globalconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,10 @@ dotnet_diagnostic.CA1846.severity = warning
510510
# https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1847
511511
dotnet_diagnostic.CA1847.severity = warning
512512

513+
# CA1852: Seal internal types
514+
# https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852
515+
dotnet_diagnostic.CA1852.severity = warning
516+
513517
# CA1868: Unnecessary call to 'Contains' for sets
514518
# https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868
515519
dotnet_diagnostic.CA1868.severity = warning

src/Microsoft.PowerShell.Commands.Diagnostics/NewWinEventCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ protected override void EndProcessing()
323323
}
324324
}
325325

326-
internal class EventWriteException : Exception
326+
internal sealed class EventWriteException : Exception
327327
{
328328
internal EventWriteException(string msg, Exception innerException)
329329
: base(msg, innerException)

src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ internal struct CounterHandleNInstance
190190
public string InstanceName;
191191
}
192192

193-
internal class PdhHelper : IDisposable
193+
internal sealed class PdhHelper : IDisposable
194194
{
195195
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
196196
private struct PDH_COUNTER_PATH_ELEMENTS

src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,7 @@ public PowerManagementCapabilities[] GetPowerManagementCapabilities()
14861486
}
14871487

14881488
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Class is instantiated directly from a CIM instance")]
1489-
internal class WmiDeviceGuard
1489+
internal sealed class WmiDeviceGuard
14901490
{
14911491
public uint[] AvailableSecurityProperties;
14921492
public uint? CodeIntegrityPolicyEnforcementStatus;
@@ -1595,7 +1595,7 @@ internal class WMiLogicalMemory
15951595
}
15961596

15971597
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Class is instantiated directly from a CIM instance")]
1598-
internal class WmiMsftNetAdapter
1598+
internal sealed class WmiMsftNetAdapter
15991599
{
16001600
public string Caption;
16011601
public string Description;
@@ -1683,7 +1683,7 @@ internal class WmiMsftNetAdapter
16831683
}
16841684

16851685
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Class is instantiated directly from a CIM instance")]
1686-
internal class WmiNetworkAdapter
1686+
internal sealed class WmiNetworkAdapter
16871687
{
16881688
public string AdapterType;
16891689
public ushort? AdapterTypeID;

src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2840,7 +2840,7 @@ internal struct PROCESS_INFORMATION
28402840
}
28412841

28422842
[StructLayout(LayoutKind.Sequential)]
2843-
internal class SECURITY_ATTRIBUTES
2843+
internal sealed class SECURITY_ATTRIBUTES
28442844
{
28452845
public int nLength;
28462846
public SafeLocalMemHandle lpSecurityDescriptor;

src/Microsoft.WSMan.Management/CurrentConfigurations.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Microsoft.WSMan.Management
1111
/// Class that queries the server and gets current configurations.
1212
/// Also provides a generic way to update the configurations.
1313
/// </summary>
14-
internal class CurrentConfigurations
14+
internal sealed class CurrentConfigurations
1515
{
1616
/// <summary>
1717
/// Prefix used to add NameSpace of root element to namespace manager.

src/Microsoft.WSMan.Management/WsManHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
namespace Microsoft.WSMan.Management
2323
{
2424
[SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "0#")]
25-
internal class WSManHelper
25+
internal sealed class WSManHelper
2626
{
2727
// regular expressions
2828
private const string PTRN_URI_LAST = @"([a-z_][-a-z0-9._]*)$";
@@ -89,7 +89,7 @@ internal class WSManHelper
8989
//
9090
//
9191
// Below class is just a static container which would release sessions in case this DLL is unloaded.
92-
internal class Sessions
92+
internal sealed class Sessions
9393
{
9494
/// <summary>
9595
/// Dictionary object to store the connection.

0 commit comments

Comments
 (0)