Skip to content

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

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

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

Conversation

@agniuks

@agniuks agniuks commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Build TransportPackage-Foundation-Official on release/2.0-stable (2.3.8-stable, buildId 153733386) fails: every C# sample in the Build all Sample solutions stage errors with:

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

Root cause

dev/UndockedRegFreeWinRT/UndockedRegFreeWinRT-AutoInitializer.cs ships in the Foundation nuget and is <Compile>-injected into consumer apps under namespace Microsoft.Windows.Foundation.UndockedRegFreeWinRTCS. Those apps also reference the Microsoft.Windows.System namespace (EnvironmentManager / PowerManager). C# resolves the leading System of System.Globalization.CultureInfo against the nearest enclosing namespace, finds Microsoft.Windows.System, and fails to locate Globalization there -> CS0234. (using System; does not help; it only affects simple-name lookup, not the leading token of a qualified name.)

The offending line was introduced by the gated servicing port #6632 (base-directory child-process isolation, #5987), which inlined the base-directory PID stamping into this file without the global:: qualifier.

Fix

Qualify with global::System.Globalization.CultureInfo.InvariantCulture so it always binds to the BCL System. IL is unchanged; this is a name-resolution-only fix.

Precedent

This is the direct servicing backport of #6633 (commit 37de565), which fixed the identical CS0234 on main (WindowsAppRuntimeBaseDirectoryAutoInitializer.cs(32,48)). The main nightly went red Jul 16 and green from Jul 18 onward once #6633 merged; it has stayed green through Aug 2.

…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::) [2.0-stable] [2.0-stable] Fix CS0234 in UndockedRegFreeWinRT auto-initializer (qualify System.Globalization with global::) Aug 3, 2026
@agniuks
agniuks merged commit c8e254d into release/2.0-stable Aug 3, 2026
15 of 20 checks passed
@agniuks
agniuks deleted the user/agnel/fix-urfw-globalization-2.0 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