Geeks With Blogs

News
Michael Crump Microsoft MVP, INETA Community Champion and XAML Advocate.

Let me start by saying, I love looking at other people’s code. I have learned so much by reading code that I would put that in a top 5 list of things every programmer should do. If it wasn’t for tools like .NET Reflector or Snoop then I would have missed reading a lot of great code. I started working in Silverlight a few months ago and wanted a utility to browse the tree nodes like Snoop does for WPF. I found several solutions but wasn’t happy until I stumbled upon Silverlight Spy 3 by First Floor Software. I watched this video on Channel9 and instantly wanted to learn more about this application. I sent an email to  Koen Zwikstra letting him know that I wanted to review his software and he provided a free personal copy of the software. So how did it go you may ask? Well, check out my review below.

First what is it? Silverlight Spy is a runtime inspector tool that will tell you pretty much everything that is going on with the application. Basically, you give it a URL that contains a Silverlight application and you can explore the element tree, events, xaml and so much more.

Below is the main screenshot after the application is loaded.

image

 

In order to play with this application I’ve decided to use my “Fade-In Screen in Silverlight Application”. I decided to use it because its small and it would be easier to tell if Silverlight Spy 3 is telling the truth. So before we start reviewing it, we will want to go ahead and add a reference to Reflector. This will allow us to decompile Silverlight assemblies.

Go to Tools then Options then click the Reflector tab. Even though this step is not required to use the application it should be done to utilize the power of the application.

image

 

After you hit OK, its time to try it out. Go ahead and put in any URL and hit Go.

image

As you can tell by the screenshot we have a three main windows. The first is the Silverlight application, The explorer view and Properties. Lets examine the Explorer view first.

image

 

 

 

The explorer provides the following information:

  • Application Settings – This provides information about Content, Deployment, Host, Out of Browser settings and other misc settings. Being able to see the Runtime Version along with the Entry Point Assembly would definitely help during debugging.
  • XAP Package – This contains compression info along with what dll’s and manifest are included in the XAP. You can view the manifest by clicking view on the property window. This is a very cool feature.

image

  • Object Browser – This will allow you to examine the .NET classes available by the XAP package. You can drill down to get more info.

image

  • Isolated Storage – This will tell you what is contained in the Isolated Storage file if the application is using one. You can also export or delete files available in both Application and Site isolated storage.
  • UI Automation – This displays the automation object model a Silverlight application exposes to Automation clients.
  • Styles – This provides access to the default and application control styles found in the application.
  • User Interface Explorer – This will assist with exploring the visual or logical tree structure of an application. It not only provides you the full XAML that was used to create the application, but allow you to change properties real-time. So for example, your developing an application and wonder what the font will look like in a different size. Instead of stopping the application and changing it and recompiling, you just change the property in Silverlight Spy 3.

image

image 

The next thing to take a look at is the Monitoring Tools.

  • Performance Monitor – Tracks the performance of your application. It has different tabs for Memory, Process, Processor, Frame Rate and Isolated Storage.

image

  • Event Monitor – This tracks all the events raised by the Silverlight user interface in real-time.

image

Thankfully, Koen thought of adding a filter so that you could take off or add different items.

  • Network Monitor – Before you probably had to use some kind of application like Fiddler to see what happens when someone hits the website. Now you can enter the URL and watch the network traffic.

image

 

 

 

 

 

 

My application does not use the ClientAccessPolicy.XML so you do not see it here. Instead, you see the html, javascript and finally the XAP file is requested. Say goodbye to fiddler!

The Dynamic Language Runtime shell allows for interactively executing dynamic language code in the Silverlight application domain. Thankfully it provided samples as I’m not a Python or Ruby guy.

image

If you wanted to grab all of the text inside of the TextBlock you could write your own code or use the sample. Very nice touch, especially with the samples.

image

 

The Application Analyzer validates the Silverlight application by checking a set of rules that include best practices, common pitfalls and be used to improve the application. I decided to try it on my small app and this is what it suggested.

image

The statistics provides a count of all the elements, brushes etc on the page. While I’m not sure how this would help you its still very interesting.

image

 

It also comes with a Cross-Domain access Policy Validator.

image

Pros: Lets see, UI Element Tree browsing, XAP Package information, Monitoring, DLR Shell, Application Analyzer and Cross-Domain Access Policy information. What more could you ask for? The amount of features the app includes makes you feel like Koen actually though them through instead of throwing them in as a filler.

Cons: I’m not really sure if this is a con but no Silverlight 1.0 or Out-of-Browser support. I definitely think Out-of-Browser support should be added in the future. I would also like to see the installer detect or prompt for the location of Red Gates Reflector.

Bottom Line: It is the best tool for the job and if you are a Silverlight developer, its definitely worth a try. I appreciate Koen for giving me the chance to review his product and if you would like to know more about the product then click here.

Posted on Saturday, August 21, 2010 9:32 PM Silverlight | Back to top

Copyright © mbcrump | Powered by: GeeksWithBlogs.net