How do you disallow DebuggerNonUserCodeAttribute from being placed on the code generated by the dataset designer?
Asked Answered
E

2

5

I would like to step through dataset designer code in an ASP.NET project. How can I ensure that this:

[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 

is not included on the code it generates?

Enthuse answered 25/6, 2009 at 15:31 Comment(0)
N
12

You cannot prevent this from happening. However, you can enable stepping through properties, methods that are tagged with this attribute by disabling Just My Code.

Go to Tools -> Option and select the Debugger node. One the right there should be a check box with the text containing "Enable Just My Code". Uncheck that box and you will be able to step into your dataset code.

Nitroso answered 25/6, 2009 at 16:33 Comment(0)
M
1

I just solved a mysterious DataSet problem by simply editing the .Designer.cs file and commenting out the appropriate DebuggerNonUserCodeAttribute declarations. If you want to take it further, you could automate this by adding a pre-build event that removes all of these lines using something like sed for Windows.

Here's the command you need:

C:\PathToSed\sed.exe -i "s/.*DebuggerNonUserCodeAttribute.*//g" $(ProjectDir)MyDataSet.Designer.cs
Mezzorilievo answered 7/3, 2013 at 2:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.