none
How to use "Error List Window" in Visual Studio to display error messages?

    Question

  • I want to take advantage of Visual Studio's "Error List Window" to display errors, warnings just like what we experienced in developing a C# project.
    I cannot find any documents to show me how to do this.
    Please help me with this issue.
    Thx
    Thursday, April 16, 2009 5:52 AM

Answers

  • newError.ErrorCategory = TaskErrorCategory.Error; // or TaskErrorCategory.Warning for warnings

     


    • Marked as answer by Charlie.Wu Tuesday, April 21, 2009 2:17 AM
    Tuesday, April 21, 2009 12:21 AM

All replies

  • Are you trying to implement this as part of a custom language's IntelliSense parser, as part of a compiler integration, or simply looking to manually place items in the Errors window independent of the code editor and build system?
    Thursday, April 16, 2009 6:17 AM
  • I plan to use the Error List Windows as part of my custom language, but I might not need IntelliSense parser. So, for now, I want to know how to manually place items in the window.
    Thx for your response.
    Thursday, April 16, 2009 6:50 AM
  • For that, you should call AddError on the AuthorinkSink you create during a ParseSource operation. You should only add the errors when the ParseReason is ParseReason.Check, or you'll find they "randomly" disappear from the Errors window.
    • Proposed as answer by Sam Harwell Thursday, April 16, 2009 6:08 PM
    • Unproposed as answer by Charlie.Wu Monday, April 20, 2009 9:08 AM
    Thursday, April 16, 2009 6:08 PM
  • I managed to get the "Error List" and using the following code to manually insert a text "Some Error Text" into the window.

                    //Get the "Error List Window"
                    ErrorListProvider errorProvider = new ErrorListProvider(this);
                    Task newError = new Task();
                    newError.Category = TaskCategory.BuildCompile;
                    newError.Text = "Some Error Text";
                    errorProvider.Tasks.Add(newError);

    Unexpectedly, the text was marked as a "Warning" not an "Error".

    I need to know how to distinguish the message as a "warning" or an "error" or a "Message" in code.

    Thx & BR.
    Wu

    Monday, April 20, 2009 9:15 AM
  • newError.ErrorCategory = TaskErrorCategory.Error; // or TaskErrorCategory.Warning for warnings

     


    • Marked as answer by Charlie.Wu Tuesday, April 21, 2009 2:17 AM
    Tuesday, April 21, 2009 12:21 AM
  • Thx for the tip richt67, I noticed that ErrorTask "is a" Task.
    Tuesday, April 21, 2009 2:18 AM
  • The answer is demonstrated over at StackOverflow:

    http://stackoverflow.com/a/1076518

    basically you write to the Output Window with the format:

    file(line): error: message for Errors tab in Error List window

    file(line): warning: message for Warning tab in Error List window

    -Jesse

    Friday, June 15, 2012 3:41 PM
  • That works, though using the error list directly is more straight forward and gives you a lot better integration with the error item for things like navigation and F1 help.

    Ryan

    Friday, June 15, 2012 3:56 PM
  • Hi Charlie.Wu

       I am very new to .net technology, Please tel me where i can use this code. Or send me full code to mail id.

    //Get the "Error List Window"
                    ErrorListProvider errorProvider = new ErrorListProvider(this);
                    Task newError = new Task();
                    newError.Category = TaskCategory.BuildCompile;
                    newError.Text = "Some Error Text";
                    errorProvider.Tasks.Add(newError);

    Unexpectedly, the text was marked as a "Warning" not an "Error".

    • Edited by NasirAhmed Friday, December 07, 2012 6:36 AM
    Friday, December 07, 2012 6:35 AM