views:

86

answers:

5

I have downloaded a sample mvc application which has a fair bit of code and quite complex. in order to understand the code i want to step through all of the code line by line as i complete basic functions via the gui. problem is i am not always sure which line the code executes from so i cannot always set a breakpoint.

is there a way to view all code line by line as it executes, in visual studio 2008, without setting a breakpoint?

+1  A: 

I don't think you can do it without at least one breakpoint. Set a breakpoint on the first line of code.

You can then step over or step into every line there after.

Update: Okay, RE your comments: Code executes in an inorder line by line fashion. The only time I have seen it execute "out of order" is with Xcode when certain compiler optimisations were activated. The tricky part was that the code was still executing in order, but the optimisations screwed up the debugger, making it look like it wasn't executing in order.

I would say look into Visual Studio's project settings and make sure you haven't played around with any strange compiler optimisations. What you are explaining should not happen otherwise.

Brock Woolf
ah but there is the problem... each function i test potentially executes from a different start point and i don't always know where that is.
Cunners
they execute from a different start point? can you clarify that in your question please. Code should execute in line by line in order. Your comment doesnt make sense
Brock Woolf
hi brock. not sure i am missing something but i thought i had. "problem is i am not always sure which line the code executes from so i cannot always set a breakpoint". i am newish to programming so my basic assumptions may not be right.
Cunners
+1  A: 

Not sure if I understand it correctly, but you can press F10 after the first line (with a break point) is reached and step trough every coming line in order of execution. Edit: and F11 "Steps into".

F.Aquino
hi. problem is i need to set a breakpoint for this to work. i want to review each line of code executed without having to set a breakpoint
Cunners
+1  A: 

Use F10 or F11 to start the project.

brian
hi. problem is i need to set a breakpoint for this to work. i want to review each line of code executed without having to set a breakpoint
Cunners
Works, without a breakpoint, in my version of VS (2008).
brian
+1  A: 

One thing to try is to add a few breakpoints to specific functions that you know will execute when you invoke certain GUI operations.

Then, examine the call stack when breaking in the debugger to see if there are any common library methods which are common to each of the call stacks (i.e. at the lower-end of the call stack).

Then perhaps you could add a breakpoint in the library method to catch all GUI operations.

LeopardSkinPillBoxHat
+1  A: 

Perhaps add a line calling System.Diagnostics.Debugger.Launch() method in the application start event?

Dan Diplo