Skip to content

JS Interop doesn't report the correct callstack #8612

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

Closed
rynowak opened this issue Mar 18, 2019 · 1 comment
Closed

JS Interop doesn't report the correct callstack #8612

rynowak opened this issue Mar 18, 2019 · 1 comment
Assignees
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed

Comments

@rynowak
Copy link
Member

rynowak commented Mar 18, 2019

There's a catch and re-throw that's breaking call stacks when using JSInterop. We probably need to use ExceptionDispatchInfo here to try and preserve the information.

You can repro this by adding a button that throws when clicked (server side).

I think the culprit is this pattern here: https://github.com/aspnet/Extensions/blob/master/src/JSInterop/Microsoft.JSInterop/src/DotNetDispatcher.cs#L106

I think we should also try to get rid of the ContinueWith here if possible (or specify the task scheduler). This has been problematic most places we do it.

Server

 	MvcSandbox.dll!MvcSandbox.Components.Pages.Index.Throw() Line 9	C#
 	Microsoft.AspNetCore.Components.dll!Microsoft.AspNetCore.Components.EventCallbackWorkItem.InvokeAsync<object>(System.MulticastDelegate delegate, object arg) Line 49	C#
 	Microsoft.AspNetCore.Components.dll!Microsoft.AspNetCore.Components.EventCallbackWorkItem.InvokeAsync(object arg) Line 38	C#
 	Microsoft.AspNetCore.Components.dll!Microsoft.AspNetCore.Components.ComponentBase.Microsoft.AspNetCore.Components.IHandleEvent.HandleEventAsync(Microsoft.AspNetCore.Components.EventCallbackWorkItem callback, object arg) Line 260	C#
 	Microsoft.AspNetCore.Components.dll!Microsoft.AspNetCore.Components.EventCallback.InvokeAsync(object arg) Line 61	C#
 	Microsoft.AspNetCore.Components.dll!Microsoft.AspNetCore.Components.Rendering.Renderer.DispatchEventAsync(int eventHandlerId, Microsoft.AspNetCore.Components.UIEventArgs eventArgs) Line 228	C#
>	Microsoft.AspNetCore.Components.Browser.dll!Microsoft.AspNetCore.Components.Browser.RendererRegistryEventDispatcher.DispatchEvent(Microsoft.AspNetCore.Components.Browser.RendererRegistryEventDispatcher.BrowserEventDescriptor eventDescriptor, string eventArgsJson) Line 25	C#
 	[Native to Managed Transition]	
 	[Managed to Native Transition]	
 	Microsoft.JSInterop.dll!Microsoft.JSInterop.DotNetDispatcher.InvokeSynchronously(string assemblyName, string methodIdentifier, object targetInstance, string argsJson)	Unknown
 	Microsoft.JSInterop.dll!Microsoft.JSInterop.DotNetDispatcher.BeginInvoke(string callId, string assemblyName, string methodIdentifier, long dotNetObjectId, string argsJson)	Unknown
 	Microsoft.AspNetCore.Components.Server.dll!Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost.BeginInvokeDotNetFromJS.AnonymousMethod__0() Line 137	C#

Client

Error: System.Exception: Here's a cool message
at Microsoft.JSInterop.DotNetDispatcher.InvokeSynchronously(String assemblyName, String methodIdentifier, Object targetInstance, String argsJson)
at Microsoft.JSInterop.DotNetDispatcher.BeginInvoke(String callId, String assemblyName, String methodIdentifier, Int64 dotNetObjectId, String argsJson)
@rynowak rynowak added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates area-blazor Includes: Blazor, Razor Components labels Mar 18, 2019
@mkArtakMSFT mkArtakMSFT added bug This issue describes a behavior which is not expected - a bug. 1 - Ready labels Mar 19, 2019
@mkArtakMSFT mkArtakMSFT added this to the 3.0.0-preview4 milestone Mar 19, 2019
@rynowak rynowak added 2 - Working Done This issue has been fixed and removed 1 - Ready labels Mar 28, 2019
@rynowak
Copy link
Member Author

rynowak commented Mar 28, 2019

dotnet/extensions#1324

@rynowak rynowak closed this as completed Mar 28, 2019
@mkArtakMSFT mkArtakMSFT removed area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels May 9, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed
Projects
None yet
Development

No branches or pull requests

2 participants