Version Used:
.NET SDK 5.0.102
Steps to Reproduce:
dotnet build the following:
Program.cs
bool EnumIsValid(FriendOrFoe f)
{
return f switch
{
FriendOrFoe.Friend or FriendOrFoe.Foe => true,
_ => false,
};
}
enum FriendOrFoe
{
Friend,
Foe
}
ConsoleApp0.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
</Project>
.editorconfig
[*.cs]
dotnet_diagnostic.IDE0072.severity = warning
Expected Behavior:
IDE0072 is not raised: all cases are handled
Actual Behavior:
IDE0072 is raised. The suggested fix is to add a separate case for FriendOrFoe.Friend and a separate case for FriendOrFor.Foe.
Version Used:
.NET SDK 5.0.102
Steps to Reproduce:
dotnet buildthe following:Program.cs
ConsoleApp0.csproj
.editorconfig
Expected Behavior:
IDE0072 is not raised: all cases are handled
Actual Behavior:
IDE0072 is raised. The suggested fix is to add a separate case for
FriendOrFoe.Friendand a separate case forFriendOrFor.Foe.