System.IO.Exception error: “The requested operation cannot be performed on a file with a user-mapped section open.”

后端 未结 5 850
梦如初夏
梦如初夏 2020-12-03 04:42

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         


        
5条回答
  •  情书的邮戳
    2020-12-03 05:18

    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 }
    

提交回复
热议问题