locked
how to delete errors from the error list window RRS feed

  • Question

  • hello im developing a project template. that project contains code files and i implemented a msbuild task to compile them. i also have a mef editor extension to display the error squigles and populate the error list while the code is been edited. the problem is that when i compile i get the errors repeated, once from the log from the build task and once from the editor extension. how can i solve this?
    Friday, May 4, 2012 5:49 PM

All replies

  • You likely need to only add your errors if the same errors aren't already present.  The error doesn't do any sort of intelligent merging/duplicate elimination, it simply displays errors for all registered providers. The build system registers a provider that pipes build errors to the error list. If you have some kind of MEF component that is also supplying the same errors outside of the build system you would need to make sure that you don't supply duplicates by examining the errors in the list before providing your own.

    Ryan

    Friday, May 4, 2012 5:54 PM
  • in the mef component i'm obtaining an ErrorListProvider like this: new ErrorListProvider(serviceProvider). this provider only shows the tasks that were created using the provider, so i don't get to see the entries generated by the build system. how can i access the complete error list, is there another way, without the ErrorListProvider. i have yet another problem, when i put some error taks from the build system, they don't disappear until i rebuild, even if i modify the code fixing the errors
    Saturday, May 5, 2012 3:02 AM
  • The error list is exposed via EnvDTE.ToolWindows.ErrorList, you can enumerate all the items in it via teh ErrorItems property.  You can only remove errors you provided, you can do that from your ErrorListProvider by calling Remove or Clear on the same collection you call Add on when you add the error.  The error list doesn't know what caused the errors so it can't remove them 'when you modify the code', you have to do that yourself once you have determined the error is fixed.

    Ryan

    Monday, May 7, 2012 11:13 PM
  • thanks a lot ryan! i didn't know how to access the error list
    Thursday, May 10, 2012 9:27 PM
  • I have a problem with this as well that might be a little more complex. It would seem that if you have to remove your errors(which I need to) you would have to keep a reference alive to the errors list so that you can later make modifications. My particular application mandates that I have to unload the app domain in which I set the errors in. The app domain is a very short lived process which generates dynamic assemblies. If I set the Reference in the default appdomain I have the problem that my code will get loaded into that domain and will never be able to be unloaded. 

    I can't seem to get these errors removed. Theoretically, it would be possible to create some sort of wcf service in my package that receives text and prints it to the error console. I could then keep my error list alive and make modifications. This seems like a heavyweight solution. Is there any other way to delete my own errors. 

    I noticed someone else storing cooking values and deleting items. Can you think of any better solutions to clearing my errors? 

    Sunday, August 25, 2013 8:05 AM