Tencent/InjectFix

Unity 2021.3.26 无法热更 async/await

lishengru opened this issue · 5 comments

ExecutionEngineException: Attempting to call method 'Cysharp.Threading.Tasks.CompilerServices.AsyncUniTaskMethodBuilder::AwaitUnsafeOnCompleted<Cysharp.Threading.Tasks.UniTask+Awaiter,IFix.ILFixInterfaceBridge>' for which no ahead of time (AOT) code was generated.
at IFix.Core.ReflectionMethodInvoker.Invoke (IFix.Core.VirtualMachine virtualMachine, IFix.Core.Call& call, System.Boolean isInstantiate) [0x00000] in <00000000000000000000000000000000>:0
at IFix.Core.VirtualMachine.Execute (IFix.Core.Instruction* pc, IFix.Core.Value* argumentBase, System.Object[] managedStack, IFix.Core.Value* evaluationStackBase, System.Int32 argsCount, System.Int32 methodIndex, System.Int32 refCount, IFix.Core.Value** topWriteBack) [0x00000] in <00000000000000000000000000000000>:0
at IFix.Core.VirtualMachine.Execute (System.Int32 methodIndex, IFix.Core.Call& call, System.Int32 argsCount, System.Int32 refCount) [0x00000] in <00000000000000000000000000000000>:0
at IFix.ILFixInterfaceBridge.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <00000000000000000000000000000000>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <00000000000000000000000000000000>:0
at IFix.Core.ReflectionMethodInvoker.Invoke (IFix.Core.VirtualMachine virtualMachine, IFix.Core.Call& call, System.Boolean isInstantiate) [0x00000] in <00000000000000000000000000000000>:0
at IFix.Core.VirtualMachine.Execute (IFix.Core.Instruction* pc, IFix.Core.Value* argumentBase, System.Object[] managedStack, IFix.Core.Value* evaluationStackBase, System.Int32 argsCount, System.Int32 methodIndex, System.Int32 refCount, IFix.Core.Value** topWriteBack) [0x00000] in <00000000000000000000000000000000>:0
at IFix.Core.VirtualMachine.Execute (IFix.Core.Instruction* pc, IFix.Core.Value* argumentBase, System.Object[] managedStack, IFix.Core.Value* evaluationStackBase, System.Int32 argsCount, System.Int32 methodIndex, System.Int32 refCount, IFix.Core.Value** topWriteBack) [0x00000] in <00000000000000000000000000000000>:0
at IFix.Core.VirtualMachine.Execute (System.Int32 methodIndex, IFix.Core.Call& call, System.Int32 argsCount, System.Int32 refCount) [0x00000] in <00000000000000000000000000000000>:0
at IFix.ILFixInterfaceBridge.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00000] in <00000000000000000000000000000000>:0
at Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1[TResult].TrySetResult (TResult result) [0x00000] in <00000000000000000000000000000000>:0
at Cysharp.Threading.Tasks.UniTask+DelayFramePromise.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
at Cysharp.Threading.Tasks.Internal.PlayerLoopRunner.RunCore () [0x00000] in <00000000000000000000000000000000>:0
--- End of stack trace from previous location where exception was thrown ---

怎么样,你解决了吗

解决了,但是没有完全解决
首先按照这个提交改下源码,重新生成ifix.dll,然后生成patch文件时用fix,不要用fix(android)或fix(ios)
可以热更async,但是async中如果插入原本没有得函数还是会报错

解决了,但是没有完全解决 首先按照这个提交改下源码,重新生成ifix.dll,然后生成patch文件时用fix,不要用fix(android)或fix(ios) 可以热更async,但是async中如果插入原本没有得函数还是会报错

可以加个qq讨论下吗?906851424,按这个提交我修改了下源码,编译后像这种await Task.Delay(1000);依然无法调用到,之后的代码也无法执行

解决了,但是没有完全解决 首先按照这个提交改下源码,重新生成ifix.dll,然后生成patch文件时用fix,不要用fix(android)或fix(ios) 可以热更async,但是async中如果插入原本没有得函数还是会报错

可以加个qq讨论下吗?906851424,按这个提交我修改了下源码,编译后像这种await Task.Delay(1000);依然无法调用到,之后的代码也无法执行

改成unitask就可以了

但是async中如果插入原本没有得函数还是会报错

报的什么错?