Why does LogicalCallContext not work with async?
问题 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. LogicalCallContext keeps a Hashtable storing the data sent to CallContext.LogicalGet/SetData. And it only does a shallow copy of this Hashtable. So if you store a mutable object in it, different tasks/threads will see each other's changes. This is why Stephen Cleary's example NDC program (posted on that MSDN thread) doesn't work