Skip to content

Commit 7731a38

Browse files
Ai-Himmelliiir1985
authored andcommitted
fix: throw IL exception correctly
1 parent b8feeb1 commit 7731a38

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ILRuntime/Runtime/Intepreter/ILIntepreter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4641,7 +4641,8 @@ public object Run(ILMethod method, object instance, object[] p)
46414641
case OpCodeEnum.Throw:
46424642
{
46434643
objRef = GetObjectAndResolveReference(esp - 1);
4644-
var ex = mStack[objRef->Value] as Exception;
4644+
var exObj = mStack[objRef->Value];
4645+
var ex = exObj as Exception ?? (exObj as ILTypeInstance)?.CLRInstance as Exception;
46454646
Free(objRef);
46464647
esp--;
46474648
throw ex;

0 commit comments

Comments
 (0)