Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UseDefaultOnConversionFailure behavior for nullable types #2275

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

twinee
Copy link

@twinee twinee commented Jul 23, 2024

Setting null as the default value for a member with a nullable type with UseDefaultOnConversionFailure set to true will not use that default value when a conversion failure occurs, but throws a TypeConverterException instead. This is unintuitive behavior and seems like a bug.

This code fixes the type comparison when the default value is set to null so that the code behaves like one would expect.

discussion
Closes #2156

@twinee twinee force-pushed the patch-1 branch 4 times, most recently from 363f6a8 to f54ad33 Compare October 21, 2024 15:03
…fault value is null

Setting a default value for a member with a nullable type with `UseDefaultOnConversionFailure` set to `true` will not use that default value when a conversion failure occurs, but throws a `TypeConverterException` instead. This is intuitive behavior and seems like a bug.

This code fixes the type comparison when the default value is set to `null` so that the code behaves like one would expect.

[discussion](JoshClose#2156 (comment))
closes JoshClose#2156
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default value not used when useOnConversionFailure: true on nullable properties
2 participants