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 value generation with converter between different numeric types #29601

Merged
merged 1 commit into from
Nov 19, 2022

Conversation

ajcvickers
Copy link
Member

Fixes #29406

The value generator selection was returning a generator for the converted type, when a value for the non-converted type should have been used.

@ajcvickers ajcvickers requested a review from a team November 17, 2022 16:59
Fixes #29406

The value generator selection was returning a generator for the converted type, when a value for the non-converted type should have been used.
generator = TryCreate();
if (generator != null)
{
return generator;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When does this path get used? Wouldn't it result in the same exception?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because this path is used when the generator is being created for the converted value--for example, when an int is wrapped in a class. For that path, the generator is used WithConverter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smells like bad coupling. I think there could be more issues hiding here. This makes #25926 more useful.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is. I started down the rabbit hole of changing the signature here, but it was quite breaking, and so went for this fix for now. It may be worth revisiting.

@ajcvickers ajcvickers merged commit 3579d25 into main Nov 19, 2022
@ajcvickers ajcvickers deleted the NotMyType1115 branch November 19, 2022 10:27
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.

HasConversion is not used in the provider value comparer
2 participants