Category: .NET

Getting a development machine set up is a fine art of patience and a good memory. I personally recommend Ninite which is frankly awesome, followed by Visual Studio in its various flavours, followed by the Web Platform Installer.

However, with so many tools, frameworks, patches and add-ons to install it can be easy to miss something.

Even more frustrating, sometimes it can even be easy to install things in the wrong order.

Silverlight debugging: Get the right Tools

Specifically for Silverlight, it can appear as if you have all the necessary pre-requisites to create and debug Silverlight applications in Visual Studio 2008 SP1, but in fact your breakpoints are never hit.

You have the Silverlight project templates installed, you’re happily mixing and matching Visual Studio and Expression access to your project tree, but when compiling and running your project, Visual Studio either flatly ignores your breakpoints or reports that the symbols haven’t been loaded and that the breakpoints won’t be hit.

Some standard solutions

A lot of Googling takes you to answers around the following, none of which have actually applied to me recently:

  • Ensure you are running from a http:// address rather than a file:// address
    • In summary, do this by creating a separate Web application in your solution and then adding a link from it to your Silverlight project to ensure VS launches your browser pointing at a web server rather than the filesystem.
    • Debugging is disabled by default when going to local filesystem-based URLs.
  • Ensure “Silverlight” debugging option in your website project Properties > Web tab is checked
    • Some solutions even point to unchecking, then rechecking the option in order to kick VS into recognising the breakpoints.
  • Manually attach to the browser process, since VS may have attached to the wrong instance.
    • This especially seems to hit IE8 users where Silverlight apps are reputedly launched in a separate process to the main HTML.
  • Ensure you have “Silverlight” attachment type listed in the “Attach to process…” dialog box and that it is selected.
    • For example, attaching to iexplore.exe but selecting “T-SQL” as your attachment type will obviously not let you hit any Silverlight breakpoints.

One other solution: install Silverlight Tools for Visual Studio 2008 SP1 (again)

For me, the biggest single problem is flatly ensuring you have installed the Silverlight Tools installed after everything else.

With all the various installers, it’s actually possible to end-up with a fully functional Silverlight development environment, including all the GUI clues, but with debugging being an impossibility. How to diagnose it? Check if you have the Silverlight option in the debugging types:

Without this type listed in the “Attach to process…” dialog, Visual Studio will give you no other clue that it won’t be able to hit breakpoints – even if you have “Silverlight” listed as a debugging option in the website properties.

Installing the Silverlight Tools for Visual Studio SP1 ensures this is in place. Then you can go back through the other items in the checklist ;)

Some useful related links:

Thanks to Microsoft and Xeed, I’m heading to the MIX10 conference which is running March 15th-17th.

I’m a little concerned by something though: everyone who I’ve told I’m in Las Vegas for a whole week has reacted with horror, sympathy and commiserations. A few days is fine, apparently – because you come home to recover. A whole week? Not so much apparently. Great! I’m there from the 12th till the 20th because actually, thanks to lastminute.com, I got a direct flight and a cheaper package than if I was only going for a few days. Now I’m starting to wonder if it would have been better to go for less time and pay to come home and sleep…

Anyways, on to MIX. One reason I’m looking forward to it (and maybe one reason why Microsoft have invited me) is I’ve already been working on a Silverlight UI for media services as part of the MimeCloud project Pete and I have set up. I’m looking at some exciting ways of getting that into a handy package on a mobile device for reporters and journalists in the field, having made a bet that Silverlight would be on WPS7. I’ll also be playing a role in giving people an introduction to Umbraco CMS, at both the free pre-party dinner and at almost every other thinkable opportunity.

Here’s some of the sessions amongst many that grab my attention, give me a shout if you’re going to be there!

SILVERLIGHT PERFORMANCE ON WINDOWS PHONE

BUILDING LARGE-SCALE, DATA-CENTRIC APPLICATIONS WITH SILVERLIGHT

CONNECTING YOUR APPLICATIONS IN THE CLOUD WITH WINDOWS AZURE APPFABRIC

THE HAAHA SHOW: MICROSOFT ASP.NET MVC SECURITY WITH HAACK AND HANSELMAN

WHAT’S NEW IN MICROSOFT ASP.NET MVC 2

BUILDING AND DEPLOYING WINDOWS AZURE-BASED APPLICATIONS WITH MICROSOFT VISUAL STUDIO 2010


p.s. I forgot to say – my good friend, ex colleague and MimeCloud partner Pete Miller is going too so come find us if you’re interested in our open-source digital asset manager :)