Click here to Skip to main content
13,893,974 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


7 bookmarked
Posted 19 Jul 2009
Licenced CPOL

Glimpse for Silverlight – Viewing Exceptions and Binding Errors

, 19 Jul 2009
Rate this:
Please Sign up or sign in to vote.
Viewing exceptions and binding errors in Silverlight



After my previous blog post, “Troubleshoot Silverlight 3 Data Bindings”, I got some feedback and while in Phoenix, I upgraded the code and have decided to call this Glimpse.

This initial release of Glimpse is a proof of concept project. As I spend more time working with Silverlight 3, I’ll add more instrumentation views (Mole for Silverlight, anyone?)

What is cool about Glimpse is that it can be used for local debug or deployed release builds. It takes a single line of code to crank it up.

BTW: I have not had a chance to make the UI pretty in Blend yet. So go easy on Karl’s Moletones UI.

Glimpse Viewer Control

The Glimpse Viewer Control is hosted inside a Floatable WindowTim Heuer has a great post on how he modified the default Silverlight ChildWindow so that it can be modal or non-modal.

I took Tim’s implementation and added the ability to set the location of the Floatable Window. My code is in the download section.

Launching Glimpse


Glimpse is launched with a single line of code, passing the Application object and a string name for the Silverlight control. If you have more that one Silverlight control on a web page, the name helps to know what control that Glimpse is providing information for.

In the above code, I’m testing if the current build is a DEBUG build. If so, launch Glimpse. In your applications, you can use other techniques for determining if Glimpse should be launched.

If your MainPage object throws an exception during object construction, Glimpse will display an Exception Viewer that will show you the exception and any inner exceptions.

To demonstrate this feature, you can uncomment the code in the MainPage constructor and then run the demo application.


Load Exception Viewer

The above code has outer and inner exceptions. This viewer will display the outer exception and all nested inner exceptions.


Application Unhandled Exceptions

When your Silverlight application has an application unhandled exception, the Glimpse Viewer Control will display a red ellipse on the right with a number indicating the number of unhandled exceptions.

  • Click the Expand button to display the Glimpse Viewer information
  • To return to contracted mode, click the Contract button
  • To clear the list of exceptions, click the Clear Exceptions button



Data Binding Exceptions

When your Silverlight application has a binding validation exception, the Glimpse Viewer Control will display a red ellipse on the left with a number indicating the number of exceptions.

In the below image, the Birthday field has text that can’t be converted into a date.


Pressing the Expand button displays the data binding validation exception. This will also show any inner exceptions if they are present.

Notice the (Added) text on the left and field on the right. This is the ValidationErrorEventAction property for the ValidationError. When the validation error is cleared, the text will display “(Removed)”.


Bindings with No Source

The below image shows the Path with a typo, an “x” has been added to the correct property name “FirstName”. This will cause a binding failure.


The below viewer provide information on all broken bindings in the host Silverlight control. Binding errors are resolved each time the “Bindings with no Source” tab is selected.


From Here

I have two projects that I want to launch on my blog, then I’ll take any feedback and add more views to the Glimpse Viewer Control.

What is nice about this approach is that you can launch Glimpse on a deployed production Silverlight control that needs some debugging love on a remote server in addition to using it during Silverlight control development.


After downloading the below project, you must change the file extension from .doc to .zip, this is a requirement of

Have a great day,

Just a grain of sand on the worlds beaches.

Posted in CodeProject, Data Binding, Exceptions, Silverlight, VB.NET


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Karl Shifflett
Architect Self
United States United States

I’m a passionate Platform Architect at Infragistics.

I’m a long-time WPF-Prism fanatic who enjoys writing developer tools and line of business applications.

My front end passions are WPF, Electron, ES2015 (ES6), Node.js, and Angular.

For the back end I use what is appropriate for the project: SQL Server and ASP.NET WebAPI, MongoDB, Express, Azure, Firebase, etc.

I am very pragmatic software engineer and strive to write simple, maintainable, and testable code. Simple code allows for solving complex problems in a maintainable way.

My Blog

My Github Repros

Just a grain of sand on the worlds beaches.

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01 | 2.8.190306.1 | Last Updated 19 Jul 2009
Article Copyright 2009 by Karl Shifflett
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid