07.25 Setting a Tracepoint in Source Code

MENU

[Context Menu] | When Hit

COMMAND

EditorContextMenus.CodeWindow.Breakpoint.BreakpointWhenHit

VERSIONS

2005, 2008, 2010

CODE

vstipDebug0010

Tracepoints give you the opportunity to unobtrusively print out information during application execution. This tip shows you how to use the IDE to create tracepoints, but for detailed information about how to do this in code, see “Tracing and Instrumenting Applications” at http://msdn.microsoft.com/en-us/library/zs6s4h68(VS.100).aspx.

The best way to illustrate simple tracepoints is with a basic loop. I would suggest creating a new project and making a simple for loop to play with. Here is my sample code:

Setting Tracepoints

You have a couple of ways to set a tracepoint ...

Get Coding Faster: Getting More Productive with Microsoft® Visual Studio® now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.