Skip to content

Conversation

@jkotas
Copy link
Member

@jkotas jkotas commented Jan 27, 2026

Reverts #122116

Investigating #123667

@jkotas
Copy link
Member Author

jkotas commented Jan 27, 2026

rt-sz report MichalStrehovsky/rt-sz#203

@tarekgh tarekgh added this to the 11.0.0 milestone Jan 27, 2026
@MihaZupan
Copy link
Member

NativeAOT failures were not all timeouts

Sorry about that.
Would the acceptable alternative be to introduce a dedicated non-generic struct just for this call? Seems unfortunate we'd have to avoid tuple syntax like this.

@jkotas
Copy link
Member Author

jkotas commented Jan 28, 2026

Would the acceptable alternative be to introduce a dedicated non-generic struct just for this call?

It is one of the strategies that we have used in other similar situations to avoid the code bloat.

For this specific case, we have 30+ places where we do string allocation using unsafe FastAllocateString in core globalization and formatting routines to avoid the code bloat and other overheads from the safe variant. I do not think we need to go out of our way to avoid the unsafe code for this one. We should aim to have a solution that scales without introducing regressions for majority of places that use FastAllocateString. The solution likely includes #85014 . cc @EgorBo

@jkotas jkotas marked this pull request as ready for review January 28, 2026 02:32
Copilot AI review requested due to automatic review settings January 28, 2026 02:32
Copy link
Contributor

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 reverts PR #122116 which reduced unsafe usage in TextInfo.cs. The revert is being done to investigate a NativeAOT binary size regression on osx-x64 (issue #123667), where the size increased from ~1.5MB to 1.551MB, causing size tests to fail.

Changes:

  • Reverts ToLowerAsciiInvariant(string) method from safe span-based implementation using string.Create back to unsafe pointer-based implementation using fixed statements and manual pointer arithmetic

@jkotas jkotas merged commit 46786f7 into main Jan 28, 2026
105 of 151 checks passed
@jkotas jkotas deleted the revert-122116-levib/reduce_unsafe_globalization branch January 28, 2026 04:09
@akoeplinger
Copy link
Member

FYI the original PR made it into 11.0-preview1 so we'd need to backport if we think it should be fixed there.

@jkotas
Copy link
Member Author

jkotas commented Jan 28, 2026

@akoeplinger I do not see this PR in preview1 branch https://github.com/dotnet/runtime/blob/release/11.0-preview1/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs

However, I do see the other reverted PR (#123307) in preview1 branch. It needs to be reverted there.

@akoeplinger
Copy link
Member

akoeplinger commented Jan 28, 2026

@jkotas ah yeah, I got confused because the original PR was linked in dotnet/dotnet#4440 but we found out that the wrong build from main was flown accidentally so the runtime repo was reset in dotnet/dotnet#4454 (which reverted that change)

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.

5 participants