Edit - More info:
This also happens on the ShellListViewIntro Demo if LayoutMode is set to MediumIcons (possibly others).
--------------------
I'm using a ShellListView to display a folder, but if I navigate to that same folder with windows explorer, create a file and then delete the file, the program would either freeze or crash (if I click any icon) with the stacktrace below.
Steps to reproduce:
Start program
Navigate to ‘My Documents’
Create ‘New Text Document.txt
Delete said file
(ShellListView does not get updated)
Click Anything inside ShellListView
(Application Crashes)
Stacktrace
System.ArgumentException
HResult=0x80070057
Message=GeneratorPosition '-1,1' passed to Remove does not have Offset equal to 0.
Parameter name: position
Source=PresentationFramework
StackTrace:
at System.Windows.Controls.ItemContainerGenerator.Remove(GeneratorPosition position, Int32 count, Boolean isRecycling)
at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.Remove(GeneratorPosition position, Int32 count)
at #w6j.#Tpk.#mpk(Int32 #npk, Int32 #LX)
at #w6j.#Tpk.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext 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, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
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.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at WpfApp2.App.Main()This exception was originally thrown at this call stack:
System.Windows.Controls.ItemContainerGenerator.Remove(System.Windows.Controls.Primitives.GeneratorPosition, int, bool)
System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.Remove(System.Windows.Controls.Primitives.GeneratorPosition, int)
#w6j.#Tpk.#mpk(int, int)
#w6j.#Tpk.MeasureOverride(System.Windows.Size)
System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
System.Windows.UIElement.Measure(System.Windows.Size)
System.Windows.ContextLayoutManager.UpdateLayout()
System.Windows.ContextLayoutManager.UpdateLayoutCallback(object)
System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
...
[Call Stack Truncated]
MainWindow.xaml.cs
using System;
using System.ComponentModel;
using System.Windows;
namespace WpfApp2
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
Shell.RootShellFolderParsingName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
}
protected override void OnClosing(CancelEventArgs e)
{
Shell.DisposeShellInstances();
base.OnClosing(e);
}
}
}
MainWindow.xaml
<Window x:Class="WpfApp2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp2"
xmlns:shell="http://schemas.actiprosoftware.com/winfx/xaml/shell"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<shell:ShellListView x:Name="Shell" LayoutMode="MediumIcons" RootSpecialFolderKind="Default">
<!--<shell:ShellListView.DefaultShellService>
<local:ShellService />
</shell:ShellListView.DefaultShellService>-->
</shell:ShellListView>
</Grid>
</Window>
[Modified 5 years ago]