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
I have one jpeg image (apparently from some Windows Phone) where I get this exception when calling ImageFile.FromFile():
System.ArgumentException
HResult=0x80070057
Message=An item with the same key has already been added. Key: 384 (Parameter 'key')
Source=System.Collections
StackTrace:
at System.Collections.Generic.SortedList`2.Add(TKey key, TValue value)
at ExifLibrary.JPEGFile.ReadExifAPP1() in D:\Code\Github\exiflibrary\ExifLibrary\JPEGFile.cs:line 624
at ExifLibrary.JPEGFile..ctor(MemoryStream stream, Encoding encoding, Boolean readTrailingData) in D:\Code\Github\exiflibrary\ExifLibrary\JPEGFile.cs:line 176
at ExifLibrary.ImageFile.FromStreamInternal(MemoryStream stream, Encoding encoding) in D:\Code\Github\exiflibrary\ExifLibrary\ImageFile.cs:line 278
at ExifLibrary.ImageFile.FromStream(Stream stream, Encoding encoding) in D:\Code\Github\exiflibrary\ExifLibrary\ImageFile.cs:line 175
at ExifLibrary.ImageFile.FromFile(String filename, Encoding encoding) in D:\Code\Github\exiflibrary\ExifLibrary\ImageFile.cs:line 142
at ExifLibrary.ImageFile.FromFile(String filename) in D:\Code\Github\exiflibrary\ExifLibrary\ImageFile.cs:line 129
...
I'm not familiar enough with the jpeg format to make sense of the code, but what I observe is that at the time of the exception, ifdqueue has 2 entries:
[0] -> [384, GPS]
[1] -> [562, First]
And then we try to insert a [384, Interop], which blows up because it already has the key 384.
If duplicates are expected, maybe the solution is to use a custom comparer that allows it, as in https://stackoverflow.com/a/21886340. Just a guess!
Awesome library by the way, I've used it successfully on many images!
The text was updated successfully, but these errors were encountered:
I tried the comparer implementation that allows duplicates from that SO question, and it makes the error go away. But I have no idea if that correct :)
I have one jpeg image (apparently from some Windows Phone) where I get this exception when calling
ImageFile.FromFile()
:I'm not familiar enough with the jpeg format to make sense of the code, but what I observe is that at the time of the exception,
ifdqueue
has 2 entries:[0] -> [384, GPS]
[1] -> [562, First]
And then we try to insert a [384, Interop], which blows up because it already has the key 384.
If duplicates are expected, maybe the solution is to use a custom comparer that allows it, as in https://stackoverflow.com/a/21886340. Just a guess!
Awesome library by the way, I've used it successfully on many images!
The text was updated successfully, but these errors were encountered: