[6.0] Mark internal the ValueConverter constructors that allow conversion of nulls #26232
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #26230.
Description
In 6.0 we implemented Allow HasConversion/ValueConverters to convert nulls. However, this has proved to be very problematic in practice with many pitfalls. For example:
These are not trivial issues to fix and for the query issues they are not easy to detect and will result in unexpected/bad data.
This makes the feature somewhat a pit-of-failure. However, the issue has 43 votes on GitHub, putting it in the top 25 and meaning that people are likely already using it. Therefore, we are proposing to mark these APIs as internal for 6.0. This still allows people to use them, but behind an analyzer warning and documentation. (This is similar to marking them as experimental--see EntityFrameworkExperimentalAttribute) We can then make them fully public in a future release after gathering more feedback and possibly making improvements.
Customer impact
Customers will get a warning when trying to use this feature. If they proceed (suppressing or ignoring the warning), it will still work as it does now, but they will hopefully be drawn to the caveats outlined above.
How found
Validating and documenting new features in EF Core 6.0.
Regression
No.
Testing
N/A
Risk
Low. The change marks the constructors that enable this as internal, but doesn't change them. We also make sure that none of our built-in converters use this feature.