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

Inspector crash #21

Open
ThorIrgens opened this issue Oct 25, 2022 · 0 comments
Open

Inspector crash #21

ThorIrgens opened this issue Oct 25, 2022 · 0 comments

Comments

@ThorIrgens
Copy link

While working with FlaUInspector we experience a lot of crashes when Hover Mode is enabled. Mainly related to writing code while as CTRL is used a lot.

One of the errors I got looked like this
An event was unable to invoke any of the subscribers (Exception from HRESULT: 0x80040201)
at Interop.UIAutomationClient.CUIAutomation8Class.CompareElements(IUIAutomationElement el1, IUIAutomationElement el2)
at FlaUI.UIA3.UIA3Automation.Compare(AutomationElement element1, AutomationElement element2)
at FlaUI.Core.AutomationElements.AutomationElement.Equals(AutomationElement other)
at FlaUInspect.ViewModels.MainViewModel.<>c__DisplayClass44_0.b__0(ElementViewModel child) in C:\GIT\Repositories\FlaUInspect\src\FlaUInspect\ViewModels\MainViewModel.cs:line 198
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source, Func2 predicate)
at FlaUInspect.ViewModels.MainViewModel.FindElement(ElementViewModel parent, AutomationElement element) in C:\GIT\Repositories\FlaUInspect\src\FlaUInspect\ViewModels\MainViewModel.cs:line 198
at FlaUInspect.ViewModels.MainViewModel.ElementToSelectChanged(AutomationElement obj) in C:\GIT\Repositories\FlaUInspect\src\FlaUInspect\ViewModels\MainViewModel.cs:line 172
at FlaUInspect.Core.HoverMode.DispatcherTimerTick(Object sender, EventArgs e) in C:\GIT\Repositories\FlaUInspect\src\FlaUInspect\Core\HoverMode.cs:line 56
at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)
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 System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
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.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at FlaUInspect.App.Main()

We also get a crash, if we select an item in the inspector, that is no longer present in the UI, like from a closed dropdown curtain.

My quesiton is, do anyone have an good suggestions or ideas on how to best solve these crashes? Other than remembering to turn off tracking after each use :).
Some crashes are due to a cached element not being there anymore and I was thinking about catching that and send back an empty AutomationElement. Then the UI would be void of property values, indicating to the user (s)he needs to refresh.

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

1 participant