Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[iOS] Implement IgnoreSymbols for CompreInfo in managed code#120462

Merged
matouskozak merged 15 commits into
dotnet:mainfrom
matouskozak:managed-apple-ignoresymbols
Oct 15, 2025
Merged

[iOS] Implement IgnoreSymbols for CompreInfo in managed code#120462
matouskozak merged 15 commits into
dotnet:mainfrom
matouskozak:managed-apple-ignoresymbols

Conversation

@matouskozak

@matouskozak matouskozak commented Oct 7, 2025

Copy link
Copy Markdown
Member

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
Copy Markdown
Member Author

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@tarekgh

tarekgh commented Oct 12, 2025

Copy link
Copy Markdown
Member

/azp run runtime-ioslike

@azure-pipelines

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.iOS.cs Outdated
Comment thread src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.iOS.cs Outdated
@matouskozak

Copy link
Copy Markdown
Member Author

/azp run runtime-maccatalyst,runtime-ioslikesimulator

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@matouskozak

Copy link
Copy Markdown
Member Author

/azp run runtime-maccatalyst

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@dotnet dotnet deleted a comment from azure-pipelines Bot Oct 13, 2025
@matouskozak

Copy link
Copy Markdown
Member Author

/azp run runtime-maccatalyst

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@matouskozak

Copy link
Copy Markdown
Member Author

/azp run runtime-ioslike

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@matouskozak

Copy link
Copy Markdown
Member Author

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

@tarekgh tarekgh 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.

Added one comment/question. LGTM otherwise.

@matouskozak matouskozak merged commit 9d4c65d into dotnet:main Oct 15, 2025
182 of 196 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 14, 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.

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

3 participants