CosmosOS / IL2CPU

IL2CPU is a compiler for .NET IL code to compile to assembly language for direct booting.
BSD 3-Clause "New" or "Revised" License
274 stars 69 forks source link

My OS is not booting #189

Open Umplayerbr19 opened 1 year ago

Umplayerbr19 commented 1 year ago

hello, my OS is not booting, i asked that in the Cosmos Discord server, and Quajak told me that the error is in IL2CPU, and told me to open an issue here, ill post the logs and the code of BeforeRun() (where is the error in, according to the logs) below.

LOGS (its in portuguese, and i removed the \Users\\ from the path):

Compilação iniciada... 1>------ Compilação iniciada: Projeto: PlatinumOS, Configuração: Debug Any CPU ------ 1>Ignorando analisadores para acelerar a construção. Você pode executar o comando 'Build' ou 'Rebuild' para executar os analisadores. 1>PlatinumOS -> C:\Users\source\repos\PlatinumOS\bin\Debug\net6.0\PlatinumOS.dll 1>Message: Executing IL2CPU on assembly 1>Message: Kernel Base: Cosmos.System.Kernel 1>Message: Checking target assembly: C:\Users\source\repos\PlatinumOS\bin\Debug\net6.0\PlatinumOS.dll 1>Message : warning : Loading plugs from assembly: Cosmos.Core_Asm, Version=10.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983 1>Message : warning : Loading plugs from assembly: Cosmos.Core_Plugs, Version=10.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983 1>Message : warning : Loading plugs from assembly: Cosmos.Debug.Kernel.Plugs.Asm, Version=10.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983 1>Message : warning : Loading plugs from assembly: Cosmos.System2_Plugs, Version=10.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983 1>Detecting fields for type 'IL2CPU.Debug.Symbols.FIELD_INFO' 1>Detecting fields for type 'IL2CPU.Debug.Symbols.FIELD_MAPPING' 1>IL2CPU : error : Exception: System.Exception: Error compiling method 'SystemVoidPlatinumOSKernelBeforeRun': System.ArgumentNullException: Value cannot be null. (Parameter 'aType') 1> at Cosmos.IL2CPU.ILOp.SizeOfType(Type aType) in C:\Development\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\ILOp.cs:line 619 1> at Cosmos.IL2CPU.ILOpCode.DoStackAnalysis(Stack1 aStack, UInt32& aStackOffset) in C:\Development\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 356 1> at Cosmos.IL2CPU.MethodAnalysis.ILMethod.Analyse() in C:\Development\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\MethodAnalysis\ILMethod.cs:line 48 1> at Cosmos.IL2CPU.AppAssembler.AnalyseMethodOpCodes(Il2cpuMethodInfo aMethod, List1 aOpCodes) in C:\Development\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\AppAssembler.cs:line 493 1> at Cosmos.IL2CPU.AppAssembler.ProcessMethod(Il2cpuMethodInfo aMethod, List1 aOpCodes) in C:\Development\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\AppAssembler.cs:line 475 1> ---> System.ArgumentNullException: Value cannot be null. (Parameter 'aType') 1> at Cosmos.IL2CPU.ILOp.SizeOfType(Type aType) in C:\Development\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\ILOp.cs:line 619 1> at Cosmos.IL2CPU.ILOpCode.DoStackAnalysis(Stack1 aStack, UInt32& aStackOffset) in C:\Development\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\ILOpCode.cs:line 356 1> at Cosmos.IL2CPU.MethodAnalysis.ILMethod.Analyse() in C:\Development\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\MethodAnalysis\ILMethod.cs:line 48 1> at Cosmos.IL2CPU.AppAssembler.AnalyseMethodOpCodes(Il2cpuMethodInfo aMethod, List1 aOpCodes) in C:\Development\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\AppAssembler.cs:line 493 1> at Cosmos.IL2CPU.AppAssembler.ProcessMethod(Il2cpuMethodInfo aMethod, List1 aOpCodes) in C:\Development\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\AppAssembler.cs:line 475 1> --- End of inner exception stack trace --- 1> at Cosmos.IL2CPU.AppAssembler.ProcessMethod(Il2cpuMethodInfo aMethod, List1 aOpCodes) in C:\Development\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\AppAssembler.cs:line 483 1> at Cosmos.IL2CPU.ILScanner.Assemble() in C:\Development\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\ILScanner.cs:line 1044 1> at Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod, IEnumerable1 plugsAssemblies) in C:\Development\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\ILScanner.cs:line 278 1> at Cosmos.IL2CPU.CompilerEngine.Execute() in C:\Development\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\CompilerEngine.cs:line 223 1>IL2CPU task took 00:00:12.7880164 1>Projeto de compilação pronto "PlatinumOS.csproj" -- FALHA. ========== Compilação: 0 bem-sucedida, 1 com falha, 0 atualizada, 0 ignorada ========== =========== Decorrido 00:13,445 =========

CODE BeforeRun(): protected override void BeforeRun() { Sys.FileSystem.VFS.VFSManager.RegisterVFS(fs);

        var fstype = fs.GetFileSystemType;
        Console.ForegroundColor = ConsoleColor.Green;
        Console.Beep(300, 100);
        Console.WriteLine($"[OK] Initialized File System: {fstype}");
        Thread.Sleep(2000);
        Console.ResetColor();

        if (!Directory.Exists("0:\\System\\"))
        {
            Console.ForegroundColor = ConsoleColor.Green;
            fs.CreateDirectory("0:\\System\\");
            File.Create("0:\\System\\SystemConfig.cfg");
            File.WriteAllText("0:\\System\\SystemConfig.cfg", "SystemFilesCreated");
            fs.CreateDirectory("0:\\Users\\");
            Console.Beep(300, 100);
            Console.WriteLine($"[OK] Created System Configs");
            Console.ResetColor();
        }
        else
        {

        }

        if (!Directory.Exists("0:\\Users\\"))
        {
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("[NO] User Found");
            Console.ResetColor();
            Console.Write("New User: ");
            var userName = Console.ReadLine();
            Console.Write("New Password: ");
            var passWord = Console.ReadLine();
            Console.WriteLine($"User {userName} Created");
            File.WriteAllText($"0:\\Users\\passwords.db", passWord);
            File.WriteAllText($"0:\\Users\\users.db", userName);
        }
        else
        {
            Console.ForegroundColor = ConsoleColor.Green;
            Console.Beep(300, 100);
            Console.Write("[OK] User Found");
            Console.ResetColor();
            var username = File.ReadAllText($"0:\\Users\\users.db");
            Console.WriteLine($"Logging in {username}...");
            Thread.Sleep(1500);                
            Console.Beep(50, 200);
            Console.Beep(250, 200);
            Console.Beep(500, 200);
            Console.Beep(750, 200);
            Console.Beep(1000, 200);
            Console.WriteLine("Logged in.");
            Console.WriteLine($"Welcome to PlatinumOS, {username}.");
            Console.Clear();
        }
    }
ADev531 commented 8 months ago

I think it's IL2CPU's problem.

or try it on lastest devkit.