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
It looks like the file you're trying to write is already open elsewhere, either by your code or by another process.
Do you have the file open in an editor? Do you have some other code that reads it, but forgets to close it?
You can use Process Explorer to find out which process has open file handle on it - use the Find / Find handle or DLL... command.