Getting ready for the Windows Phone 7 Exam 70-599 (Part 3) XNA for Silverlight developers: Part 13 - Mango (2)

Silverlight Debug Helper (Visual Studio Add-in)

Published on Tuesday, June 21, 2011 8:00:00 AM UTC in Programming & Tools

If you are actively using my debug helper Add-in for Visual Studio which I released last fall, you may be pleased to learn that I've uploaded a new version. And if you're not using it yet, I invite you to take a look at it.

The tool has been renamed to "Silverlight Debug Helper" (formerly "Firefox Debug Helper") because I added support for Chrome and Internet Explorer to it. If you have the previous version installed, you may want to uninstall it first.

Silverlight Debug Helper has gone open source and is now available on CodePlex! I'll keep this page for consistency, but from now on you should check the official project page for new releases and the source code: http://sldebughelper.codeplex.com

Ever since browsers started using isolation features for plug-ins and multiple operating system processes, debugging a Silverlight application became a bit annoying. For example, Firefox hosts the Silverlight runtime in a process "plugin-container.exe". Unfortunately, when you start debugging a Silverlight project, Visual Studio does not attach to that process automatically. I've seen the same happen when you debug in Chrome: depending on whether a Silverlight application is already running in an open tab or not, a new "chrome.exe" process may be spawned that hosts Silverlight, and Visual Studio then does not attach to that process. And also Internet Explorer (9+) shows this behavior: it spawns several processes for its tabs, and often Visual Studio is not attached to the correct process that actually hosts the Silverlight runtime.

One solution people tend to is to e.g. turn of the plug-in isolation feature in Firefox, which solves this problem because then Silverlight again runs in the main process. However, this means you're running your development and maybe test machines with different settings than 99% of your potential users, and unfortunately Silverlight in fact may behave differently in certain scenarios with the isolation feature turned on or off. In extreme cases, this means serious bugs may slip through when you do that.

A better solution

To work around this, I've developed a small helper some time ago to solve the issues with Firefox. The helper installs as Visual Studio Add-in and runs in the background. When you start debugging a project, it checks whether Visual Studio is already attached to the correct process(es), and tries to do that if it's not. Since last fall, I've tweaked the functionality some more and added support for both IE9+ and Chrome. I've been using this improved version for quite some time and found no issues whatsoever, so I decided to put it online for you to make your developer life a bit easier too. To use it, simply download and extract the archive below, then install the VSI package with a double-click. You can control the Add-in from within Visual Studio by using the Add-in Manager in the Tools menu. If you want to remove it completely later, simply delete the .dll and .AddIn files from the folder MyDocuments/Visual Studio 201[0|2]/Addins. On the next startup, Visual Studio will notify you that the plugin could not be found and offers to remove it from the plug-ins list.

Disclaimer: This add-in comes as-is, without warranty of any kind. You use it at your own risk, and I'm not liable for any damages caused by the use of this add-in. I only tested this software in my own development environment, which is Visual Studio 2012 and Windows 8 64-bit (both English versions).

[Download link removed: get the most recent version from the Visual Studio Gallery or CodePlex]

Version history

1.2.0.0 - 2012-06-23

Added support for Visual Studio 2012

1.1.0.0 - 2011-06-21

Added support for IE (9+) and Chrome (no configuration options whatsoever at the moment) Made the attaching mechanism more reliable Renamed the Add-in from "Firefox Debug Helper" to "Silverlight Debug Helper"

1.0.0.0 - 2010-09-14

Initial version with support for Firefox 3.6.4+

Feedback

I'd love to hear your feedback, bug reports and feature request (I cannot promise anything, but if it's possible I'll take a look at it). If you bump into problems, make sure to keep an eye on the output window of Visual Studio and include that info when you contact me. The Add-in logs errors and problems there. Thank you!

Tags: Chrome · Firefox · Internet Explorer · Silverlight · Visual Studio Add-in