Search code examples
c#resharperusing-statementproductivity-power-toolsxml-documentation

Resharper and Productivity Power Tools fight over my usings. How can I stop the bloodshed?


Here's the type of code that starts the violence:

public interface ISomething
{
   /// <exception cref="IOException" />
   void DoSomethingWithTheFilesystem();
}

Resharper 9.2 sees this and suggests (insists) that I add a using System.IO for IOException with a blue underline and a pop-over message that I can't dismiss. However, since this is an interface, I don't have an actual code reference to IOException, and I have Productivity Power Tools configured to remove unused usings when files are saved. So as soon as I save the document, PPT deletes the using. Which makes R# complain again the next time I open it (or do code analysis). Automatically adding usings when you add code is a very useful feature. So is automatically removing them when you delete it. Is there something I can do to make peace between these two factions without sacrificing one or the other?


Solution

  • Based on my comment as a suggestion which worked, I'll repost here as the answer.

    Use the fully qualified namespace to maintain peace amongst the factions. As mentioned in the comments by @siride, this is "probably actually better that you use the fully qualified name anyway. The documentation should be complete in place, without depend on using statements."

    /// <exception cref="IOException" />
    

    Becomes:

    /// <exception cref="System.IO.IOException" />