views:

43

answers:

2

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  A: 

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.

Hans Passant
Through a combination of http://www.koders.com/cpp/fid006DC4C11F458707221DA6ED2ED9CC3C7AE12E11.aspx and http://www.koders.com/cpp/fidFB82C2FF644D476EBEFA132529BA1A6DCA264698.aspx I managed to get what I wanted.
adrianbanks
A: 

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

Mel Harbour
I was aware of that tool. Does it also detect exceptions that are thrown as a result of code in the framework's C++ functions (eg. the one throw on this line -> http://www.koders.com/cpp/fidFB82C2FF644D476EBEFA132529BA1A6DCA264698.aspx#L1632)?
adrianbanks