VS 2008 Tracepoints – Debug output without touching your code (Say goodbye to Debug.Write ?)

Sara Ford's WebLog - Did you know… You can use Tracepoints to log “printf” or “console.writeline” info without editing your code? - #237

 

“This is a new feature for VS2008.

On a given line of code where you want to log the value of a variable, you could do the old fashion way of doing a Console.Writeline() or a PrintF().  But in VS 2008, there’s a new feature called tracepoints.

Just right-click, select breakpoints, but instead of Insert Breakpoint, select Insert Tracepoint.

Insert Tracepoints from Context Menu

This will bring up the Tracepoint dialog, where VS gives you some helpful defaults.  But for this example, the really helpful default is in the descriptive text for logging the contents of a variable.

Tracepoints dialog

You’ll notice that the editor shows a diamond instead of a circle.

Tracepoints indicated by a diamond

And the tracepoints are logged in the Output Window’s Debug Pane

Debug Window Output Pane logs tracepoints[Post leached in full as I couldn’t think of a way to summarize/truncate it well and wanted to make sure everyone got the full impression of it]

Now that’s fricken cool.

Sigh… another day, another realization of how little I know…

转载于:https://www.cnblogs.com/jintan/archive/2008/06/27/1231390.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值