代码乱了(靳如坦的技术blog)

专注于.net,c#,Ajax、Sql Server、SmartClient等相关的开发
posts - 102, comments - 575, trackbacks - 12, articles - 2
  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理

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…


标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2008-06-28 00:25 编辑过
Google站内搜索



相关文章:

相关链接: