WCF "DataContext accessed after Dispose"

Posted by David Ward on Stack Overflow See other posts from Stack Overflow or by David Ward
Published on 2010-04-09T08:34:38Z Indexed on 2010/04/09 8:43 UTC
Read the original article Hit count: 1181

Filed under:
|
|

I have an application with numerous WCF services that make use of LINQ-To-SQL as the data access model. I am having lots of problems with the "DataContext accessed after Dispose" exception. I understand what this exception is and that it is occurring because I have not "initialised" the data that is trying to be accessed. I've read many articles that suggest that I called ToList() on any arrays before the parent object is returned by the service.

My issue is that I am getting this exception and I don't know where it is originating from and therefore I don't know what hasn't been initialised.

Can anyone advise how best to identify the root cause?

(I have used the MS Service Trace Viewer and this doesn't seem to give me any further information)

© Stack Overflow or respective owner

Related posts about c#

Related posts about linq-to-sql