我有这个code的调用MethodInfo的:
I have this code which Invokes a MethodInfo:
try { registrator.Method.Invoke(instance, parameters); } catch{ registrator.FailureType = RegistratorFailureType.ExceptionInRegistrator; //registrator.Exception = e; }
该Registrator只是一个MethodInfo的包装,方法属性是MethodInfo的对象本身。参数是和Object []和实例方法的声明类型(与Activator.Create创建)的正确实例。
The Registrator is just a MethodInfo wrapper, the Method property is the MethodInfo object itself. parameters is and object[] and instance is a correct instance of the Method's declaring type (created with Activator.Create).
该方法看起来是这样的(我是测试异常捕获):
The Method looks like this (I was testing exception catching):
class Test : Plugin, ITest { public void Register(IWindow window) { throw new Exception("Hooah"); } }
现在的问题是:该异常没有抓到和Visual Studio的未捕获的异常气泡弹出
The problem is: The exception is never caught and the Visual Studio's uncaught exception bubble pops up.
这是在VS 2010中使用.NET 4.0
This is in VS 2010 with .NET 4.0
推荐答案这个问题是不是在你的code反正。 在调试/异常菜单,删除所有检查。 它应该工作。
The problem is not in your code anyway. In the Debug/Exceptions menu, remove all checks. It should work.
更多推荐
从MethodInfo.Invoke Uncatcheable异常
发布评论