Enable CA1012: Abstract types should not have public constructors (#13940)

https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1012
This commit is contained in:
xtqqczze 2020-11-21 15:07:28 +00:00 committed by GitHub
parent eafeab554b
commit 60643e27df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 8 deletions

View file

@ -24,7 +24,8 @@ dotnet_diagnostic.CA1008.severity = none
dotnet_diagnostic.CA1010.severity = silent
# CA1012: Abstract types should not have public constructors
dotnet_diagnostic.CA1012.severity = none
dotnet_diagnostic.CA1012.severity = warning
dotnet_code_quality.ca1012.api_surface = all
# CA1014: Mark assemblies with CLSCompliant
dotnet_diagnostic.CA1014.severity = none

View file

@ -28,7 +28,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
/// <summary>
/// The constructor.
/// </summary>
public CimAsyncOperation()
protected CimAsyncOperation()
{
this.moreActionEvent = new ManualResetEventSlim(false);
this.actionQueue = new ConcurrentQueue<CimBaseAction>();

View file

@ -19,7 +19,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
/// <summary>
/// Constructor method.
/// </summary>
public CimBaseAction()
protected CimBaseAction()
{
}

View file

@ -69,7 +69,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
/// <param name="session"></param>
/// <param name="observable"></param>
/// <param name="resultType"></param>
public AsyncResultEventArgsBase(
protected AsyncResultEventArgsBase(
CimSession session,
IObservable<object> observable,
AsyncResultType resultType)
@ -86,7 +86,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
/// <param name="observable"></param>
/// <param name="resultType"></param>
/// <param name="context"></param>
public AsyncResultEventArgsBase(
protected AsyncResultEventArgsBase(
CimSession session,
IObservable<object> observable,
AsyncResultType resultType,

View file

@ -4198,7 +4198,7 @@ namespace System.Management.Automation
/// <param name="runspace">Runspace.</param>
/// <param name="runspaceType">Runspace type.</param>
/// <param name="parentDebuggerId">Debugger Id of parent.</param>
public NestedRunspaceDebugger(
protected NestedRunspaceDebugger(
Runspace runspace,
PSMonitorRunspaceType runspaceType,
Guid parentDebuggerId)

View file

@ -204,7 +204,7 @@ namespace System.Management.Automation.Interpreter
internal readonly int _labelIndex;
public IndexedBranchInstruction(int labelIndex)
protected IndexedBranchInstruction(int labelIndex)
{
_labelIndex = labelIndex;
}

View file

@ -21,7 +21,7 @@ namespace System.Management.Automation.Internal
/// </summary>
/// <param name="stream">The stream to read.</param>
/// <exception cref="ArgumentNullException">Thrown if the specified stream is null.</exception>
public ObjectReaderBase([In, Out] ObjectStreamBase stream)
protected ObjectReaderBase([In, Out] ObjectStreamBase stream)
{
if (stream == null)
{