-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Open
matouskozak
wants to merge
2
commits into
dotnet:release/9.0-staging
Choose a base branch
from
matouskozak:backport9.0/fix-indexOf-empty-strings
base: release/9.0-staging
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[release/9.0-staging][iOS][globalization] Fix IndexOf on empty strings on iOS to return -1 #112012
matouskozak
wants to merge
2
commits into
dotnet:release/9.0-staging
from
matouskozak:backport9.0/fix-indexOf-empty-strings
+23
−11
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tagging subscribers to this area: @dotnet/area-system-globalization |
tarekgh
approved these changes
Jan 30, 2025
vitek-karas
approved these changes
Jan 30, 2025
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
This was referenced Jan 31, 2025
Open
Open
ilonatommy
approved these changes
Feb 3, 2025
6 tasks
jeffschwMSFT
approved these changes
Feb 3, 2025
There was a problem hiding this 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
3 tasks
/ba -g the timeout on CoreCLR Windows x64 Debug is not related to this change |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Customers using
CompareInfo.IndexOf
orstring.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
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
orstring.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.