microsoft / microsoft/WindowsAppSDK

PrimaryLanguageOverride always return null/empty

Open
#6,118 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area-MRTCore needs-triage
Dominant language
C++
Stars
4.7k
Forks
471
Avg merge
3d 13h
Merged PRs (30d)
28

Description

### Describe the bug

`Microsoft.Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride` is not persisted across app relaunch (unlike UWP behavior).

`ApplicationLanguages.PrimaryLanguageOverride` behaves differently in WinUI 3 compared to UWP (Windows.Globalization).

In UWP, once PrimaryLanguageOverride is set and the app is **relaunched**, the value is persisted and can be read again.
In WinUI 3, after relaunching the application, **PrimaryLanguageOverride** always returns **null** or an **empty string**, even though it was previously set successfully.

This creates a behavior inconsistency between UWP and WinUI and makes it impossible to rely on `PrimaryLanguageOverride` for persistent language selection.

Is this behavior by design, or is it a bug / missing implementation in Microsoft.Windows.Globalization?

If by design, documentation should explicitly state that PrimaryLanguageOverride is not persisted in WinUI 3.

Sorry guys for tagging you:
@stefansjfw
@kmahone
@riverar

### Steps to reproduce the bug

1.Create a WinUI 3 desktop application.
2.Set the language override:
`Microsoft.Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "en-US";`
3.Close the application.
4.Relaunch the application.
5.Read:

`Debug.WriteLine(Microsoft.Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride);`

### Expected behavior

After relaunch, PrimaryLanguageOverride should still return the previously set value (same behavior as UWP Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride).

### Screenshots

_No response_

### NuGet package version
Latest
None

### Packaging type
Packaged
_No response_

### Windows version
11 Latest
_No response_

### IDE
VS2026
_No response_

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by investigating Microsoft.Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride in the WinUI 3 desktop path and compare its relaunch behavior with UWP Windows.Globalization. Reproduce the packaged-app steps, then determine whether the intended outcome is persistence or explicit documentation that the value is not persisted.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, csharp
Domain
desktop, localization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.