-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SyntaxEditorBasedFixAllProvider crashed for IDE0066 #37907
Comments
tagging @alrz |
from the stacktrace, this looks like a nested switch followed by a break which probably belongs to the outer switch. a few regex lookups didn't find any interesting case in corefx so far. I'll see if I can come up with a repro. |
@CyrusNajmabadi would it be possible to record the diagnostic location for which the CodeFixProvider throws? so that we can spot the offending code in a fix-all operation. |
I attached a debugger and found the problematic case. Here's a repro: using System;
class Program
{
public static void Main() { }
public DayOfWeek StatusValue() => DayOfWeek.Monday;
public short Value => 0;
public bool ValueBoolean()
{
bool value;
switch (StatusValue())
{
case DayOfWeek.Monday:
switch (Value)
{
case 0:
value = false;
break;
case 1:
value = true;
break;
default:
throw new Exception();
}
break;
default:
throw new Exception();
}
return value;
}
} |
I have a fix for this and a few others, will open a pr soon. |
C# Tools 3.3.0-beta2-19401-05+8ed56b826700926009731ca4d3de0a4e4e652969
I tried running IDE0066 (use 'switch' expression) on a .sln for all of corefx. At some point it failed with the message "'SyntaxEditorBasedFixAllProvider' encountered an error and has been disabled." with the stack:
I don't have a simple repro.
The text was updated successfully, but these errors were encountered: