Skip to content

[1.8-stable] Fix CS0234 in UndockedRegFreeWinRT auto-initializer (qualify System.Globalization with global::) - #6670

Merged
agniuks merged 1 commit into
release/1.8-stablefrom
user/agnel/fix-urfw-globalization-1.8
Aug 3, 2026
Merged

agniuks merged 1 commit into
release/1.8-stablefrom
user/agnel/fix-urfw-globalization-1.8

Conversation

@agniuks

@agniuks agniuks commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Problem

dev/UndockedRegFreeWinRT/UndockedRegFreeWinRT-AutoInitializer.cs on release/1.8-stable carries a latent CS0234 that breaks any C# app consuming the Foundation package with undocked reg-free WinRT auto-init enabled:

UndockedRegFreeWinRT-AutoInitializer.cs(36,48): error CS0234:
The type or namespace name 'Globalization' does not exist in the namespace 'Microsoft.Windows.System'

Note: the 1.8-stable TransportPackage-Foundation-Official pipeline has no sample-build stage, so this is not caught by CI here, but it is byte-identical to the 2.0-stable break (see companion PR #6669) and ships broken to consumers.

Root cause

The file is <Compile>-injected into consumer apps under namespace Microsoft.Windows.Foundation.UndockedRegFreeWinRTCS. The unqualified leading System in System.Globalization.CultureInfo binds to the SDK's Microsoft.Windows.System namespace (nearest enclosing scope) instead of the BCL System -> CS0234. Introduced by the gated servicing port #6631 (base-directory child-process isolation, #5987), which inlined the base-directory PID stamping without global::.

Fix

Qualify with global::System.Globalization.CultureInfo.InvariantCulture. IL is unchanged; name-resolution-only fix.

Precedent

Direct servicing backport of #6633 (commit 37de565), which fixed the identical CS0234 on main. Companion 2.0-stable fix: #6669.

…lobalization with global::

The auto-initializer ships inside the Microsoft.WindowsAppSDK.Foundation nuget and is compiled into consumer app projects under namespace Microsoft.Windows.Foundation.UndockedRegFreeWinRTCS. When the app also references the Microsoft.Windows.System namespace (e.g. EnvironmentManager or PowerManager), the unqualified leading 'System' in 'System.Globalization.CultureInfo' binds to Microsoft.Windows.System instead of the BCL System, producing:

  error CS0234: The type or namespace name 'Globalization' does not exist in the namespace 'Microsoft.Windows.System'

This broke every C# sample in the Foundation official build. Prefix the reference with global:: so it always resolves to the BCL System namespace.

This is the servicing equivalent of the main-branch fix #6633 (commit 37de565), which resolved the identical CS0234 after the base-directory child-process isolation change (#5987). The servicing port inlined the base-directory stamping into this file and did not carry the #6633 follow-up.
@agniuks
agniuks requested a review from a team August 3, 2026 17:15
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@agniuks

agniuks commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.

@agniuks agniuks changed the title Fix CS0234 in UndockedRegFreeWinRT auto-initializer (qualify System.Globalization with global::) [1.8-stable] [1.8-stable] Fix CS0234 in UndockedRegFreeWinRT auto-initializer (qualify System.Globalization with global::) Aug 3, 2026
@agniuks
agniuks merged commit a921500 into release/1.8-stable Aug 3, 2026
17 of 29 checks passed
@agniuks
agniuks deleted the user/agnel/fix-urfw-globalization-1.8 branch August 3, 2026 18:12
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.

2 participants