Skip to content

Conversation

@ViveliDuCh
Copy link
Member

Fixes @dotnet/runtime/issues/119901

Ports the null-checking logic for SpanHelpers<T>.SequenceEqual from the core runtime implementation to the System.Memory package, ensuring correct handling of nullable reference types and preventing NullReferenceException when comparing arrays with nulls.

@ViveliDuCh ViveliDuCh requested a review from jozkee October 2, 2025 22:47
@ViveliDuCh ViveliDuCh requested a review from a team as a code owner October 2, 2025 22:47
Copy link
Member

@jozkee jozkee left a comment

Choose a reason for hiding this comment

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

  • dotnet/coreclr#21232 was addressing null refs for more than just SequenceEqual, I think those will need to be addressed too.
  • Can you please also include tests?

…Update dataset expectations for some null reference scenarios where applicable in this repo.
@ViveliDuCh ViveliDuCh requested a review from jozkee October 9, 2025 18:45
@tarekgh
Copy link
Member

tarekgh commented Oct 9, 2025

dotnet/coreclr#21232 was addressing null refs for more than just SequenceEqual, I think those will need to be addressed too.

I see the rest is added. Only public unsafe static bool Contains<T>(ref T searchSpace, T value, int length) existed in the runtime but not exist here. Just mentioning that for clarity and no action is needed.

Copy link
Member

@tarekgh tarekgh left a comment

Choose a reason for hiding this comment

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

Added little comments/questions. LGTM, otherwise.

@ViveliDuCh ViveliDuCh merged commit 1be7a95 into dotnet:main Oct 10, 2025
5 checks passed
@ViveliDuCh ViveliDuCh deleted the null-issue branch October 10, 2025 18:34
@ViveliDuCh ViveliDuCh restored the null-issue branch October 10, 2025 21:36
@ViveliDuCh ViveliDuCh self-assigned this Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SequenceEqual throws NullReferenceException

6 participants