How can I avoid automatically attaching to T-SQL for debugging in Visual Studio 2008?
-
06-07-2019 - |
Question
When debugging web sites that I'm working on, I tend to use Attach to Process rather than F5 to start debugging (since the site's already on in Firefox). However, occasionally when doing so, I'll get the following error:
EXECUTE permission denied on object 'sp_sdidebug', database 'master', owner 'dbo'.
I know this is caused by attaching the debugger for T-SQL, rather than just managed code (see this blog post for further explanation on that issue).
I'm hoping that it's possible to set somewhere to avoid attaching to T-SQL in the first place, rather than having to remember to go reset that setting each time I attach.
So, here's the real question: Does anyone know how I can change the default behavior of Visual Studio 2008, so that when attaching to a process through the debug menu, it does not automatically attach to T-SQL, but only to managed code? That is, how can Studio be set to remember not to attach to anything other than managed code?
FYI, if there are project-specific settings, I'm using a C# Web Application project.
Solution
You can change the debugging engines used to attach to a process by clicking on the 'select...' button on the 'attach to:' line in the attach dialog.
Choose the 'Debug these code types' option instead of the automatic one, and make sure the T-SQL option is cleared.
I don't know how to set this as a default, hopefully Visual Studio will just remember it.
OTHER TIPS
Under the properties for the project(with the project selected in the Solution Explorer: right-click and select Properties; or Press Alt-F7; or Press Alt-Enter; or select Project/xxxx Properties from the menu), switch to the [Debug] tab, and uncheck "Enable SQl Debugging"
If you right click the database connection in the server explorer in VS, you should see 2 debugging options, ensure they are not ticked.
Also in the project settings, you can alter whether SQL debugging is enabled.