Skip to content

Check for Windows NLS vs. ICU behavior differences in Globalization tests #6034

Closed

Description

@lbussell

Nano Server 2025 does not include ICU by default.

When ICU is missing on Linux, Globalization Invariant Mode is disabled, and you try to use globalization features, the .NET Runtime throws an exception.

In the same scenario on Windows, instead of throwing an error, the Runtime falls back to using Windows' NLS (National Language Support) feature. This has some breaking changes which are documented here: https://learn.microsoft.com/en-us/dotnet/core/extensions/globalization-icu

We should check for those breaking changes in the recently added globalization test scenario.


Related Issues: #5944, #5635

The following table summarizes my best understanding of the .NET Runtime's behavior under different globalization scenarios:

OS ICU Present Invariant Mode Behavior when using globalization features
Linux ✅ ✅ Exception (expected)
Linux ✅ ❌ Works as expected
Linux ❌ ✅ Exception (expected)
Linux ❌ ❌ Exception - I consider this scenario a misconfiguration
--- --- --- ---
Windows ✅ ✅ Exception (expected)
Windows ✅ ❌ Works as expected
Windows ❌ ✅ Exception (expected)
Windows ❌ ❌ Falls back to NLS behavior!

Activity

  1. moved this from Backlog to Post Release in .NET Dockeron Nov 11, 2024
  2. moved this from Post Release to Current Release in .NET Dockeron Nov 13, 2024
  3. ericstj commented on Nov 14, 2024

    @ericstj
    Member

    @tarekgh to weigh in,

    This is intentional. The windows build of .NET works on older OSes where ICU is absent and our customers expect it to use NLS.

    I guess you're saying you'd prefer that we would have made it more breaking by not falling back to NLS on an OS version where we expect ICU to be present, unless the customer specifically told us to use NLS with the switch?

  4. MichaelSimons commented on Nov 14, 2024

    @MichaelSimons
    Member

    I guess you're saying you'd prefer that we would have made it more breaking by not falling back to NLS on an OS version where we expect NLS to be present, unless the customer specifically told us to use NLS with the switch?

    Can you clarify if this is even a supported/tested scenario? e.g. NLS fallback on an modern OS like nanoserver 2025 where the globalization FOD is not installed by default?

  5. tarekgh commented on Nov 14, 2024

    @tarekgh
    Member

    Comments on the table above:

    • Behavior when using globalization features: This title needs some clarification, particularly when Globalization Invariant mode is enabled.

      • When using the Invariant culture and the Invariant mode is on, most scenarios will not throw exceptions but will exhibit specific behaviors. For instance, string comparisons will be ordinal rather than linguistic. Additional details about Invariant mode can be found in the documentation.
      • When other cultures are used when Invariant mode is on, an exception is typically expected by default. However, this behavior can be adjusted with a configuration switch that allows the creation of any culture, though all created cultures will still behave like the Invariant culture.
    • On Windows systems: Even when ICU is available and Invariant mode is turned off, users can switch to NLS by setting the appropriate configuration switch.

    • App-local ICU: Apps have the option to use ICU app-local, enabling them to manage globalization independently from the OS by carrying their own version of ICU.

    The only scenario that is not supported which you called it misconfiguration is when ICU is missing on non-Windows platforms and the Invariant mode is not enabled.

    Can you clarify if this is even a supported/tested scenario? e.g. NLS fallback on an modern OS like nanoserver 2025 where the globalization FOD is not installed by default?

    .NET ensures that applications follow OS behavior. So, if ICU is available on Windows, the app will use ICU by default. If ICU is not present, the app will revert to the default globalization behavior, similar to native applications.

  6. tarekgh commented on Nov 14, 2024

    @tarekgh
    Member

    Some clarification, on nanoserver 2025 I didn't check if NLS APIs will still be available to call and only trimming the data. I'll try to find out that.

  7. lbussell commented on Nov 14, 2024

    @lbussell
    MemberAuthor

    @ericstj I think you meant:

    I guess you're saying you'd prefer that we would have made it more breaking by not falling back to NLS on an OS version where we expect ICU to be present, unless the customer specifically told us to use NLS with the switch?

    If that's the case, then yes that's the question we're asking. If ICU is the forward-looking globalization approach for Windows, then we are wondering if we should reconsider the Runtime's behavior for this scenario (for new Windows versions). I think all other Windows versions since ICU was added all have ICU. Except now NanoServer 2025.

    We are inclined to turn globalization invariant mode on by default for this image, so that we avoid users sliently encountering breaking changes when migrating from NanoServer 2022 to 2025 images and not realizing they're using NLS. Then we would provide instructions for installing ICU and enabling globalization.

  8. richlander commented on Nov 15, 2024

    @richlander
    Member

    Let's assume we ship images w/o ICU installed and w/o GIVM enabled. Do we need to warn or just inform users about this choice? That's the key question.

  9. tarekgh commented on Nov 15, 2024

    @tarekgh
    Member

    Do we have the option to install ICU on such image?

  10. richlander commented on Nov 15, 2024

    @richlander
    Member

    Yes! That's one of the options and is my preference. We need to find out the size impact for that.

    It would be good to get an answer to the question I asked. Some of this thread is operating on the premise that NLS behavior is different/worse and that we'd need to warn people about that. I want to determine if that is true.

  11. 16 remaining items

  12. lbussell commented on Nov 22, 2024

    @lbussell
    MemberAuthor

    @richlander is the ask here then to more generally validate the entire runtime on Nano Server 2025? I've lost track of the next steps since this started as a specific globalization issue, but now it seems broader. I'd like to make sure we're on the same page and not repeating efforts others are already doing, or putting in more resources to this specific case than we do for other platforms.

    The best way to scout these things is if we have a helix queue to add work to - we can then schedule a build sending work to that queue.

    This will be blocked on Add Windows 2025 support to Helix (dotnet/dnceng#4170).

    We can produce Nano Server 2025 Helix container images from buildtools-prereqs, but it won't matter if we don't have a Server Core 2025 queue to run them on, if I understand correctly how Helix works.

    /cc @ilyas1974

  13. ericstj commented on Nov 22, 2024

    @ericstj
    Member

    How are folks testing on Server Core 2025 right now? Just building locally and running tests? VMs? Any instructions that could be shared - maybe we can get someone to scout the library tests.

  14. lbussell commented on Nov 22, 2024

    @lbussell
    MemberAuthor

    We are running the .NET Docker tests which aren't very comprehensive. I don't know any other teams that are running tests on 2025. There is one 2025 ARM queue for some reason. But no AMD64: dotnet/dnceng#3343.

    I proposed in my PR that we ship the nightly .NET images now to better facilitate testing while we wait on Helix queues. These images are functional, but we just want to understand the nuances of the globalization changes better. #5944

  15. tarekgh commented on Nov 24, 2024

    @tarekgh
    Member

    but we just want to understand the nuances of the globalization changes better.

    I already talked to Windows team and the behavior should be clear now. nano-server 2025 will work as nano-server-2022 which will use NLS. Both are not installing ICU till now. Only changes can be noticed when Windows updates the locale data, which usually happens almost with every release. Let me know if you have any more questions regarding globalization I can help with.

  16. richlander commented on Nov 24, 2024

    @richlander
    Member

    Thanks. I think that is good enough. We have been so used to ICU at this point, that an NLS scenario seemed unique and different. Seems like we should move forward treating this as just another version upgrade.

    Thanks for reaching out to the Windows team and helping us better understand the situation.

  17. lbussell commented on Nov 25, 2024

    @lbussell
    MemberAuthor

    @tarekgh, so the presence or absence of Windows.Globalization.dll should not affect .NET's behavior?

  18. tarekgh commented on Nov 25, 2024

    @tarekgh
    Member

    so the presence or absence of Windows.Globalization.dll should not affect .NET's behavior?

    That is correct, .NET don't depend on this library. This library is used by WinRT which we are not calling for globalization.

  19. lbussell commented on Nov 26, 2024

    @lbussell
    MemberAuthor

    .NET images for Server 2025 are now published from our nightly branch (not supported for production yet). Can @tarekgh or @ericstj do any testing with these images to validate @tarekgh's claims here?

    • mcr.microsoft.com/dotnet/nightly/runtime:9.0-nanoserver-ltsc2025
    • mcr.microsoft.com/dotnet/nightly/aspnet:9.0-nanoserver-ltsc2025
    • mcr.microsoft.com/dotnet/nightly/sdk:9.0-nanoserver-ltsc2025
  20. tarekgh commented on Nov 26, 2024

    @tarekgh
    Member

    @lbussell I smoke tested the SDK image and I can confirm NLS is used successfully there and behave as expected.

  21. richlander commented on Nov 27, 2024

    @richlander
    Member

    Thanks much!

  22. self-assigned this
    on Dec 16, 2024
  23. moved this from Sprint to In Progress in .NET Dockeron Dec 18, 2024
  24. lbussell commented on Jan 7, 2025

    @lbussell
    MemberAuthor

    Tests were added in #6120.

  25. moved this from In Progress to Done in .NET Dockeron Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions