In Visual Studio 2010, if you are debugging a native executable which in turn loads a managed DLL built against a version of the framework previous to version 4, you may find that breakpoints which are set in the managed code are not hit. The breakpoints are displayed correctly, you just never hit them when executing the code in question.
If you attach to the process as opposed to running it from the debugger directly, you can hit the breakpoints if you change the code type to Managed (v2.0, v1.1, v1.0) when attaching. This can be done in the Attach to Process dialog (from the Debug, Attach to Process… menu). From there, choose the Select button and choose the Managed (v2.0, v1.1, v1.0) selection in the Select Code Type dialog.
This is an issue in the Visual Studio 2010 debugger. When loading the managed code, the debugger makes the wrong assumption about your managed code and loads the incorrect managed debugger.
This can be worked around when debugging directly from Visual Studio by including an application configuration file for your native executable which causes the correct framework debugger to be loaded. E.g. :
<?xml version =”1.0″?>
<supportedRuntime version=”v2.0.50727″ />
From the Project menu, select Add New Item and then select the Configuration file in the Add New Item dialog. Copy the configuration code above into the config file.
Microsoft is investigating resolutions to this issue to be included in future releases of Visual Studio or Visual Studio Service Packs.