Visual Studio Web Applications—Error List and Task List
| CSharp-Online.NET:Articles |
| Visual Studio Articles |
| © 2006 M. MacDonald, M. Szpuszta |
Error List and Task List
The Error List and Task List are two versions of the same window. The Error List catalogs error information that’s generated by Visual Studio when it detects problematic code. The Task List shows a similar view with to-do tasks and other code annotations you’re tracking. Each entry in the Error List and Task List consists of a text description and, optionally, a link that leads you to a specific line of code somewhere in your project.
With the default Visual Studio settings, the Error List appears automatically whenever you build a project that has errors (see Figure 2-10).
![]()
Figure 2-10. Viewing build errors in a project
To see the Task List, choose View > Other Windows > Task List. Two types of tasks exist—user tasks and comments. You can choose which you want to see from the drop-down list at the top of the Task List. User tasks are entries you’ve specifically added to the Task List. You create these by clicking the Create User Task icon (which looks like a clipboard with a check mark) in the Task List. You can give your task a basic description, a priority, and a check mark to indicate when it’s complete.
Note As with breakpoints, any custom tasks you add by hand are stored in the hidden solution files. This makes them fairly fragile—if you rename or move your project, these tasks will disappear without warning (or without even a notification the next time you open the website).
The comment entries are more interesting, because they’re added automatically and they link to a specific line in your code. To try the comment feature, move somewhere in your code, and enter the comment marker (//) followed by the word TODO (which is commonly referred to as a token tag). Now type in some descriptive text:
// TODO: Replace this hard-coded value with a configuration file setting. string fileName = @"c:\myfile.txt"
Because your comment uses the recognized token tag TODO, Visual Studio recognizes it and automatically adds it to the Task List (as shown in Figure 2-11).

Figure 2-11. Keeping track of tasks
To move to the line of code, double-click the new task entry. Notice that if you remove the comment, the task entry is automatically removed as well.
Three token tags are built-in—HACK, TODO, and UNDONE. However, you can add more. Simply select Tools > Options. In the Options dialog box, navigate to the Environment > Task List tab. You’ll see a list of comment tokens, which you can modify, remove, and add to. Figure 2-12 shows this window with a new ASP comment token that you could use to keep track of sections of code that have been migrated from classic ASP pages.

Figure 2-12. Adding a new comment token
|

