Skip to content

Conversation

@SteveSandersonMS
Copy link
Member

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.

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
@SteveSandersonMS SteveSandersonMS added the area-blazor Includes: Blazor, Razor Components label Jan 20, 2022
@SteveSandersonMS SteveSandersonMS requested a review from a team January 20, 2022 11:12
{
parser = ConvertToGuid;
}
else if (typeof(T) == typeof(Guid?))
Copy link
Contributor

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.

Copy link
Member Author

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.

@ghost
Copy link

ghost commented Jan 21, 2022

Hello @SteveSandersonMS!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

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 (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit cb80a40 into main Jan 21, 2022
@ghost ghost deleted the pr/33594 branch January 21, 2022 15:41
ShreyasJejurkar pushed a commit to ShreyasJejurkar/aspnetcore that referenced this pull request Jan 22, 2022
* 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 pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants