-1

When trying to debug a T-SQL query within Azure SQL Managed Instance database from Visual Studio, I get an error:

Failed to start debugger and exception was generated: Data is null. This method or property cannot be called on null values

Followed by this:

Unable to start program MSSQL Operation not supported Unknown error 0x80004005

Debugging a T-SQL query from within Visual Studio 2019 current version 16.11.11 yields the following errors:

Failed to start debugger and exception was generated: Data is null. This method or property cannot be called on null values

Unable to start program MSSQL Operation not supported Unknown error 0x80004005

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 3
    I've been working with T-SQL for 20+ years, and have yet to come across a single scenario where a debugger would have helped. And they removed the debugger from SSMS for a reason. T-SQL is not object-oriented or 3GL, what do you get from a debugger that you can't get from basic `PRINT` or other output options? – Aaron Bertrand Mar 31 '22 at 17:42
  • [dup on MS Q&A](https://learn.microsoft.com/en-us/answers/questions/795744/azure-sql-managed-instance-tsql-query-debugging.html) – SMor Mar 31 '22 at 19:46

1 Answers1

0

Azure SQL Managed Instances cannot be debugged using the debug method of SSMS or via Visual studio. Answer by the MS support team : " As discussed Azure SQL Managed Instance does not support debugging as SQL Server engine DDL’s which is required by the debugger are not accessible in PaaS environment."

On all Azure SQL PaaS database options (DTU model, vCore model, Serverless, Managed Instance, Hyperscale) and Synapse you will have that constraint. Even tools like SQL Server Management Tools (SSMS) that once had a Debugger integrated it no longer has it, and honestly it was never useful when I had to use it.

Azure Data Studio has a Profiler Extension that help a little bit to determine the sequence of instructions that were executed to produce a result set but won't help you to watch the values of variables.

If all this is painful for you maybe your organization should consider choose a SQL Server VM (IaaS) instead of PaaS.

You can also export Azure SQL Databases to a local developer environment and do debugging locally.

Finally, if you need to debug on Production use PRINT or SELECT statements of T-SQL to watch the values of variables or display intermediate result sets. You can also save intermediate results or outputs into a temporary table or log table.

Alberto Morillo
  • 13,893
  • 2
  • 24
  • 30