views:

29

answers:

5

Hello,

Is there any tool I can use to view the values of variables live as the code executes in VS?

Right now I can see them only when I keep a breakpoint.But,the problem is that the code works perfectly fine when I keep a breakpoint.it messes up only when it runs fast.

Any help would be appreciated.

Thanks

A: 

I my opinion , rather than setting break points, you can use Debug.Write(yourVariable) under the Debug mode, so you can watch the value in the output windows.

Cheers.

DrakeVN
A: 

Sounds like you need a conditional breakpoint. Aside from printing the values (console, debug output, trace) as the code runs there is nothing that will show you live data slow enough for you to see it. Put a conditional statement in detecting when the values are no longer valid and stick a programmatic break point on that.

Adam
A: 

You can only view variables when you have a breakpoint, however you could just manually write the variable values to the Visual Studios Output window:

System.Diagnostics.Debug.WriteLine(variable);
GenericTypeTea
A: 

Use Debug.Write to print out the variables. You can also use profiler.

Kangkan
A: 

All the aforementioned methods (dumping to console, using Debug.Write, custom logging, etc. etc.) to dump the contents of variables will do the trick .

From your problem description however (i.e. "...works fine with breakpoints, fails when left alone to run..."), it sounds like you have a threaded scenario with synchronization issues. If that's the case, inspecting the synchronization methods used might yield better results.

Willem van Rumpt