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

Use Type.GetTypeCode() instead of private extension #57540

Conversation

StephenMolloy
Copy link
Member

Use Type.GetTypeCode instead of private extension.

In the 1.0 days, Type.GetTypeCode() did not exist. So we created our
own extension method and used that. Now that this method exists
in .Net Core again, we should use the framework version instead
of our own. Doing so fixes edge case issues like #53553.

Also, while adding a test that checks for the regression
reported in #53553, I found that the reflection-based serializer
was taking a logically different approach to serialization when
writing out an enum (or array) that has been cast down (to object
in this case.) This PR also brings the reflection-based serializer
in line with how the refemit logic.

Fixes #53553

@StephenMolloy StephenMolloy merged commit 078af6b into dotnet:main Aug 17, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Sep 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

XmlSerializer serialization of enum differs from .NET Framework (crashes)
2 participants