为什么VS2010总是在MethodInfo.Invoke发生异常时中断? [英] Why does VS2010 always break on exception from MethodInfo.Invoke?

查看:134
本文介绍了为什么VS2010总是在MethodInfo.Invoke发生异常时中断?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MethodInfo.Invoke(o,null)周围进行了一次try/catch,并且VS2010设置为永不中断Exception,但是不幸的是,调试器仍在Invoked方法中中断.该方法是静态的,并且我已经安装了Phone Developer Beta.

I have a try/catch around a MethodInfo.Invoke(o,null), and VS2010 is set to never break on Exceptions, but unfortunately the debugger continues to break inside the Invoked method. The method is static, and I've got the Phone Developer Beta installed.

这是错误还是开发人员错误?

Is this a bug or developer error?

谢谢!

推荐答案

是的,未选中每个异常复选框,仅在这些Invoke异常时才会中断.所有其他例外都可以正常工作.

Yes, with every exception check-box is un-checked it breaks on only these Invoke exceptions. All the other exceptions work fine.

好消息是,一个匿名天才给了我一个解决方法:

The great news is that an anonymous genius gave me a work-around:

delegate void VoidTest(); 
VoidTest test = 
    (VoidTest)Delegate.CreateDelegate(typeof(VoidTest), o, method.Name); 
test(); 

这些异常确实如预期那样进入了异常处理程序! =)

These exceptions do land in the exception handler just as expected! =)

这篇关于为什么VS2010总是在MethodInfo.Invoke发生异常时中断?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆