If a MatButton links to a PDF resource and has the target set to "_blank" after some time unhandled TaskCanceledException is raised.
- Create Blazor Server Side project
- Paste the following code in the Index.razor file:
<MatButton Link="https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611_sample_explain.pdf" Target="_blank"> Click here </MatButton>
- Click the button and wait for about 30 seconds and you'll get the following error:
blazor.server.js:8 Uncaught (in promise) TypeError: Converting circular structure to JSON --> starting at object with constructor 'Window' --- property 'parent' closes the circle at JSON.stringify (<anonymous>) at blazor.server.js:8 (anonymous) @ blazor.server.js:8 Promise.then (async) beginInvokeJSFromDotNet @ blazor.server.js:8 (anonymous) @ blazor.server.js:1 e.invokeClientMethod @ blazor.server.js:1 e.processIncomingData @ blazor.server.js:1 connection.onreceive @ blazor.server.js:1 i.onmessage @ blazor.server.js:1 blazor.server.js:19 [2020-09-17T17:32:52.919Z] Error: System.Threading.Tasks.TaskCanceledException: A task was canceled. at Microsoft.JSInterop.JSRuntime.InvokeWithDefaultCancellation[T](String identifier, Object[] args) at MatBlazor.BaseMatComponent.JsInvokeAsync[T](String code, Object[] args) at MatBlazor.BaseMatButton.OnClickHandler(MouseEventArgs ev) at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_0(Object state) at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteSynchronously(TaskCompletionSource 1 completion, SendOrPostCallback d, Object state) at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<.cctor>b__23_0(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteBackground(WorkItem item) e.log @ blazor.server.js:19 C @ blazor.server.js:8 (anonymous) @ blazor.server.js:8 (anonymous) @ blazor.server.js:1 e.invokeClientMethod @ blazor.server.js:1 e.processIncomingData @ blazor.server.js:1 connection.onreceive @ blazor.server.js:1 i.onmessage @ blazor.server.js:1
Blazorfiddle does not seem to allow opening new tabs from within its code therefore link is not provided.
If a MatButton links to a PDF resource and has the target set to "_blank" after some time unhandled TaskCanceledException is raised.
<MatButton Link="https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611_sample_explain.pdf" Target="_blank"> Click here </MatButton>blazor.server.js:8 Uncaught (in promise) TypeError: Converting circular structure to JSON --> starting at object with constructor 'Window' --- property 'parent' closes the circle at JSON.stringify (<anonymous>) at blazor.server.js:8 (anonymous) @ blazor.server.js:8 Promise.then (async) beginInvokeJSFromDotNet @ blazor.server.js:8 (anonymous) @ blazor.server.js:1 e.invokeClientMethod @ blazor.server.js:1 e.processIncomingData @ blazor.server.js:1 connection.onreceive @ blazor.server.js:1 i.onmessage @ blazor.server.js:1 blazor.server.js:19 [2020-09-17T17:32:52.919Z] Error: System.Threading.Tasks.TaskCanceledException: A task was canceled. at Microsoft.JSInterop.JSRuntime.InvokeWithDefaultCancellation[T](String identifier, Object[] args) at MatBlazor.BaseMatComponent.JsInvokeAsync[T](String code, Object[] args) at MatBlazor.BaseMatButton.OnClickHandler(MouseEventArgs ev) at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_0(Object state) at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteSynchronously(TaskCompletionSource 1 completion, SendOrPostCallback d, Object state) at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<.cctor>b__23_0(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteBackground(WorkItem item) e.log @ blazor.server.js:19 C @ blazor.server.js:8 (anonymous) @ blazor.server.js:8 (anonymous) @ blazor.server.js:1 e.invokeClientMethod @ blazor.server.js:1 e.processIncomingData @ blazor.server.js:1 connection.onreceive @ blazor.server.js:1 i.onmessage @ blazor.server.js:1Blazorfiddle does not seem to allow opening new tabs from within its code therefore link is not provided.