Tuesday, June 24, 2008

TIP: Debugging a MS Dynamics CRM Callout from Visual Studio

If you are getting System.Data.SqlClient.SqlException: Could not find stored procedure 'sp_sdidebug' error (as logged by CRM Trace), make the following settings in your project and Attach to Process.

  1. In project properties: Debug tab – Uncheck 'Enable SQL Server debugging'. Compile the project in debug mode, and copy the dll and pdb files to \Program Files\Microsoft CRM\server\bin\assembly
  2. Run the page that calls the callout so that the assembly is loaded into memory
  3. At VS command prompt enter tasklist /m assemblyname* to get the process id
  4. Open the project in visual studio, add break points
  5. In the Debug menu in visual studio, select Attach to process, select w3wp.exe with ID obtained in step 3. Make the following settings.

  1. Click Attach
  2. Run the page that calls the callout and the process will step into the code.

Remote debugging steps are the same, but you need to create a local admin account on the server with same credentials as yours, start the remote debugger with that user id (By right clicking remote debugger tool & clicking 'Run As')

0 comments: