Description
Bug description
Pages (or components) are rendered in the wrong language.
In an app with several languages, after the user changes the language, pages that trigger
new rendering based on external events can cause the page to be rendered with the previous language setting that was current
when the external events were first set up.
This can make the page language flicker between two languages if page is also rendered based on user interaction.
If it is not, the page will appear stuck in the wrong language.
The first rendering is made in the correct language, but following a new rendering triggered by an external event the language is set based on the event. Changing the CurrentUICulture
just before invoking StateHasChanged
will correct this, but that has to be done every time.
To Reproduce
(https://github.com/SandvikTeeness/Blazor.UICulture.Bug)
The bug is demonstrated on the Counter page by using a timer placed on the WeatherForecastService
.
- Start the timer with the button on the home page
- Change to another language
- Go to the Counter page and click the button
- For each click, wait a second or two. The timer is set up to call its' event each 2 seconds.
I expect you to see the language flicker between the first you had when starting the app, and the language you have chosen as current.
Further technical details
- ASP.NET Core version:
- The IDE (VS / VS Code/ VS4Mac) you're running on, and its version:
- Include the output of
dotnet --info
:
dotnet --info Output
.NET SDK (reflecting any global.json):
Version: 5.0.402
Commit: e9d3381880
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.402\
Host (useful for support):
Version: 5.0.11
Commit: f431858f8b
.NET SDKs installed:
5.0.102 [C:\Program Files\dotnet\sdk]
5.0.302 [C:\Program Files\dotnet\sdk]
5.0.402 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
Visual Studio -> Copy Info
Microsoft Visual Studio Professional 2019
Version 16.11.5
VisualStudio.16.Release/16.11.5+31729.503
Microsoft .NET Framework
Version 4.8.04084
Installed Version: Professional
Visual C++ 2019 00435-60000-00000-AA225
Microsoft Visual C++ 2019
ADL Tools Service Provider 1.0
This package contains services used by Data Lake tools
ASA Service Provider 1.0
ASP.NET and Web Tools 2019 16.11.75.64347
ASP.NET and Web Tools 2019
ASP.NET Web Frameworks and Tools 2019 16.11.75.64347
For additional information, visit https://www.asp.net/
Azure App Service Tools v3.0.0 16.11.75.64347
Azure App Service Tools v3.0.0
Azure Data Lake Node 1.0
This package contains the Data Lake integration nodes for Server Explorer.
Azure Data Lake Tools for Visual Studio 2.6.1000.0
Microsoft Azure Data Lake Tools for Visual Studio
Azure Functions and Web Jobs Tools 16.11.75.64347
Azure Functions and Web Jobs Tools
Azure Stream Analytics Tools for Visual Studio 2.6.1000.0
Microsoft Azure Stream Analytics Tools for Visual Studio
C# Tools 3.11.0-4.21403.6+ae1fff344d46976624e68ae17164e0607ab68b10
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Cookiecutter 16.11.21196.2
Provides tools for finding, instantiating and customizing templates in cookiecutter format.
Fabric.DiagnosticEvents 1.0
Fabric Diagnostic Events
GitHub.VisualStudio 2.11.106.19330
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.
IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info
Microsoft Azure HDInsight Azure Node 2.6.1000.0
HDInsight Node under Azure Node
Microsoft Azure Hive Query Language Service 2.6.1000.0
Language service for Hive query
Microsoft Azure Service Fabric Tools for Visual Studio 16.10
Microsoft Azure Service Fabric Tools for Visual Studio
Microsoft Azure Stream Analytics Language Service 2.6.1000.0
Language service for Azure Stream Analytics
Microsoft Azure Stream Analytics Node 1.0
Azure Stream Analytics Node under Azure Node
Microsoft Azure Tools for Visual Studio 2.9
Support for Azure Cloud Services projects
Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft Library Manager 2.1.113+g422d40002e.RR
Install client-side libraries easily to any web project
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards
Microsoft Visual Studio Tools for Containers 1.2
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.
Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package
Node.js Tools 1.5.30526.3 Commit Hash:c09c81113bcbc86d57943fcdd67e82434263d61d
Adds support for developing and debugging Node.js apps in Visual Studio
NuGet Package Manager 5.11.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
Python 16.11.21196.2
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.
Python - Conda support 16.11.21196.2
Conda support for Python projects.
Python - Django support 16.11.21196.2
Provides templates and integration for the Django web framework.
Python - Profiling support 16.11.21196.2
Profiling support for Python projects.
Razor (ASP.NET Core) 16.1.0.2122504+13c05c96ea6bdbe550bd88b0bf6cdddf8cde1725
Provides languages services for ASP.NET Core Razor.
ResXManager ResXManager
Manage localization of all ResX-Based resources in one place. Shows all resources of a solution and let's you edit the strings and their localizations in a well-arranged data grid.
SQL Server Data Tools 16.0.62107.28140
Microsoft SQL Server Data Tools
SQLite & SQL Server Compact Toolbox 4.8
SQLite & SQL Server Compact Toolbox adds scripting, import, export, rename, query execution and much more to SQL Server Compact & SQLite Data Connections.
Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.
Test Adapter for Google Test 1.0
Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.
ToolWindowHostedEditor 1.0
Hosting json editor into a tool window
TypeScript Tools 16.0.30526.2002
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 3.11.0-4.21403.6+ae1fff344d46976624e68ae17164e0607ab68b10
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 16.11.0-beta.21322.6+488cc578cafcd261d90d748d8aaa7b8b091232dc
Microsoft Visual F# Tools
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Container Tools Extensions 1.0
View, manage, and diagnose containers within Visual Studio.
Visual Studio Tools for CMake 1.0
Visual Studio Tools for CMake
Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers
Visual Studio Tools for Kubernetes 1.0
Visual Studio Tools for Kubernetes
VsVim 2.8.0.0
VsVim is a Vim emulator for Visual Studio
WiX Toolset Visual Studio Extension 1.0.0.4
WiX Toolset Visual Studio Extension version 1.0.0.4
Copyright (c) .NET Foundation and contributors. All rights reserved.