среда, 16 июня 2010 г.

Debugging Silverlight 4 application with Visual Studio 2010 and Google Chrome

Debugging Silverlight application on a system with Google Chrome installed as default browser, I run into an issue: breakpoints were not hit. I got the message: “The breakpoint will not currently be hit. No symbols have been loaded for this document”.

BreakpointWillNotBeHit

What happens? It looks like Visual Studio 2010 doesn’t play well with Chrome browser.

When Silverlight application is started for debugging, Visual Studio launches web browser and attaches debugger to it. Chrome runs in multiple processes (process per tab?) and most of the time Visual Studio attaches debugger to the wrong process, the process that doesn’t host Silverlight application. That’s why symbols are not loaded and breakpoints are disabled.

The only workaround I know at the moment is to manually attach the debugger to correct chrome.exe process, the one that hosts the application being debugged.

Step-by-step illustration.

1. Create Silverlight application, start debugging.

Processes

Notice that the debugger is attached to the chrome.exe with PID=4132 and breakpoint is disabled.

2. At the same time Process Explorer displays that there are two another chrome.exe processes running: 5816 and 3876.

ProcessExplorer 

3. In Visual Studio open “Attach to Process” dialog:

ManualAttachTo

Notice that chrome.exe process with PID=3876 has “Silverlight” in the “Type” column. Select it and press “Attach” button.

Voila: debugger output prints “'chrome.exe' (Silverlight): Loaded 'AgDemo', Symbols loaded.”, and breakpoints are resolved.

Sure, manually attaching debugger is not convenient. This is just a workaround – I’m looking forward for better solution.

1 комментарий:

Random thoughts, ideas and questions on .NET development

Постоянные читатели