Clicking on PDF Viewer scrollbars when using OnPageClick event results in console error

I am consistently getting an error in the browser console window every time I click on either the PDF horizontal or vertical scrollbars.  For some reason, this issue ONLY happens when I include the OnPageClick event in the PdfViewerEvents.

When starting a new .NET6 Blazor Server project using the template and including the Syncfusion.Blazor.PdfViewerServer.Windows NuGet package (version 20.2.0.40), here is the code to add to Index.razor that would recreate the issue:

<SfPdfViewerServer>
    <PdfViewerEvents OnPageClick="PageClickHandler" />
</SfPdfViewerServer>

@code {
    public void PageClickHandler(PageClickEventArgs args) { }
}

When running the web app in IISExpress, simply load any PDF into the PDFViewer component and click the PDFViewer scrollbar with the mouse to see the error appear in the browser Dev Tools console:

Uncaught (in promise) Error: System.Text.Json.JsonException: The JSON value could not be converted to System.Int32. Path: $.pageNumber | LineNumber: 0 | BytePositionInLine: 73.
 ---> System.InvalidOperationException: Cannot get the value of a token type 'Null' as a number.
   at System.Text.Json.Utf8JsonReader.TryGetInt32(Int32& value)
   at System.Text.Json.Utf8JsonReader.GetInt32()
   at System.Text.Json.Serialization.Converters.Int32Converter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable`1 actualByteCount)
   at System.Text.Json.JsonSerializer.ReadDocument[TValue](JsonDocument document, JsonTypeInfo jsonTypeInfo)
   at System.Text.Json.JsonSerializer.Deserialize[TValue](JsonDocument document, JsonSerializerOptions options)
   at Syncfusion.Blazor.PdfViewer.PdfViewerJSInteropAdaptor.Trigger(String eventName, JsonDocument args)
    at Tt.endInvokeDotNetFromJS (http://localhost:24482/_framework/blazor.server.js:1:3700)
    at http://localhost:24482/_framework/blazor.server.js:1:71773
    at Array.forEach (<anonymous>)
    at Tt._invokeClientMethod (http://localhost:24482/_framework/blazor.server.js:1:71759)
    at Tt._processIncomingData (http://localhost:24482/_framework/blazor.server.js:1:69801)
    at Tt.connection.onreceive (http://localhost:24482/_framework/blazor.server.js:1:64201)
    at o.onmessage (http://localhost:24482/_framework/blazor.server.js:1:48517)

4 Replies

SK Sinthiya Kalimuthu Syncfusion Team August 2, 2022 02:32 PM UTC

Hi Christopher,


We were able to reproduce the reported issue  “Exception occurs while clicking on PDF Viewer scrollbars when using OnPageClick event” and suspect this to be a defect. We will analyze further on this and update you with more details on August 04, 2022.


Regards,

Sinthiya K



SK Sinthiya Kalimuthu Syncfusion Team August 5, 2022 06:00 AM UTC

Hi Christopher,


We have confirmed that the reported issue “Exception occurs in OnPageClick event PDF Viewer scrollbar is clicked” is a defect and logged the defect reported for the same. The fix for the issue will be included in our upcoming weekly NuGet release on August 17, 2022. You can track the status using the below feedback link.


Feedback link :

https://www.syncfusion.com/feedback/36837/exception-occurs-while-clicking-on-pdf-viewer-scrollbars-when-using-onpageclick


Regards,

Sinthiya K



SK Sinthiya Kalimuthu Syncfusion Team August 18, 2022 05:56 AM UTC

Hi Christopher,


Sorry for the inconvenience.


The fix for the reported issue was not included in the latest weekly release. However, the fix will be included in our upcoming weekly NuGet release on August 24, 2022.


Regards,

Sinthiya K



SK Sinthiya Kalimuthu Syncfusion Team August 24, 2022 08:51 AM UTC

Hi Christopher,


We have fixed the reported issue and the fix was included in our latest weekly release v20.2.0.45. Kindly upgrade to that version to get the issue resolved.


Package:

Blazor Client   

https://www.nuget.org/packages/Syncfusion.Blazor.PdfViewer/

Blazor Sever  

https://www.nuget.org/packages/Syncfusion.Blazor.PdfViewerServer.Windows  


CDN:

https://cdn.syncfusion.com/blazor/20.2.45/styles/bootstrap5.css

https://cdn.syncfusion.com/blazor/20.2.45/syncfusion-blazor-pdfviewer.min.js



Regards,

Sinthiya K


Loader.
Up arrow icon