avengerx/ilspy

Switch-case wrong indentation

Opened this issue · 0 comments

Steps to reproduce

  1. Decompile code from a switch-case statement

Error message shown

The decompiled code would like something like this:

private void FunctionName(int someValue)
{
    int i = 0;
    switch (someValue)
    {
    case 0:
    {
        Console.WriteLine("Case zero");
        break;
    }
    default:
    {
        Console.WriteLine("Case de-fault");
       break;
    }
    }
}

While it should instead look like this:

private void FunctionName(int someValue)
{
    int i = 0;
    switch (someValue)
    {
        case 0:
        {
            Console.WriteLine("Case zero");
            break;
        }
        default:
        {
            Console.WriteLine("Case de-fault");
           break;
        }
    }
}

Details

  • Affected versions: ILSpy 7.2.1 ... 8.0.0.7063. Not confirmed other versions.