InterfaceGenerator icon indicating copy to clipboard operation
InterfaceGenerator copied to clipboard

Nullable Annotations should be taken over to the interface.

Open mtren opened this issue 1 year ago • 0 comments

Curent Behaviour: For the class

[InterfaceGenerator.GenerateAutoInterface(VisibilityModifier = "public")] public class AClass : IAClass {

    [return: NotNullIfNotNull(nameof(content))]
    public byte[]? TheMethod(byte[]? content)
    {
        if (content == null) return content;
        return content;
    }
}

this interface is generated:

public partial interface IAClass
{
    byte[]? TheMethod(byte[]? content);
}

Excpected Interface:

public partial interface IAClass
{
    [return: NotNullIfNotNull(nameof(content))]
    byte[]? TheMethod(byte[]? content);
}

Also other paremeter Attributes should be considered. Eg. MaybeNullWhen() or EnumeratorCancellation.

mtren avatar May 11 '23 06:05 mtren