ArgumentNull_Generic Arg_ParamName_Name
Hi,
In a blazor webassembly project with Visualstudio 2022 .net8 I implemented the SyncfusionLocalizer class in an external dll to use the Italian language.
In the debugging phase everything works correctly but when I publish the web application, running, when I navigate to pages where only the sfgrid is present I receive this error:
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: ArgumentNull_Generic Arg_ParamName_Name, format
System.ArgumentNullException: ArgumentNull_Generic Arg_ParamName_Name, format
at System.ArgumentNullException.Throw(String ) at System.ArgumentNullException.ThrowIfNull(Object , String )
at System.String.FormatHelper(IFormatProvider provider, String format, ReadOnlySpan`1 args)
at System.String.Format(String format, Object arg0, Object arg1) at Syncfusion.Blazor.Navigations.SfPager.BuildRenderTree(RenderTreeBuilder __builder)
at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__6_0(RenderTreeBuilder builder)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder , RenderFragment , Exception& )
and the grid navigation line disappears (SfPager).
This is the class used:
public class SyncfusionLocalizer : ISyncfusionStringLocalizer
{
// To get the locale key from mapped resources file
public string GetText(string key)
{
return ResourceManager.GetString(key);
}
public System.Resources.ResourceManager ResourceManager
{ get { return Resources.SfResources.ResourceManager;
}
}
Which is instantiated in program.cs:
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Sid.App;
using MyStarterKit.Client;
using MyStarterKit.Client.Blazor.Classes;
using Syncfusion.Blazor;
using System.Globalization;
using Sid.Client.Classes;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services.AddSyncfusionBlazor();
builder.Services.AddSingleton(typeof(ISyncfusionStringLocalizer), typeof(SyncfusionLocalizer));
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("it");
CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("it");
#if (DEBUG)
Sessione.Instance.UrlWebserviceDefault = @"http://localhost:5031/";
#else
Sessione.Instance.UrlWebserviceDefault = @"http://93.119.160.187:6510/";
#endif
await SessioneSid.Start();
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("mykey"); //rel 27.xx
await builder.Build().RunAsync();
Hi Egidio,
Before proceeding with the reported problem, we require some additional
clarification from your side. Please share the following details to help us
proceed further:
- Could you share the grid code snippet or a reproducible sample with duplicate data that demonstrates the issue you encountered after deployment?
- Could you provide step-by-step instructions on how you deploy the application on your end?
- Are there any error logs or console messages that appear when the issue occurs?
- Please ensure that all required configurations are set correctly when the application is published. This includes any data sources, services, or dependent configurations.
Based on this information, we will create and deploy an application on our end to address the issue as soon as possible. Thank you for your cooperation, and we look forward to assisting you further.
Regards,
Prathap Senthil
this is the code that calls sfgrid:
@inherits MyMasterDetailPage<ListOfSBLAnagrafica,SmartBindingAnagrafica, SBLAnagrafica>
<div class="@IsVisible" style="background-color:lightgray">
<button @onclick="Escape">Esci</button>
@if (!WaitingState)
{
<button @onclick="Update">Vedi</button>
<button @onclick="Insert">Nuovo</button>
}
else
{
<span class="spinner-border spinner-border-sm"></span>
}
<h2>Anagrafiche</h2>
<SfGrid @ref="dg" DataSource="@elenco" AllowPaging="true" Locale="it" Toolbar="@(new List<string>() { "Search" })">
<GridPageSettings PageSize="20"></GridPageSettings>
<GridSelectionSettings Mode="SelectionMode.Row" Type="Syncfusion.Blazor.Grids.SelectionType.Single" />
<GridEvents OnRecordDoubleClick="GridRowDoubleClicked" TValue="SmartBindingAnagrafica"></GridEvents>
<GridColumns>
<GridColumn HeaderText="Nominativo" Field="Nominativo" />
<GridColumn HeaderText="Nascita" Field="DataDiNascita" Format="d" Type="ColumnType.Date" />
<GridColumn HeaderText="Codice Fiscale" Field="CodiceFiscale" />
</GridColumns>
</SfGrid>
</div>
@if (!IsActiveMaster)
{
<AnagraficaItem ID="@IDSelected" OnExitCallback=@onExitFormCallback />
}
@code{}
where the variables and methods are defined in MyMasterDetailPage<ListOfSBLAnagrafica,SmartBindingAnagrafica, SBLAnagrafica>
This code works regularly in another project in net7 and syncfusion version 20.4.52 while in this net8 project it works regularly in debug with visualstudio but published on the site, when rendering the page it responds with the error reported above.
thanks
Based on the reported issue, it seems that
your code uses the Local property in SfGrid. We would like to clarify that
currently, there is no Local property available in SfGrid. We suspect the issue
might be related to localization settings in your .NET 8 project. To assist
you, we have prepared a simple sample that includes proper localization
settings. Additionally, we have step-by-step instructions in our documentation
for your reference. Please refer to the documentation to modify your project
according to the provided guidance.
Reference :Localization
(Multi-Language) in Blazor components | Syncfusion
If the issue persists, could you share the grid code snippet or a reproducible sample with duplicate data that demonstrates the issue? Alternatively, you may modify the attached project to reproduce your issue. This will help us validate the problem promptly and provide a solution.
Attachment: BlazorWASMLocalization_1f3a3c2d.zip
To get out of the problem I implemented the resources in the project excluding those inserted in the APIs created to share them with all subsequent projects. For the moment I leave everything to work this way but I believe that there is the possibility of pursuing the path of implementation in external dlls because in the debug phase it works while in execution on the site it reports malfunction. Thanks for the help provided
Hi Egidio,
Thanks for the update. It looks like the solution works. Regarding the issue
with the external DLLs, where it works during the debug phase but malfunctions
during site execution, we will validate the issue and update you soon. In the
meantime, please use the current solution to overcome the problem.
Regards,
Naveen
To further address the reported problem, we need some additional clarification from you. Please provide the following details so we can proceed:
Could you please clear your browser cache and the NuGet packages in your project, then check whether the issue is still reproducible?
Could you share the link to the demo of the project you published?
Could you provide a sample that reproduces the issue with duplicate data? Additionally, detailed step-by-step instructions on how you deploy the application on your end would be helpful.
The requested details will help us validate the reported issue and provide a solution as quickly as possible. Thank you for your understanding.
- 6 Replies
- 3 Participants
-
EG egidio
- Nov 26, 2024 06:32 PM UTC
- Jan 2, 2025 03:09 PM UTC