Debugging without executing your application

Published 30 July 09 02:06 PM | Coding4Fun 

I came across Habib Heydarian’s blog and he has one of the coolest tips I’ve seen in a while with debugging.  Habib shows how to debug an application without actually running it.

He uses the Immediate Window (Debug –> Windows –> Immediate Window) to actually create an instance of the Window then uses the Show Dialog method to display it.  Since this code is executing, it will trigger break points in your code! 

Get Microsoft Silverlight

Via [10-4 episode on the Historical Debugger in Visual Studio 2010]

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Alesguz said on August 13, 2009 7:54 PM:

Great...!!! I'll try it right now.

# Steve Bargelt said on August 20, 2009 1:20 PM:

Really? 1) it takes longer to type the friggin' commands out then to hit F5 and click a button. 2) How many sub form don't depend on some data being passed from a parent form. 3)He states there is NO WAY to set your startup form? Huh? The app just picks one at random? I think NOT!

# Coding4Fun said on August 25, 2009 3:22 PM:

@Steve Bargelt, if you have an application that has tons of forms, it can become very time consuming to click through everything to get to the item you want.  And then you can test, close, tweak, hit up in the intermediate window which will repeat the last command, hit enter and bam, it repeats.  If a form needs data sent, you may be able to mock it out.  This may not work in every scenario but it is one tool to help out.

He is wrong regarding no way to declare what form is the start up form.  That can be configured in App.Xaml by changing the StartupUri attribute in the root.

Good catch.

# voidfoo said on October 3, 2009 12:23 AM:

One thing to know is that for C# projects Visual Studio actually starts a debugging session for you behind the scene.

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required

Search

This Blog

Syndication

Page view tracker