Skip to content

Fix CS0234 in BaseDirectory auto-initializer (qualify System.Globalization with global::) - #6625

Closed
v-arlysenko wants to merge 2 commits into
microsoft:mainfrom
v-arlysenko:fix/basedir-autoinit-globalization-cs0234
Closed

v-arlysenko wants to merge 2 commits into
microsoft:mainfrom
v-arlysenko:fix/basedir-autoinit-globalization-cs0234

Conversation

@v-arlysenko

Copy link
Copy Markdown
Contributor

Problem

TransportPackage-Foundation-Nightly (OneBranch) on main (commit aa197a5) fails with:

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

Root cause

dev/Common/WindowsAppRuntimeBaseDirectoryAutoInitializer.cs (added in #6619) lives in
namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime.BaseDirectoryCS. When the
file is compiled into a consumer that references the Microsoft.Windows.System WinMD, the
leading System in System.Globalization.CultureInfo binds to Microsoft.Windows.System
(reachable via the enclosing Microsoft.Windows namespace) instead of the root System
namespace → CS0234. A standalone compile doesn't hit this, which is why #6619 passed but
the nightly transport build (with Microsoft.Windows.System in scope) broke.

Fix

Qualify with global::System.Globalization.CultureInfo.InvariantCulture to force the root
namespace. Matches the existing convention in the repo (e.g. VSPackage.Designer.cs).

…ation with global::

The generated WindowsAppRuntimeBaseDirectoryAutoInitializer.cs lives in namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime.BaseDirectoryCS. When compiled into a consumer that references the Microsoft.Windows.System WinMD, the leading 'System' in 'System.Globalization.CultureInfo' binds to Microsoft.Windows.System (via the enclosing Microsoft.Windows namespace) instead of the root System namespace, producing CS0234 (namespace 'Globalization' does not exist in 'Microsoft.Windows.System'). This broke TransportPackage-Foundation-Nightly. Qualify with global:: to force the root namespace.
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@v-arlysenko

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

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

@v-arlysenko

Copy link
Copy Markdown
Contributor Author

/azp run WindowsAppSDK-Templates-PR

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@v-arlysenko

Copy link
Copy Markdown
Contributor Author

/azp run TransportPackage-Foundation-PR

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@v-arlysenko

Copy link
Copy Markdown
Contributor Author

Duplication

@v-arlysenko
v-arlysenko deleted the fix/basedir-autoinit-globalization-cs0234 branch July 17, 2026 16:15
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