Skip to content

Instantly share code, notes, and snippets.

@christophercurrie
Created July 2, 2013 23:44
Show Gist options
  • Save christophercurrie/5914256 to your computer and use it in GitHub Desktop.
Save christophercurrie/5914256 to your computer and use it in GitHub Desktop.
BitmapDecoder bug
Known issue: Stream opened for Uri is not closed until finalized unless BitmapCacheOption.OnLoad set
Both overloads of this method contain a bug, where a stream is opened for the Uri, which is not closed until the bitmap decoder is finalized, unless BitmapCacheOption.OnLoad is set. Since there is no Dispose() method, there is no way to force closing the stream, except for removing all references to the BitmapDecoder, and forcing finalization using GC.Collect().
The workaround is to use the overload that takes a Stream, and dispose of the stream after you are done with the Decoder.
http://connect.microsoft.com/VisualStudio/feedback/details/344914/bitmapdecoder-not-releasing-file-lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment