benaadams / Ben.BlockingDetector

Blocking Detection for ASP.NET Core
Apache License 2.0
734 stars 38 forks source link

Add new caveat #1

Closed slang25 closed 6 years ago

slang25 commented 6 years ago

Please close if I am incorrect. This library requires that this sync context is flowed through the code.

benaadams commented 6 years ago

This is correct

slang25 commented 6 years ago

It's not that it won't work inside the awaited method, it's that calls below within the same async method will run with a null context.

slang25 commented 6 years ago

Let me create a sample to be clear

slang25 commented 6 years ago

@benaadams See here: https://github.com/slang25/Ben.BlockingDetector/blob/await-example/src/Ben.BlockingDetector.Sample/Controllers/HomeController.cs#L24 When you remove the first await, the detection works.

benaadams commented 6 years ago

Should now even catch moving off the sync context for Tasks; though it won't catch Monitor.Wait etc if you do; so not removing the caveat just yet

slang25 commented 6 years ago

https://github.com/benaadams/Ben.BlockingDetector/commit/d651e390011eeecbd4328b6cdc4d0bb365d44c0e#r26963867 I'm enjoying "Tips of the Toub"

benaadams commented 6 years ago

I'm enjoying "Tips of the Toub"

@stephentoub's the bringer of magic