…erface
A `T?` return on a generic method whose `T` carries a non-value-type constraint
(`class`, `class?`, an interface, or `notnull`) cannot be expressed in the explicit
setup-interface implementation: CS0460 forbids restating the inherited constraint
and `where T : default` (CS8822) conflicts with those constraints. Without a clause
the compiler resolves bare `T?` as `Nullable<T>` and reports CS0453/CS9334/CS0738/CS0266.
The setup-side return type now drops the trailing `?` for these methods. NRT
annotations are erased at runtime, so the underlying setup object is unchanged.
The user-facing mock body keeps `T?` because the constraint is visible there.
A
T?return on a generic method whoseTcarries a non-value-type constraint (class,class?, an interface, ornotnull) cannot be expressed in the explicit setup-interface implementation: CS0460 forbids restating the inherited constraint andwhere T : default(CS8822) conflicts with those constraints. Without a clause the compiler resolves bareT?asNullable<T>and reports CS0453/CS9334/CS0738/CS0266.The setup-side return type now drops the trailing
?for these methods. NRT annotations are erased at runtime, so the underlying setup object is unchanged. The user-facing mock body keepsT?because the constraint is visible there.