![]() |
|
ReaderWmf leaks temporary files - Printable Version +- AB4D Forum (https://forum.ab4d.com) +-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4) +--- Forum: Paste2Xaml and Ab2d.ReaderWmf (https://forum.ab4d.com/forumdisplay.php?fid=7) +--- Thread: ReaderWmf leaks temporary files (/showthread.php?tid=242) |
ReaderWmf leaks temporary files - kguetter - 02-14-2012 I have the following code: Code: using (ReaderWmf reader = new ReaderWmf())Every time this section is executed, a EMF file is created in %LOCALAPPDATA%. There is a first chance exception on the closing brace (i.e. the Dispose call) "The process cannot access the file 'C:\Users\kg\AppData\Local\9333da9f-ef9d-4fd1-ab8a-66d8b0647bc0.emf' because it is being used by another process." Here is the call stack: Code: mscorlib.dll!System.IO.__Error.WinIOError(int errorCode = 0x80070020, string maybeFullPath = "C:\\Users\\kg\\AppData\\Local\\9333da9f-ef9d-4fd1-ab8a-66d8b0647bc0.emf") + 0x321 Bytes Using Sysinternals ProcessExplorer I found that there is no other process having an open handle to the file (only my program itself). Klaus Edit: Maybe this is the same problem as in the post "Problem with ReaderWmf Class in Web Service (WCF)". The metaFile variable in my code snippet is indeed a Stream. RE: ReaderWmf leaks temporary files - kguetter - 02-16-2012 It is indeed the same problem. As a workaround, I saved the stream to a temporary file, called the ReadGeometry overload taking a file name and then deleted the temporary file again. RE: ReaderWmf leaks temporary files - abenedik - 02-16-2012 As you have correctly sad, the current version of ReaderWmf creates a temporary file when metafile is read from a stream. I am preparing a release of a new version of ReaderWmf. I have already implemented reading metafiles directly from memory stream (without temp file). At first I was not aware that this is possible without a temp file, but after some additional investigation I have found a way to do it. I think that the new version will be available in the next week. Until than you can use the mentioned workaround. RE: ReaderWmf leaks temporary files - abenedik - 02-24-2012 I would like to inform you that the new version of ReaderWmf was just released - it does not create a temporary file any more when reading metafile from stream. It also fixes some other problems. For more information see the related blog post: http://blog.wpf-graphics.com/post/2012/02/24/Maintenance-releases-for-all-products-are-now-available.aspx |