[BUG] An unhandled exception occured / Index was out of range
Describe the bug I start the programme on windows 10 and want to navigate to an image folder with a few subfolders and thousands of images. When double-clicking on the image folder the programme shows an error message (see screenshot) and shuts down completely.
Version: Version 1.9
Tool: SDWebUI Forge and ComfyUI.
To Reproduce See bug description.
Expected behavior I want to enter the folder, see and select images to read the metadata of the images.
Am also getting the same error. Everything appears to be working okay, but if I go to folders and try to open a folder to see the images contained within it, I get the Unhandled Exception error and the program closes. I can view images via albums, search, etc without issue.
Can you try this build:
https://github.com/RupertAvery/DiffusionToolkit/actions/runs/14713952094/artifacts/3023901450
I also get this error when I open a folder containing images.
If this happens when you open an image, can you upload the image here? Or upload the error in the log file?
If this happens when you open an image, can you upload the image here? Or upload the error in the log file?
it does not matter. the same error pops when going in the TAB search images (CTRL+2) below folder TAB. so it is not about quality of image. plus please i was unable to find image FILE SIZE in (MB or KB etc) thanks for Adding the SIZE in sorting options. but it does not show file size. like what is the actual size on the system. i can see pixel size in the image parameter side panels. 2000X3000 pixels. for example but is it 14 mb or 30 mb, i can't see such option to view. thanks
It's not when opening an image that the error occurs, but when clicking on a folder for me.
If this happens when you open an image, can you upload the image here? Or upload the error in the log file?
Hello, I found the problem in the file "ThumbnailView.xaml.Page.cs"
I have modified "public void ReloadThumbnailsView()"
Here's my fix:
public void ReloadThumbnailsView()
{
var wrapPanel = GetChildOfType<WrapPanel>(this);
if (wrapPanel == null || wrapPanel.Children.Count == 0)
return; // 🔐 Protects against out-of-range indexing here
var scrollViewer = GetChildOfType<ScrollViewer>(this);
if (scrollViewer == null)
return;
var offset = scrollViewer.VerticalOffset;
var height = scrollViewer.ViewportHeight;
var item = wrapPanel.Children[0] as ListViewItem;
// 🛡️ Additional verification
if (item == null)
return;
var preloadSize = item.ActualHeight * 2;
double top = 0;
double left = 0;
var maxHeight = item.ActualHeight;
for (var i = 0; i < wrapPanel.Children.Count; i++)
{
item = wrapPanel.Children[i] as ListViewItem;
if (item == null)
continue; // 🛡️ Additional verification
if (top + item.ActualHeight >= (offset - preloadSize) && top <= (offset + height + preloadSize))
{
if (item?.DataContext is ImageEntry { LoadState: LoadState.Unloaded } imageEntry)
{
ServiceLocator.ThumbnailService.QueueImage(imageEntry);
}
}
if (item.ActualHeight > maxHeight)
{
maxHeight = item.ActualHeight;
}
left += item.ActualWidth;
if (left + item.ActualWidth > wrapPanel.ActualWidth)
{
top += maxHeight;
maxHeight = item.ActualHeight;
left = 0;
}
}
}
I compiled and executed and the problem disappeared and I see my list of folders and I can click on them :)
how do we non programing dumb users fix this?
how do we non programing dumb users fix this?
You have to wait for the creator to apply the modification and make the update :)
Thanks for fixing this, @Light-x02 !
Here's the fixed build
https://github.com/RupertAvery/DiffusionToolkit/actions/runs/14734845909/artifacts/3030902988
Here's the fixed build
https://github.com/RupertAvery/DiffusionToolkit/actions/runs/14734845909/artifacts/3030902988
Thanks. That fixes it for me. Initial navigation is slow and I thought the program had hung (I have a fairly large number of folders), but after that initial load or whatever is performed it's then quick.
Here's the fixed build
https://github.com/RupertAvery/DiffusionToolkit/actions/runs/14734845909/artifacts/3030902988
Hi Rupert, your application is EXTREMELY excellent but I too am having the same error. It only happens when I try to open a sub folder within the main folder which I have added to Diffusion Toolkit. Your link doesn't work :( How do I get the updated fixed build?
Here's the fixed build https://github.com/RupertAvery/DiffusionToolkit/actions/runs/14734845909/artifacts/3030902988
Hi Rupert, your application is EXTREMELY excellent but I too am having the same error. It only happens when I try to open a sub folder within the main folder which I have added to Diffusion Toolkit. Your link doesn't work :( How do I get the updated fixed build?
Did you put this build on? It's the FIX.
https://github.com/RupertAvery/DiffusionToolkit/actions/runs/14734845909/artifacts/3030902988
Here's the fixed build https://github.com/RupertAvery/DiffusionToolkit/actions/runs/14734845909/artifacts/3030902988
Hi Rupert, your application is EXTREMELY excellent but I too am having the same error. It only happens when I try to open a sub folder within the main folder which I have added to Diffusion Toolkit. Your link doesn't work :( How do I get the updated fixed build?
Did you put this build on? It's the FIX.
https://github.com/RupertAvery/DiffusionToolkit/actions/runs/14734845909/artifacts/3030902988
Odd, the link gave me a 404 error when I posted "Page not found" but now it works. Oh well lol, thanks, I'll give it a try. Hope to see this available via the update within the application for everyone.
Here's the fixed build
https://github.com/RupertAvery/DiffusionToolkit/actions/runs/14734845909/artifacts/3030902988
Thanks guys! This fixed it for me! Great software and great fix! Big respect!
Getting this error and the link above is 404
...and now the link works...weird...
1.9.1 fixed the issue for me. Consider publishing to releases/?
The only gotcha in 1.9.1 is that I can't figure out how to add more new folders from the Root Folders view, which I could in V1.9.0 via the settings / general. So I used 1.9.0 to add more folders, then switched back to 1.9.1 to actually view them 😉.
just downloaded a fresh copy deleted the original and the roaming files and still have this issue
this is still an issue for me in the latest release (1.9.0) Has the above fix been pushed to the latest builds?
The artifact link that was linked previously:
https://github.com/RupertAvery/DiffusionToolkit/actions/runs/14734845909/artifacts/3030902988
is no longer functional.
Hey @jwoeifjofwefawsfasd @fdwr and anyone else running into issues with 1.9.0:
You can download the master zip / code through this link: https://github.com/RupertAvery/DiffusionToolkit/archive/refs/heads/master.zip
You can also click the green <> Code button in the middle - middle right on the Code page for Diffusion Toolkit, and select Download ZIP. Once you unzip or extract all of the files into a folder, run the "publish.cmd" file. It should properly work after that. You MAY have to have .NET 6 SDK installed, however, I had ran publish.cmd previously and it didn't need .NET 6 SDK.
After you run the publish.cmd file, all of Diffusion Toolkit gets placed into a new folder titled "build". You can rename it or move it to wherever you like, but that has all of the normal files that you'd see if you downloaded any of the releases. Running Diffusion Toolkit.exe should then not give you any errors (at least, not of this Index variety).
Let me know if you have any further issues.