MicrosoftEdge / MicrosoftEdge/WebView2Feedback
[Problem/Bug]: System.Globalization.CultureNotFoundException when InvariantGlobalization true in .csproj
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
What happened?
We have a .NET 8 console application that ultimately spawns a WebView2 Control within a WinForm
We've recently set <InvariantGlobalization>true</InvariantGlobalization> in our .csproj to deal with System.Text JSON deserialization issues,
Since this has been released we've been seeing the following in our logs
System.Globalization.CultureNotFoundException
Only the invariant culture is supported in globalization-invariant mode. See https://aka.ms/GlobalizationInvariantMode for more information. (Parameter 'culture')
3081 (0x0c09) is an invalid culture identifier.
Stack trace:
System.Globalization.CultureInfo.GetCultureInfo(Int32 culture):92
System.Windows.Forms.InputLanguage.get_LanguageTag():203
System.Windows.Forms.InputLanguageChangedEventArgs..ctor(InputLanguage inputLanguage, Byte charSet):23
System.Windows.Forms.InputLanguage.CreateInputLanguageChangedEventArgs(Message m):16
System.Windows.Forms.Control.WmInputLangChange(Message& m):46
System.Windows.Forms.Control.WndProc(Message& m):1035
Microsoft.Web.WebView2.WinForms.WebView2.WndProc(Message& m):58
System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam):42
We aren't explicitly attempting to set any culture info on the WebView2 control
Can someone confirm if this a supported configuration?
Importance
Moderate. My app's user experience is affected, but still usable.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
No response
SDK Version
No response
Framework
Winforms
Operating System
Windows 10, Windows 11
OS Version
No response
Repro steps
We don't have clear steps to reproduce but this is affecting multiple different clients and their devices.
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
Don't know
Last working version (if regression)
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported System.Windows.Forms.InputLanguage and Control.WmInputLangChange stack frames, along with the WebView2.WinForms.WndProc path. Determine whether .NET 8 WinForms with InvariantGlobalization=true is supported and whether the reported culture-change event can be reproduced; done means a confirmed support status or a narrowly scoped, reproducible cause.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100