报错:System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ExecutionEngineException: Attempting to call method 'MBaseView::GetView' for which no ahead of time (AOT) code was generated.
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0
at IFix.Core.ReflectionMethodInvoker.Invoke (IFix.Core.VirtualMachine virtualMachine, Call& call, Boolean isInstantiate) [0x00000] in :0
at IFix.Core.VirtualMachine.Execute (IFix.Core.Instruction* pc, IFix.Core.Value* argumentBase, System.Object[] managedStack, IFix.Core.Value* evaluationStackBase, Int32 argsCount, Int32 methodIndex, Int32 refCount, IFix.Core.Value** topWriteBack) [0x00000] in :0
at IFix.Core.VirtualMachine.Execute (Int32 methodIndex, Call& call, Int32 argsCount, Int32 refCount) [0x00000] in :0
at IFix.ILFixDynamicMethodWrapper.__Gen_Wrap_0 (System.Object P0) [0x00000] in :0
at BaseView.OnShowLoadComplete (.CacheInfoData cacheInfo, System.Object[] args) [0x00000] in :0
at AssetsCachePool.onLoadComplete (.AssetsData ad, System.Object[] args) [0x00000] in :0
at Assets+c__Iterator0.MoveNext () [0x00000] in :0
at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in :0
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0
at IFix.Core.ReflectionMethodInvoker.Invoke (IFix.Core.VirtualMachine virtualMachine, Call& call, Boolean isInstantiate) [0x00000] in :0
at IFix.Core.VirtualMachine.Execute (IFix.Core.Instruction* pc, IFix.Core.Value* argumentBase, System.Object[] managedStack, IFix.Core.Value* evaluationStackBase, Int32 argsCount, Int32 methodIndex, Int32 refCount, IFix.Core.Value** topWriteBack) [0x00000] in :0
at IFix.Core.VirtualMachine.Execute (Int32 methodIndex, Call& call, Int32 argsCount, Int32 refCount) [0x00000] in :0
at IFix.ILFixDynamicMethodWrapper.__Gen_Wrap_0 (System.Object P0) [0x00000] in :0
at MBaseView.OnShowLoadComplete (.CacheInfoData cacheInfo, System.Object[] args) [0x00000] in :0
方法:
[IFix.Patch]
public void InitUserInfoData()
{
if(null == mUserHead)
mUserHead = GetView(预制体, 父预制体);
mUserHead.ShowUserHead(Lv)
{
//赋值
});
// userName.text = this.Nickname; //原代码
userName.text = "热更代码测试"; //patch修改的部分
}
PS:
1、这个要Patch的方法InitUserInfoData(),是在加载预制体的回调里调用的。
2、GetView()是父类的一个方法,具体如下
public virtual T GetView(Transform source, Transform parent = null, SyncEvent Event = null) where T : BaseViewWidgets
{
//实例化操作
}
3、在同一脚本下,热更其他方法是正常的。
请问大神这个也是因为泛型的原因吗?