This can be fixed in .NET 4.0 but not documented.
I ran into the same error in the web production service. The error is similar and random during peak activity: "Element xxx not declared." However, in my case, we simply validate the XML using the cyclic Read command, rather than serializing the object.
The service is built / running under .NET 3.5, and in the development environment, I can easily replicate this error by starting 5 threads and simultaneously making a service call. The error occurs about 1 out of 10 requests.
When I sat down to solve this problem, the first thing I did was upgrade the service to .NET 4.0. Once I have done this, I can no longer produce this error. I increased the number of threads and removed the throttling of the service - there are still no errors.
While current documentation still indicates that the operations of the XmlSchema instance are not guaranteed by the thread, there may have been some structural change between 3.5 and 4.0, which improves thread safety for operations such as reading / checking on XmlSchema.
source share