Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/9.0-staging][iOS][globalization] Fix IndexOf on empty strings on iOS to return -1 #112012

Conversation

matouskozak
Copy link
Member

@matouskozak matouskozak commented Jan 30, 2025

Manual backport of #111898.

Fix incorrect return condition for iOS IndexOf implementation and add test case for IndexOf("", <something>) and "".Contains(<something>). Clean-up of some styling issues and adding comments.

Customer Impact

  • Customer reported
  • Found internally

Customers using CompareInfo.IndexOf or string.Contains APIs on empty source strings involving ICU logic are returning a result 0 (indicates found at index 0) instead of -1 (indicates not found).

Some of the issues reported by customers:

Regression

  • Yes
  • No

The regression was introduced in #86895 and initially limited to when hybrid globalization is enabled. However, in .NET 9, we switched fully to Apple native globalization APIs (initially also referred to as hybrid globalization), thus spreading this issue to all iOS Globalization code using the IndexOf API.

Testing

Previously there were no test cases for this code path. This PR adds test scenarios for both CompareInfo.IndexOf or string.Contains.

Risk

Low

This change is correcting previously incorrect behavior. It is unlikely that .NET 9 iOS customers are depending on this new behavior as it is fundamentally incorrect as per .net doc.

@tarekgh tarekgh added the Servicing-consider Issue for next servicing release review label Jan 30, 2025
@tarekgh tarekgh added this to the 9.0.3 milestone Jan 30, 2025
@matouskozak
Copy link
Member Author

/azp run runtime-extra-platforms

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@jeffschwMSFT jeffschwMSFT left a comment

Choose a reason for hiding this comment

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

lgtm. we will take for consideration in 9.0.x

@jeffschwMSFT jeffschwMSFT modified the milestones: 9.0.3, 9.0.x Feb 3, 2025
@matouskozak
Copy link
Member Author

/ba -g the timeout on CoreCLR Windows x64 Debug is not related to this change

@rbhanda rbhanda modified the milestones: 9.0.x, 9.0.3 Feb 4, 2025
@rbhanda rbhanda added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Feb 4, 2025
@matouskozak
Copy link
Member Author

/azp run runtime-extra-platforms

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@matouskozak
Copy link
Member Author

matouskozak commented Feb 11, 2025

I had to disable the newly added test for wasm hybrid globalization due to an incorrect output 551ba2e (fyi: @ilonatommy) Rerunning the CI to confirm there is nothing else related. @jeffschwMSFT

@matouskozak
Copy link
Member Author

The timeouts on osx-arm64 Release NativeAOT* jobs are not related and are already present on rolling-builds, e.g. https://dev.azure.com/dnceng-public/public/_build/results?buildId=947948&view=results.

@matouskozak
Copy link
Member Author

The runtime-extra-platforms failures are not related to this PR.

@matouskozak
Copy link
Member Author

/ba-g timeouts are not related to this PR

@matouskozak matouskozak merged commit 0eef239 into dotnet:release/9.0-staging Feb 13, 2025
189 of 206 checks passed
@akoeplinger akoeplinger modified the milestones: 9.0.3, 9.0.4 Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Globalization os-ios Apple iOS Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants