Error after Startup Blazor Web App (net 8)

I have following problem in my Blazor Web App (Net 8) with Version 4.2 (see below).
I receive always this error and it doesn't matter if it's a blanc Solution (new created) or an already existing Solution - converted from net 7 to 8.

I followed exactly the instructions in your "Get Started" page. But the result is still the same :confounded:

What I have tried!

  • I've cleared browser cache - more than once.
  • I've cleared Visual Studio cache
  • create Empty Blazor Web App
  • use different 5.x Radzen Version

I am using:
Microsoft Visual Studio Enterprise 2022 (64-bit) - Current Version 17.11.4
Microsoft .Net Framework Version 4.8.09037

What do I wrong - where is my mistake?!?!


crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Cannot provide a value for property 'Service' on type 'Radzen.Blazor.RadzenDialog'. There is no registered service of type 'Radzen.DialogService'.
System.InvalidOperationException: Cannot provide a value for property 'Service' on type 'Radzen.Blazor.RadzenDialog'. There is no registered service of type 'Radzen.DialogService'.
at Microsoft.AspNetCore.Components.ComponentFactory.<>c__DisplayClass9_0.g__Initialize|1(IServiceProvider serviceProvider, IComponent component)
at Microsoft.AspNetCore.Components.ComponentFactory.InstantiateComponent(IServiceProvider serviceProvider, Type componentType, IComponentRenderMode callerSpecifiedRenderMode, Nullable1 parentComponentId) at Microsoft.AspNetCore.Components.RenderTree.Renderer.InstantiateChildComponentOnFrame(RenderTreeFrame[] frames, Int32 frameIndex, Int32 parentComponentId) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewComponentFrame(DiffContext& diffContext, Int32 frameIndex) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewSubtree(DiffContext& diffContext, Int32 frameIndex) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& diffContext, Int32 newFrameIndex) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.ComputeDiff(Renderer renderer, RenderBatchBuilder batchBuilder, Int32 componentId, ArrayRange1 oldTree, ArrayRange`1 newTree)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
ManagedError: One or more errors occurred. (Cannot provide a value for property 'ThemeService' on type 'Radzen.Blazor.RadzenTheme'. There is no registered service of type 'Radzen.ThemeService'.)
at Jn (c:\Temp\BlazorApp1\BlazorApp1\wwwroot_framework\https:\raw.githubusercontent.com\dotnet\runtime\08338fcaa5c9b9a8190abb99222fed12aaba956c\src\mono\wasm\runtime\marshal-to-js.ts:349:18)
at Ll (c:\Temp\BlazorApp1\BlazorApp1\wwwroot_framework\https:\raw.githubusercontent.com\dotnet\runtime\08338fcaa5c9b9a8190abb99222fed12aaba956c\src\mono\wasm\runtime\marshal-to-js.ts:306:28)
at wasm://wasm/00b21c96:wasm-function[349]:0x1f979
at wasm://wasm/00b21c96:wasm-function[245]:0x1be41
at wasm://wasm/00b21c96:wasm-function[238]:0xf00e
at wasm://wasm/00b21c96:wasm-function[306]:0x1e693
at wasm://wasm/00b21c96:wasm-function[327]:0x1ee89
at wasm://wasm/00b21c96:wasm-function[217]:0xce5e
at wasm://wasm/00b21c96:wasm-function[773]:0x44219
at e. (https://localhost:7000/_framework/dotnet.runtime.8.0.8.80cvijctdx.js:3:216298) {superStack: {…}, stack: , message: 'One or more errors occurred. (Cannot provide…ered service of type 'Radzen.ThemeService'.)', Symbol(wasm js_owned_gc_handle): 102}

Check our getting started - it's explicitly stated how to register and use components like Dialog, Tooltip, ContextMenu, etc.

Many thanks for your quick answer!!!!!!!!

Correct - Service is not part of ServiceCollection.

But where in your documentation can I find this. In Get-Started (Section - .net 8 - point six) the only service which is registered is: builder.Services.AddRadzenComponents();
That is what I have done.

Where can I find the explicit call to register the DialogService in your documentation on this page.

That's the documentation. You however should call that in all Program.cs files you have in your solution.

Hi!
Thanks for your reply!!!!! The problem was solved with this additional line of code!
Can you tell me why is this necessary and should this not be a part of your "Getting Started" documentation.
Best regards
Patrick