Not so long ago I installed VS 2012 and I quickly noticed something very irritating when debugging in C#. When debugging Windows Forms Applications, I want it to go straight to the code I've written, but it always goes through the InitializeComponent() method. Is there any way I can make the IDE skip this?
Skip code when debugging (VS 2012)?
Page 1 of 17 Replies - 342 Views - Last Post: 16 January 2013 - 03:19 PM
Replies To: Skip code when debugging (VS 2012)?
#2
Re: Skip code when debugging (VS 2012)?
Posted 16 January 2013 - 04:09 AM
What do you mean it "always goes through InitializeComponent()"?
That's a valid step in your application's setup, leading you to your designer code. You can simply Step Over (F1) this if you don't want to go into the method when it breaks.
That's a valid step in your application's setup, leading you to your designer code. You can simply Step Over (F1) this if you don't want to go into the method when it breaks.
This post has been edited by RudiVisser: 16 January 2013 - 04:10 AM
#3
Re: Skip code when debugging (VS 2012)?
Posted 16 January 2013 - 04:16 AM
Create a Breakpoint by right-clicking the line you want to stop at, or by clicking to the far left of the line, then pressing Start will run to the line. Then you can Step Into F11 or Step Over F10 (if you don't want to jump to called procedures/methods).
You can also right-click the line and choose Run to Cursor.
You can also right-click the line and choose Run to Cursor.
#4
Re: Skip code when debugging (VS 2012)?
Posted 16 January 2013 - 05:46 AM
Also check you key mappings. You may have installed or inherited one set of key mappings on your old IDE, and you may have installed the default key mappings when you installed VS2012 instead of porting over your old key mappings from your older IDE.
#5
Re: Skip code when debugging (VS 2012)?
Posted 16 January 2013 - 07:28 AM
SOunds like you could use a few pointer to debugger smarter not harder
Q: I do x and y happens which I didn't expect but I don't know how to figure out why. How do I debug and find my problem?
A:
Q: I do x and y happens which I didn't expect but I don't know how to figure out why. How do I debug and find my problem?
A:
- Debugging video 1: Breakpoints and Local variables
- Debugging video 2: Advanced breakpoints
- Debugging tutorial
- Debugging tips
- Debugging in detail
- Great debugging tips
- It still doesn't work, article
- Debugging tools survival guide
- Video: Tips & Tricks to use Visual Studio to the fullest
- 5 return dataset.Tables[tableName].Columns.Count;
A condensed line like this makes a lot of assuptions that everything goes right, and gives you nothing to check or debug.
If only for R&D / Debug purposes it can often be advantagous to break down the line
if (dataset != null) { if (datase.Tables != null) { if (!string.IsNullOrWhiteSpace(tableName) { if (dataset.Tables[tableName].Columns != null)
Now you can put a breakpoint on the top line and walk through it with F10 and check every object. You also don't try to manipulate a thing that doesn't yet exist.
This post has been edited by tlhIn`toq: 16 January 2013 - 07:29 AM
#6
Re: Skip code when debugging (VS 2012)?
Posted 16 January 2013 - 03:06 PM
The are Attributes you can add to methods so the debugger skips them.
#7
Re: Skip code when debugging (VS 2012)?
Posted 16 January 2013 - 03:11 PM
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote







|