I am looking into a problem whereby it seems that there is some cross contamination between different operations when retrieving an extension instance from OperationContext. It is one of those annoying concurrency based hard to replicate issues. I strongly suspect some sort of threading issue. We are running WCF services on IIS7.0/.NET 4 integrated mode. The relevant section of our extension is as follows:
public class CustomContext : IExtension<OperationContext>, ICustomContext
{
public CustomContext Current
{
get
{
return OperationContext.Current != null ? OperationContext.Current.Extensions.Find<CustomContext>() : null;
}
}
...
}
The above is called from a PostSharp aspect, I'm not sure if this is relevant of not? Given the above are there any obvious conditions under which the call to current might return the wrong CustomContext instance? Apologies for such an open ended question.