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

ASP.NET Core does have a SynchronizationContext when using Blazor #99

Open
Sebazzz opened this issue Dec 22, 2022 · 2 comments
Open

ASP.NET Core does have a SynchronizationContext when using Blazor #99

Sebazzz opened this issue Dec 22, 2022 · 2 comments

Comments

@Sebazzz
Copy link

Sebazzz commented Dec 22, 2022

Avoid using Task.Result and Task.Wait:

:bulb:**NOTE: ASP.NET Core does not have a `SynchronizationContext` and is not prone to the deadlock problem.**

ASP.NET Core Blazor does appear to use a synchronization context, being the RendererSynchronizationContext](https://source.dot.net/#Microsoft.AspNetCore.Components/Rendering/RendererSynchronizationContext.cs,11).

@davidfowl
Copy link
Owner

It does! Specifically, in Blazor Server when executing razor components (I should probably change that now).

@Sebazzz
Copy link
Author

Sebazzz commented Dec 27, 2022

Yup, I should have specifically mentioned Blazor Server. This SynchronizationContext implementation doesn't necessarily schedule the work on the same thread like the WPF, WinForms and legacy ASP.NET does. It is prone to the same blocking issues however, I think.

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

2 participants