Cosmos icon indicating copy to clipboard operation
Cosmos copied to clipboard

Calling an unimplemented virtual interface method causes Kernel Fault 0x1

Open retrievaaaa opened this issue 3 years ago • 1 comments

Area of Cosmos - What area of Cosmos are we dealing with?

Probably IL2CPU

Expected Behaviour - What do you think that should happen?

It should work fine

Actual Behaviour - What unexpectedly happens?

The kernel crashes with 0x1 and following output in the debugger:

Type
0x000007C5
MethodId
0x00000D87
Not FOUND!

Reproduction - How did you get this error to appear?

I have following setup:

public class Process {
        public IApp app;
        public int pid;

        public void Kill() {
            if (app != null) {
                app.OnExit();
            }else {
                Kernel.Instance.mDebugger.Send("[WARN] App is null! Unable to call IApp.OnExit! (pid=" + pid + ")");
            }
            
            ProcessManager.RemoveProcessWithPid(pid);
        }

        public Process(IApp app) {
            this.app = app;
        }
    }

In my case, I call Process.Kill and get the error. According to the stacktrace, the error happens on the line app.OnExit();. app is a IApp, which is an interface with following method:

public virtual void OnExit() {}

Because this method is virtual, an implementation in the classes that implement the interface is not required but IL2CPP apparently does not generate a method then.

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

Latest devkit for all of them

Workaround

Current workaround is just implementing the method.

retrievaaaa avatar Feb 04 '23 18:02 retrievaaaa

Cosmos Gen3 has replaced the IL2CPU-based Gen2 codebase, and gen3 is now the default branch of this repository. This issue was filed against Gen2, which is no longer developed, so it is being closed as part of the Gen3 cutover (#3088).

If you still hit this on Gen3, please open a fresh issue. The compiler, the build pipeline and the debugging story are all different now, so a new report will get a far more useful answer than reviving this one. Start here: https://cosmosos.github.io/

Gen2 remains on the gen2 branch, and this issue stays readable.

valentinbreiz avatar Sep 15 '26 20:09 valentinbreiz