vikramlearning / blazorbootstrap

An Enterprise-class Blazor Bootstrap Component library built on the Blazor and Bootstrap CSS frameworks.
https://docs.blazorbootstrap.com/
Apache License 2.0
670 stars 32 forks source link

PdfViewer example throwing null reference exception in js #662

Open mark-fay-03 opened 4 months ago

mark-fay-03 commented 4 months ago

PdfViewer example throwing null reference exception in js

I have followed the Blazor Bootstrap Getting Started guide to install Blazor Bootstrap on a .NET 8 Blazor (SSR) application. I then followed the example from the PdfViewer Component on the home.razor page for both the pdf from GitHub and the hard coded pdf byte stream.

I expected the pdf to load correctly.

Unfortunately, the PdfViewer loads then the blazor.js throws the exception below (after turning on DetailedErrors in appsettings.json) before displaying the PDF's contents.

[2024-04-16T20:12:58.956Z] Error: System.AggregateException: One or more errors occurred. (TypeError: Cannot read properties of null (reading 'insertBefore')) ---> System.InvalidOperationException: TypeError: Cannot read properties of null (reading 'insertBefore') at Microsoft.AspNetCore.Components.RenderTree.Renderer.InvokeRenderCompletedCallsAfterUpdateDisplayTask(Task updateDisplayTask, Int32[] updatedComponents) --- End of inner exception stack trace ---

Versions (please complete the following information):

Sample code

Same as https://docs.blazorbootstrap.com/getting-started/blazor-webapp-server-global-net-8#sample-code https://docs.blazorbootstrap.com/components/pdf-viewer#base64string

mark-fay-03 commented 4 months ago

This also occurs with the starter template (NET8.BlazorWebAppRenderModeServerGlobal) provided in the documentation here. https://github.com/vikramlearning/blazorbootstrap-starter-templates

gvreddy04 commented 4 months ago

@mark-fay-03 Thank you for reporting this. We will investigate.

gvreddy04 commented 4 months ago

@mark-fay-03 I am unable to reproduce the issue in the starter template.

Screenshot:

image

gvreddy04 commented 4 months ago

@mark-fay-03 Could you please provide a code sample or a link to a GitHub repository that demonstrates the issue with minimal steps for replication?