Skip to content

Translation for Nullable<T>.ToString() #33942

@ranma42

Description

@ranma42

What is the intended translation for Nullable<T>.ToString()?

It is currently unclear (at least to me) what is the intended result (and/or translation) because:

  • the C# documentation states that it returns

    The text representation of the value of the current Nullable object if the HasValue property is true, or an empty string ("") if the HasValue property is false.

  • EFCore is attempting to test that the translation matches the C# definition in ToString_boolean_property_nullable, but it does so without ever populating the column with NULL
  • EFCore returns NULL for NULLs in bool? columns in SQL Server and Sqlite
  • EFCore returns the "True" string for NULL in other bool? expressions
    reported as Inconsistent results for Nullable<bool>.ToString() #33941
  • EFCore returns "" for enums
  • EFCore converts (hence propagates NULL) for several types in SQL Server and Sqlite

I realized that the situation was unclear while working on #33940

Metadata

Metadata

No fields configured for Feature.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions