code-cracker/code-cracker — pull request #169 by felipebz (2014-12-21 21:30:49+00:00)
Title: Fix unnecessary break generation in ConvertToSwitchCodeFix

Fix bug in CC019.

This code:

if (s == "A")
{
DoStuff();
}
else if (s == "B")
{
DoStuff();
}
else if (s == "C")
{
DoStuff();
}
else
{
throw new Exception();
}

Is converted to:

switch (s)
{
case "A":
DoStuff();
break;
case "B":
DoStuff();
break;
case "C":
DoStuff();
break;
default:
throw new Exception();
break;
}

This causes a "CS0162: Unreachable code detected" after the throw statement.