Hello,
protected override void Run()
{
try
{
switch (Logged)
{
case false:
break;
case true:
//LOGGED
Console.Write(UserLevel.TypeUser() + userLogged + "~ " + current_directory + "> ");
var cmd = Console.ReadLine();
Shell.Interpreter.Interpret(cmd);
Console.WriteLine();
break;
}
}
catch (Exception ex)
{
running = false;
Crash.StopKernel(ex);
}
}
When I did this switch case, I had that error:
Error: Exception: System.Exception: Error compiling method 'SystemVoidAlve_OSKernelRun': System.Exception: Error interpreting stacktypes for IL_000F: Beq ---> System.Exception: Comparing types 'System.Int32, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' and 'System.Boolean, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' not supported!
2> at Cosmos.IL2CPU.ILOpCodes.OpBranch.DoInterpretStackTypes(Boolean& aSituationChanged) in C:\Users\dacru\Documents\Visual Studio 2017\Projects\Alve-Cosmos\Cosmos\source\Cosmos.IL2CPU\ILOpCodes\OpBranch.cs:line 173
2> at Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Users\dacru\Documents\Visual Studio 2017\Projects\Alve-Cosmos\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:line 413
2> --- End of inner exception stack trace ---
2> at Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Users\dacru\Documents\Visual Studio 2017\Projects\Alve-Cosmos\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:line 417
2> at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(ILOpCode xNextOpCode, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Users\dacru\Documents\Visual Studio 2017\Projects\Alve-Cosmos\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:line 470
2> at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(Int32 aPosition, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Users\dacru\Documents\Visual Studio 2017\Projects\Alve-Cosmos\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:line 464
2> at Cosmos.IL2CPU.ILOpCode.DoInterpretNextInstructionStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Users\dacru\Documents\Visual Studio 2017\Projects\Alve-Cosmos\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:line 446
2> at Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Users\dacru\Documents\Visual Studio 2017\Projects\Alve-Cosmos\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:line 423
2> at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(ILOpCode xNextOpCode, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Users\dacru\Documents\Visual Studio 2017\Projects\Alve-Cosmos\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:line 470
2> at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(Int32 aPosition, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Users\dacru\Documents\Visual Studio 2017\Projects\Alve-Cosmos\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:line 464
2> at Cosmos.IL2CPU.ILOpCode.DoInterpretNextInstructionStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Users\dacru\Documents\Visual Studio 2017\Projects\Alve-Cosmos\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:line 446
2> at Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Users\dacru\Documents\Visual Studio 2017\Projects\Alve-Cosmos\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:line 423
2> at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(ILOpCode xNextOpCode, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Users\dacru\Documents\Visual Studio 2017\Projects\Alve-Cosmos\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:line 470
2> at Cosmos.IL2CPU.ILOpCode.InterpretInstructionIfNotYetProcessed(Int32 aPosition, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Users\dacru\Documents\Visual Studio 2017\Projects\Alve-Cosmos\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:line 455
2> at Cosmos.IL2CPU.ILOpCodes.OpBranch.DoInterpretNextInstruc
And on ILSpy I have this:
IL_000d: ldloc.0 //local 0 is a bool
IL_000e: ldc.i4.1
IL_000f: beq.s IL_0015
I solved the problem with the help of @jp2masa using a if/else !
System.Private.CoreLib
Hmm..
It's the same .NET standard library, IL code is different from usual .NET Framework?
馃
No the IL code is generated by the same Roslyn that a normal C# application will use but in some way the IL generated is not totally correct see here: https://github.com/dotnet/roslyn/issues/21200
We need to fix our IL interpreter..
More native code issues.
Problem has been fixed with the help of @jp2masa 馃憤
Problem is comparing types int and bool code wasn't there so the method didn't return
Compiler thinks that this is not supported so that's why it is not working
@jp2masa @KingLuigi4932 Well done !