1

Closed

Build-error when too many cases in switch-statement (with string variable)

description

This doesnt build:
 
        string i = "";
        switch (i)
        {
            case "0":
                break;
            case "1":
                break;
            case "2":
                break;
            case "3":
                break;
            case "4":
                break;
            case "5":
                break;
            default:
                break;
        }
 
 
But this does:
 
        string i = "";
        switch (i)
        {
            case "0":
                break;
            case "1":
                break;
            case "2":
                break;
            case "3":
                break;
            case "4":
                break;
            default:
                break;
        }
 
 
The error is of the "missing plug" type. Seems only to happen when you are using a string in the switch statement and not integer for example.
Closed Jun 22, 2012 at 1:26 PM by kudzu
Future compiler support and has to do with plugs.

comments

kudzu wrote Jul 8, 2011 at 10:53 PM

This has to do with a C# optimization with string based case statements. What is the full plug error?

Ragnar_Darude wrote Jul 9, 2011 at 5:05 PM

System.Object System.RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter(System.RuntimeType, System.RuntimeType)
at Cosmos.IL2CPU.ILScanner.ScanMethod(MethodBase aMethod, Boolean aIsPlug) in C:\Cosmos devkit\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 804
at Cosmos.IL2CPU.ILScanner.ScanQueue() in C:\Cosmos devkit\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 944
at Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod) in C:\Cosmos devkit\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 308
at Cosmos.Build.MSBuild.IL2CPUTask.Execute() in C:\Cosmos devkit\source2\Build\Cosmos.Build.MSBuild\IL2CPUTask.cs:line 245

kudzu wrote Jul 10, 2011 at 7:01 PM

That is the where, but not the what. Need the error text please.