Describe the bug
When you instantly switch while the folder loads, the app crashes.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
App shouldn't crash and the refresh task should run in background.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
2020-08-14 14:08:36.7060|ERROR|Files.App|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.ItemViewModel.UpdateDirectoryInfo() + 0xf0
at Files.Filesystem.ItemViewModel.<RapidAddItemsToCollectionAsync>d__70.MoveNext() + 0x970
--- 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_11[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>+0x12a44a0
Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.99. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
@Jaiganeshkumaran could you check if this issue still exists on master? If we're lucky it got fixed with this
@gave92 But that's for the recycle bin. I will build the latest branch and try it.
@Jaiganeshkumaran yeah the PR was for the recyclebin, but from the stacktrace it looks like that change may solve this issue too (error is NullReferenceException and the PR adds a null check to the UpdateDirectoryInfo() function)
@gave92 I tried it and it still seems to crash but this time it needs to be done extremely fast (< 50ms). Regular users may not notice it but we should fix it.
@Jaiganeshkumaran Hello there.
Was your stack trace the same as before after @gave92 PR?
@gave92 Yes the same stack trace after @gave92's PR. Nothing changed.
@Jaiganeshkumaran We recently made improvements that could affect this area. Can you still reproduce this issue on the latest Store build?