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

后端 未结 5 847
梦如初夏
梦如初夏 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:10

    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.

提交回复
热议问题