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.
Some useful related links:
- Silverlight Tools for Visual Studio SP1 mentioned above (http://go.microsoft.com/fwlink/?LinkID=143571)
- Alternatively you can download the standalone Silverlight SDK from http://go.microsoft.com/fwlink/?LinkID=157102.
- Silverlight Toolkit (http://silverlight.codeplex.com)
- Not to be confused with the required developer tools, this is an awesome open-source set of examples to get your started with Silverlight.
- Silverlight + WCF RIA Services (http://www.silverlight.net/riaservices/)
- The “Getting Started” page from Microsoft (http://www.silverlight.net/getstarted/)