-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Fix delegate allocation in CachingContext.GetOrAddJsonTypeInfo #80437
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
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsFixes #80430
|
...braries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.Caching.cs
Outdated
Show resolved
Hide resolved
@@ -156,11 +156,14 @@ internal void ClearCaches() | |||
internal sealed class CachingContext | |||
{ | |||
private readonly ConcurrentDictionary<Type, JsonTypeInfo?> _jsonTypeInfoCache = new(); | |||
private readonly Func<Type, JsonTypeInfo?> _jsonTypeInfoFactory; |
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.
consider adding comment why we're doing this (it's one of the things I'd personally by default choose shorter code)
Thanks! Know when this will be released? (Just so I know when to watch out for it) |
It should be available in the first preview release of .NET 8. @stephentoub @ericstj do you think this meets the bar for servicing? The issue would impact performance in applications that make heavy use of polymorphism. |
/backport to release/7.0 |
Started backporting to release/7.0: https://github.com/dotnet/runtime/actions/runs/3895615065 |
@eiriktsarpalis backporting to release/7.0 failed, the patch most likely resulted in conflicts: $ git am --3way --ignore-whitespace --keep-non-patch changes.patch
Applying: Fix delegate allocation in CachingContext.GetOrAddJsonTypeInfo
Applying: Address PR feedback
error: sha1 information is lacking or useless (src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.Caching.cs).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0002 Address PR feedback
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
@eiriktsarpalis an error occurred while backporting to release/7.0, please check the run log for details! Error: git am failed, most likely due to a merge conflict. |
…t#80437) * Fix delegate allocation in CachingContext.GetOrAddJsonTypeInfo * Address PR feedback
…ypeInfo (#80513) * Fix delegate allocation in CachingContext.GetOrAddJsonTypeInfo (#80437) * Fix delegate allocation in CachingContext.GetOrAddJsonTypeInfo * Address PR feedback * Ensure CachingContext.Options isn't being trimmed away. * Update servicing version Co-authored-by: Stephen Toub <[email protected]>
Fixes #80430
Allocation regression from #71746