SergeyTeplyakov / ReSharperContractExtensions

Set of extensions for R# that simplifies Design by Contract programming using Code Contracts.
MIT License
69 stars 10 forks source link

Hides Copy Comments from base #35

Open tankbob opened 10 years ago

tankbob commented 10 years ago

The contextual (Alt+Enter) menu options for adding requires to a method appear to hide the Copy Comments from base resharper option.

If I add the requires then copy comments from base is available again

SergeyTeplyakov commented 10 years ago

Could you please provide some repo?

Because what I've see that "Copy comment from base" context action is available when the caret is on on method declaration itself and unavailable on the argument.

class Base
{
    /// <summary>
    /// Foo
    /// </summary>
    /// <param name="s"></param>
    public virtual void Foo(string s)
    { }
}

class Derived : Base
{
    // If caret is on Foo itself (like Fo{caret}o) the Copy comment from base is availble,
    // but if the caret is on argument "s" this action is unavailable (but the behavior doesn't change depending on context action availability of this tool.
    public override void Foo(string s)
    {
        //Contract.Requires(!string.IsNullOrEmpty(s));
        base.Foo(s);
    }
}
tankbob commented 10 years ago

I thought I could, but it appears to be intermittent, I cannot reliably reproduce at the moment. It did seem that whenever there was a problem, Choosing to add the contract fixed copy comments from base. I could then remove the contract options. I'm wondering if the issue is actually resharper playing silly. The base classes in my case were in different projects. I will see if I can reliably reproduce this.