Debugging Silverlight Tip

By admin on Nov 21 2008 | 1 Comments

If you're doing any kind of Silverlight work you're bound to get "Error on page" in Internet Explorer. Here's what I'm talking about.

You fire up your app in the browser window and BLAM. Screen is empty and you get the "Error in page" error. Double click the error and you get an Internet Explorer JS Error Window. Here it is in all its glory:

 image

 

How Do I Catch The Exception in Code?

The exception IS happening in code you're just not catching un-handled exceptions.

To turn them on, go to Debug --> Exceptions:

image

You'll get the window below. Check the "Common Language Runtime Exceptions" checkbox and click OK.

image

 

You will not get exceptions bubbled up to the Dev Environment. Here's what it looks like in action  (with the same error as the "blank screen" above).

image

 

Click "Break" and break into the area where the code barfed on you, and then clean up the mess you've created (on accident of course - who creates un-handled exceptions for fun anyway). :)

 

Enjoy.

Post info

Tags:
Categories: Silverlight , Visual Studio

Comments

bruce chase
bruce chase United States on 4/19/2009 2:20 PM Thanks for the post. The "error on page" has bugging (yea a pun) me for a while.  I could take care of it pretty quickly.

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading