Skip to content

Conversation

matouskozak
Copy link
Member

@matouskozak matouskozak commented Oct 7, 2025

Supersedes #118523.

Implementation of CompareOptions.IgnoreSymbols for IndexOf, IsPrefix, IsSuffix, Compare on iOS. Because ObjectiveC string APIs (https://developer.apple.com/documentation/foundation/nsstring/compareoptions?language=objc) don't provide a direct alternative to IgnoreSymbols option, we filter the symbols from the strings in the managed code and after returning from native, we re-calculate the original index and length.

The implementation works in a following:

  1. Preprocess the source and search strings by removing the symbols.
  2. Invoke the native API for comparison.
  3. Map the range from preprocessed source string back to the original string to get the index and length.

Fixes #111895

@tarekgh tarekgh added this to the 11.0.0 milestone Oct 7, 2025
@matouskozak matouskozak changed the title Implement IgnoreSymbols for CompreInfo in managed code for iOS [iOS] Implement IgnoreSymbols for CompreInfo in managed code Oct 7, 2025
@matouskozak
Copy link
Member Author

/azp run runtime-extra-platforms

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tarekgh
Copy link
Member

tarekgh commented Oct 12, 2025

/azp run runtime-ioslike

Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

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 implements support for the CompareOptions.IgnoreSymbols option in CompareInfo operations on iOS using hybrid globalization. Previously, this option was not supported on Apple platforms and would throw exceptions.

  • Adds native implementation for symbol filtering in managed code for iOS
  • Updates test cases to enable IgnoreSymbols tests on Apple platforms
  • Modifies native enum definition to use explicit types and hex values

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

File Description
src/native/libs/System.Globalization.Native/pal_collation.m Updates enum definition to use explicit int32_t type and hex values
src/libraries/System.Runtime/tests/System.Globalization.Tests/CompareInfo/*.cs Removes platform-specific test exclusions and adds comprehensive IgnoreSymbols test cases
src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.iOS.cs Implements IgnoreSymbols functionality with symbol filtering buffer and character categorization
src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.Icu.cs Updates method signatures to use ReadOnlySpan parameters instead of raw pointers

@matouskozak
Copy link
Member Author

/azp run runtime-maccatalyst,runtime-ioslikesimulator

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@matouskozak
Copy link
Member Author

/azp run runtime-maccatalyst

Copy link

No pipelines are associated with this pull request.

@dotnet dotnet deleted a comment from azure-pipelines bot Oct 13, 2025
@matouskozak
Copy link
Member Author

/azp run runtime-maccatalyst

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@matouskozak
Copy link
Member Author

/azp run runtime-ioslike

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@matouskozak
Copy link
Member Author

The failures on Apple mobile are unrelated to this PR and are already known.

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 one comment/question. LGTM otherwise.

@matouskozak matouskozak merged commit 9d4c65d into dotnet:main Oct 15, 2025
182 of 196 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS][globalization] Implement IgnoreSymbols compare option for string collation APIs on iOS

3 participants