From 257dd97db895eacabecb3bc5e345b2eab6a18a2f Mon Sep 17 00:00:00 2001 From: AiHimmel Date: Fri, 28 Nov 2025 21:01:17 +0800 Subject: [PATCH] fix: throw IL exception correctly --- ILRuntime/Runtime/Intepreter/ILIntepreter.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ILRuntime/Runtime/Intepreter/ILIntepreter.cs b/ILRuntime/Runtime/Intepreter/ILIntepreter.cs index 03e410a6..298effc5 100644 --- a/ILRuntime/Runtime/Intepreter/ILIntepreter.cs +++ b/ILRuntime/Runtime/Intepreter/ILIntepreter.cs @@ -4641,7 +4641,8 @@ public object Run(ILMethod method, object instance, object[] p) case OpCodeEnum.Throw: { objRef = GetObjectAndResolveReference(esp - 1); - var ex = mStack[objRef->Value] as Exception; + var exObj = mStack[objRef->Value]; + var ex = exObj as Exception ?? (exObj as ILTypeInstance)?.CLRInstance as Exception; Free(objRef); esp--; throw ex;