Showing posts with label debugging. Show all posts
Showing posts with label debugging. Show all posts

Friday, March 25, 2011

How to debug silverlight webpart in sharepoint 2010.?

SharePoint Silverlight debugging in Visual Studio is not supported by default, due to Script debugging settings turned on. It means that you can’t set breakpoints and step into your code in VS if you are not deploying Silverlight controls via feature. Such functionality is supported when you host your SL project in external Web Project (another reason not to host in SharePoint during development)



To provide the SharePoint SL debugging capabilities you need to package your .XAP file in SharePoint Project (in VS) and deploy as a Feature. Such approach allows to enable “Siverlight Debugging” instead of client one, and step into your .cs code from Visual Studio 2010. This options is set from the VS IDE. Navigate to the SharePoint project properties –> SharePoint Tab –> click “Enable Silverlight Debugging”. That checkbox will activate the Remote Debugger and you will be able to debug SL hosted in SharePoint using Visual Studio 2010 (but you need to configure the Remote Debugger first, opening the firewall ports. On the 64bit windows you need to configure the x86 version of msvsmon.exe because the Visual Studio is x86)


Note: Debugging doesn’t work if you don’t have another instance of the the SL page opened in browser. Seems there is a bug resolving assemblies, because when you start debugging your solution might be re-builded , IIS restarts, thus remote debugger can’t attach to the right assemblies. To fix it just open another tab in browser, navigate to page with SL control you are debugging and only after that start debugging which will open the second instance of that page.

 Debug both silverlight and javascript together

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

  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.


Thursday, February 19, 2009

How to Enable Silver light Debugging


If we try to add a new silver light project to a solution, then Visual studio prompts with the following dialogue box.



So that we can enable debugging on this newly created silver light application. However if we wanted to add an existing silver light application to a solution which contains a website project then we have to explicitly enable debugging on this silver light application, otherwise Visual studio wont debug this silver light application, when we set the Web application as the start up project.


To enable debugging on this newly added existing silver light project.
1) In solution Explorer, Right click on the Web Project and select ‘Property Pages’ .Here is the screen shot to select ‘Property Pages’



2) In ‘Property pages’ Window in ‘Start Options’ , make sure that the check boxes ‘ASP.NET’ and ‘Silverlight ‘ both are selected.



3) Select ‘Silverlight Application’ then Click on the ‘Add’ button, it will open the following window. Select the check box ‘Enable Silverlight Debugging’ then press ‘Apply’ then ‘Ok’.