Skip to content

RS2001 mis-fires claiming a Warning severity should be documented as Disabled #82495

@AArnott

Description

@AArnott

Version Used: Microsoft.CodeAnalysis.Analyzers 5.3.0-2.final

Steps to Reproduce:

    /// <summary>
    /// The ID for diagnostics reported by this analyzer.
    /// </summary>
    public const string Id = "VSMEF012";

    /// <summary>
    /// The descriptor for disallowing MEFv1 attributes.
    /// </summary>
    public static readonly DiagnosticDescriptor DisallowV1Descriptor = new(
        id: Id,
        title: Strings.VSMEF012_Title,
        messageFormat: Strings.VSMEF012_V1Disallowed_MessageFormat,
        helpLinkUri: Utils.GetHelpLink(Id),
        category: "Usage",
        defaultSeverity: DiagnosticSeverity.Warning,
        isEnabledByDefault: false);

    /// <summary>
    /// The descriptor for disallowing MEFv2 attributes.
    /// </summary>
    public static readonly DiagnosticDescriptor DisallowV2Descriptor = new(
        id: Id,
        title: Strings.VSMEF012_Title,
        messageFormat: Strings.VSMEF012_V2Disallowed_MessageFormat,
        helpLinkUri: Utils.GetHelpLink(Id),
        category: "Usage",
        defaultSeverity: DiagnosticSeverity.Warning,
        isEnabledByDefault: false);

And an AnalyzerReleases.Unshipped.md file with this content:

### New Rules

Rule ID | Category | Severity | Notes
--------|----------|----------|-------
VSMEF012 | Usage | Warning | Disallow MEF attribute version

Alternatively, run these commands:

git clone git@github.com:drewnoakes/vs-mef
cd vs-mef
git checkout 2da0846e10b21a2dee18bf22617f49e70047b120
dotnet build .\src\Microsoft.VisualStudio.Composition.Analyzers\

Diagnostic Id: RS2001: Rule 'VSMEF012' has a changed 'Category' or 'Severity' from the last release. Either revert the update(s) in source or add a new up-to-date entry to unshipped release file.

Expected Behavior:
No warnings, because in fact the default diagnostic severity matches between md and cs files.

Actual Behavior:

D:\a\1\s\src\Microsoft.VisualStudio.Composition.Analyzers\VSMEF012DisallowMefAttributeVersionAnalyzer.cs(40,9): error RS2001: Rule 'VSMEF012' has a changed 'Category' or 'Severity' from the last release. Either revert the update(s) in source or add a new up-to-date entry to unshipped release file. (https://github.com/dotnet/roslyn/blob/main/src/RoslynAnalyzers/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md) [D:\a\1\s\src\Microsoft.VisualStudio.Composition.Analyzers\Microsoft.VisualStudio.Composition.Analyzers.csproj]
D:\a\1\s\src\Microsoft.VisualStudio.Composition.Analyzers\VSMEF012DisallowMefAttributeVersionAnalyzer.cs(52,9): error RS2001: Rule 'VSMEF012' has a changed 'Category' or 'Severity' from the last release. Either revert the update(s) in source or add a new up-to-date entry to unshipped release file. (https://github.com/dotnet/roslyn/blob/main/src/RoslynAnalyzers/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md) [D:\a\1\s\src\Microsoft.VisualStudio.Composition.Analyzers\Microsoft.VisualStudio.Composition.Analyzers.csproj]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions