Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception: System.Exception: Native code encountered, plug required. Check build output for more information. #3092

Open
UnlegitDqrk opened this issue Oct 14, 2024 · 5 comments

Comments

@UnlegitDqrk
Copy link

Expected Behaviour - What do you think that should happen?

It happend after restarting my PC before i got no problems, so i dont know where the Problem is

Actual Behaviour - What unexpectedly happens?

1>IL2CPU : error : Exception: System.Exception: Native code encountered, plug required. Check build output for more information.

Reproduction - How did you get this error to appear?

I dont know, i just restarted my laptop and sind then i get the exception

Version - Were you using the User Kit or Dev Kit? And what User Kit version or Dev Kit commit (Cosmos, IL2CPU, X#)?

Dev Kit commit #3087

Error Log:
1>IL2CPU : error : Exception: System.Exception: Native code encountered, plug required. Check build output for more information.
1> DO NOT REPORT THIS AS A BUG.
1> Please see http://www.gocosmos.org/docs/plugs/missing/
1> Need plug for: System.Void System.Reflection.MetadataImport.GetCustomAttributeProps(System.IntPtr, System.Int32, &System.Int32, &System.Reflection.ConstArray)(Plug Signature: System_Void__System_Reflection_MetadataImport__GetCustomAttributeProps_System_IntPtr__System_Int32___System_Int32___System_Reflection_ConstArray ).
1> Static: True
1> Assembly: System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
1> Called from:
1>System.Reflection.MetadataImport::Void GetCustomAttributeProps(Int32, Int32 ByRef, System.Reflection.ConstArray ByRef)
1>System.Reflection.CustomAttribute::Boolean IsCustomAttributeDefined(System.Reflection.RuntimeModule, Int32, System.RuntimeType, Int32, Boolean)
1>System.Reflection.CustomAttribute::Boolean IsDefined(System.RuntimeType, System.RuntimeType, Boolean)
1>System.RuntimeType::Boolean IsDefined(System.Type, Boolean)
1>System.Reflection.MemberInfo::Boolean IsDefined(System.Type, Boolean)
1>
1>
1> at Cosmos.IL2CPU.ILScanner.ScanMethod(MethodBase aMethod, Boolean aIsPlug, String sourceItem) in C:\Users\finna\Desktop\Workspaces\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\ILScanner.cs:line 562
1> at Cosmos.IL2CPU.ILScanner.ScanQueue() in C:\Users\finna\Desktop\Workspaces\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\ILScanner.cs:line 751
1> at Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod, IEnumerable`1 plugsAssemblies) in C:\Users\finna\Desktop\Workspaces\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\ILScanner.cs:line 270
1> at Cosmos.IL2CPU.CompilerEngine.Execute() in C:\Users\finna\Desktop\Workspaces\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\CompilerEngine.cs:line 187
1>IL2CPU task took 00:00:04.8878459

@ADev531
Copy link

ADev531 commented Oct 14, 2024

Are you using Reflection?
Otherwise, Can you give code?

@UnlegitDqrk
Copy link
Author

Are you using Reflection? Otherwise, Can you give code?

No i imported CosmosTTF and the Cosmos-Optimization-Kit. But i didnt found anything with reflection

@ADev531
Copy link

ADev531 commented Oct 14, 2024

Are you using Custom Attributes?
If not, can you provide the Kernel code?

@UnlegitDqrk
Copy link
Author

Im using the ManifestResourceStream but here is the Kernel Code (not the cleanest):
`
using Cosmos.Core.Memory;
using Cosmos.HAL;
using Cosmos.System;
using Cosmos.System.ExtendedASCII;
using Cosmos.System.Graphics;
using Cosmos.System.Graphics.Fonts;
using DarkOS.Apps;
using DarkOS.Commands;
using DarkOS.Main.Graphics;
using DarkOS.Main.Hardware;
using DarkOS.Main.User;
using DarkOS.OptimizationKit;
using DarkOS.Resources;
using DarkOS.Utils;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using Console = System.Console;
using Sys = Cosmos.System;

namespace DarkOS.Main
{
public class Kernel : Sys.Kernel
{
public static readonly int screenHeight = 1920, screenWidth = 1080;
public static readonly int DefaultFontHeight = 14;

    public static Canvas Canvas { get; private set; }
    public static Mode Mode { get; private set; }
    public static bool IsBooting { get; private set; } = true;
    public static bool Optimized = true;

    protected override void OnBoot()
    {
        IsBooting = true;
        base.OnBoot();

        Mode = new Mode((uint)screenHeight, (uint)screenWidth, ColorDepth.ColorDepth32);

        Canvas = FullScreenCanvas.GetFullScreenCanvas(Mode);
        Canvas.DrawImageAlpha(Images.Logo, (int)(Mode.Width / 2 - 258), (int)(Mode.Height / 5));
        Canvas.Display();

        PowerManager.DelayCode(500);
        KernelGraphics.DrawStatus($"Starting {Globals.NAME} {Globals.VERSION}");
        PowerManager.DelayCode(500);
        KernelGraphics.DrawStatus($"Developed by {Globals.AUTHOR} {Globals.COSMOS}");
        PowerManager.DelayCode(1500);
    }

    protected override void BeforeRun()
    {
        KernelGraphics.DrawStatus("Initializing Console");
        Console.SetWindowSize(90, 30);
        Console.OutputEncoding = CosmosEncodingProvider.Instance.GetEncoding(437);

        TTFManager.RegisterFont("KMB", Fonts.KodeMonoBoldByte);

        KernelGraphics.DrawStatus("Initializing File System");
        FileManagement.Initialize();
        PowerManager.DelayCode(2000);

        KernelGraphics.DrawStatus("Initializing Commands");
        CommandManager.Initialize();
        PowerManager.DelayCode(1000);

        KernelGraphics.DrawStatus("Initializing Entry Manager");
        EntryManager.Initialize();
        PowerManager.DelayCode(500);

        KernelGraphics.DrawStatus("Initializing User Control");
        UserControl.Initialize();
        PowerManager.DelayCode(500);

        KernelGraphics.DrawStatus("Initializing Graphics");
        DesktopGrid.gridItems.Add(new GridItem("Shell", Images.Control, 0, 0, 1));
        DesktopGrid.gridItems.Add(new GridItem("Welcome", Images.Control, 1, 0, 2));
        DesktopGrid.gridItems.Add(new GridItem("App 3", Images.Control, 0, 1, 0));
        Desktop.Initialize();
        PowerManager.DelayCode(500);

        IsBooting = false;
    }

    protected override void Run()
    {
        WriteMessage.Write($"{FileManagement.CurrentPath} >> ");
        string command = Console.ReadLine();
        CommandManager.RunCommand(command);

        try
        {
            Keyboard.KeyInfo = new ConsoleKeyInfo();
            Keyboard.IsKeyPressed = false;

            if (KeyboardManager.TryReadKey(out var key))
            {
                Keyboard.KeyInfo = new ConsoleKeyInfo(key.KeyChar, key.Key.ToConsoleKey(),
                    key.Modifiers == ConsoleModifiers.Shift,
                    key.Modifiers == ConsoleModifiers.Alt,
                    key.Modifiers == ConsoleModifiers.Control);

                Keyboard.IsKeyPressed = true;
            }

            Desktop.Update();
            CobaltCore.CallCore();
        }
        catch (Exception exception)
        {
            PowerManager.Panic(exception.Message);
        }
    }
}

}
`

@ADev531
Copy link

ADev531 commented Oct 17, 2024

There is some problem (But not compile problem) in kernel file.

You should put that Canvas part to BeforeRun().

Anyways, I can't find any problems in this file. Can you give other files? (via comment or via github)

@zarlo zarlo removed the Bug label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants