One of the key benefits of IntelliTrace is that it collects lots of useful information about your application which allows you to debug exactly what the application was doing when a problem occurred. With so much information, it’s important to be able to search for the specific data that led to the bug in the program. IntelliTrace provides a couple of features inside the editor that allow you to narrow down your search:
- Search For This Line In IntelliTrace
- Search For This Method In IntelliTrace
Both of these features are available from the editor context menu (shown below). In this blog post, I’m going to cover the first feature, i.e. Search For This Line In IntelliTrace. In a future blog, I’m going to cover the second feature, i.e. Search For This Method In IntelliTrace.
So what does the "Search For This Line In IntelliTrace" command do exactly and how is it used? Let’s walkthrough a simple example to see how this feature works. In the following code snippet, I am interested in finding out how many times the the statement ShoppingCartItem item = FindItem(product); (line 7 below) was executed and also, I want to figure out what happened before this line was called.
In order to do that, I can right-click on line 7 above and select "Search For This Line in IntelliTrace".
After selecting the command, the IntelliTrace Search Bar is shown at the top of the editor window. The screenshot below highlights the IntelliTrace Search Bar.
Think of the Search Bar as the controls on your DVR where you can go backwards and forwards through your IntelliTrace recording. One of the key features that the IntelliTrace Search Bar provides is displaying the number of times that a line of code was executed. In the example below, you can see that the highlighted line was executed 4 times.
Using the Search Bar, you can debug backwards from the time when the line of code was executed. In the screenshot below, after clicking the left arrow once, I can now use IntelliTrace to step back through the code.