Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Microsoft.JSInterop.JSException: Converting circular structure to JSON in .NET7

I have created a Blazor Server application in .NET6.but recently I've upgraded it to.NET7.since this time,i am getting above issue .

Error: Microsoft.JSInterop.JSException: Converting circular structure to JSON --> starting at object with constructor 'Window' --- property 'window' closes the circle TypeError: Converting circular structure to JSON --> starting at object with constructor 'Window' --- property 'window' closes the circle at JSON.stringify ()

this issue is occurring from this line

await _jsRuntime.InvokeAsync<object>("open", url, "_blank");

this line is responsible for opening a URL in a new tab on the browser. once I click on a navigation bar link, the above line is called and occurred this issue.is there anybody who knows an answer to this issue? please help me, appreciate all your answers.

like image 618
buddhi chamalka Avatar asked Sep 14 '25 16:09

buddhi chamalka


1 Answers

I changed this line

await _jsRuntime.InvokeAsync<object>("open", url, "_blank");

as this

await _jsRuntime.InvokeVoidAsync("open", url, "_blank");

after that, I didn't get that issue.

like image 104
buddhi chamalka Avatar answered Sep 16 '25 06:09

buddhi chamalka