Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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-mapped section open.     at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)    at System.Xml.XmlTextWriter..ctor(String filename, Encoding encoding)    at System.Xml.XmlDocument.Save(String filename) 

The error happened when I called XmlDocument's Save(string) function.

Any ideas on what happened?

like image 498
Bryan Denny Avatar asked Aug 19 '09 21:08

Bryan Denny


1 Answers

Looks like another process had the file open using the file mapping (shared memory) APIs.

The find function in Process Explorer should be able to tell you.

like image 125
Richard Avatar answered Sep 27 '22 22:09

Richard