Seeing a looping of throws System.ComponentModel.Win32Exception.
Can see it using ProcesExplorer or enable native & disable "just my code" - otherwise it goes by "undetected"
How does one troubleshoot it - quite complex application with WinForms & WPF (ElementHost), have not touched any AutomationPeer occurs in different parts of code usually during visibility toggle (i.e. false) or close. But how to root cause it. Once it triggers it keeps retriggering i.e. App.Run seeing thrown C# exception increase all the time.
System.ComponentModel.Win32Exception
HResult=0x80004005
Message=Invalid window handle
Source=WindowsBase
StackTrace:
at MS.Win32.UnsafeNativeMethods.GetWindowText(HandleRef hWnd, StringBuilder lpString, Int32 nMaxCount)
This exception was originally thrown at this call stack:
MS.Win32.UnsafeNativeMethods.GetWindowText(System.Runtime.InteropServices.HandleRef, System.Text.StringBuilder, int)
Target framework 4.8 but some might be older, plugin based and got history back from .NET 1.0 but don't think its related.