-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Catch exception in TryConvertTo [updated] #39649
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
Conversation
Add test cases for trying to convert valid and invalid GUID values. Catch exception in TryConvertTo Catch when the converter throws an exception and return false and set the out value to default. Change to Guid specific Converter Remove try/catch added in TryConvertTo and replace with Guid Converter Add case for Nullable Guid Add tests for NullableGuid Fix NullableGuid parse reflect a null as parsed
| { | ||
| parser = ConvertToGuid; | ||
| } | ||
| else if (typeof(T) == typeof(Guid?)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kinda unrelated - I imagine this block of code would look a lot nicer as a switch expression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, probably. This code predates switch expressions. Keeping this out-of-scope for the PR though.
|
Hello @SteveSandersonMS! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
* Add test for TryConvertTo for GUID type Add test cases for trying to convert valid and invalid GUID values. Catch exception in TryConvertTo Catch when the converter throws an exception and return false and set the out value to default. Change to Guid specific Converter Remove try/catch added in TryConvertTo and replace with Guid Converter Add case for Nullable Guid Add tests for NullableGuid Fix NullableGuid parse reflect a null as parsed * Update src/Components/Components/test/BindConverterTest.cs Co-authored-by: Jeff Layton <[email protected]>
This is a continuation of #33594. I had to create a new PR because the original one was no longer mergeable and further tweaks were needed.