We frequently get support calls due to breakpoints not being hit. There are lots of possible reasons why this can occur. Today I would like to talk about one of those – using the ‘auto’ debugger type. Here is the basic idea of how auto works:
Open the debuggee as a file
Crack the image file headers
Look for the IMAGE_COR20_HEADER
If the IMAGE_COR20_HEADER directory is there, and the flags have COMIMAGE_FLAGS_ILONLY set, then we only debug the managed code in the process. This is what happens for your C#/VB applications.
If the IMAGE_COR20_HEADER directory is there, but the IL ONLY flag isn’t set, then we do mixed mode debugging. This is what happens for a Managed C++ application.
If the IMAGE_COR20_HEADER directory is not there at all, then we do native only debugging. This is what happens for everything else.
‘Auto’ gets users into trouble when they are trying to set breakpoints in dlls. Since auto only looks at the exe, it doesn’t care that you are using a managed dll from a native only exe – you are still going to do native only debugging. My suggestion is to not use ‘auto’, but rather manually pick the debugger type.
Steve commented on this as well (http://blogs.msdn.com/stevejs/archive/2004/05/05/126497.aspx).