While extracting: Value of '893' is not valid for 'Value'
Describe the bug A clear and concise description of what the bug is.
Value of '893' is not valid for 'Value'. 'Value' should be between 'minimum' and 'maximum'.
Parameter name: Value
Technical Detail:
at System.Windows.Forms.ProgressBar.set_Value(Int32 value)
at LessMsi.Gui.ExtractionProgressDialog.UpdateProgress(ExtractionProgress progress)
at LessMsi.Gui.ExtractionProgressDialog.UpdateProgress(IAsyncResult result)
at LessMsi.Msi.Wixtracts.ExtractionProgress.ReportProgress(ExtractionActivity activity, String currentFileName, Int32 filesExtractedSoFar)
at LessMsi.Msi.Wixtracts.ExtractFiles(Path msi, String outputDir, MsiFile[] filesToExtract, AsyncCallback progressCallback)
at LessMsi.Gui.MainForm.btnExtract_Click(Object sender, EventArgs e)
To Reproduce Steps to reproduce the behavior:
- Open TopazVideoAI.msi
- Click on [Extract]
- At about 100% progress see error above
Desktop (please complete the following information):
- OS: Windows 10
Additional context
lessmsi.exe x TopazVideoAI.msi MSIEX\ works well, but last line shown is 894/892 Topaz Video AI.exe.
Hello @colemar.
I'd like to work on this issue and will be grateful if you can provide the msi file you used.
Thank you.
@mega5800 Sorry, I don't have the msi file anymore.
I see. In a quick Google search, I found the next link for TopazVideoAI.msi: https://docs.topazlabs.com/video-ai/download-and-install
Let me download it and check if I am able to reproduce the issue you have.
@mega5800 I bet it is possible that if there are files with the same name (which we know occurs for installers supporting x86 and x64) it could end up sending a file count during progress multiple times which could exceed the maximum value. This could occur due to the simplistic check at https://github.com/activescott/lessmsi/blob/68cde3ee5206baad4d09249100876c60d6c379df/src/LessMsi.Core/Msi/Wixtracts.cs#L330
You could probably create a unit test on an msi that has two files with the same name, but two different platforms and do an extraction and get it to call progress.ReportProgress with a value that is greater than the TotalFileCount value it was initialized with.
One way to fix might be to make sure that the ExtractionProgress class updates the _totalFileCount on every updateProgress call just before it updates the _filesExtractedSoFar value at https://github.com/activescott/lessmsi/blob/68cde3ee5206baad4d09249100876c60d6c379df/src/LessMsi.Core/Msi/Wixtracts.cs#L73
It might be a little weird that the TotalFiles value might change over time, but seems reasonable.
Just an idea. Hope this helps!