Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no tracked object with id '5'. Perhaps the DotNetObjectReference instance was already disposed #120

Open
Dupie123 opened this issue Nov 2, 2022 · 0 comments

Comments

@Dupie123
Copy link

Dupie123 commented Nov 2, 2022

Please see the following issue

Uncaught (in promise) Error: System.ArgumentException: There is no tracked object with id '5'. Perhaps the DotNetObjectReference instance was already disposed. (Parameter 'dotNetObjectId')
at Microsoft.JSInterop.JSRuntime.GetObjectReference(Int64 dotNetObjectId)
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.BeginInvokeDotNet(JSRuntime jsRuntime, DotNetInvocationInfo invocationInfo, String argsJson)
at Object.endInvokeDotNetFromJS (blazor.webassembly.js:1:3531)
at Object.Rt [as endInvokeDotNetFromJS] (blazor.webassembly.js:1:60566)
at Object.St [as invokeJSFromDotNet] (blazor.webassembly.js:1:60049)
at _mono_wasm_invoke_js_blazor (dotnet.6.0.10.ab6o20rtby.js:1:195300)
at 00971d2a:0x1a492
at 00971d2a:0xce60
at 00971d2a:0xbd73
at 00971d2a:0xabebf
at 00971d2a:0x6fc80
at 00971d2a:0x702ed

When using IClickBoundariesHandler and calling the following

await _clickHandler.RegisterClickBoundariesAsync(_clickDiv,
async (args) => await PageClick(args, false),
async (args) => await PageClick(args, true));
_clickSubscribed = true;

I then have the following code on IAsyncDisposable.DisposeAsync()

if (_clickSubscribed)
await _clickHandler.RemoveClickBoundariesAsync(_clickDiv);
await _clickHandler.DisposeAsync();

But when the page navigates away the error above is returned. Going back to the first page now doubles the error to 2 elements registered by the click event causing a memory leak

Uncaught (in promise) Error: System.ArgumentException: There is no tracked object with id '10'. Perhaps the DotNetObjectReference instance was already disposed. (Parameter 'dotNetObjectId')
at Microsoft.JSInterop.JSRuntime.GetObjectReference(Int64 dotNetObjectId)
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.BeginInvokeDotNet(JSRuntime jsRuntime, DotNetInvocationInfo invocationInfo, String argsJson)
at Object.endInvokeDotNetFromJS (blazor.webassembly.js:1:3531)
at Object.Rt [as endInvokeDotNetFromJS] (blazor.webassembly.js:1:60566)
at Object.St [as invokeJSFromDotNet] (blazor.webassembly.js:1:60049)
at _mono_wasm_invoke_js_blazor (dotnet.6.0.10.ab6o20rtby.js:1:195300)
at 00971d2a:0x1a492
at 00971d2a:0xce60
at 00971d2a:0xbd73
at 00971d2a:0xabebf
at 00971d2a:0x6fc80
at 00971d2a:0x702ed

Can you please assit me in solving the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant