Debug SL3 OOB application startup

Just a short post.
The other day I was having some trouble debugging the start up of a Silverlight 3 OOB application. The problem was well and truly gone before I could attach to the application from Visual Studio.

If you didn’t realise, you can attach VS to your OOB app by attaching to the appropriate sllauncher.exe instance.

As stated though, you will miss out on any start up problems you are trying to debug.

My (hacky) work around was to wack this in my start up code… I wacked it in MainPage.xaml.cs, but I can’t see any reason this won’t work in App.xaml.cs:

while (!Debugger.IsAttached)

This code will basically hang the app until you attach your debugger! Just make sure you don’t let this one in to production 🙂

4 thoughts on “Debug SL3 OOB application startup

  1. Did you tried with Debugger.Break().

    Also if you want to test your app out of browser, I think you can start it from the command line, selecting to start an app instead of the browser, that way you would just hit F5 and start the process with the debugger attached.

Comments are closed.