Monday, August 26, 2013

Visual Studio error message template

Visual Studio (among others) will recognize lines that follow a certain pattern in the output window and turn them into links that open an editor to the file and then position the cursor where the error occurred.

The general pattern used by the tools and recognized by Visual Studio is:

fileName(startLine,startColumn[,endLine,endColumn]): error errorCode: errorMessage
An example message would look like:

C:\Source\path\to\solution\project\FileWithCompileError.cs(154,20,154,26): error CS0103: The name 'result' does not exist in the current context
The endLine and endColumn are optional; presumably not all errors can be pinpointed to a range so accurately.

No comments: