Skip to content

Fix crash in DOTNET_SYSTEM_GLOBALIZATION_INVARIANT mode#8738

Merged
JaynieBai merged 1 commit intodotnet:mainfrom
mfilippov:mf-crash-fix
May 10, 2023
Merged

Fix crash in DOTNET_SYSTEM_GLOBALIZATION_INVARIANT mode#8738
JaynieBai merged 1 commit intodotnet:mainfrom
mfilippov:mf-crash-fix

Conversation

@mfilippov
Copy link
Copy Markdown
Contributor

Context

If DOTNET_SYSTEM_GLOBALIZATION_INVARIANT is enabled and console codepage non-ANSI MSBuild will crash on an attempt to create CultureInfo:

Unhandled exception. System.Globalization.CultureNotFoundException: Only the invariant culture is supported in globalization-invariant mode. See https://aka.ms/GlobalizationInvariantMode for more information. (Parameter 'name')
en-US is an invalid culture identifier.

Changes Made

Keep the current thread culture the same if CurrentUICulture is Invariant.

@JanKrivanek
Copy link
Copy Markdown
Member

FYI @nagilson (currently touching the MSBuild i18n in #8503)

Copy link
Copy Markdown
Member

@JanKrivanek JanKrivanek left a comment

Choose a reason for hiding this comment

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

Looks good to me - thanks!

Copy link
Copy Markdown
Member

@rainersigwald rainersigwald left a comment

Choose a reason for hiding this comment

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

I do not remember all the subtleties here but this looks like it's good to me.

@nagilson
Copy link
Copy Markdown
Member

nagilson commented May 9, 2023

FYI @nagilson (currently touching the MSBuild i18n in #8503)

Thanks for the ping, this shouldnt have any conflicts or issues with that change to my expectation

@JanKrivanek JanKrivanek added the merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now. label May 10, 2023
@JaynieBai JaynieBai merged commit 7f4bef8 into dotnet:main May 10, 2023
@mfilippov mfilippov deleted the mf-crash-fix branch May 10, 2023 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants