Crash when folder contains invalid shortcut
See original GitHub issueDescription
When I enter my Images folder, Files will crash. I’ve tested another folders but this is the only one where I got the crash.
I cleaned the log to only have the relevant:
debug.log:
2021-12-13 18:29:51.4576|ERROR|AppUnhandledException|Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at Files.Filesystem.StorageEnumerators.Win32StorageEnumerator.<GetFile>d__4.MoveNext() + 0xe6b
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x70
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x38
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task) + 0x17
at Files.Filesystem.StorageEnumerators.Win32StorageEnumerator.<ListEntries>d__2.MoveNext() + 0x2cb
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x70
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x38
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task) + 0x17
at Files.ViewModels.ItemViewModel.<>c__DisplayClass142_1.<<EnumerateItemsFromStandardFolderAsync>b__4>d.MoveNext() + 0x29a
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x70
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x38
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task) + 0x17
at System.Runtime.CompilerServices.TaskAwaiter.GetResult() + 0xb
at Files.ViewModels.ItemViewModel.<EnumerateItemsFromStandardFolderAsync>d__142.MoveNext() + 0x6f6
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x70
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x38
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task) + 0x17
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() + 0xf
at Files.ViewModels.ItemViewModel.<RapidAddItemsToCollection>d__138.MoveNext() + 0x20d
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x70
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x38
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task) + 0x17
at System.Runtime.CompilerServices.TaskAwaiter.GetResult() + 0xb
at Files.ViewModels.ItemViewModel.<RapidAddItemsToCollectionAsync>d__137.MoveNext() + 0x509
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__7_0(Object) + 0x1e
at System.Action`1.Invoke(T) + 0x28
at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore() + 0x33
at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21
at __Interop.ComCallHelpers.Call(__ComObject, RuntimeTypeHandle, Int32) + 0xb8
at __Interop.ForwardComStubs.Stub_10[TThis](__ComObject, Int32) + 0x24
at Microsoft.AppCenter.Utils.ApplicationLifecycleHelper.<.ctor>b__17_1(Object, UnhandledErrorDetectedEventArgs) + 0x3d
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
at Microsoft.AppCenter.Utils.ApplicationLifecycleHelper.<.ctor>b__17_1(Object, UnhandledErrorDetectedEventArgs) + 0x75
at System.EventHandler`1.Invoke(Object, TEventArgs) + 0x2e
at __Interop.Intrinsics.HasThisCall__23[TArg0](Object, IntPtr, Object, TArg0) + 0x36
at Files!<BaseAddress>+0x13a84c0
debug_fulltrust.log
2021-12-13 18:29:49.0209|WARN|StartSTATask|El sistema no puede encontrar el archivo especificado. (0x80070002)
System.IO.FileNotFoundException: El sistema no puede encontrar el archivo especificado. (0x80070002)
at Vanara.PInvoke.HRESULT.ThrowIfFailed(String message)
at Vanara.PInvoke.Shell32.ShellUtil.GetShellItemForPath(String path)
at Vanara.Windows.Shell.ShellItem..ctor(String path)
at FilesFullTrust.Win32API.GetFileIconAndOverlay(String path, Int32 thumbnailSize, Boolean getOverlay, Boolean onlyGetOverlay)
at FilesFullTrust.MessageHandlers.Win32MessageHandler.<>c__DisplayClass3_0.<ParseArgumentsAsync>b__1()
at FilesFullTrust.Win32API.<>c__DisplayClass0_0`1.<StartSTATask>b__0()
2021-12-13 18:29:51.0675|WARN|ParseFileOperationAsync|Error HRESULT E_FAIL has been returned from a call to a COM component.
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
at Vanara.PInvoke.Shell32.IShellLinkW.Resolve(HWND hwnd, SLR_FLAGS fFlags)
at Vanara.Windows.Shell.ShellLink.LoadAndResolve(String linkFile, SLR_FLAGS resolveFlags, HWND hWin, UInt16 timeOut)
at Vanara.Windows.Shell.ShellLink..ctor(String linkFile, LinkResolution resolveFlags, IWin32Window window, TimeSpan timeOut)
at FilesFullTrust.MessageHandlers.FileOperationsHandler.ParseFileOperationAsync(PipeStream connection, Dictionary`2 message)
Steps To Reproduce
- Go to Images folder (I don’t know if this is related to #4764, maybe yes)
- The app will crash.
Expected behavior
Not crashing
Files Version
Versión: 2.0.42.0 OS Version: 10.0.19044.1387
Windows Version
Windows 10 21H2 19044.1387
Relevant Assets/Logs
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Shortcuts Not Working in Windows 10 - Looking on Wrong ...
For some reason, the shortcut is attempting to run the program from the C drive, but it is not there. When I check...
Read more >Moved folder causing broken shortcuts
I have been fixing them manually by opening the shortcut and changing the drive letter and dropping everything up to "MyMainFolder" but im ......
Read more >Crash while Setting Working Folder for Data Shortcuts
When I select the correct folder, one that I have been using for the past 8 months, the program just freezes and will...
Read more >6 Ways to Fix “The Item That This Shortcut Refers to Has ...
Navigate to the desktop or the folder containing the faulty shortcut file. Double-click on the shortcut file and check if the issue has...
Read more >Fix Corrupted Icons and Shortcuts In Windows 7/8/10 - YouTube
Fix corrupted icons and shortcuts in Windows 7/8/10. To show icons faster, Windows caches them into a file. This special file contains icons ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@gave92 sure, I’ve sent it to you on discord app-dev channel.
@gave92 it seems that one of them has no path:
(the one without thumbnail)