-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 VeryLargeAmountOfEnumsToSerialize test #37710
Conversation
src/libraries/System.Text.Json/tests/Serialization/EnumConverterTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/Serialization/EnumConverterTests.cs
Show resolved
Hide resolved
Parallel.For(0, 8, i => JsonSerializer.Serialize((MyEnum)(46 + i), options)); | ||
|
||
// Write the remaining enum values. We should not store any more values in | ||
// the cache. If we do, we may throw OutOfMemoryException on some machines. |
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.
Perhaps clarify a bit that the OutOfMemoryException would be thrown if we didn't have a cap on the dictionary.
// Write the remaining enum values. The cache is capped to avoid OutOfMemoryException due
// to having too many cached items.
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.
Will update the comment in #37720 (to avoid CI reset).
|
||
// Write the remaining enum values. We should not store any more values in | ||
// the cache. If we do, we may throw OutOfMemoryException on some machines. | ||
for (int i = 54; i <= MaxValue; i++) |
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.
How long does this test take?
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.
It takes ~6.75s on my machine (which would be ~20% of total test time if it were not outer-loop).
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.
Thanks for fixing it.
Fixes #37471. Follow up for #36726.