Why does LogicalCallContext not work with async?

后端 未结 2 1737
一生所求
一生所求 2021-01-31 09:32

In this question the accepted answer by Stephen Cleary says that LogicalCallContext can\'t work correctly with async. He also posted about it in this MSDN thread.

Logica

2条回答
  •  情深已故
    2021-01-31 10:20

    Stephen confirms that this works on .Net 4.5 and Win8/2012. Not tested on other platforms, and known not to work on at least some of them. So the answer is that Microsoft got their game together and fixed the underlying issue in at least the most recent version of .Net and the async compiler.

    So the answer is, it does work, just not on older .Net versions. (So the log4net project can't use it to provide a generic NDC.)

提交回复
热议问题