InjectFix icon indicating copy to clipboard operation
InjectFix copied to clipboard

加载补丁后执行修复的函数执行了两次

Open yzx4036 opened this issue 5 years ago • 4 comments

版本unity 2020 1.11f

我确定调用代码的地方只有一次,原代码运行没问题`

两次的调用堆栈如下,两次的IFix.Core.VirtualMachine:Execute 调用有不同

1、

Init Start111 UnityEngine.Debug:Log(Object) DCETRuntime.Log:Info(String) (at Packages/DCET.Core/Runtime/Unity/Log.cs:23) DCET.Log:Info(String) (at Packages/DCET.Core/Hotfix/Other/Log.cs:14) System.Reflection.MethodBase:Invoke(Object, Object[]) IFix.Core.ReflectionMethodInvoker:Invoke(VirtualMachine, Call&, Boolean) IFix.Core.VirtualMachine:Execute(Instruction*, Value*, Object[], Value*, Int32, Int32, Int32, Value**) IFix.Core.VirtualMachine:Execute(Instruction*, Value*, Object[], Value*, Int32, Int32, Int32, Value**) IFix.Core.VirtualMachine:Execute(Int32, Call&, Int32, Int32) IFix.ILFixDynamicMethodWrapper:__Gen_Wrap_0() DCET.Init:Start() DCETHotfixBridge.<StartHotfix>d__2:MoveNext() (at Assets/HotfixBridge/MonoHelper.cs:53) System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start(<StartHotfix>d__2&) DCETHotfixBridge.MonoHelper:StartHotfix() DCETHotfixBridge.HotfixHelper:StartHotfix() (at Assets/HotfixBridge/HotfixHelper.cs:11) DCETRuntime.<Awake>d__0:MoveNext() (at Assets/Runtime/Boot.cs:26) System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start(<Awake>d__0&) DCETRuntime.Boot:Awake()

2、

Init Start111 UnityEngine.Debug:Log(Object) DCETRuntime.Log:Info(String) (at Packages/DCET.Core/Runtime/Unity/Log.cs:23) DCET.Log:Info(String) (at Packages/DCET.Core/Hotfix/Other/Log.cs:14) System.Reflection.MethodBase:Invoke(Object, Object[]) IFix.Core.ReflectionMethodInvoker:Invoke(VirtualMachine, Call&, Boolean) IFix.Core.VirtualMachine:Execute(Instruction*, Value*, Object[], Value*, Int32, Int32, Int32, Value**) IFix.Core.VirtualMachine:Execute(Int32, Call&, Int32, Int32) IFix.ILFixInterfaceBridge:MoveNext() System.Reflection.MethodBase:Invoke(Object, Object[]) IFix.Core.ReflectionMethodInvoker:Invoke(VirtualMachine, Call&, Boolean) IFix.Core.VirtualMachine:Execute(Instruction*, Value*, Object[], Value*, Int32, Int32, Int32, Value**) IFix.Core.VirtualMachine:Execute(Int32, Call&, Int32, Int32) IFix.ILFixDynamicMethodWrapper:__Gen_Wrap_0() DCET.Init:Start() DCETHotfixBridge.<StartHotfix>d__2:MoveNext() (at Assets/HotfixBridge/MonoHelper.cs:53) System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start(<StartHotfix>d__2&) DCETHotfixBridge.MonoHelper:StartHotfix() DCETHotfixBridge.HotfixHelper:StartHotfix() (at Assets/HotfixBridge/HotfixHelper.cs:11) DCETRuntime.<Awake>d__0:MoveNext() (at Assets/Runtime/Boot.cs:26) System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start(<Awake>d__0&) DCETRuntime.Boot:Awake()

yzx4036 avatar Dec 09 '20 06:12 yzx4036

发个能重现的样例代码?

chexiongsheng avatar Dec 09 '20 06:12 chexiongsheng

发个能重现的样例代码?

在样例工程改的, helloworld.cs test方法改为async(打补丁前修改,然后修改log打补丁),是因为不支持 async await吗? 工程在压缩包,已经打好补丁了 image

InjectFix#262_unity2020111f.zip

yzx4036 avatar Dec 09 '20 07:12 yzx4036

我的2019.4.9f1测试只打印一次

chexiongsheng avatar Dec 28 '20 06:12 chexiongsheng

就楼主的测试用例,在Unity 2020.3.4LTS 也是打印2次

Ron3 avatar Apr 21 '21 11:04 Ron3