views:

303

answers:

3

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.

A: 

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"

James Curran
In the C# Web Application project, I think this is the Debuggers section on the Web tab. However, only ASP.NET is checked, not SQL Server.
bdukes
+2  A: 

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.

Rob Walker
Yeah, this is what I'm currently doing. Unfortunately, it doesn't remember after a restart.
bdukes
New OS, new Visual Studio, and now it is remembering... Thanks!
bdukes
A: 

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.

leppie
I'm not connected to the database in server explorer, and if I do, I'm not seeing the options you mention (not in the right click menu, not on the properties window).Also, see my response to @James Curran in regards to the project setting.
bdukes