I received a very weird IOException when writing to an XML file:
System.IO.IOException: The requested operation cannot be performed on a file with a user-map
Try excluding the file from your project while you debug. I found that it was in fact VS2010 which was holding the XML file. You can then select "Show all files" in your solution explorer to check the XML file post debug.
A lock will stop the issue when doing multiple writes.
lock(file){ write to file code here }