Is it possible to link a method marked with MethodImplOptions.InternalCall to its implementation?

自闭症网瘾萝莉.ら 提交于 2019-12-07 11:45:12

问题


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.


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/2775641/is-it-possible-to-link-a-method-marked-with-methodimploptions-internalcall-to-it

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!