How can I avoid a reported conflict when moving an explicit interface implementation into a derived class in ReSharper?

31 views Asked by At

Given the following code

namespace MyNamespace
{
    class MyExampleDerived : MyExampleBase
    {
        public int MyAnswer()
        {
            return 42;
        }
    }

    class MyExampleBase : IMyInterface
    {
        int IMyInterface.MyAnswer()
        {
            return 0;
        }
    }

    interface IMyInterface
    {
        int MyAnswer();
    }
}

If I try moving IMyInterface and IMyInterface.MyAnswer from the base class to the derived class using "Push Members Down", I get the following notification of an error level severity conflict:

Resharper Conflict found

MyExampleChild.cs
  MyNamespace.MyExampleDerived.MyAnswer declared in the target element has conflicts with moved members
    (5,14) public int MyAnswer()

If I continue with it, there's no compilation errors for the code, even though the documentation Resolve conflicts in refactorings indicates that a conflict with a "no entry" icon should cause the compilation to fail.

Is there anything wrong with such a move, and if not, how can I make ReSharper not report it as a conflict?

(Yes, I could just ignore it saying that there's a conflict, but my actual refactorings would have multiple conflicts reported, and false alarms make it harder to notice real problems)

0

There are 0 answers