Still crashes. Both test cases I wrote. Thou differently this time; no error log and with an error message window
Huh. I wasn't expecting that.
Can't you reproduce the crash with the steps I gave? Strange.
In case you didn't understand the German version of the error log, here it's in English (note: this is from the 0.23.1 version, not from the debug version!):
Album Art Downloader has encountered a fatal error, and has had to close.
If you wish to report this error, please include this information, which
has been written to the file: C:\Program Files\AlbumArtDownloader\errorlog.txt
App version: 0.23.0.0, running on Microsoft Windows NT 5.1.2600 Service Pack 2
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.ArrayList.RemoveAt(Int32 index)
at System.Windows.Data.ListCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)
at System.Windows.Data.CollectionView.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection`1.RemoveItem(Int32 index)
at System.Collections.ObjectModel.Collection`1.Remove(T item)
at System.Collections.ObjectModel.Collection`1.System.Collections.IList.Remove(Object value)
at AlbumArtDownloader.Controls.ArtPanelList.OnImageSizeChanged(Object sender, EventArgs e)
at AlbumArtDownloader.AlbumArt.SetImageDimensions(Double width, Double height)
at AlbumArtDownloader.AlbumArt.<>c__DisplayClass7.<RetrieveFullSizeImageWorker>b__6()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at AlbumArtDownloader.App.AlbumArtDownloader.IPriorInstance.Run()
at AlbumArtDownloader.InstanceMutex.RunAppAsServiceHost(IPriorInstance instance, String channelUri)
at AlbumArtDownloader.App.Main(String[] args)
What I understand is that your code crashed because it tried to access an array index which was not there anymore. I'd guess that this is due to the fact that the filter removes covers from the result list and the process for getting the full size images ("RetrieveFullSizeImageWorker" perhaps?) tries to read an array index which was removed because of the filter. So, if you make the change to never filter out the "Unknowns" in the results list/window, I bet that the crash goes away.. or it might not.. or it could bring more problems (wrong index/image get).. it would be wise to check out that the "get full images" process always tries to access the correct index, which could have been moved or removed.. that is if the processes are run in parallel (the "update result list" & "get full"). Do I make sense at all or am I talking rubbish? I could be wrong.. considering that this "black box" testing I'm doing is pretty hard.
How about the problem where the list would update while the preview was being shown, does that still happen?
It's fixed. Thou honestly I still hate the fact that the cover is re-sorted (if it was different size) after I let the preview close. BUT, it's consistent now and no freezes so I guess I've to live with that. With big lists you could lose the position of the cover you were previewing. Although you could consider using, in example, a color indication (colored border on the image, put a transparent green "correct" image over the image (you could use a transparent disk image in same way for saved covers), etc.) whether the preview has been opened or not. This would make browsing much clearer, i.e. you instantly see which covers you've already checked.
In addition, it would be nice to have indicators for covers I've clicked to show the full size image in background (letting go of the preview window) when those are fully loaded. Now it only shows the "search" image in the left-top corner. A "search/download complete" image would be nice. This would also enhance the usability a lot. E.g. I always check many full size images and when they're big, the loading takes a while, and I like to open many "background full images", but it's hard to detect which images I chose when the full size image is ready.
For the filtering, I think I'm going to have it so that Unknowns are never filtered out.
Good call. Maybe the best solution here.