Steve Crane
Steve Crane

Reputation: 4440

How to debug Silverlight against Google Chrome

Does anyone know how to debug a Silverlight 2 app running in Google Chrome from Visual Studio? Even after making sure that Chrome is the debugging browser, breakpoints are still not being hit.

Upvotes: 10

Views: 8113

Answers (5)

Lothimos
Lothimos

Reputation: 51

Attach to the process manually (Tools > Attach to process), but make sure to attach to the chrome process that lists its type as "Silverlight, ...". Its title should be blank.

If you see your application name in the title, it's because chrome has a separate process for the HTML form that your Silverlight app is in, and the html's title probably matches. Attaching to this process does not load the Silverlight assemblies.

I usually will start debugging the app in IE to make sure that the most recent changes are compiled and running, then launch chrome, clear its cache ('cause it likes to hang onto Silverlight data), paste in the url from IE, and then stop IE and attach to chrome. Extra steps, but worth not spending 3 hours to figure out you are looking at cached assemblies.

Upvotes: 4

Vitali Fokin
Vitali Fokin

Reputation: 203

Simply set SL app as startup prtoject instead of asp.net and press F5

Upvotes: 2

Mike Post
Mike Post

Reputation: 6460

This is an issue with Visual Studio interacting with Chrome: http://code.google.com/p/chromium/issues/detail?id=45560. My guess is you need to wait for a Visual Studio patch, but I honestly wouldn't hold your breath. The majority of Silverlight developers just use IE or FF for debugging. (Apparently even FF has some issues now that they've sandboxed their plugins: http://timheuer.com/blog/archive/2010/08/16/enable-silverlight-debugging-in-firefox-visual-studio.aspx#20476). As much as I hate IE, it's really your best bet for debugging Silverlight apps.

Upvotes: 2

Harlequin
Harlequin

Reputation:

You can have more than one browser running on your localhost. 1) Hit F5 to run debug. Probably opens IE or whatever your default is. F5 your way through the breakpoints until it's loaded. Leave this IE open. 2) Open your other browser, coping the localhost Url into the new browser and run it. New browser should hit the breakpoints.

This works with all browsers, and even emulators like BlackBerry emulators.

Upvotes: 4

Tristan Warner-Smith
Tristan Warner-Smith

Reputation: 9771

Have you tried attaching to Chrome manually? Tools > Attach to process?

Chrome isn't officially supported but there are hacks.

Here for example. Halo's comment may give you some help too.

Upvotes: 5

Related Questions