-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CSHARP-5564: Enum with ushort underlying type is not serialized correctly #1847
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
base: main
Are you sure you want to change the base?
Conversation
|
Note to reviewers: while reviewing this PR consider not only the fix that was made but also whether there is danger of unintended side effects that we have not detected with our existing tests. |
| { | ||
| throw new ArgumentException($"{typeof(TEnumUnderlyingType).FullName} is not the underlying type of {typeof(TEnum).FullName}."); | ||
| } | ||
| if (typeof(TIntegralType) != typeof(int) && typeof(TIntegralType) != typeof(long) && typeof(TIntegralType) != typeof(uint) && typeof(TIntegralType) != typeof(ulong)) |
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.
What about byte?
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.
BTW, can we use IsIntegral method here?
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.
Done
|
|
||
| public static bool IsIntegral(this Type type) | ||
| { | ||
| return type == typeof(int) || type == typeof(long) || type == typeof(uint) || type == typeof(ulong); |
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.
What about byte?
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.
Modified to add all integral types.
No description provided.