How To Debug Designer Code

JaedenRuiner

Well-known member
Joined
Aug 13, 2007
Messages
340
Programming Experience
10+
Well,

I've asked a couple of question about some errors and haven't heard back, but I figure one thing would probably allow me to see with clearer vision what is going on with my code, because a lot of it isn't my code it is 'generated' code which doesn't always "Step Into" nicely.

Is there a way that I can tell the compiler/debugger whatever to allow me to "Step Into" the DataSet Generated Code?

Thanks
 
In the Solution Explorer, there is a button up top that pops up with a tooltip reading "Show All Files". If you click that, you'll be able to browse all of the files where generated code is stored. The code generated by the Dataset is listed in a file that will be named something like foobarDataSet.Designer.vb
 
Ah, yes, that is "Browse" the designer files. I want to step into them when debugging. Like when you create a Typed Dataset, it has a Constructor New.
VB.NET:
    <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
    Public Sub New()
        MyBase.New
        Me.BeginInit
        Me.InitClass
        Dim schemaChangedHandler As Global.System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged
        AddHandler MyBase.Tables.CollectionChanged, schemaChangedHandler
        AddHandler MyBase.Relations.CollectionChanged, schemaChangedHandler
        Me.EndInit
    End Sub
I want to step into that functioni there and subsequently step into InitClass() etc. Right Now it won't step "into" it steps "over".

Thanks
 
In the designer file, comment out the line <System.Diagnostics.DebuggerStepThrough()>

That compiler tag disallows stepping into, it's meant to help with debugging. When you know a sub or function (or entire class) works correctly, set that compiler tag in code so when you're debugging other things, you're not bothered with stepping into code that you know works.
 
Back
Top