if (File.Exists (strDirectory + "\\temp.mxd")) File.Delete(strDirectory + "\\temp.mxd"); System.IO.FileStream oFileStream = new System.IO.FileStream(strDirectory + "\\temp.mxd", FileMode.Create); oFileStream.Write(MyImage, 0, MyImage.Length); IMapDocument mapDoc = new MapDocumentClass(); mapDoc.Open(strDirectory + "\\temp.mxd"); // Throw exception
Solved! Go to Solution.
You might try closing the stream. The standard practice is to use a "using" statement. Google on "filestream using statement".
I assume that you know that map documents (mxd files) are OLE structured storage. I point this out because you did not share the code related to "MyImage".
You might try closing the stream. The standard practice is to use a "using" statement. Google on "filestream using statement".
I assume that you know that map documents (mxd files) are OLE structured storage. I point this out because you did not share the code related to "MyImage".