Version Used:
VisualStudio.15.Preview/15.3.0-Preview+26510.0
Steps to Reproduce:
Consider the following program:
class Program
{
public static void Main()
{
switch ((object)null) // here
{
case bool _:
case true:
case false:
break;
}
switch ((bool?)null) // here
{
case bool _:
case true:
case false:
break;
}
}
}
Expected Behavior:
"IDE0004 C# Cast is redundant" is not reported. The program obviously won't compile without the casts.
Actual Behavior:
Both casts are highlighted as redundant by "IDE0004 C# Cast is redundant".
Fix 'Remove unnecessary cast' is offered but does nothing.
However I can select 'preview changes' from the fix menu and apply it from the preview window. It will remove the cast and broke compilation although the preview window says there will be no changes.
