Visual Studio Developer Center > Visual Studio Forums > Visual Studio Debugger > trying to get t-sql debugging working from VSTS(uite) 2008 SP1
Ask a questionAsk a question
 

Answertrying to get t-sql debugging working from VSTS(uite) 2008 SP1

  • Sunday, May 03, 2009 9:00 PMJames Manning Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    OS: Win7 RC
    VS: Team Suite 2008, then Team Explorer installed, then SP1 applied
    SQL: SQL 2008 Standard with SP1 applied
    Project: ASP.NET 3.5 Web Site (not Web Application)
    current account ("Owner") is in the Administrators group and UAC is turned off (set to the bottom of the slider)

    To enable T-SQL debugging, I went to the web site project properties, "Web" tab, and turned on the "SQL Server" checkbox under the "Debuggers" section at the bottom.

    When I then "Start Debugging" (F5) I get an error that T-SQL debugging failed

    Cannot debug some of the code in process w3wp.exe [760]. See below for status.

     Managed code succeeded.
     T-SQL code succeeded.
     T-SQL code failed (0x80040a07).

    the "succeeded then failed" for t-sql is very odd, of course.

    unfortunately, I can't find any hits for what 0x80040a07 might be caused by.

    If i open one of the sprocs using server explorer and try to set a breakpoint, the breakpoint has the yellow exclamation mark warning with a hover-over comment of "The breakpoint will not currently be hit.  No symbols have been loaded for this document."

    I've also tried having the connection string specifically use "sa" to connect to the sql server, then having the connection in server explorer also use sa, but that didn't help.

    I've also tried (from googling around)
    1) regsvr32 sqldbg.dll
    2) exec sp_sdidebug 'legacy_on' (doesn't appear to exist on SQL 2008)
    3) sp_enable_sql_debug (didn't seem to help)

    I can't seem to get debugging working from SSMS either.
    1) trying to Debug -> Start Debugging with a breakpoint set in the sproc results in:
    "Data is Null. This method or property cannot be called on Null values. (System.Data)"
    2) I can set a breakpoint in the sproc, but when I execute the sproc it doesn't hit the breakpoint, it just executes the sproc

    Any hints/tips on what I could try next to get t-sql debugging working?  Not being able to step into a debug the sprocs is quite the PITA :)

    Thanks!!

    James

    • Edited byJames Manning Sunday, May 03, 2009 9:05 PMadded info about SSMS debugging also not working
    •  

Answers

  • Thursday, May 07, 2009 5:50 AMRoahn LuoMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hello James,

    To distinguish whether the project is a Web Site project or a Web Application:
      right click the project name, if there is an option "Property Pages", then, it is a Web site project. If the option is "Properties", it is a Web Application project.

    Generally, if we want to enable T-SQL debugging, we need to attach to sqlservr.exe process and tell Visual Studio automatically determine the type of code to debug. Here are the detailed steps to do this:

      1. From the Tools menu, select Attach to Process.
      2. In the dialog box, find sqlservr.exe in the list of available processes, and click to highlight.
      3. Press the Select button to open the Select Code Type box.
      4. Select the Automatically determine the type of code to debug option, and click OK.
      5. Click the Attach button.
    Please have a try and see if the issue still occur.
    For more information, please refer to How to: Debug T-SQL Using the SQL Server Management Studio.

    Yes, not being able to step into the Stored Procedure from the code in application tier is one of the limitations when we doing SQL Debugging. I'm sorry if it bring you any inconvenient. Also, you could refer to the article below for more walkthroughs on Debugging Database Object.

    Best regards,
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!

All Replies

  • Thursday, May 07, 2009 5:50 AMRoahn LuoMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hello James,

    To distinguish whether the project is a Web Site project or a Web Application:
      right click the project name, if there is an option "Property Pages", then, it is a Web site project. If the option is "Properties", it is a Web Application project.

    Generally, if we want to enable T-SQL debugging, we need to attach to sqlservr.exe process and tell Visual Studio automatically determine the type of code to debug. Here are the detailed steps to do this:

      1. From the Tools menu, select Attach to Process.
      2. In the dialog box, find sqlservr.exe in the list of available processes, and click to highlight.
      3. Press the Select button to open the Select Code Type box.
      4. Select the Automatically determine the type of code to debug option, and click OK.
      5. Click the Attach button.
    Please have a try and see if the issue still occur.
    For more information, please refer to How to: Debug T-SQL Using the SQL Server Management Studio.

    Yes, not being able to step into the Stored Procedure from the code in application tier is one of the limitations when we doing SQL Debugging. I'm sorry if it bring you any inconvenient. Also, you could refer to the article below for more walkthroughs on Debugging Database Object.

    Best regards,
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
  • Tuesday, August 18, 2009 8:01 PMsa_tomas_1548_58974634 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello.

    I have the same problem.

    My configuration is SQL Server Developer edition on Windows 7 RTM enterprise (just downloaded from MSDN). VS 2008 Team Suite for DB.

    I can not debug from the same pc nor from Vista computer.

    I can read in event log of Windows 7 pc 4 errors:

    1) The following fatal alert was generated: 48. The internal error state is 552. Event id = 36888 Schannel
    2) The certificate received from the remote server was issued by an untrusted certificate authority. Because of this, none of the data contained in the certificate can be validated. The SSL connection request has failed. The attached data contains the server certificate. Id = 36882

    3) the same as 1)
    4) the same as 2)

    I cannot debug sp on Windows 7.

    :-(((

    Please help me.

    Thank you tom
  • Monday, November 02, 2009 10:29 PMTJO Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I have the same problem.  
    Just installed windows 7 ultimate.
    Running sql server 2008
    Trying to run debugger in but receive errors

    TITLE: Microsoft SQL Server Management Studio
    ------------------------------

    Failed to start debugger

    ------------------------------
    ADDITIONAL INFORMATION:

    Data is Null. This method or property cannot be called on Null values. (System.Data)

    ------------------------------
    BUTTONS:

    OK
    ------------------------------






    ---------------------------
    Microsoft SQL Server Management Studio
    ---------------------------
    Unable to start program 'MSSQL:://myserver\STANDARD/DGI/sys/=0'.




    ---------------------------
    OK   
    ---------------------------

  • Wednesday, November 04, 2009 9:34 PMAndrew B Hall - MSFTModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    It sounds like this is a permissions issue.  If debugging inside SSMS is not working, this indicates a more general problem than a Visual Studio debugging issue.  In order to successfully debug SQL Server the Windows account that you are logged into needs the appropriate permissions on the database as well as whatever database account you are using to connect (if not connecting with Windows Authentication), because debugging uses Windows Authentication regardless of your DB connection method.  For example, if I am logged into Windows as "Andrew" and I am using the "sa" account to connect to the database, the debugger is going to  authenticate against "Andrew", so "Andrew" needs the appropriate permissions to debug the database, not just the "sa" account.


    Best Regards, Andrew Hall. Visual Studio Debugger.
  • Saturday, November 14, 2009 3:09 AMYuriK111 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Before trying anything else.
    Close your VS
    Point to VS shortcut-> right click and select Run as Administrator
    This solves the problem