Skip to content

Conversation

PranavSenthilnathan
Copy link
Member

Attempt to fix #118172

Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

@PranavSenthilnathan
Copy link
Member Author

@EgorBot -windows_x64 --filter "System.Text.Json.Tests.Perf_Get.GetGuid"

@PranavSenthilnathan
Copy link
Member Author

This change is worth taking even if it doesn't improve perf since the check is unnecessary and does not follow the same pattern as other types. Marking as ready for review.

@PranavSenthilnathan PranavSenthilnathan marked this pull request as ready for review August 5, 2025 22:45
@Copilot Copilot AI review requested due to automatic review settings August 5, 2025 22:45
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes an unnecessary length check in the TryGetGuidCore method within the Utf8JsonReader.TryGet.cs file, specifically targeting issue #118172. The change simplifies the GUID parsing logic by eliminating a redundant validation that was checking if the escaped GUID length exceeds the maximum allowed length.

Key Changes

  • Removed the length validation check against JsonConstants.MaximumEscapedGuidLength in the GUID parsing path
  • Streamlined the code flow by eliminating an early return condition
Comments suppressed due to low confidence (1)

src/libraries/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.TryGet.cs:1354

  • The removal of the length check means that extremely long strings will now be processed by subsequent GUID parsing logic. This behavior change should be covered by tests to ensure that oversized inputs are handled correctly by the downstream parsing code.
                span = ValueSpan;

@PranavSenthilnathan PranavSenthilnathan merged commit 8fdfa4f into dotnet:main Aug 7, 2025
81 checks passed
@PranavSenthilnathan PranavSenthilnathan deleted the fix-guid-perf branch August 7, 2025 06:17
@github-actions github-actions bot locked and limited conversation to collaborators Sep 6, 2025
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.

[Perf] System.Text.Json.Tests.Perf_Get Regression on 7/22/2025 8:55:52 AM +00:00
2 participants