Skip to content

[Problem/Bug]: System.Globalization.CultureNotFoundException when InvariantGlobalization true in .csproj #4831

Open
@jpalmowski

Description

@jpalmowski

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions