Search code examples
c#blazorsyncfusionblazor-server-sideblazor-client-side

Getting error in arguments in Microsoft.JSInterop.Infrastructure.DotNetDispatcher.ParseArguments after update blazor version 3.0100


After ubdating my blazor project from .net preview 7 to .net core 3.0.100 version i am getting below error in sycfusion grid control, I have updated all the latest packages.also update syntax changes by taking reference from https://devblogs.microsoft.com/aspnet/asp-net-core-and-blazor-updates-in-net-core-3-0-preview-9/

`blazor.server.js:8 Uncaught (in promise) Error: System.ArgumentException: The call to 'UpdateTemplate' expects '5' parameters, but received '4'. at 
Microsoft.JSInterop.Infrastructure.DotNetDispatcher.ParseArguments(JSRuntime jsRuntime, String methodIdentifier, String arguments, Type[] parameterTypes)
   at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.InvokeSynchronously(JSRuntime jsRuntime, DotNetInvocationInfo& callInfo, IDotNetObjectReference objectReference, String argsJson)
   at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.BeginInvokeDotNet(JSRuntime jsRuntime, DotNetInvocationInfo invocationInfo, String argsJson)
    at Object.endInvokeDotNetFromJS (blazor.server.js:8)
    at e.<anonymous> (blazor.server.js:8)
    at blazor.server.js:1
    at Array.forEach (<anonymous>)
    at e.invokeClientMethod (blazor.server.js:1)
    at e.processIncomingData (blazor.server.js:1)
    at e.connection.onreceive (blazor.server.js:1)
    at WebSocket.i.onmessage (blazor.server.js:1)
endInvokeDotNetFromJS @ blazor.server.js:8
(anonymous) @ blazor.server.js:8
(anonymous) @ blazor.server.js:1
e.invokeClientMethod @ blazor.server.js:1
e.processIncomingData @ blazor.server.js:1
connection.onreceive @ blazor.server.js:1
i.onmessage @ blazor.server.js:1

 <EjsGrid ID="gdProjects" @ref="gdProjects" ModelType="@model" DataSource="@filteredProjects" AllowReordering="true" AllowFiltering="true" AllowPaging="true" AllowMultiSorting="false" AllowSorting="true" AllowExcelExport="true" AllowPdfExport="true" Toolbar="@(new List<string>() { "Search" })">
            <GridFilterSettings Type="@Syncfusion.EJ2.Blazor.Grids.FilterType.Menu"></GridFilterSettings>
            <GridPageSettings PageCount="10" PageSizes="true"></GridPageSettings>
            <GridColumns>
                <GridTemplates>
                    <RowTemplate>
                        @{
                            var project = (context as ProjectTable);
                            <td class="data-cell pointer" @onclick="(()=>OnProjectClick(project.ProjectId))">
                                @project.ProjectName
                            </td>
                            <td class="data-cell pointer" @onclick="(()=>OnClientClick(project.ClientId))">
                                @project.ClientName
                            </td>
                            <td class="data-cell">
                                @project.Status
                            </td>
                            <td class="data-cell">
                                @project.NextStep
                            </td>
                            <td class="data-cell">
                                @project.DueDate
                            </td>
                        }
                    </RowTemplate>
                </GridTemplates>
                <GridColumn Field=@nameof(ProjectTable.ProjectName) HeaderText="Project Name" />
                <GridColumn Field=@nameof(ProjectTable.ClientName) HeaderText="Client Name" />
                <GridColumn Field=@nameof(ProjectTable.Status) HeaderText="Status" />
                <GridColumn Field=@nameof(ProjectTable.NextStep) HeaderText="Next Step" />
                <GridColumn Field=@nameof(ProjectTable.DueDate) HeaderText="Due Date" />
            </GridColumns>
        </EjsGrid>`

Solution

  • I guess there is a version mismatch between the Nuget(Syncusion.EJ2.Blazor) and ejs.interop.min.js file. Please ensure to use same version script files to resolve this error.

    For example, if you are using Nuget v17.3.17 then the script files should be referred from the below CDN.

    <script src="https://cdn.syncfusion.com/ej2/17.3.17/dist/ejs.interop.min.js"></script>

    Reference: https://ej2.syncfusion.com/blazor/documentation/grid/getting-started/