Skip to content

IDE doesn't suggest upgrading LangVersion when emitting error as warning #69228

@jjonescz

Description

@jjonescz

Version Used: e1a7480

Steps to Reproduce:

<PropertyGroup>
  <LangVersion>11</LangVersion>
  <GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
/// <summary>
/// <see cref="M(ref readonly int)"/>
/// </summary>
class C
{
    public static void M(ref readonly int x)
    {
        Console.WriteLine(x);
    }
}

Diagnostic Id: CS1658, CS8652

Expected Behavior: Visual Studio suggests upgrading language version as a code action on the cref="M(ref readonly int)" where the following warning is reported:

CS1658: The feature 'ref readonly parameters' is currently in Preview and unsupported. To use Preview features, use the 'preview' language version.. See also error CS8652.

Actual Behavior: Visual Studio suggest upgrading language version only for error CS8652 emitted for public static void M(ref readonly int x) declaration, but not when the same error is emitted as warning inside the doc comment (implemented here - notice the forceWarning: true parameter):

CheckFeatureAvailability(parameter.ReadOnlyKeyword, MessageID.IDS_FeatureRefReadonlyParameters, diagnostics, forceWarning: true);

Note that this example is about ref readonly parameters, but similar issue probably holds for other scenarios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-IDEBughelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on it

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Completed

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions