Skip to content

IDE0072 Add missing cases not well implemented when nullable #61594

@JeanCollas

Description

@JeanCollas

I am not sure it is the right place to post this issue, but here it is:

Using Visual Studio 17.1.6, adding missing cases to a switch statement on a nullable enum gives an incorrect generated code.

public static string ToAnotherEnum(this MyEnum? myEnumValue)
        => statut switch
        {
        }

This code will auto-implement the following:

public static string ToAnotherEnum(this MyEnum? myEnumValue)
        => statut switch
        {
            MyEnum?.Value1 => throw new NotImplementedException(),
            MyEnum?.Value2 => throw new NotImplementedException(),
        }

Which seems incorrect, there should not be the ?.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-IDEBugIDE-CodeStyleBuilt-in analyzers, fixes, and refactoringshelp 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

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions