According to the PostSharp documentation, attribute inheritance should be among others supported:
The parameter or return value of the abstract, virtual, or method interface
But in my case, it does not support inheritance when these supported elements are combined. I have this minimal code to reproduce the problem:
public interface IData { }
public interface ITest
{
void DoSomething([Required] IData data);
}
public abstract class AbstractTest : ITest
{
public abstract void DoSomething(IData data);
}
public class Test : AbstractTest
{
public override void DoSomething(IData data)
{
throw new NotImplementedException();
}
}
The construction of this code ends with:
PostSharp.Patterns.Contracts.RequiredAttribute "cannot be applied to the method" PostSharpInheritance.AbstractTest.DoSomething(PostSharpInheritance.IData)@data "because it is abstract.
Required , . Required , , .
() , ?