I’ve been trying my hand at extending Community Server. The SDK and Dave Stokes’ SDK installation guide are invaluable but I came upon an awkward glitch when trying to debug my first extension. Having attached the VS debugger to the web server process, and done anything in Community Server I'd get

An exception of type ‘System.Data.SqlClient.SqlException’ occurred in System.Data.dll but was not handled in user code

Additional information: EXECUTE permission denied on object ‘sp_sdidebug’, database ‘master’, owner ‘dbo’.

A quick bit of googling reveals that this isn’t a uncommon but it’s related to SQL debugging and I wasn’t attempting to do that. None of my VS projects had ‘Enable SQL Debugging’ checked. Fortunately the solution was quite straightforward : when attaching the aspnet_wp.exe process to VS, make sure you are only attach managed code.

  • Click Tools > Attach to Process
  • Click the Select button just above the list of available processes to attach to
  • Select ‘Debug these code types’ and check only the boxes for Managed (and Native if necessary) code.
  • Click OK
  • Click Attach
  • Debug as normal

Full credit to techenvelope for this.

For reference though, if you are trying to do some SQL debugging, the MS advice is to

The actual support articles are