Skip to content

Issue with ThreadStatic/AsyncLocal Variables Being Set to Null After Migrating from SpecFlow to Reqnroll (Playwright, NUnit) #469

Discussion options

You must be logged in to vote

SpecFlow (v3) was not really async. It used a hack to run the async hooks and step definitions from a sync context. SpecFlow v4 (never released) introduced real async handling and that (naturally) changed the behavior.

In my opinion, using the [ThreadStatic] and AsyncLocal for this purpose is a bad practice in general. As mentioned it in the related issue, you can have a look at our sample app (https://github.com/reqnroll/Sample-ReqOverflow/tree/main/ReqOverflow.Specs.WebUI) that solves all this without needing [ThreadStatic] and AsyncLocal.

So primarily I recommend to remove these constructs and build up the infrastructure without them.

Using AsyncLocal does not work in the same way as […

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by 304NotModified
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants