Files
Files copied to clipboard
Bug: Crash when dragging files
Description
Noticed while organizing files, when I start dragging and move it up or down to make it scroll down, it will freeze and crash.
As soon as I drag to this area it crashes, or if I drag them around for a bit randomly, not sure, but I can replicate it every single time.
Looked for errors in the logs when this happens but it doesn't say anything.
Steps To Reproduce
Go to any folder Start dragging a file or more around Try moving them up to scroll up (or down)
Crash, no errors in logs.
Steps to fix
Wasn't able to figure out how to fix. Saw in another comment said running it as administrator causes it to crash, but it isn't running in the background, and when I start it up it doesn't prompt me to run it as administrator.
Files Version
2.4.25.0
Windows Version
Win 11 22H2 22623.1245
Log file
The problem seems to be this log line for whoever looks into this:
2023-02-03 19:33:34.1880|ERROR|AppUnhandledException|The server threw an exception. (0x80010105 (RPC_E_SERVERFAULT)) System.Runtime.InteropServices.COMException (0x80010105): The server threw an exception. (0x80010105 (RPC_E_SERVERFAULT))
Some addition: events during the crashes
Application: Files.exe CoreCLR Version: 7.0.222.60605 .NET Version: 7.0.2 Description: The process was terminated due to an unhandled exception. Exception Info: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Stack: at ABI.Microsoft.UI.Xaml.Controls.IControlOverridesMethods.OnDragOver(WinRT.IObjectReference, Microsoft.UI.Xaml.DragEventArgs) at ABI.Microsoft.UI.Xaml.Controls.IControlOverrides.Do_Abi_OnDragOver_26(IntPtr, IntPtr) at ABI.Microsoft.UI.Xaml.IApplicationStaticsMethods.Start(WinRT.IObjectReference, Microsoft.UI.Xaml.ApplicationInitializationCallback) at Files.App.Program.Main()
Faulting application name: Files.exe, version: 1.0.0.0, time stamp: 0x638f99ee Faulting module name: Microsoft.UI.Xaml.dll, version: 3.0.0.2301, time stamp: 0x655f8cbf Exception code: 0xc0000005 Fault offset: 0x00000000002e0e2a Faulting process id: 0x0x24A8 Faulting application start time: 0x0x1D937FDB11ADD98 Faulting application path: C:\Program Files\WindowsApps\Files_2.4.25.0_x64__wvne1zexy08sa\Files.App\Files.exe Faulting module path: C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.2_2000.747.1945.0_x64__8wekyb3d8bbwe\Microsoft.UI.Xaml.dll Report Id: a06ec228-4447-493c-8420-a5f5ea1f485f Faulting package full name: Files_2.4.25.0_x64__wvne1zexy08sa Faulting package-relative application ID: App
Is this still an issue in the preview version? https://files.community/download/preview
Is this still an issue in the preview version? https://files.community/download/preview
Updated, went into a folder, selected like 30 pictures, started dragging them up and as soon as I got to the ui bar on top it froze and crashed, so doesn't seem like it's fixed sadge
Just wanted to check back, downloaded the latest stable (2.4.71.0 on 10.0.22631.1835) and it still happens
Reproduce same as before.
Go to a folder with a lot of files, select like 7 images or whatever, and then drag them to the top bar where the tabs go and it will crash.
Faulting application name: Files.exe, version: 1.0.0.0, time stamp: 0x641de100
Faulting module name: Microsoft.UI.Xaml.dll, version: 3.0.0.2303, time stamp: 0x6c39c3fc
Exception code: 0xc0000005
Fault offset: 0x00000000002e0e2a
Faulting process id: 0x0x64A0
Faulting application start time: 0x0x1D99D4CCA2220C2
Faulting application path: C:\Program Files\WindowsApps\Files_2.4.71.0_x64__wvne1zexy08sa\Files.App\Files.exe
Faulting module path: C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.2_2000.802.31.0_x64__8wekyb3d8bbwe\Microsoft.UI.Xaml.dll
Report Id: 636a4864-d0a4-4c12-ab5e-116f97b64f3f
Faulting package full name: Files_2.4.71.0_x64__wvne1zexy08sa
Faulting package-relative application ID: App
Same on 2.5.1.0.
We've made some adjustments that may help, can you check if this is still an issue in the latest preview version? https://files.community/download/preview
@yaira2
Faulting application name: Files.exe, version: 1.0.0.0, time stamp: 0x64b07659
Faulting module name: Microsoft.UI.Xaml.dll, version: 3.1.4.0, time stamp: 0x88757e1c
Exception code: 0xc0000005
Fault offset: 0x0000000000312da2
Faulting process id: 0x0x6358
Faulting application start time: 0x0x1D9DC29752356B3
Faulting application path: C:\Program Files\WindowsApps\FilesPreview_2.5.25.0_x64__wvne1zexy08sa\Files.App\Files.exe
Faulting module path: C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.4_4000.964.11.0_x64__8wekyb3d8bbwe\Microsoft.UI.Xaml.dll
Report Id: 7972822a-6287-4c3e-8ea4-dca61a57bcb0
Faulting package full name: FilesPreview_2.5.25.0_x64__wvne1zexy08sa
Faulting package-relative application ID: App
Unfortunately the same thing happens. Went into a folder, selected around 20 images, dragged them towards the border and same behavior.
This is also after a complete clean windows install (my current version is 23531.1001
Log.
2023-09-03 17:20:59.9314|Error|System.Runtime.InteropServices.COMException (0x8001010E): The application called an interface that was marshalled for a different thread. (0x8001010E (RPC_E_WRONG_THREAD))
at ABI.Microsoft.UI.Xaml.Interop.WinRTNotifyCollectionChangedEventArgsRuntimeClassFactory.CreateInstanceWithAllParameters(NotifyCollectionChangedAction action, IList newItems, IList oldItems, Int32 newIndex, Int32 oldIndex)
at ABI.System.Collections.Specialized.NotifyCollectionChangedEventHandler.NativeDelegateWrapper.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
at Files.App.Utils.Storage.BulkConcurrentObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e, Boolean countChanged)
at Files.App.Utils.Storage.BulkConcurrentObservableCollection`1.Insert(Int32 index, T item)
at Files.App.ViewModels.UserControls.SidebarViewModel.AddElementToSection(INavigationControlItem elem, LocationItem section, Int32 index)
at Files.App.ViewModels.UserControls.SidebarViewModel.SyncSidebarItems(LocationItem section, Func`1 getElements, NotifyCollectionChangedEventArgs e)
at Files.App.ViewModels.UserControls.SidebarViewModel.<>c__DisplayClass72_0.<<Manager_DataChanged>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at CommunityToolkit.WinUI.DispatcherQueueExtensions.<>c__DisplayClass2_0.<<EnqueueAsync>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Files.App.ViewModels.UserControls.SidebarViewModel.Manager_DataChanged(Object sender, NotifyCollectionChangedEventArgs e)
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
The error you're encountering, System.Runtime.InteropServices.COMException (0x8001010E): The application called an interface that was marshalled for a different thread. (0x8001010E (RPC_E_WRONG_THREAD)), is a common error in multithreaded applications that use COM objects.
It's caused when an interface is invoked from a different thread than the one that it was created on. This is fundamental to how COM operates, as each COM object has a specific thread affinity, which means it must be invoked from the same thread on which it was instantiated.
The error seems to occur during a change in the collection of items in some form of sidebar in your file explorer application. Specifically, it's happening during the invocation of BulkConcurrentObservableCollection<T>.Insert() method, which seems to be called from SidebarViewModel.AddElementToSection().
Unfortunately, as a user, there's not much you can do to fix this, since it's a programming error. However, you can assist the developers by providing them with the error logs and a detailed description of your actions that led to the crash. This will help them reproduce the problem and fix it.
For the developers, they have to ensure the COM object is invoked from the correct thread. If the COM object is created on a UI thread, it should be used on the UI thread only. If it needs to be used on a different thread, they might need to implement a mechanism to marshal the call to the correct thread.
In .NET, for instance, there are several ways to marshal the execution to the UI thread, such as using Dispatcher.Invoke() or Dispatcher.BeginInvoke() methods in WPF applications, or SynchronizationContext.Post() or SynchronizationContext.Send() methods for a more generic approach. However, the exact solution depends on the architecture of the application and the threading model it uses.
@Enferlain can you try to repro this again in v3.0.2 and upload the updated log file?
Why did you close this issue when a similar issue was reported very recently?
I assume https://github.com/files-community/Files/commit/9d9d39c506f7f26f39686e11a7f359da0125fd16 fixed it
@Lukiluc29 which issue are you referring to?
@Lukiluc29 which issue are you referring to?
This issue was reported 7 hours ago #13950
I haven't been able to check yet, but I also did a clean windows install a month or two ago so maybe it wouldn't be the same scenario unless I'm schizo and already tried after reinstalling. Either way I'll check within a few days if the last fix solved it. Should be easy since the issue had a 100% reproduction rate for me