Reputation: 153
I want to debug a SQLCLR stored procedure in SQL Server. I have been trying to debug an SP in VS2015 Community and in the recently installed VS2017 Community editions without success. I am pretty sure that the problem lies in attaching to SQL Server but as I've done everything I can find mentioned online but to no avail.
When creating the database project in SQL Server Express LocalDB everything works fine. If I change the connection string to use my Developer Edition SQL Server, I then get an error. I have done the following:
In Visual Studio I created a simple database project with a simple method to send some text to the output pipe.
[Microsoft.SqlServer.Server.SqlProcedure]
public static void mytest ()
{
SqlContext.Pipe.Send("in clr Craig1");
}
Thereafter, the procedure executes and performs the pipe function, but it does not let me do the attachment and the debugging.
Any ideas of what I'm doing wrong? Thanks Craig
Upvotes: 3
Views: 1864
Reputation: 48836
You might just need to start Visual Studio with "Run as Administrator". I do not believe that I needed to do that when running Windows 8, but I am running Windows 10 now and definitely need to "Run as Administrator". I am guessing that you cannot otherwise attach to someone else's process (I have my Developer Edition running with a service account of "SQL Server", yet LocalDB always runs as the Login that started it, typically yourself). I have not tested to see if running Developer Edition as myself would still require "Run as Administrator", or how running Developer Edition as "Local System" would affect this behavior.
Upvotes: 3