Skip to content

[release/11.0] Fix paired span sorting with struct comparers - #136614

Merged
ViveliDuCh merged 1 commit into
release/11.0from
backport/pr-136333-to-release/11.0
Nov 10, 2026
Merged

ViveliDuCh merged 1 commit into
release/11.0from
backport/pr-136333-to-release/11.0

Conversation

@github-actions

@github-actions github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #136333 to release/11.0

/cc @jkotas @xgbtxy

Customer Impact

  • Customer reported
  • Found internally

MemoryExtensions.Sort<TKey, TValue, TComparer> overload does not produce sorted output in some situations

Regression

  • Yes
  • No

Introduced by #116109

Testing

Targeted regression test

Risk

Low

The paired span specialization for a concrete struct comparer selects a
median pivot but starts partitioning without moving it to `hi - 1`. Even
already sorted keys `0..16` can become `0..7, 15, 8..14, 16`.

Restore the paired pivot exchange identified in the issue, matching the
neighboring partitioners. The regression explicitly selects the
value-type comparer overload and checks both keys and their associated
items at lengths 16, 17, and 499 with ascending and reversed input.

Resolves #136274

> [!NOTE]
> This change, its tests, and this description were prepared with Codex
and are AI-generated.
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@jkotas

jkotas commented Oct 29, 2026

Copy link
Copy Markdown
Member

@eiriktsarpalis Could you please take this through the libraries servicing process?

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

@eiriktsarpalis
eiriktsarpalis requested a review from artl93 November 4, 2026 12:25
@eiriktsarpalis eiriktsarpalis added the Servicing-consider Issue for next servicing release review label Nov 4, 2026

@artl93 artl93 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Regression. Approved.

@eiriktsarpalis eiriktsarpalis added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Nov 4, 2026
@eiriktsarpalis

Copy link
Copy Markdown
Member

Approved over email

@eiriktsarpalis

Copy link
Copy Markdown
Member

/ba-g test failures unrelated

@ViveliDuCh
ViveliDuCh merged commit aaa5a0a into release/11.0 Nov 10, 2026
157 of 164 checks passed
@ViveliDuCh
ViveliDuCh deleted the backport/pr-136333-to-release/11.0 branch November 10, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Memory Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants