首页 文章 ILRuntime在热更重的Task异步报错无法定位的问题
NullReferenceException: Object reference not set to an instance of an object. ILRuntime.Runtime.Intepreter.ILIntepreter.Execute (ILRuntime.CLR.Method.ILMethod method, ILRuntime.Runtime.Stack.StackObject* esp, System.Boolean& unhandledException) (at Assets/Dependencies/ILRuntime/ILRuntime/Runtime/Intepreter/ILIntepreter.cs:151) ILRuntime.Runtime.Intepreter.ILIntepreter.Execute (ILRuntime.CLR.Method.ILMethod method, ILRuntime.Runtime.Stack.StackObject* esp, System.Boolean& unhandledException) (at Assets/Dependencies/ILRuntime/ILRuntime/Runtime/Intepreter/ILIntepreter.cs:2006) --- End of stack trace from previous location where exception was thrown --- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) (at <695d1cc93cca45069c528c15c9fdd749>:0) UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <a78ba17154144f538987598c967cc088>:0) UnityEngine.UnitySynchronizationContext:ExecuteTasks()
ILRuntime在热更代码中的Task异步报错无法定位到具体热更什么代码中,可以在抛出该异常前先捕获到热更的堆栈(ILIntepreter.cs:151):
var thisObj = RetriveObject(arg, mStack);
if (thisObj == null){
var err = this.AppDomain.DebugService.GetStackTrace(this);
throw new NullReferenceException(err);
}