The Silverlight Tools for Visual Studio 2010 include support for debugging Silverlight-based applications. The Silverlight Tools support most managed debugging features. However, it does not support edit-and-continue, just-in-time debugging, and mixed-mode debugging.
For information about the Silverlight Tools for Visual Studio 2010, see Silverlight Tools.
With the Silverlight Tools installed, you can debug Silverlight projects the same way that you would any other project type. When you press F5, Visual Studio will start your application in the default browser and attach the debugger. You can then perform common tasks, such as setting breakpoints and examining the call stack.
Visual Studio 2010 and Silverlight 4 provide additional support for debugging out-of-browser applications. For more information, see Out-of-Browser Support. Silverlight 5 adds support for setting breakpoints on data bindings in XAML. When a breakpoint is hit, you can use the Locals window to examine the state of a binding and pinpoint any issues. For more information, see Data Binding.
For general information about debugging with Visual Studio, see Debugging in Visual Studio.
With the Silverlight Tools installed, you can also attach the debugger to any local process running a Silverlight-based application in a supported browser or out-of-browser window. The Attach to Process dialog box (on the Debug menu) lists these processes with "Silverlight" in the Type column.
You can also attach the debugger to a remote Macintosh browser process running a Silverlight-based application. This requires some additional configuration steps on both computers, and is supported only between a computer running Windows and a Macintosh computer. Additionally, when debugging a remote process, the Disassembly and Registers windows are not available.
For more information, see Walkthrough: Setting Up Remote Debugging on the Macintosh.
The native API used to implement Silverlight managed-code debugging is the ICorDebug Interface. Silverlight adds a few new APIs, but otherwise, this is the same API used to implement debuggers for managed applications that use the full .NET Framework. This means that you can extend existing managed-code debuggers to support Silverlight without requiring significant amounts of new code.
For more information, see Silverlight Debugging Overview and Debugging (Unmanaged API Reference). If you have questions regarding the API usage or documentation, see the Building Development and Diagnostic Tools for .NET forum.
Clear the Disable Script Debugging (Internet Explorer) check box
Clear the Disable Script Debugging (Other) check box.
Select the Display a notification about every script error check box.
Clear the Show friendly HTTP error messages check box.
Use CTRL+F5 to start your application without the debugger. You can then attach the debugger to the browser process using the Script code type as described earlier in this topic. After you attach the debugger, you can refresh the browser to reload the Silverlight plug-in. This is necessary to debug your application startup code.
When your solution includes a Web project, disable the Silverlight debugger. In Visual Studio, select the Web project, and then on the Project menu, select ProjectName Properties. Then, on the Web tab, in the Debuggers section, clear the Silverlight check box. You can then use F5 to start your application with the script debugger attached.
When the script debugger is attached, the breakpoints in your managed Silverlight code will be disabled.