简体   繁体   中英

Why aren't my breakpoints hitting SQL In Visual Studio 2019 debugging script from network server

So I am unfortunate enough to work in an organization who uses SSMS18, meaning I don't have the built-in debugger for SSMS. I am relegated to using VS2019 Professional to set break points and step through stored procedures. No Biggie, right?

Well when I select "Execute with Debugger" (can't see the selection in GIF for some reason) it loads then executes and never hits my breakpoint.

I followed these posts below to no avail.
How to debug stored procedure in VS 2015? This one I could not find what he was describing in step 6, but I debugged a SQL-Query in VS2019 before, but that was a local instance and not a remote server like it is in this case.


Cannot execute breakpoint inside stored procedure from VS 2017

below is a gif of what is happening 我试图调试

Any and all help is greatly appreciated.

下载并安装 SSMS < 18 版。然后您就可以进行调试了。

I have my database on another system and I want to debug remotely using visual studio 2019. Setting up a connection works to the database but debugging a stored procedure does not work. I get a message box indicating 'Unable to start the Transact-SQL debugger, could not connect to the Database Engine instance 'servername\\instancename'. Make sure you have enabled the debugging firewall exceptions and are using a login that is a member of the sysadmin fixed server role. Click Help for more information. The user that I am using has sysadmin role, checked it using the 'SELECT IS_SRVROLEMEMBER('sysadmin', 'YourLogin') command. I have disable the firewall on the remote machine. Locally I have enabled port 1433, 1434 and 135. Unfortunately this does not resolves the issue.

I had the same problem and then remembered reading about Debugging firewall ports when I installed SQLServer 2019.

With SS 2014 I didn't get any error messages but when I tried to debug with SS2019 it said possible firewall block.

https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/s0fk6z6e(v=vs.100)

Why aren't my breakpoints hitting SQL In Visual Studio 2019 debugging script from network server

According to your issue, you can try to follow my steps:

One

1) connect the database in SQL Server Explorer and make sure you can access the data successfully.

2) right-click on the selected procedure and choose Execute Procedure Option. Then it will open a new query window where you can execute your stored procedure as shown below.

An easy way is that you can just choose Debug Procedure , it will debug your procedure directly and you should not follow the below steps.

3) set a new breakpoint in the query file and select Execute with Debugger . Since you cannot open the green arrow's drop-down box, you can select the menu on the top by SQL-->Execute with Debugger to debug your procedure.

Besides, please remember to select the right database before debugging so that you don't run debug statements against other databases.

Note: If your stored procedure requires parameters as input, Visual Studio will prompt you to enter the values before opening the new query window.

More info you can refer to this .

Two

1) Right-click on the Project in the Solution Explorer --> Add--> Script-->Script(Not in Build) .

2) Write a custom query to select your procedure like exec dbo.Users_GetUserInfo and then choose SQL-->Execute with Debugger .

Hope it could help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM