是否可以将标有 MethodImplOptions.InternalCall 的方法链接到其实现?
在尝试查找异常的可能原因时,我使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
内部调用最终会调用 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.
如果你想追踪哪些方法可以抛出给定类型的异常,你可以使用 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