Error running application after creating new page

I am following the quickstart defined https://www.radzen.com/documentation/blazor/crm/dashboard/ to create a new page and I get a Unhandled exception rendering component error when running the application. What step could I have missed?

StackTrace:
blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Unable to parse the response.
System.Exception: Unable to parse the response.
at Radzen.HttpResponseMessageExtensions.ReadAsync[T] (System.Net.Http.HttpResponseMessage response) <0x376a5b0 + 0x004ce> in :0
at RadzenCrm3.SecurityService.GetUserById (System.String id) [0x00118] in c:\temp\RadzenCRM3\client\Services\SecurityService.cs:216
at RadzenCrm3.SecurityService.IsAuthenticatedAsync () [0x00110] in c:\temp\RadzenCRM3\client\Services\SecurityService.cs:107
at RadzenCrm3.Pages.HomeComponent.OnInitializedAsync () [0x00030] in c:\temp\RadzenCRM3\client\Pages\Home.razor.designer.cs:134
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync () <0x2df5e60 + 0x0013a> in :0
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask (System.Threading.Tasks.Task taskToHandle) <0x30203d0 + 0x000b6> in :0

1 Like

We haven't seen this error before and don't know what could be causing it.

Thank you @korchev
I was able to fix this issue. When I created the ServerMethodsController.cs file in Visual studio, VS created it with the namespace RadzenCrm.Controllers. I had to change it to RadzenCrm to get the application to work. The other change that I have to make was to add the AsEnumerable() after the Include statement, to the RevenueByEmployee and RevenueByMonth method like so:

public IActionResult RevenueByEmployee()
    {
      var result = crmContext.Opportunities
                           .Include(opportunity => opportunity.User).AsEnumerable()
                           .GroupBy(opportunity => $"{opportunity.User.FirstName} {opportunity.User.LastName}")
                           .Select(group => new {
                             Employee = group.Key,
                             Revenue = group.Sum(opportunity => opportunity.Amount)
                           });
      return Ok(JsonSerializer.Serialize(result, new JsonSerializerOptions
      {
        PropertyNamingPolicy = null
      }));
    }

Hopefully this helps someone.