开发者

"The breakpoint will not currently be hit..." error when trying to debug a TSQL stored proc called by .NET code

I am getting the error:

"The breakpoint will not currently be hit. Unable to bind SQL breakpoint at this time. Object containing the breakpoint not loaded"

"The breakpoint will not currently be hit..." error when trying to debug a TSQL stored proc called by .NET code

When I did the steps to debug a stored proc called from my .net app?

What should I be checking?

(VS 2开发者_高级运维005 and SQL Server 2005 both running on the same PC, I can debug a stored proc if I do "step into" from the Server Explorer)


Make sure that in the project properties > Debug > 'Enable SQL server debugging' checked otherwise you won't be able to step into a stored procedure from your .net code (even though you can step through it using server explorer). Has to be the executing project.

If you're calling the stored procedure from a SqlCommand, set a break point on the Command.Execute() line and then step into it. From there you will be taken to the stored procedure code and will be able to walk through it.

If you continue to get the empty breakpoint icon, try refreshing server explorer.


In addition to enabling SQL Debugging on the project, like DustinDavis said, I had to select "Allow SQL/CLR Debugging" in the context menu for the server in SQL Server Object Explorer (Visual Studio 2015). See How can I step into a SQL Server stored proc from my C# code?

Also make sure both the user account under which VS runs and under which your application connects have sysadmin privileges.


Still the same error happens in Visual Studio 2017. What helps me is:

  1. Right click on the server in SQL Server Object Explorer and check "Allow SQL/CLR Debugging"/"Application Debugging" or both.
  2. In SQL Server Object Explorer find the object you want to debug.
  3. Right click on it -> Debug (Procedure/Function).
  4. In "Debug Function" window specify all the parameters if there exists.
  5. Visual Studio generates code to debug that (Procedure/Function), go "Step Into" (F11) and when it goes into needed (Procedure/Function) code set breakpoints where you need.
  6. Now you continue current debugging by pressing "Continue" button and when it finishes run your app in Debug mode.
  7. Profit. Now Visual Studio steps into breakpoints were set in step 4 from .NET code.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜