Skip to content

Error in net-maui Blazor Hybrid APP #50

@johannes-steurer

Description

@johannes-steurer

Hi,

I appreciate you work. Great component!

I use the Signature pad (8.1.5) in a blazor server scenario as well as in a BlazorWebView via net Maui (both time via the exact same code via a shared razor-class-library). In the Browser I have zero issues, but in net Maui sometimes I get the following Exception:

On Android it looks like this:

Microsoft.JSInterop.JSException: Cannot read properties of null (reading 'addEventListener')
TypeError: Cannot read properties of null (reading 'addEventListener')
    at Module.setup (https://0.0.0.0/_content/Blazor.SignaturePad/sigpad.interop.js?ver=8.1.5:9:13)
    at https://0.0.0.0/_framework/blazor.webview.js:1:3050
    at new Promise (<anonymous>)
    at g.beginInvokeJSFromDotNet (https://0.0.0.0/_framework/blazor.webview.js:1:3007)
    at External.__callback (https://0.0.0.0/_framework/blazor.webview.js:1:48020)
    at MessagePort.<anonymous> (<anonymous>:23:21)
   at Microsoft.JSInterop.JSRuntime.<InvokeAsync>d__16`1[[Microsoft.JSInterop.Infrastructure.IJSVoidResult, Microsoft.JSInterop, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext()
   at Microsoft.JSInterop.JSObjectReferenceExtensions.InvokeVoidAsync(IJSObjectReference , String , Object[] )
   at SignaturePad.SignaturePad.Setup()
   at SignaturePad.SignaturePad.OnAfterRenderAsync(Boolean firstRender)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task , ComponentState ) | AddWebMobile.RazorPages.Index.BuildRenderTree

on iOS it slooks a bit different:

ERROR  Microsoft.JSInterop.JSException: null is not an object (evaluating 'element.addEventListener')
setup@app://0.0.0.0/_content/Blazor.SignaturePad/sigpad.interop.js:9:12
@app://0.0.0.0/_framework/blazor.webview.js:1:3050
Promise@[native code]
beginInvokeJSFromDotNet@app://0.0.0.0/_framework/blazor.webview.js:1:3018
@app://0.0.0.0/_framework/blazor.webview.js:1:48025
@user-script:1:4:75
forEach@[native code]
@user-script:1:4:45
   at Microsoft.JSInterop.JSRuntime.<InvokeAsync>d__16`1[[Microsoft.JSInterop.Infrastructure.IJSVoidResult, Microsoft.JSInterop, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext()
   at Microsoft.JSInterop.JSObjectReferenceExtensions.InvokeVoidAsync(IJSObjectReference , String , Object[] )
   at SignaturePad.SignaturePad.Setup()
   at SignaturePad.SignaturePad.OnAfterRenderAsync(Boolean firstRender)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task , ComponentState ) | AddWebMobile.RazorPages.Index.BuildRenderTree

I am not able to tell under which circumstances this happens as I myself could not reproduce it so far, but got several error-reports from customers.

Thanks for your support

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions