Microsoft.JSInterop.JSException: Could not find 'sfBlazor.methodCall' ('methodCall' was undefined).

When trying to load up a document in the PDF Viewer, I keep receiving the following error :

Microsoft.JSInterop.JSException: Could not find 'sfBlazor.methodCall' ('methodCall' was undefined).

at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) at Syncfusion.Blazor.PdfViewer.PdfViewerBase.InvokeJS(String moduleName, String methodName, Object[] methodParams) at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__140_0(Object state) at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteSynchronously(TaskCompletionSource`1 completion, SendOrPostCallback d, Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) 

This was not happening until today.  Am I missing something?


4 Replies 1 reply marked as answer

DM Dhivyabharathi Mohan Syncfusion Team July 14, 2021 12:59 PM UTC

Hi Tim, 
 
We have checked with the provided details and we were unable to reproduce the reported issue while loading the PDF document from the URL. We have shared the sample, code snippet and video in which we tried to replicate this issue. 
 
 
 
Code snippet: 
 
<SfPdfViewerServer @ref="PdfViewer" EnableFormFields="false" DocumentPath="@DocumentPath" EnableNavigationToolbar="false" EnableAnnotationToolbar="false" EnableToolbar="true" Height="100%" Width="100%"> 
    <PdfViewerCustomStampSettings EnableCustomStamp="true" IsAddToMenu="true" Width="194" Height="75" MaxHeight="75" MaxWidth="194" MinHeight="75" MinWidth="194" CustomStamps="@CustomStamps"></PdfViewerCustomStampSettings> 
    <PdfViewerContextMenuSettings EnableContextMenu="false" /> 
    <PdfViewerAnnotationSettings IsLock="false" /> 
    <PdfViewerEvents Created="created" AnnotationAdded="@AnnotationAdded" DocumentLoaded="@DocumentLoaded" AnnotationRemoved="@AnnotationRemoved" AnnotationSelected="@AnnotationSelected"></PdfViewerEvents> 
</SfPdfViewerServer> 
 
public string DocumentPath { get; set; } 
    public SfPdfViewerServer PdfViewer { get; set; } 
public void created() 
    { 
        System.Net.WebClient webClient = new System.Net.WebClient(); 
        byte[] byteArray = webClient.DownloadData(Url); 
        DocumentPath = "data:application/pdf;base64," + Convert.ToBase64String(byteArray); 
    } 
 
 
 
 
Could you kindly try the sample and let us know whether you are facing the same issue in the sample which we provided? If yes, kindly share the details about in which event you are loading the PDF document. It will be helpful for us to investigate further and provide the details at the earliest. 
 
Regards, 
Dhivya. 
 



TS Tim Southard July 15, 2021 03:00 PM UTC

I'm still getting an error.  I've removed essentially everything and have it loading a document from the file system.  I am now getting the following in the dev console :


document.getElementById(...).ej2_instances is undefined



TS Tim Southard July 15, 2021 06:57 PM UTC

I found the issue.  I'm not sure why it just became an issue but I did not have the blazor app running in secure (https).  Once I made that change things began working again.


Marked as answer

DM Dhivyabharathi Mohan Syncfusion Team July 16, 2021 05:40 AM UTC

Hi Tim, 
  
  
Thank you for your update. We are glad to know that the reported issue is resolved. 
  
  
Regards, 
Dhivya. 


Loader.
Up arrow icon