Skip to content

Commit

Permalink
Rephrased AV1830 to mention the current sync context
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisdoomen authored and mapfel committed Mar 22, 2021
1 parent 84feff4 commit e06d18a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion _pages/1800_PerformanceGuidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ Now when an ASP.NET MVC controller action does this:
return View(data);
}

You end up with a deadlock. Why? Because the `Result` property getter will block until the `async` operation has completed, but since an `async` method will automatically marshal the result back to the original thread and ASP.NET uses a single-threaded synchronization context, they'll be waiting on each other. A similar problem can also happen on WPF, Silverlight or a Windows Store C#/XAML app. Read more about this [here](http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115163.aspx).
You end up with a deadlock. Why? Because the `Result` property getter will block until the `async` operation has completed, but since an `async` method _could_ automatically marshal the result back to the original thread (depending on the current `SynchronizationContext` or `TaskScheduler`) and ASP.NET uses a single-threaded synchronization context, they'll be waiting on each other. A similar problem can also happen on UWP, WPF or a Windows Store C#/XAML app. Read more about this [here](http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115163.aspx).

0 comments on commit e06d18a

Please sign in to comment.