“Hidden Secrets” of the Visual Studio .NET debugge

2019-01-29 17:42发布

As much as I generally don't like the discussion/subjective posts on SO, I have really come to appreciate the "Hidden Secrets" set of posts that people have put together. They provide a great overview of some commonly missed tools that you might now otherwise discover.

For this question I would like to explore the Visual Studio .NET debugger. What are some of the "hidden secrets" in the VS.NET debugger that you use often or recently discovered and wish you would have known long ago?

14条回答
Anthone
2楼-- · 2019-01-29 18:21

As a web developer who works with Web Services that are within the same solution as my front-end code most of the time, I found the ability to "attach" to a process to be a HUGE time saver.

Before I found this hidden gem, I would always have to set a breakpoint on some front-end code that called a web service method and step into it. Now that I know about this trick/feature I can easily set breakpoints on any part of my code that I want to which saves me loads of time and effort.

查看更多
放荡不羁爱自由
3楼-- · 2019-01-29 18:22

As posted in another post Sara Ford is doing a current series on the VS debugger.

Her blog is the best source of VS tips: http://blogs.msdn.com/saraford/archive/tags/Visual+Studio+2008+Tip+of+the+Day/default.aspx

查看更多
爷的心禁止访问
4楼-- · 2019-01-29 18:25

You can drag current line cursor (yellow arrow) up and down your code when execution is paused.

Additionally, in order to enable this during pause on exception you have to click "enable editing" on exception details first.

You can also make VS break on handled exceptions by checking one's of interest under: Debug->Exceptions : Thrown column

查看更多
【Aperson】
5楼-- · 2019-01-29 18:25

Things I use often:

  • Click the menu item "Debug | Exceptions" (or Ctrl-D, E for short) and you can enable breaking at the time that any exception is thrown, or choose to not break on certain exceptions.

  • You can set up the debugger to download some of the framework source code and symbols from a MS server and step into the framework code. (Some libraries, like System.ServiceModel, are not yet available). It in the Options windows under Debugging. See MSDN How-To.

  • You can use the VS.NET debugger to debug Javascript running in IE. You just need to install the IE javascript debugger, and enable javascript debugging in IE's settings. Then on a JS error it will pop up a "do you want to debug" dialog box, and you can choose to debug in VS.NET.

查看更多
▲ chillily
6楼-- · 2019-01-29 18:27

Some useful shortcut keys.

  • F11 to step into a method.
  • Shift-F11 to step out of a method.
  • F10 to step over a method.
查看更多
女痞
7楼-- · 2019-01-29 18:29
登录 后发表回答