是否可以将标有 MethodImplOptions.InternalCall 的方法链接到其实现?

发布于 2024-08-31 23:22:48 字数 321 浏览 1 评论 0原文

在尝试查找异常的可能原因时,我使用 Reflector 跟踪代码路径。我越来越深入,但最终得到了一个如下所示的方法调用:

[MethodImpl(MethodImplOptions.InternalCall)]
private extern void SomeMethod(int someParameter);

方法上的此标记告诉框架在某处调用 C++ 函数。有什么方法可以找出实际调用的方法,以及可能调用的其他方法吗?

注意:我并不是真的想查看此方法的源代码,我只是想知道可能引发我看到的源自此方法调用的异常的情况。

In trying to find the possible cause of an exception, I'm following a code path using Reflector. I've got deeper and deeper, but ended up at a method call that looks like:

[MethodImpl(MethodImplOptions.InternalCall)]
private extern void SomeMethod(int someParameter);

This markup on the method tells the framework to call a C++ function somewhere. Is there any way to find out what method actually gets called, and in turn what else is likely to be called?

NB: I don't really want to see the source code of this method, I just want to know the possible things that could throw the exception I am seeing that originates out of this method call.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

好听的两个字的网名 2024-09-07 23:22:48

内部调用最终会调用 CLR 中的 C++ 函数。您可以在 转子源代码。查看 clr\src\vm\ecall.cpp 以查找从 .NET 可见名称到 CLR 函数名称的映射。请注意,来源已过时。

Internal calls end up making a call to a C++ function in the CLR. You can find them back in the Rotor source code. Look at clr\src\vm\ecall.cpp to find the mapping from the .NET visible name to the CLR function name. Beware that the source is getting dated.

夏天碎花小短裙 2024-09-07 23:22:48

如果你想追踪哪些方法可以抛出给定类型的异常,你可以使用 http://www.red-gate.com/products/Exception_Hunter/index.htm

If you want to track down which methods can throw a given type of exception, you could use http://www.red-gate.com/products/Exception_Hunter/index.htm

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文