Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8.8 System.ArgumentOutOfRangeException: Length couldn't be less than zero. #1530

Closed
Eugenii10 opened this issue Apr 3, 2023 · 3 comments
Closed

Comments

@Eugenii10
Copy link

Eugenii10 commented Apr 3, 2023

System information:

  • Windows OS version: Windows 11 version 21H2
  • ImageGlass version: 8.8.3.28 x64 Portable
  • Latest 4.8 .NET Framework is installed.

To Reproduce

Steps to reproduce the behavior:

  1. Launch ImageGlass.
  2. Press 'X' to launch ExifTool.
  3. Use next settings 'Tools > Command argumets':
    -p "D:\Repos\exiftool-sd-format\exif.fmt"
    The specified format file you can get here: https://raw.githubusercontent.com/Eugenii10/exiftool-sd-format/main/exif.fmt
  4. If I don't use specified format file, it works as expected without any error. Previous version 8.7.11.6 worked fine with that format file.

Actual behavior:

Additional popup window for ExifTool information is opened, but is is empty. The error message is displayed:

System.ArgumentOutOfRangeException: Длина не может быть меньше нуля.
Имя параметра: length
   в System.String.Substring(Int32 startIndex, Int32 length)
   в ImageGlass.Library.Image.ExifToolWrapper.ParseExifTags(String cmdOutput, String originalFileName)
   в ImageGlass.Library.Image.ExifToolWrapper.<ReadAsync>d__8.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в ImageGlass.FrmExifTool.<Local_OnImageChanged>d__12.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

It seems to be a problem with displaying tags from format file which are not presented in the current file's metadata. This is my guess.

Expected behavior:

Opened popup window is filled with the information from ExifTool.

Screenshots:

Additional context:

Suddenly version 8.7.11.6 doesn't want to show popup window for ExifTool information. It just blinks once with it's title bar and nothing more happen: nor error, nor something visual happen. It even doesn't blink second time until you close it and reopen. Not sure what actions lead to that condition. And Windows restart doesn't help in this situation.

@d2phap
Copy link
Owner

d2phap commented Apr 3, 2023

Since v8.8, the default commands to pass to the exiftool has 1 more arugment: -H - which is to print out the TagId.

public static string DefaultCommands => "-fast -G -t -m -q -H";

But the UI currently only shows Tag group, Tag name and Tag value. The correct order should be:

Tag_Group\tTag_Id\tTag_Name\tTag_Value"

To make it works, you can change your fmt file as below:

# ***
- File	File name	$FileName
+ File	-	File name	$FileName
- File	Directory name	${directory;s/\//\\/g}
+ File	-	Directory name	${directory;s/\//\\/g}

Also note that, there is a bug that makes the preview command in both Settings > Tool and the Exiftool does not show -H.

@Eugenii10
Copy link
Author

It works, thanks! I have just added - as Tag_Id to each line as you wrote.

@d2phap
Copy link
Owner

d2phap commented Apr 4, 2023

Also note that, there is a bug that makes the preview command in both Settings>Tool and the Exiftool does not show -H.

It should be fixed in v8.8.4.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants