Debug Silverlight and JavaScript together

Posted on 1/2/2010 @ 4:54 PM in #Vanilla .NET by | Feedback | 1436 views

My good friend Andrew Connell recently blogged about a SharePoint2010 dev tidbit . Basically the issue here is that debugging both JavaScript and Silverlight in the same session is troublesome. In order to debug Silverlight, you have to enable silverlight debugging instead of script debugging in your project. In his words -

What you want to do is look at the SharePoint project’s properties, click on the SharePoint tab and look at the bottom of the dialog. Make sure the Enable Silverlight debugging (instead of Script debugging) option is checked. This will allow you to have the full debugging experience of your Silverlight apps when testing from within SharePoint.

Well he is right! But sometimes you need to debug both silverlight and javascript together, especially when you’re doing HTML bridge development where requests seamlessly pass between SL and JS. And believe me, that happens way too often in real world apps! In my upcoming book I demonstrate a client side only post-back-less webpart connections using a similar technique, and it’s so sweet, I think you’ll be usin’ it :).

So here’s a workaround! 

  1. Use Chrome instead of IE,
  2. Rig your SharePoint project to use Silverlight debugging,
  3. Inside Chrome press CTRL_ALT_J to open the javascript debugger, and use chrome’s SL debugger, which is pretty fancy I might add.

Since chrome uses different processes for everything, they can simultaneously debug SL and JS. Also, since you are hooked into the same session, you have access to the SharePoint Client Object Model, and ClientContext.current and all that jazz!

Sweet huh? Happy SharePointing!

Sound off but keep it civil:

Older comments..

On 10/1/2010 3:32:26 AM Rav said ..
brilliant, thnx for sharing.