从MethodInfo.Invoke Uncatcheable异常 [英] Uncatcheable exception from MethodInfo.Invoke

查看:160
本文介绍了从MethodInfo.Invoke Uncatcheable异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个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异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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