Value cannot be null. (Parameter 'format')
Environment
Product | UI for Blazor |
Description
I am getting an error when I am using a Telerik Blazor component in an application with enabled localization.
Error Message
The exact error message can vary. Here are just a few examples:
Unhandled exception rendering component: Value cannot be null. (Parameter 'format')
System.ArgumentNullException: Value cannot be null. (Parameter 'format')
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.Format(String format, Object arg0, Object arg1)
at Telerik.Blazor.Components.TelerikWizard.get_PagerMessage()
System.ArgumentNullException: Value cannot be null. (Parameter 'format')
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at Telerik.Blazor.Components.Common.Filters.FilterMenu.TelerikFilterMenu.get_FilterMenuSettingsLabel()
Possible Cause
A similar error can occur if a component is used in a localized application, but the .resx
files are missing some keys for the corresponding component.
The app either needs to implement localization for the Telerik components correctly, or not implement a localization service at all. Partial localization is not possible. So, it is essential that the .resx
files for the Telerik components are always up-to-date and contain all the necessary keys.
Solution
To solve the issue, make sure that:
- The application is correctly configured to use localization
- The resx files are up-to-date and contain all required localization strings
Find the latest localization files in two places:
- (maintained by Telerik) In the offline version of our Blazor demo site. Download our UI for Blazor automated installer or UI for Blazor ZIP archive. Then, look inside folder
/demos/TelerikBlazorDemos/Resources/
. - (maintained by the community) In the telerik/blazor-ui-messages GitHub repository
In some cases, you might not get an error, but components may appear partially localized (some texts are missing). More details on that are available at Partially Localized Components, Missing Text, Not Translated Text.