Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with IL2CPU Error
#1
I swear, Kernel.cs is the only file I've edited.

   
Reply
#2
Some condition IL2CPU doesnt like. Right now everyone is focused on other areas, mostly on X#.

I'll ping the team to see if they have any ideas off the top of their heads.
Reply
#3
Thank you so much! Restarting VS19 did nothing. I will see tomorrow if powering up the PC fresh fixes it.
Reply
#4
Could you please post the entire error message from the output window including the stack?
Are you on the newest version either Userkit or Devkit?
Reply
#5
Userkit, couldn’t find an installer for the devkit. When I get back on my PC today, I will try and expand the output window.
Reply
#6
Output window reads this after attempting to compile once today:
Code:
1>------ Build started: Project: CosmosKernel2, Configuration: Debug Any CPU ------
1>CosmosKernel2 -> C:\Users\aweso\source\repos\CosmosKernel2\CosmosKernel2\bin\Debug\netcoreapp2.0\cosmos\CosmosKernel2.dll
1>Message: Executing IL2CPU on assembly
1>Message: Kernel Base: Cosmos.System.Kernel
1>Message: Checking target assembly: C:\Users\aweso\source\repos\CosmosKernel2\CosmosKernel2\bin\Debug\netcoreapp2.0\cosmos\CosmosKernel2.dll
1>Detecting fields for type 'IL2CPU.Debug.Symbols.FIELD_INFO'
1>Detecting fields for type 'IL2CPU.Debug.Symbols.FIELD_MAPPING'
1>Detecting fields for type 'IL2CPU.Debug.Symbols.MethodIlOp'
1>Detecting fields for type 'IL2CPU.Debug.Symbols.AssemblyFile'
1>Detecting fields for type 'IL2CPU.Debug.Symbols.Document'
1>Detecting fields for type 'IL2CPU.Debug.Symbols.Method'
1>IL2CPU : error : Exception: System.Exception: Error compiling method 'SystemVoidCosmosKernel2KernelPrompt': System.Exception: Error interpreting stacktypes for IL_00F6: Ldind_Ref ---> System.Exception: Invalid ref type: System.Void*
1>   at Cosmos.IL2CPU.ILOpCodes.OpNone.DoInterpretStackTypes(Boolean& aSituationChanged) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCodes\OpNone.cs:line 1090
1>   at Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 415
1>   --- End of inner exception stack trace ---
1>   at Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 419
1>   at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(ILOpCode xNextOpCode, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 469
1>   at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(Int32 aPosition, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 463
1>   at Cosmos.IL2CPU.ILOpCode.DoInterpretNextInstructionStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 447
1>   at Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 425
1>   at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(ILOpCode xNextOpCode, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 469
1>   at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(Int32 aPosition, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 463
1>   at Cosmos.IL2CPU.ILOpCode.DoInterpretNextInstructionStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 447
1>   at Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 425
1>   at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(ILOpCode xNextOpCode, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 469
1>   at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(Int32 aPosition, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 463
1>   at Cosmos.IL2CPU.ILOpCode.DoInterpretNextInstructionStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 447
1>   at Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 425
1>   at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(ILOpCode xNextOpCode, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 469
1>   at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(Int32 aPosition, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 463
1>   at Cosmos.IL2CPU.ILOpCode.DoInterpretNextInstructionStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 447
1>   at Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 425
1>   at Cosmos.IL2CPU.AppAssembler.InterpretInstructionsToDetermineStackTypes(List`1 aCurrentGroup) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\AppAssembler.cs:line 732
1>   at Cosmos.IL2CPU.AppAssembler.EmitInstructions(_MethodInfo aMethod, List`1 aCurrentGroup, Boolean& emitINT3) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\AppAssembler.cs:line 558
1>   at Cosmos.IL2CPU.AppAssembler.ProcessMethod(_MethodInfo aMethod, List`1 aOpCodes) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\AppAssembler.cs:line 511 ---> System.Exception: Error interpreting stacktypes for IL_00F6: Ldind_Ref ---> System.Exception: Invalid ref type: System.Void*
1>   at Cosmos.IL2CPU.ILOpCodes.OpNone.DoInterpretStackTypes(Boolean& aSituationChanged) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCodes\OpNone.cs:line 1090
1>   at Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 415
1>   --- End of inner exception stack trace ---
1>   at Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 419
1>   at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(ILOpCode xNextOpCode, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 469
1>   at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(Int32 aPosition, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 463
1>   at Cosmos.IL2CPU.ILOpCode.DoInterpretNextInstructionStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 447
1>   at Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 425
1>   at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(ILOpCode xNextOpCode, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 469
1>   at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(Int32 aPosition, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 463
1>   at Cosmos.IL2CPU.ILOpCode.DoInterpretNextInstructionStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 447
1>   at Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 425
1>   at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(ILOpCode xNextOpCode, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 469
1>   at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(Int32 aPosition, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 463
1>   at Cosmos.IL2CPU.ILOpCode.DoInterpretNextInstructionStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 447
1>   at Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 425
1>   at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(ILOpCode xNextOpCode, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 469
1>   at Cosmos.IL2CPU.ILOpCode.InterpretInstruction(Int32 aPosition, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 463
1>   at Cosmos.IL2CPU.ILOpCode.DoInterpretNextInstructionStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 447
1>   at Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 425
1>   at Cosmos.IL2CPU.AppAssembler.InterpretInstructionsToDetermineStackTypes(List`1 aCurrentGroup) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\AppAssembler.cs:line 732
1>   at Cosmos.IL2CPU.AppAssembler.EmitInstructions(_MethodInfo aMethod, List`1 aCurrentGroup, Boolean& emitINT3) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\AppAssembler.cs:line 558
1>   at Cosmos.IL2CPU.AppAssembler.ProcessMethod(_MethodInfo aMethod, List`1 aOpCodes) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\AppAssembler.cs:line 511
1>   --- End of inner exception stack trace ---
1>   at Cosmos.IL2CPU.AppAssembler.ProcessMethod(_MethodInfo aMethod, List`1 aOpCodes) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\AppAssembler.cs:line 526
1>   at Cosmos.IL2CPU.ILScanner.Assemble() in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILScanner.cs:line 998
1>   at Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod, IEnumerable`1 plugsAssemblies) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILScanner.cs:line 266
1>   at Cosmos.IL2CPU.CompilerEngine.Execute() in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\CompilerEngine.cs:line 200
1>IL2CPU task took 00:00:16.9483532
1>Done building project "CosmosKernel2.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

This is the entire contents of Kernel.cs:
Code:
using System;
using System.Collections.Generic;
using System.Text;
using Sys = Cosmos.System;

namespace CosmosKernel2
{
    public class Kernel : Sys.Kernel
    {
        int userid = -1;
        int passwordattempts = 5;
        int currentpasswordattempts = 0;
        string user = "";
        string password = "";
        string[] users = { "ADMIN", " ", " ", " ", " " };
        string[] passwords = { "OSADMIN", " ", " ", " ", " " };
        bool logon = false;
        string input = "";
        protected override void BeforeRun()
        {
            user = "";
            password = "";
            logon = false;
            currentpasswordattempts = 0;
            userid = -1;
            Console.Clear();
            //code to read a file from boot drive and adjust ADMIN settings.(users, passwords, etc)
            Console.WriteLine("Cosmos booted successfully. This version of this OS is designed to test features of Cosmos. Good Luck!");
        }
        protected override void Run()
        {
            if (!logon)
            {
                Console.WriteLine("You are not logged on.");
                while (userid == -1)
                {
                    SelectUser();
                }
                Console.WriteLine("Selected User: {0}.", user);
                SelectPassword();
            }

            else if (logon)
            {
                Console.Write("#{0}!>", user);
                input = Console.ReadLine();
                Prompt();
            }
        }
        public void SelectUser()
        {
            Console.WriteLine("Enter a username from the list below.");
            for (int ctr = 0; ctr < 5; ctr++)
            {
                Console.WriteLine("- {0}", users[ctr]);
            }
            user = Console.ReadLine();

            for (int ctr = 0; ctr < 5; ctr++)
            {
                if (user == users[ctr])
                {
                    userid = ctr;
                }
            }
        }
        public void SelectPassword()
        {
            Console.WriteLine("Input the corresponding password for user {0}", user);
            password = Console.ReadLine();
            currentpasswordattempts++;

            while ((password != passwords[userid]) && (currentpasswordattempts <= (passwordattempts - 1)))
            {
                Console.WriteLine("Wrong password. Try again.");
                password = Console.ReadLine();
                currentpasswordattempts++;
            }
            if (currentpasswordattempts == passwordattempts)
            {
                Console.WriteLine("Out of password attempts. Rebooting device. Press any key to continue.");
                Console.ReadLine();
                //Sys.Power.Reboot();
                Console.WriteLine("rebooting :P");
            }
            if (password == passwords[userid])
            {
                logon = true;
                Console.WriteLine("Login Successful as user {0}. Proceeding to prompt.", user);
            }
        }
        public void Prompt()
        {
            int commandend = 0;
            int tagpoint = 0;
            string[] tags = { "", "", "", "", ""};
            string command = "";

            commandend = input.IndexOf(" ") - 1;           //Detect and isolate the command from the input
            if (commandend != -1)
            {
                for (int ctr = 0; ctr <= commandend; ctr++)
                {
                    command += input[ctr];
                }
            }
            else
            {
                command = input;
            }

            Console.WriteLine("Received Command '{0}'.", command);

            if (command == "Power")
            {
                for (int ctr = 0; ctr < 5; ctr++)
                {
                    tagpoint = input.IndexOf("/", (tagpoint - 1) + (ctr * 3));
                    if (tagpoint != -1)
                    {
                        tags[ctr] += input[tagpoint];
                        tags[ctr] += input[tagpoint + 1];
                    }
                }
                Console.WriteLine("Tag 0 is '{0}'. Tag 1 is '{1}'. Tag 2 is '{2}'. Tag 3 is '{3}'. Tag 4 is '{4}'.",
                    tags[0], tags[1], tags[2], tags[3], tags[4]);
            }
            else if (command == "Help" || command == "help")
            {
                Console.WriteLine("Standard help message: \nPower: Used to trigger reboots, shutdowns, and sleep mode. \nAlso changes settings related to Auto-sleep and time-out functions.");
            }
        }
    }
}
Reply
#7
@Quajak @kudzu

I experimented a little. I removed the Prompt routine(line 92) and commented out the reference to it. The process then booted in VMWare JUST FINE. Somewhere in these lines is the issue.
Code:
        public void Prompt()
        {
            int commandend = 0;
            int tagpoint = 0;
            string[] tags = { "", "", "", "", ""};
            string command = "";

            commandend = input.IndexOf(" ") - 1;           //Detect and isolate the command from the input
            if (commandend != -1)
            {
                for (int ctr = 0; ctr <= commandend; ctr++)
                {
                    command += input[ctr];
                }
            }
            else
            {
                command = input;
            }

            Console.WriteLine("Received Command '{0}'.", command);

            if (command == "Power")
            {
                for (int ctr = 0; ctr < 5; ctr++)
                {
                    tagpoint = input.IndexOf("/", (tagpoint - 1) + (ctr * 3));
                    if (tagpoint != -1)
                    {
                        tags[ctr] += input[tagpoint];
                        tags[ctr] += input[tagpoint + 1];
                    }
                }
                Console.WriteLine("Tag 0 is '{0}'. Tag 1 is '{1}'. Tag 2 is '{2}'. Tag 3 is '{3}'. Tag 4 is '{4}'.",
                    tags[0], tags[1], tags[2], tags[3], tags[4]);
            }
            else if (command == "Help" || command == "help")
            {
                Console.WriteLine("Standard help message:");
                Console.WriteLine("Power: Used to trigger reboots, shutdowns, and sleep mode.");
                Console.WriteLine("Also changes settings related to Auto-sleep and time-out functions.");
            }
        }

I am going to try putting the Prompt routine into a blank kernel and see what happens.

EDIT: It fails. IL2CPU throws the same issue.
Reply
#8
if (command == "Power")
            {
                for (int ctr = 0; ctr < 5; ctr++)
                {
                    tagpoint = input.IndexOf("/", (tagpoint - 1) + (ctr * 3));
                    if (tagpoint != -1)
                    {
                        tags[ctr] += input[tagpoint];
                        tags[ctr] += input[tagpoint + 1];
                    }
                }
                Console.WriteLine("Tag 0 is '{0}'. Tag 1 is '{1}'. Tag 2 is '{2}'. Tag 3 is '{3}'. Tag 4 is '{4}'.",
                    tags[0], tags[1], tags[2], tags[3], tags[4]);
            }
If I cut out the two red lines, it works. Something about these two is tripping up IL2CPU. I am going to hold this project in archive and make a functional version under a for-real project name.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)