Bagikan melalui


Debugging Silverlight Applications in Out Of Browser Mode

On an internal mailing list yesterday, someone asked how to debug their Silverlight 3 application as it runs Out of Browser.  They were seeing some behavior that would only reproduce in the first few seconds and only in OOB mode.  Fortunately, you can install your app locally and then debug it directly in the Out of Browser window.

In the Silverlight project properties, on the debug tab, you can enable launching it as an OOB application:

enableOOBdebugging

The drop down box contains all of the web projects in the solution which consume your Silverlight application.  Because they are treated as different installs by the runtime, you may want to change this setting if issues occur when installing from one web project but not another.  The notice below the dropdown simply indicates that you haven’t installed the Silverlight application in the context of that web project yet.  If the notice does not appear, then you’re good to go.

The next step after enabling OOB debugging is to set your Silverlight app to the startup project.  Normally the web project is the startup project, and it hosts the Silverlight app; in this case, we don’t want to run the website.  To set the startup project, just right-click the project in Solution Explorer and select ‘Set as Startup Project’. 

setStartupProject

You’ll know which project is set as it will be in bold in Solution Explorer.

Now when you start debugging, the application will launch in Out of Browser mode.  To go back to debugging in the web site’s context, simply change the web project back to being the startup project.

Comments

  • Anonymous
    July 29, 2009
    When hitting Run, I get this error and can't debug it: Warning: A StringBuilder buffer has been overflowed by unmanaged code. The process may become unstable. Insufficient capacity allocated to the StringBuilder before marshaling it. Any ideas?

  • Anonymous
    January 21, 2010
    I get the same error .... quite annoying

  • Anonymous
    June 06, 2010
    The comment has been removed

  • Anonymous
    June 07, 2010
    @sladapter: first thing that comes to mind is to make your web project run on your local IIS, instead of the WebDev server.  Haven't tried it, so I'm not positive if that would work around the problem...

  • Anonymous
    August 09, 2010
    it save me a day,, thanks a looooooooooooooooooooooooooooot

  • Anonymous
    September 08, 2010
    As a Silverlight newbie, good to know.

  • Anonymous
    February 04, 2011
    How to debug both OOB and Web local at the same time? Thank you.