Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files crashes/messes up folder content when reading external drive if a different drive was inserted, but using the same drive letter #4930

Closed
jh961202 opened this issue May 17, 2021 · 2 comments

Comments

@jh961202
Copy link

Explain the bug
If an external drive was inserted and opened by Files, seems like Files will cache the folder content of the drive.
However if ANOTHER external drive was then inserted after the current drive was removed, Windows might assign the same drive letter to it.
At this moment if trying to open newly-inserted external drive using Files, there might be 2 possible behavior:
1.Files crash and exit
2.Newly inserted drive's root content will messed up with the former drive's root content.

To reproduce

  1. Insert any one of the external mass storage drive (i.e. Portable HDD or USB flash disk) and open it with Files.
  2. Close Files, note down the drive letter of external disk and eject it.
  3. Insert different external mass storage drive with DIFFERENT content inside, and make sure it's getting the same drive letter as the former removed one.
  4. Open Files, select the external drive and see the error.

Expected behavior
Files should show the newly-inserted drive root content.

Logfile
===debug.txt===
2021-05-17 08:30:17.2983|ERROR|.ctor|元素找不到。

元素找不到。
|System.Exception: 元素找不到。

元素找不到。

at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21
at __Interop.ComCallHelpers.Call(__ComObject, RuntimeTypeHandle, Int32, Void*) + 0xbe
at __Interop.ForwardComStubs.Stub_3[TThis, TResult](__ComObject, Int32) + 0x37
at Windows.ApplicationModel.Core.CoreApplicationView.get_DispatcherQueue() + 0x18
at Files.ViewModels.ItemViewModel.<>c__DisplayClass101_0.<b__0>d.MoveNext() + 0xf51
--- 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.d__101.MoveNext() + 0xed
--- 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.Views.LayoutModes.GenericFileBrowser.<AllView_LoadingRow>d__41.MoveNext() + 0x118
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.b__7_0(Object) + 0x1e
at System.Action1.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_19[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.EventHandler1.Invoke(Object, TEventArgs) + 0x2e
at __Interop.Intrinsics.HasThisCall__24[TArg0](Object, IntPtr, Object, TArg0) + 0x36
at Files!+0x158f900

===End debug.txt===

===debug_fulltrust.txt===
021-05-17 08:30:12.1684|INFO|FilesFullTrust.Win32API|系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)|System.IO.FileNotFoundException: 系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)
於 Vanara.PInvoke.Shell32.ShellUtil.GetShellItemForPath(String path)
於 FilesFullTrust.Win32API.GetFileIconAndOverlay(String path, Int32 thumbnailSize)
於 FilesFullTrust.Win32API.<>c__DisplayClass0_01.<StartSTATask>b__0() 2021-05-17 08:30:12.1684|INFO|FilesFullTrust.Program|Argument: GetIconOverlay| 2021-05-17 08:30:12.1904|INFO|FilesFullTrust.Win32API|系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)|System.IO.FileNotFoundException: 系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002) 於 Vanara.PInvoke.Shell32.ShellUtil.GetShellItemForPath(String path) 於 FilesFullTrust.Win32API.GetFileIconAndOverlay(String path, Int32 thumbnailSize) 於 FilesFullTrust.Win32API.<>c__DisplayClass0_01.b__0()
2021-05-17 08:30:12.1904|INFO|FilesFullTrust.Program|Argument: GetIconOverlay|
2021-05-17 08:30:12.2153|INFO|FilesFullTrust.Program|Argument: GetIconOverlay|
2021-05-17 08:30:12.2153|INFO|FilesFullTrust.Win32API|系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)|System.IO.FileNotFoundException: 系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)
於 Vanara.PInvoke.Shell32.ShellUtil.GetShellItemForPath(String path)
於 FilesFullTrust.Win32API.GetFileIconAndOverlay(String path, Int32 thumbnailSize)
於 FilesFullTrust.Win32API.<>c__DisplayClass0_01.<StartSTATask>b__0() 2021-05-17 08:30:12.2153|INFO|FilesFullTrust.Program|Argument: GetIconOverlay| 2021-05-17 08:30:12.2153|INFO|FilesFullTrust.Win32API|系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)|System.IO.FileNotFoundException: 系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002) 於 Vanara.PInvoke.Shell32.ShellUtil.GetShellItemForPath(String path) 於 FilesFullTrust.Win32API.GetFileIconAndOverlay(String path, Int32 thumbnailSize) 於 FilesFullTrust.Win32API.<>c__DisplayClass0_01.b__0()
2021-05-17 08:30:12.2153|INFO|FilesFullTrust.Program|Argument: GetIconOverlay|
2021-05-17 08:30:12.2153|INFO|FilesFullTrust.Win32API|系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)|System.IO.FileNotFoundException: 系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)
於 Vanara.PInvoke.Shell32.ShellUtil.GetShellItemForPath(String path)
於 FilesFullTrust.Win32API.GetFileIconAndOverlay(String path, Int32 thumbnailSize)
於 FilesFullTrust.Win32API.<>c__DisplayClass0_01.<StartSTATask>b__0() 2021-05-17 08:30:12.2153|INFO|FilesFullTrust.Program|Argument: GetIconOverlay| 2021-05-17 08:30:12.2153|INFO|FilesFullTrust.Win32API|系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)|System.IO.FileNotFoundException: 系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002) 於 Vanara.PInvoke.Shell32.ShellUtil.GetShellItemForPath(String path) 於 FilesFullTrust.Win32API.GetFileIconAndOverlay(String path, Int32 thumbnailSize) 於 FilesFullTrust.Win32API.<>c__DisplayClass0_01.b__0()
2021-05-17 08:30:12.2153|INFO|FilesFullTrust.Program|Argument: GetIconOverlay|
2021-05-17 08:30:12.2153|INFO|FilesFullTrust.Win32API|系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)|System.IO.FileNotFoundException: 系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)
於 Vanara.PInvoke.Shell32.ShellUtil.GetShellItemForPath(String path)
於 FilesFullTrust.Win32API.GetFileIconAndOverlay(String path, Int32 thumbnailSize)
於 FilesFullTrust.Win32API.<>c__DisplayClass0_01.<StartSTATask>b__0() 2021-05-17 08:30:12.2153|INFO|FilesFullTrust.Program|Argument: GetIconOverlay| 2021-05-17 08:30:12.2153|INFO|FilesFullTrust.Win32API|系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)|System.IO.FileNotFoundException: 系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002) 於 Vanara.PInvoke.Shell32.ShellUtil.GetShellItemForPath(String path) 於 FilesFullTrust.Win32API.GetFileIconAndOverlay(String path, Int32 thumbnailSize) 於 FilesFullTrust.Win32API.<>c__DisplayClass0_01.b__0()
2021-05-17 08:30:12.2153|INFO|FilesFullTrust.Program|Argument: GetIconOverlay|
2021-05-17 08:30:12.2153|INFO|FilesFullTrust.Win32API|系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)|System.IO.FileNotFoundException: 系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)
於 Vanara.PInvoke.Shell32.ShellUtil.GetShellItemForPath(String path)
於 FilesFullTrust.Win32API.GetFileIconAndOverlay(String path, Int32 thumbnailSize)
於 FilesFullTrust.Win32API.<>c__DisplayClass0_01.<StartSTATask>b__0() 2021-05-17 08:30:12.2422|INFO|FilesFullTrust.Program|Argument: GetIconOverlay| 2021-05-17 08:30:12.2422|INFO|FilesFullTrust.Win32API|系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)|System.IO.FileNotFoundException: 系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002) 於 Vanara.PInvoke.Shell32.ShellUtil.GetShellItemForPath(String path) 於 FilesFullTrust.Win32API.GetFileIconAndOverlay(String path, Int32 thumbnailSize) 於 FilesFullTrust.Win32API.<>c__DisplayClass0_01.b__0()
2021-05-17 08:30:12.2512|INFO|FilesFullTrust.Program|Argument: GetIconOverlay|
2021-05-17 08:30:12.2512|INFO|FilesFullTrust.Win32API|系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)|System.IO.FileNotFoundException: 系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)
於 Vanara.PInvoke.Shell32.ShellUtil.GetShellItemForPath(String path)
於 FilesFullTrust.Win32API.GetFileIconAndOverlay(String path, Int32 thumbnailSize)
於 FilesFullTrust.Win32API.<>c__DisplayClass0_01.<StartSTATask>b__0() 2021-05-17 08:30:12.2512|INFO|FilesFullTrust.Program|Argument: GetIconOverlay| 2021-05-17 08:30:12.2612|INFO|FilesFullTrust.Win32API|系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)|System.IO.FileNotFoundException: 系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002) 於 Vanara.PInvoke.Shell32.ShellUtil.GetShellItemForPath(String path) 於 FilesFullTrust.Win32API.GetFileIconAndOverlay(String path, Int32 thumbnailSize) 於 FilesFullTrust.Win32API.<>c__DisplayClass0_01.b__0()
2021-05-17 08:30:12.2612|INFO|FilesFullTrust.Program|Argument: GetIconOverlay|
2021-05-17 08:30:12.2612|INFO|FilesFullTrust.Win32API|系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)|System.IO.FileNotFoundException: 系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)
於 Vanara.PInvoke.Shell32.ShellUtil.GetShellItemForPath(String path)
於 FilesFullTrust.Win32API.GetFileIconAndOverlay(String path, Int32 thumbnailSize)
於 FilesFullTrust.Win32API.<>c__DisplayClass0_01.<StartSTATask>b__0() 2021-05-17 08:30:12.2612|INFO|FilesFullTrust.Program|Argument: GetIconOverlay| 2021-05-17 08:30:12.2771|INFO|FilesFullTrust.Win32API|系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002)|System.IO.FileNotFoundException: 系統找不到指定的檔案。 (發生例外狀況於 HRESULT: 0x80070002) 於 Vanara.PInvoke.Shell32.ShellUtil.GetShellItemForPath(String path) 於 FilesFullTrust.Win32API.GetFileIconAndOverlay(String path, Int32 thumbnailSize) 於 FilesFullTrust.Win32API.<>c__DisplayClass0_01.b__0()
===End debug_fulltrust.txt===

Screenshots
Since Files exited unexpectly, no screenshots were able to provided.

System Information

  • OS Version: Windows 10 20H2 19042.985
  • App version: v1.5.2.0

Additional comment
Since I'm using this app under Traditional Chinese environment, here's a brief translation of some of the strings in the log:

元素找不到=Element not found
系統找不到指定的檔案=File not found
於=at
發生例外狀況於=Expection happened at

@jh961202 jh961202 added the bug label May 17, 2021
@lukeblevins
Copy link
Contributor

lukeblevins commented May 17, 2021

@gave92 Luckily we're removing the caching feature soon, so it sounds like this issue could be resolved alongside #4922 ?

@gave92
Copy link
Member

gave92 commented Jun 6, 2021

Yup should be fixed in main.

@gave92 gave92 closed this as completed Jun 6, 2021
@yaira2 yaira2 added the fixed label Jun 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants