According to MSDN, XmlSchemaSet
class is not guaranteed to be thread-safe.
So can multiple XmlReader
objects be created with a single XmlReaderSettings
object referencing one XmlSchemaSet
object and used concurrently from multiple threads? Or does this mean I am required to create a new XmlReaderSettings
object and assign it a new copy of XmlSchemaSet
every time I need to process a new document in the background?
Seems like this would be very wasteful. Especially since XmlSchemaSet
would need to recompile the schema for every new document.
Is the answer the same for XmlWriter
objects?
Of course, I wouldn't modify the XmlSchemaSet
object after populating it initially. I would also call the Compile
method before first using it. After that, it seems like everything should be just safe since only reads would be performed, but I'm not sure.