1
Vote

ContextItems not flowing across Async Methods

description

In one of our projects we are using ContextItems in the Logging Block to populate additional properties in the LogEntry.

It all works fine in synchronous scenarios. But in async scenarios like async/await oder in async callbacks from WCF Services the ContextItems are lost.

Is this by design?

In the source I have found that the ContextItems use the remoting CallContext. But it doesn't use the LogicalCallContext which is also transported across threads.

What is the best solution for this problem? Since the async programming model is much easier in .NET 4.5 there should be a need for a fix for this, shouldn't it?

Thank
Marius Filipowksi

comments