0

I have created .NET 7 Blazor-hosted application with Identity Server 4 and role-based authentication - the latest version.

There is page fetchdata as we know - it comes out of the box.

I have tried to remove bootstrap, CSS files etc, as per other topics of StackOverflow, thng is, this is the latest version of .NET and with previous versions, I did not have these issues, the process was the same.

I have added the latest version of MudBlazor:

  • problem does not exist once I access fetchdata component via menu
  • this problem appears once I try to access fetchdata directly from the URL

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Could not find 'mudElementRef.getBoundingClientRect' ('mudElementRef' was undefined). Error: Could not find 'mudElementRef.getBoundingClientRect' ('mudElementRef' was undefined). at https://localhost:7060/_framework/blazor.webassembly.js:1:328 at Array.forEach () at a.findFunction (https://localhost:7060/_framework/blazor.webassembly.js:1:296) at _ (https://localhost:7060/_framework/blazor.webassembly.js:1:2442) at https://localhost:7060/_framework/blazor.webassembly.js:1:3330 at new Promise () at Object.beginInvokeJSFromDotNet (https://localhost:7060/_framework/blazor.webassembly.js:1:3311) at Object.Gt [as invokeJSFromDotNet] (https://localhost:7060/_framework/blazor.webassembly.js:1:62537) at Object.Ii (https://localhost:7060/_framework/dotnet.7.0.0.amub20uvka.js:5:71465) at _mono_wasm_invoke_js_blazor (https://localhost:7060/_framework/dotnet.7.0.0.amub20uvka.js:14:103886) Microsoft.JSInterop.JSException: Could not find 'mudElementRef.getBoundingClientRect' ('mudElementRef' was undefined). Error: Could not find 'mudElementRef.getBoundingClientRect' ('mudElementRef' was undefined). at https://localhost:7060/_framework/blazor.webassembly.js:1:328 at Array.forEach () at a.findFunction (https://localhost:7060/_framework/blazor.webassembly.js:1:296) at _ (https://localhost:7060/_framework/blazor.webassembly.js:1:2442) at https://localhost:7060/_framework/blazor.webassembly.js:1:3330 at new Promise () at Object.beginInvokeJSFromDotNet (https://localhost:7060/_framework/blazor.webassembly.js:1:3311) at Object.Gt [as invokeJSFromDotNet] (https://localhost:7060/_framework/blazor.webassembly.js:1:62537) at Object.Ii (https://localhost:7060/_framework/dotnet.7.0.0.amub20uvka.js:5:71465) at _mono_wasm_invoke_js_blazor (https://localhost:7060/_framework/dotnet.7.0.0.amub20uvka.js:14:103886) at Microsoft.JSInterop.JSRuntime.d__16`1[[MudBlazor.Interop.BoundingClientRect, MudBlazor, Version=6.1.5.0, Culture=neutral, PublicKeyToken=null]].MoveNext() at MudBlazor.MudDrawer.UpdateHeight() at MudBlazor.MudDrawer.OnAfterRenderAsync(Boolean firstRender) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) <

1
  • How do you remove Bootstrap from Blazor? Commented Dec 18, 2022 at 14:00

1 Answer 1

0

All that you have to do is to add AddMudServices() under the builder in the Program.cs pipeline - under the builder on the top.

var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");

builder.Services.AddMudServices();

as well you don't need to delete bootstrap and custom CSS style files.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.