Repro:
- Create a Blazor WebAssembly application
- Update
Program.cs to contain:
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.DefaultThreadCurrentUICulture =
Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = new CultureInfo("ja-JP");
// ... and now everything that was already there
var builder = WebAssemblyHostBuilder.CreateDefault(args);
// ... etc
- If you want, also test displaying something in this culture by adding to
Index.razor the output @((123.45).ToString("c"))
Expected:
- On startup, should give the error Blazor detected a change in the application's culture that is not supported with the current project configuration. To change culture dynamically during startup, set true in the application's project file.
- Actual, no error, and the value
@((123.45).ToString("c")) is rendered as 123 JPY (i.e., no ¥ symbol)
This is a regression since 5.0. If you do the same with the 5.0 SDK, it will produce the error.
However, if you modify the order of the source code to this:
var builder = WebAssemblyHostBuilder.CreateDefault(args);
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.DefaultThreadCurrentUICulture =
Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = new CultureInfo("ja-JP");
// ... and now everything that was already there
... then it does produce the correct error on 6.0. So it seems we've changed how the culture change detection works and made it less robust.
Repro:
Program.csto contain:Index.razorthe output@((123.45).ToString("c"))Expected:
@((123.45).ToString("c"))is rendered as123 JPY(i.e., no¥symbol)This is a regression since 5.0. If you do the same with the 5.0 SDK, it will produce the error.
However, if you modify the order of the source code to this:
... then it does produce the correct error on 6.0. So it seems we've changed how the culture change detection works and made it less robust.