locked
How to manipulate error window? RRS feed

  • Question

  • I wanted to clear items in the error window before building a project. However, I found no way to manipulate the error window. I have checked the IVsErrorList interface. It only provides "BringToFront" and "ForceShowErrors" methods.

    Can anyone tell me how to do this trick?

    Thanks a lot.

    Wednesday, August 24, 2011 2:18 AM

Answers

  • Does your language service create an ErrorListProvider? That seems like the only way it can add errors into the error list - where it owns the errors. What do the errors look like? I would search the codebase for IVsTaskProvider and/or IVsErrorItem. As far as I know, MPF does not come packaged with implementations of these...

    Once you have a handle to the ErrorListProvider, you can call ErrorListProvider.Tasks.Clear().
    If you're trying to do this as a pre-build event, take a look at IVsUpdateSolutionEvents2.UpdateProjectCfg_Begin. This will get called before your project builds.



    Adi Unnithan | Software Design Engineer | SQL Server Developer Tools | Please mark the post as answered if it sufficiently answers your question
    • Marked as answer by lcasperr Thursday, August 25, 2011 2:41 PM
    Thursday, August 25, 2011 6:49 AM

All replies

  • Unless you own the errors (you have your own ErrorListProvider - in which case you can call ErrorListProvider.Tasks.Clear()), you will not be able to clear the errors, since these errors may be owned by other providers.

    You could coerce the removal of some errors by calling an action that most providers recognize as 'time to remove all errors', such as cleaning a solution (DTE.Solution.SolutionBuild.Clean) but there's no guarantee you will remove all errors since some providers may choose to ignore this.

    HTH,
    -adi


    Adi Unnithan | Software Design Engineer | SQL Server Developer Tools | Please mark the post as answered if it sufficiently answers your question
    Wednesday, August 24, 2011 3:51 AM
  • Unless you own the errors (you have your own ErrorListProvider - in which case you can call ErrorListProvider.Tasks.Clear()), you will not be able to clear the errors, since these errors may be owned by other providers.

    You could coerce the removal of some errors by calling an action that most providers recognize as 'time to remove all errors', such as cleaning a solution (DTE.Solution.SolutionBuild.Clean) but there's no guarantee you will remove all errors since some providers may choose to ignore this.

    HTH,
    -adi


    Adi Unnithan | Software Design Engineer | SQL Server Developer Tools | Please mark the post as answered if it sufficiently answers your question.

    The problem is that my language service emits errors and MSBuild generates duplicated errors.

    The language service is implemented by using the MPF.  It seems that the ProjectNode does not clean errors before build. How do I solve this problem?

    Thx.

    Wednesday, August 24, 2011 2:49 PM
  • Does your language service create an ErrorListProvider? That seems like the only way it can add errors into the error list - where it owns the errors. What do the errors look like? I would search the codebase for IVsTaskProvider and/or IVsErrorItem. As far as I know, MPF does not come packaged with implementations of these...

    Once you have a handle to the ErrorListProvider, you can call ErrorListProvider.Tasks.Clear().
    If you're trying to do this as a pre-build event, take a look at IVsUpdateSolutionEvents2.UpdateProjectCfg_Begin. This will get called before your project builds.



    Adi Unnithan | Software Design Engineer | SQL Server Developer Tools | Please mark the post as answered if it sufficiently answers your question
    • Marked as answer by lcasperr Thursday, August 25, 2011 2:41 PM
    Thursday, August 25, 2011 6:49 AM
  • Thx, that helps alot.
    Thursday, August 25, 2011 2:41 PM