Limit types that get converted to null for empty/null input in NullableConverter by oroztocil · Pull Request #60498 · dotnet/aspnetcore (original) (raw)

Limits the nullable types for which empty string or null input gets converted to null in NullableConverter. After the change this only happens for types that either have TypeCode != TypeCode.Object or belong to a set of special supported types (currently DateOnly, TimeOnly, DateTimeOffset).

Other types get processed by the respective non-nullable converter as was the case before #52499. In particular, types implementing IParsable (with the exception of the types mentioned above) get converted using their TryParse method (via ParsableConverter) which means they can provide custom implementation for handling empty/null inputs.