I'm currently pulling my hair out here. I have an SQL Server Database project in Visual Studio 2013, which contains a CLR SP. I have a test script created in order to call the SP and enable me to debug it. I can build, make changes and publish\deploy to my SQL Server 2014 no problem. However, when I set a break point on my test script I can step into the test, but when it then calls the CLR SP it doesn't hit any of the breakpoints I've set in it. Instead I get Dynamic Transact-SQL windows popping up with any SQL executed within my CLR SP, which is not help at all as the logic I want to debug is the c# code.
Any ideas?
Cheers,
Stu.
Please see my comment above for the answer to this problem.
Related
I have a SQL Server 2008 R2 CLR Database project with a table value function. The table value function runs select queries in order to preform it's logic. I want to debug this in VS 2010 so I can step through my code but for the life of me I can't figure out how to do it and I have read countless Blogs.
I have a test.sql file and I have set it as my default test script with a breakpoint in my CLR function. When I click the "Start Debugging" button from within my test script VS 2010 will go into not responding mode while it re-deploys my assembly and then after a few minutes VS 2010 will stop debugging with a message that it exited with code "0". It's like it never runs my code.
I have also tried selecting the function from the server explorer and clicking the "step into" option on the context menu but I just get an error that remote debugging is not setup on our development server. Do I need remote debugging enabled and if so how do I go about doing it the right way to get this to work. I have been at this for days and I am ready to pull my hair out. I even spent my weekend working on this. Please any help would be appreciated.
I downloaded http://www.microsoft.com/en-us/download/details.aspx?id=475 the Visaul Studio 2010 remote debugger from here. I ran the .exe to install on my local machine and the development server. After which I was able to use the "step into" feature under server explorer and step through my code.
I'm looking for a way to debug the stored procedures that SharePoint uses. I would like to get an idea what is happening on the database side. The COM Exception message is pig-useless (0x8004005, which means generic problem - hurrah) and I would like to see what is going wrong on the other side as I can't muck around in the COM Component itself.
While I followed the description on how to setup VS for debugging the SQL Server they somehow all assume I can call the stored proc myself. I'm looking for either a Debugger.break()-style T-SQL call or something similar. Any ideas?
You can debug a stored procedure on SERVER only and NOT on CLIENT.
If sql server is installed on server, and in your local PC you have only SQL Server Management Studio is installed, you can not debug stored procedure in your local PC.
You need to go to server and there you can debug stored procedure in SQL Server Management Studio like this:
Open stored procedure in SQL Server Management Studio.
Click "Start Debugging" from Debug menu.
I've created a SQL 2008 database project in Visual Studio 2010. I have imported existing tables and stored procedures using both of the available methods of import (script or connecting to db). Regardless of which method I use, after the import completes I see my table files in the Visual Studio project, however, I get the following error when trying to view the object by double clicking on it:
Object reference not set to an instance of an object.
I can also see the files I am trying to access on the hard drive. Perhaps this is a permissions issue masked with an obscure error message? I've done some research and am stumped at this point. Any assistance is greatly appreciated.
Details on Visual Studio 2010: Version 10.0.40291.1 SP1Rel
My OS is: Windows Server 2008 R2 Standard
Thanks!
Starting VS 2010 with "devenv /ResetSkipPkgs", should help, mostly due to the "non-loading problem" of some of the key modules.
Tearing my hair out in despair now after hours of fighting and googling. I'm trying to debug a simple CLR method. Setup: Visual Studio 2010, SQL Server 2008 R2 Express, Vista Business SP2. I'm a domain user but a local admin on the machine, and a sysadmin on the local instance of SQL Server. I created a new VS database project, pointed it to my db connection string (used this db before), then it asked me if I want to enable debuggig for the connection, to which I answered yes.
I verified that the project deploys fine (can see the assembly and its procedure appear in SQL Server Management Studio), and that I can call it just fine within SSMS. I then added the very same EXEC code to the Test.sql script in my db project, and marked it as the default debug script. I then set a breakpoint both in Test.sql and CLR code.
But when I hit F5 all I get is the following output:
Canceled by user.
Auto-attach to process '[2144] sqlservr.exe' on machine 'DAWID-PC' succeeded.
The thread 'dawid-pc\sqlexpress [54]' (0x13c4) has exited with code 0 (0x0).
The thread 'dawid-pc\sqlexpress [54]' (0x13c4) has exited with code 0 (0x0).
The thread 'dawid-pc\sqlexpress [56]' (0x109c) has exited with code 0 (0x0).
The thread 'dawid-pc\sqlexpress [56]' (0x109c) has exited with code 0 (0x0).
The program '[2144] sqlservr.exe: dawid-pc\sqlexpress' has exited with code 0 (0x0).
And my debugging session ends right there.
I have c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger\x86\msvsmon.exe running; I can see a message saying MyDomain\MyUsername connected. appear every time I hit F5 in Visual Studio. I don't have a firewall running on my PC, and have no anti virus software installed.
Do you have any idea how to make it work? My real target was remote debugging but I thought I should try local first and iron out any setup quirks before venturing any further...
I had this same problem. It appears to be an issue with your project being configured for .NET 3/3.5. As soon as I changed my platform to .NET 2.0 I could hit my break points. I can't wait until the have .NET 4 integration in SQL Server CLR types.
I came across this error recently using VS2010 and SQL 2008 R2 (both installed locally). I switched off my firewall, etc. and still have no luck. Eventually I stumbled across what looked like a SQL Server memory issue. The SQL Log Files were showing a lot of AppDomain X unloaded messages. Anyway, the led me to here: http://www.johnsansom.com/sql-server-memory-configuration-determining-memtoleave-settings/#axzz1SZM5nqyF
and after changing my SQL Server -g startup option to -g384, hey presto the debugging worked !!
I'm not a SQL DBA so maybe someone can jump in and add to this if they have any knowledge of MemToLeave settings.
Ciaran
in server explorer remove Allow SQL Server debugging, but set Application debugging
Start debugging and VS will request to set Allow SQL Server debugging.
Then it will work.
Abbas Shojaee
Set your break-points in the source..,Build and deploy (Sql server projects will build and deploy when you run, but will not hit any break points you have set!.)
On the Server explorer make sure you have enabled Application Debugging and Allow SQL/CLR Debugging.
On the Server Explorer navigate to the clr stored procedure/function that you want to debug,
Right click and Step Into (Alt+F5) .. After 'Attach security warning' , you will see assemblies being loaded in the output window , followed by this, break point will be hit and you can continue usual debugging tasks.
I'm trying to build a setup project in Visual Studio 2005, and it is failing every time, after opening a dialog box labeled Microsoft SQL Server 2005 Tools and configuring for a few minutes. The Microsoft SQL Server 2005 Tools dialog then launches a dialog with the text Failure creating local group SQLServer2005NotificationServices$COMPUTER_NAME. I suspect this failure is because I'm not currently local admin on my machine (a situation I hope will be rectified rapidly), but I don't see why I need to configure MS SQL 2005, as my project does not use it, and in fact has no DB connectivity. How can I get past this step to a successful build?
Related:
Visual studio configures SQL 2008 on every build
Visual Studio Setup and Deployment build fails with no errors
Update: Got my admin back, but this is still taking up time to run, and I'd still like to be rid of it.
I found something about it on Microsoft Connect. Seems like it's a bug. In the reply they linked to a knowledge base article with some workarounds.