Debugging Visual Studio Generated Strongly Typed DataSet Code

Tuesday, March 4, 2008

Sometimes you may face a situation when you need to debug Visual Studio generated code. For example, when you create strongly typed DataSets, Visual Studio generates corresponding code.

If you put a break point in such code, to your surprise the debugger will not fire it. This happens because the v2.0 CLR debugging services has a feature called Just-My-Code (JMC for short) debugging. By default this is enabled in Visual Studio. Hence, all code (methods) marked with System.Diagnostics.DebuggerNonUserCodeAttribute will be ignored by the debugger and no break points set in such code will be fired.

This is a pretty nice feature to avoid needless stepping in 3rd party code and Visual Studio generated code as well. However, as mentioned above, sometimes we need exactly the opposite, i.e. to be able to debug the Visual Studio generated code.

You can disabled JMC in Visual Studio options as shown on the screen shot below. Simply, clear the Enable Just My Code (Managed only) check box.

Mike Stall has a pretty nice article about JMC in his blog, which you can find here: