ModernFlyouts
ModernFlyouts copied to clipboard
Bug: Crash after resuming from hibernation, resulting in no volume panel at all
I'm not sure when exactly it crashes, but I notice that I have no volume panel (not stock or ModernFlyouts) when I resume, and the tray icon is still in the tray until I hover, which indicates a crash to me.
Steps: Open ModernFlyouts Hibernate Resume Observe lack of ModernFlyouts
Windows 10 20H2 (19042.804)
ModernFlyouts 0.9.0.0
Can you share info from Reliability monitor?
Next time it happens I'll make sure to grab a snapshot from Reliability Monitor.
This is what is in Reliability Monitor after resuming from hibernation today, and ModernFlyouts was closed. It seems it doesn't happen every time. I'll keep monitoring it. Let me know what other info you need.
Can you try 0.9.1? There may be an indirect fix for that.
I'll update right now, I'll post again if I notice it disappear after hibernation again.
After updating to 0.9.1, it happened again, here's what's in Reliability Monitor.
Interesting. Can you please tell me what the Event Viewer says for that? There should be 2 logs, one regarding the executable crash and one regarding .NET Runtime. Pick the last one as it tells us what error generated that crash. Thank you!
Here's the summary from Event Viewer on the .NET Runtime error.
CoreCLR Version: 6.0.21.15706
.NET Version: 6.0.0-preview.3.21157.6
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
at System.Windows.Threading.Dispatcher.VerifyAccess()
at System.Windows.ResourceReferenceExpression.ListenForFreezableChanges(Object resource)
at System.Windows.ResourceReferenceExpression.GetRawValue(DependencyObject d, Object& source, DependencyProperty dp)
at System.Windows.ResourceReferenceExpression.GetValue(DependencyObject d, DependencyProperty dp)
at System.Windows.DependencyObject.EvaluateExpression(EntryIndex entryIndex, DependencyProperty dp, Expression expr, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry newEntry)
at System.Windows.DependencyObject.EvaluateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry newEntry, OperationType operationType)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.ResourceReferenceExpression.InvalidateExpressionValue(Object sender, EventArgs e)
at System.Windows.TreeWalkHelper.InvalidateResourceReferences(DependencyObject d, ResourcesChangeInfo info)
at System.Windows.TreeWalkHelper.OnResourcesChanged(DependencyObject d, ResourcesChangeInfo info, Boolean raiseResourceChangedEvent)
at System.Windows.TreeWalkHelper.OnResourcesChangedCallback(DependencyObject d, ResourcesChangeInfo info, Boolean visitedViaVisualTree)
at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
at System.Windows.DescendentsWalker`1.StartWalk(DependencyObject startNode, Boolean skipStartNode)
at System.Windows.TreeWalkHelper.InvalidateOnResourcesChange(FrameworkElement fe, FrameworkContentElement fce, ResourcesChangeInfo info)
at System.Windows.ResourceDictionary.NotifyOwners(ResourcesChangeInfo info)
at System.Windows.ResourceDictionary.OnMergedDictionariesChanged(Object sender, NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.Collection`1.Remove(T item)
at ModernWpf.MergedDictionariesHelper.RemoveIfNotNull(Collection`1 mergedDictionaries, ResourceDictionary item)
at ModernWpf.ThemeResources.ApplyElementTheme(ResourceDictionary target, ElementTheme theme)
at ModernWpf.ThemeManager.ApplyRequestedTheme(FrameworkElement element)
at ModernWpf.ThemeManager.OnRequestedThemeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.RefreshValue()
at MS.Internal.Data.ClrBindingWorker.ScheduleTransferOperation(Object arg)
at MS.Internal.Data.DataBindEngine.ProcessCrossThreadRequests()
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 MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
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.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run()
at ModernFlyouts.Program.<>c.<Main>b__2_1()
at ModernFlyouts.AppLifecycle.AppLifecycleManager.StartApplication(String[] args, Action action)
at ModernFlyouts.Program.<>c__DisplayClass2_0.<Main>b__0()
at System.Threading.Thread.StartCallback()
And the one from the Application Error
Faulting module name: KERNELBASE.dll, version: 10.0.19041.804, time stamp: 0x0e9c5eae
Exception code: 0xe0434352
Fault offset: 0x000000000002d759
Faulting process id: 0x8e0
Faulting application start time: 0x01d719b90c12a20f
Faulting application path: C:\Program Files\WindowsApps\32669SamG.ModernFlyouts_0.9.1.0_x64__pcy8vm99wrpcg\ModernFlyoutsHost.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report Id: 1f8b2cf9-1e06-40d1-a9b5-75e6a45262ce
Faulting package full name: 32669SamG.ModernFlyouts_0.9.1.0_x64__pcy8vm99wrpcg
Faulting package-relative application ID: App
Thank you. So ModernWpf is the culprit here (tries to apply theme color via OnRequestedThemeChanged on a different thread). Our fault or library issue? @Samuel12321 @Cyberdroid1
This could be indirectly caused by a tool I used called Auto Dark Mode, which essentially sets up a Task Scheduler entry to change the Windows theme from dark > light and vice versa when the sun rises/sets. It's possible that ModernFlyouts crashes after resuming from hibernate and the theme needs to be swapped. However, this works perfectly fine with other Windows elements like the taskbar and basically all other programs (albiet with a bit of lag) so I still would consider this a bug if it is caused by this functionality.
It's a bug indeed. I hope I find time in these days to find what causes this crash internally albeit I may have an idea.
@ADeltaX I dig into that. Same here https://github.com/ModernFlyouts-Community/ModernFlyouts/issues/522 It all about ThemeManager. Errors occurs in:
-
UIManager.UpdateFlyoutBackgroundOpacity
-
TrayIconManager.UpdateTrayIconInternal
-
FlyoutHandler.Initialize
→UIManager.ActualFlyoutTheme
(maybe)
Seems like it is a library bug: https://github.com/Kinnara/ModernWpf/issues/199
Issue still present in 9.3.0
Library issue appears to have been fixed in December, would new versions of ModernFlyouts include the fix or are there compatibility issues?
the next version of ModernFlyouts will fix this by removing our dependency on modernwpf