-
-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
System.ObjectDisposedException: Cannot access a closed Stream.
at System.IO.Strategies.BufferedFileStreamStrategy.WriteByteSlow(Byte value)
at System.IO.Strategies.BufferedFileStreamStrategy.WriteByte(Byte value)
at System.IO.FileStream.WriteByte(Byte value)
at AnimatedGif.AnimatedGifCreator.Finish()
at AnimatedGif.AnimatedGifCreator.Dispose()
This occurs if the caller did this:
using var agc = AnimatedGif.Create(...);
//...write frames
agc.Dispose();
//...do something with the generated file, such as rename it
//later, variable agc goes out of scope, and gets disposed a second time triggering the exception
Personally I think there should be a public API for letting the user commit and close the file ahead of dispose, but a simple fix would be to set _stream to null after disposing.
Metadata
Metadata
Assignees
Labels
No labels