Skip to content

Conversation

@tarekgh
Copy link
Member

@tarekgh tarekgh commented Feb 16, 2022

PerformanceCounter's was creating culture objects using LCID. When running with Globalization Invariant Mode, it is not allowed to create any culture using LCID. Also, if the switch DOTNET_SYSTEM_GLOBALIZATION_PREDEFINED_CULTURES_ONLY is set to true there, it will not allow creating any culture even using culture names except the Invariant culture. That means PerformanceCounter library will not be usable at all when enabling the Globalization Invariant Mode.

The fix here is to allow running PerformanceCounter with the Globalization Invariant Mode and always report counters matching the English language at that time.

@ghost
Copy link

ghost commented Feb 16, 2022

Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti, @safern
See info in area-owners.md if you want to be subscribed.

Issue Details

PerformanceCounter's was creating culture objects using LCID. When running with Globalization Invariant Mode, it is not allowed to create any culture using LCID. Also, if the switch DOTNET_SYSTEM_GLOBALIZATION_PREDEFINED_CULTURES_ONLY is set to true there, it will not allow creating any culture even using culture names except the Invariant culture. That means PerformanceCounter library will not be usable at all when enabling the Globalization Invariant Mode.

The fix here is to allow running PerformanceCounter with the Globalization Invariant Mode and always report counters matching the English language at that time.

Author: tarekgh
Assignees: -
Labels:

area-System.Diagnostics.Tracing

Milestone: -

@ghost
Copy link

ghost commented Feb 16, 2022

Tagging subscribers to this area: @dotnet/area-system-diagnostics-performancecounter
See info in area-owners.md if you want to be subscribed.

Issue Details

PerformanceCounter's was creating culture objects using LCID. When running with Globalization Invariant Mode, it is not allowed to create any culture using LCID. Also, if the switch DOTNET_SYSTEM_GLOBALIZATION_PREDEFINED_CULTURES_ONLY is set to true there, it will not allow creating any culture even using culture names except the Invariant culture. That means PerformanceCounter library will not be usable at all when enabling the Globalization Invariant Mode.

The fix here is to allow running PerformanceCounter with the Globalization Invariant Mode and always report counters matching the English language at that time.

Author: tarekgh
Assignees: tarekgh
Labels:

area-System.Diagnostics.PerformanceCounter

Milestone: -

@tarekgh
Copy link
Member Author

tarekgh commented Feb 16, 2022

@carlossanlop could you please help reviewing this PR? let me know if you have any question.

CC @ericstj @safern

Copy link
Contributor

@carlossanlop carlossanlop left a comment

Choose a reason for hiding this comment

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

Thanks @tarekgh . I left a couple of questions for you, and one for @safern.

Copy link
Contributor

@carlossanlop carlossanlop left a comment

Choose a reason for hiding this comment

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

LGTM.

@tarekgh
Copy link
Member Author

tarekgh commented Feb 17, 2022

/backport to release/6.0

@github-actions
Copy link
Contributor

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1861454365

@github-actions
Copy link
Contributor

@tarekgh backporting to release/6.0 failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: Fix PerformanceCounter's when running with Globalization Invariant Mode
Using index info to reconstruct a base tree...
M	src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs
M	src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs
Falling back to patching base and 3-way merge...
Auto-merging src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs
CONFLICT (content): Merge conflict in src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs
Auto-merging src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs
CONFLICT (content): Merge conflict in src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Fix PerformanceCounter's when running with Globalization Invariant Mode
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

tarekgh added a commit to tarekgh/runtime that referenced this pull request Feb 18, 2022
ericstj pushed a commit that referenced this pull request Mar 10, 2022
…balization Invariant Mode (#65537)

* [dotnet/runtime] Backport Fix PerformanceCounter's when running with Globalization Invariant Mode (PR #65414)

* Add GeneratePackageOnBuild & ServicingVersion project properties
@ghost ghost locked as resolved and limited conversation to collaborators Mar 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants