Closed chipeng1023 closed 4 weeks ago
这里调试时会有乱跳的情况
具体是怎么乱跳的,要不你录一个gif动图吧
然后我用本项目Retry特性断点逐步调试正常,是怎么解决的?
你是指这个直接用 https://github.com/inversionhourglass/Rougamo.Retry ?
Convert.ToInt32("");这一行报错的话,正常是从方法体开始位置进来,但是目前是每次报错都会在方法体结束位置弹出提示
你是指这个直接用 https://github.com/inversionhourglass/Rougamo.Retry ? 是的
用Rougamo.Retry的效果是这样的,看着一切正常
调试相关的信息大部分存储在DebugInformation
和CustomDebugInformations
中,你生成的$Aop_Xxx
方法需要设置这个调试信息。我的做法是拷贝原方法的调试信息的同时做相应修改,可以参考我的实现:
https://github.com/inversionhourglass/Shared.Fody.Simulations/blob/49d96098b28bcde6f5ee45c3d93cdc4bea968a9a/Extensions/MonoCloneExtension.cs#L266-L282
你截图里重试+睡眠的方式用 Rougamo.Retry 也可以实现,如果你只是想要额外添加重试睡眠的功能,可以通过扩展Rougamo.Retry来实现,对于比较通用的功能,你也可以提交PR到Rougamo.Retry。当然,如果你是对MSIL/Mono.Cecil/Fody比较感兴趣,自己实现一套也是挺好的。
ok,我改下看看
这里调试时会有乱跳的情况,Sub方法加上DebuggerStepThrough后就直接不进方法体了
注入后反编译是这样的
然后我用本项目Retry特性断点逐步调试正常,是怎么解决的?