Navigating away from a page with a grid on it before it finishes rendering throws an error

I have a page with a grid on it. If I navigated to the page and navigate to another page before the Grid has completed rendering then I get a NullReferenceException with the following stack trace. If I wait for the grid to complete its renders and then move off to another page then there is no error.

Syncfusion.Blazor.dll!Syncfusion.Blazor.Grids.Internal.GridJSInteropAdaptor<vx.Services.DynamicDictionary>.Dispose() Unknown
Syncfusion.Blazor.dll!Syncfusion.Blazor.Grids.SfGrid<vx.Services.DynamicDictionary>.System.IDisposable.Dispose.AnonymousMethod__342_1(System.Threading.Tasks.Task t1) Unknown
System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread threadPoolThread, System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
System.Private.CoreLib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot, System.Threading.Thread threadPoolThread) Unknown
System.Private.CoreLib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() Unknown

The following is logged to the browser console:

Uncaught (in promise) Error: System.ArgumentException: There is no tracked object with id '55'. Perhaps the DotNetObjectReference instance was already disposed. (Parameter 'dotNetObjectId')
   at Microsoft.JSInterop.JSRuntime.GetObjectReference(:65226/Int64 dotNetObjectId)
   at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.BeginInvokeDotNet(:65226/JSRuntime jsRuntime, DotNetInvocationInfo invocationInfo, String argsJson)
    at Object.endInvokeDotNetFromJS (blazor.server.js:1)
    at e.<anonymous> (blazor.server.js:8)
    at blazor.server.js:1
    at Array.forEach (<anonymous>)
    at e.invokeClientMethod (blazor.server.js:1)
    at e.processIncomingData (blazor.server.js:1)
    at e.connection.onreceive (blazor.server.js:1)
    at WebSocket.i.onmessage (blazor.server.js:1)

Attached is output from our application log.


Attachment: Grid_destroy_error_application_log_3cfdf91c.zip

1 Reply

VN Vignesh Natarajan Syncfusion Team December 10, 2020 11:48 AM UTC

Hi Michael,   

Thanks for contacting Syncfusion support.  

Query: “If I navigated to the page and navigate to another page before the Grid has completed rendering then I get a NullReferenceException with the following stack trace 

We have analyzed the reported issue and we are able to reproduce the first exception “null reference error” (thrown from dispose) at our end also. We have considered the reported query as a bug and logged the defect report “Exception occur while navigating away from Grid before it gets rendered completely” for the same. Thank you for taking the time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and including the defect fix in our weekly release which is expected to be rolled out by mid of January, 2021. We will update you once the release is rolled out.   
      
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.      
  

But we are facing difficulties in validating the second exception thrown regarding the ArgumentException. We need some more information about the issue. So kindly share the following details.  

  1. Share the Grid rendering code example.
  2. Share your .NET Core version (3.1 or 5.0)?
  3. Are you facing the script error during the initial rendering or while navigating away from Grid?
  4. If you are using the Grid toolbar, kindly ensure the reported issue by removing the Grid toolbar alone.
  5. Share more details about the issue.  

Above requested details will be helpful for us to validate the reported query at our end and provide solution as early as possible.  

Regards, 
Vignesh Natarajan  










Loader.
Up arrow icon