title: How do you override a nullable annotated generic method in C#?
body: <p>I am trying to add nullability support to parts of an existing code base.  One area that has me stumped is how to override a generic method when the return value is nullable annotated.</p>
  <pre><code>#nullable enable
  public class Stuff&lt;T&gt; {}
  
  public abstract class Base {
      public virtual Stuff&lt;T?&gt;? MakeStuff&lt;T&gt;() =&gt; null;
      
      public Stuff&lt;T?&gt;? MakeStuff2&lt;T&gt;() =&gt; null;  
  }
  
  
  public abstract class Derived : Base {
      public override  Stuff&lt;T?&gt;? MakeStuff&lt;T&gt;() =&gt; base.MakeStuff&lt;T&gt;();
  }
  </code></pre>
  <p>This results in a pair of error messages that don't quite make sense to me:</p>
  <blockquote>
  <p>Compilation error (line 26, col 29): 'Derived.MakeStuff()': return type must be 'Stuff&lt;T?&gt;' to match overridden member 'Base.MakeStuff()'</p>
  </blockquote>
  <blockquote>
  <p>Compilation error (line 26, col 29): The type 'T' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method 'Nullable'</p>
  </blockquote>
  <p>This all works when nullable is not enabled.</p>