从MethodInfo.Invoke Uncatcheable异常

编程入门 行业动态 更新时间:2024-10-26 02:27:20
本文介绍了从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异常

本文发布于:2023-11-05 04:15:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1559873.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:异常   MethodInfo   Invoke   Uncatcheable

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!