You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I pass an invalid or corrupt heic file to the HeifImage constructor, an exception is thrown without closing the file. If I try to delete the file I get an access violation exception.
try
{
using (var img = new HeifImage(heicImageFile)) // HeifException thrown here: "Heif image exception - Invalid input: No 'ftyp' box"
using (var primary = img.PrimaryImage())
{
primary.Write(jpegImageFile, 100);
}
File.Delete(heicImageFile);
}
catch (Exception ex)
{
File.Delete(heicImageFile); // IOException thrown here: "The process cannot access the file xxx.heic because it is being used by another process."
}
I would suggest you close/dispose the file handle in the finally block of a try/catch/finally so there are no memory leaks or file handles left open from an exception.
The text was updated successfully, but these errors were encountered:
If I pass an invalid or corrupt heic file to the HeifImage constructor, an exception is thrown without closing the file. If I try to delete the file I get an access violation exception.
I would suggest you close/dispose the file handle in the finally block of a try/catch/finally so there are no memory leaks or file handles left open from an exception.
The text was updated successfully, but these errors were encountered: