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: http://blogs.msdn.com/jmstall/archive/2004/12/31/344832.aspx
Debugging Visual Studio Generated Strongly Typed DataSet Code
Tuesday, March 4, 2008
Posted by
George S.
at
5:31 AM
Labels: Debugging, Visual Studio
Subscribe to:
Post Comments (Atom)

7 comments:
This comment has been removed because it linked to malicious content. Learn more.
See Here
See here or here
SECURITY CENTER: See Please Here
See Please Here
It doesn't work!
I don't know what I'm doing wrong, but I'm debugging a web service, and it uses a typed dataset, and the damn thing goes into the code every time. And Just My Code is properly CHECKED in the Tools/Options/Debugging.
My friend is experiencing the same thing, and he's debugging a web app (not a web service) in case that makes a difference.
I *think* the attribute is respected with winforms debugging but I'm not sure ...
Nope. It doesn't work for winforms debugging either. And the CLR debugger also has this failing.
Post a Comment