HASS.Agent crashes on explorer.exe restart
This is kind of a weird one - I use virtual desktops a lot and I have 3 monitors so I'm pretty constantly flipping between 15 or so desktops all day. Windows 11 doesn't always love me doing this, and due to some issue I haven't worked out, the taskbar will get jacked until I restart explorer.exe.
This is normally a non-event, taskbar will come back and system tray and everything is happy except HASS.Agent. When explorer.exe restarts, HASS.Agent will crash silently. Windows event log deets in the thread.
To re-create: Open Win11 task manager, find explorer.exe, and click "restart task".
15 Replies
Help us Help Others!
To help others find answers, you can mark your question as solved via
Right click solution message -> Apps -> ✅ Mark Solution
Help us Help You!
Please don't delete messages or posts because it makes it impossible to understand what happened. If you don't want your messages to be seen then don't post here.
Make sure to provide detailed reports of bugs.
Please include error log uploads and info about the bug.
Event ID 1026
Application: HASS.Agent.exe
CoreCLR Version: 6.0.2724.6912
.NET Version: 6.0.27
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidCastException: Specified cast is not valid.
at WindowsDesktop.Interop.IServiceProvider.QueryService(Guid& guidService, Guid& riid)
at WindowsDesktop.Interop.ComInterfaceAssembly.CreateInstance(Type type, Nullable
1 guidService)
at WindowsDesktop.Interop.ComInterfaceAssembly.CreateInstance(String comInterfaceName, Guid clsid)
at WindowsDesktop.Interop.ComWrapperBase1..ctor(ComInterfaceAssembly assembly, Guid clsid)
at WindowsDesktop.Interop.Build22621.VirtualDesktopManagerInternal..ctor(ComInterfaceAssembly assembly, ComWrapperFactory factory)
at WindowsDesktop.Interop.Build22621.VirtualDesktopProvider22621.InitializeCore(ComInterfaceAssembly assembly)
at WindowsDesktop.Interop.VirtualDesktopProvider.Initialize(ComInterfaceAssembly assembly)
at WindowsDesktop.VirtualDesktop.InitializeCore()
at WindowsDesktop.VirtualDesktop.HandleExplorerRestarted()
at WindowsDesktop.VirtualDesktop.<>c.<.cctor>b__77_0()
at WindowsDesktop.Utils.ExplorerRestartListenerWindow.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
<continued>
at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(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)
Then an event 1000:
Faulting application name: HASS.Agent.exe, version: 2.0.2.0, time stamp: 0x65310000
Faulting module name: KERNELBASE.dll, version: 10.0.22621.3085, time stamp: 0x98257e11
Exception code: 0xe0434352
Fault offset: 0x0000000000064d8c
Faulting process id: 0x0x4438
Faulting application start time: 0x0x1DA60D88D4183DE
Faulting application path: C:\Users\Allen\AppData\Local\HASS.Agent\Client\HASS.Agent.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report Id: e4856619-f88a-4475-b285-b08a424dfd83
Faulting package full name:
Faulting package-relative application ID:
Then event 1001
Fault bucket 1335466257019559275, type 4
Event Name: APPCRASH
Response: Not available
Cab Id: 0
Problem signature:
P1: HASS.Agent.exe
P2: 2.0.2.0
P3: 65310000
P4: KERNELBASE.dll
P5: 10.0.22621.3085
P6: 98257e11
P7: e0434352
P8: 0000000000064d8c
P9:
P10:
Attached files:
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.41b892e6-9ebf-4c7c-aceb-962e55c0fbb5.tmp.dmp
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.6f192789-d5d5-4123-aff1-251e54bcea45.tmp.WERInternalMetadata.xml
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.a4a850b6-8a30-4100-9b2a-6f33969efa49.tmp.csv
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.ebc3a81f-4e9e-4db3-8b76-d1e6b8789b2d.tmp.txt
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.783e5d92-5f82-4b97-a16d-9cf438135ee2.tmp.xml
These files may be available here:
\\?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_HASS.Agent.exe_63d6cb7ade4c289b7aaace6a2a06e56e06d7fe7_39a05308_6bee942e-9214-481c-bf8b-c82196f6ef70
Analysis symbol:
Rechecking for solution: 0
Report Id: e4856619-f88a-4475-b285-b08a424dfd83
Report Status: 268435456
Hashed bucket: 87988b784007f5569288877c332bdd6b
Cab Guid: 0
@Amadeo
hmm interesting
looks like a crash within the library that we're using for VD mgmt
To re-create: Open Win11 task manager, find explorer.exe, and click "restart task".are you using the VD mgmt features of HASS.Agent? VD sensor or command?
I am!
Allright, I disabled the ActiveDesktopSensor from my config, store and activate sensors, then restart explorer and HASS.Agent crashes. Restart H.A, check sensor config and find that the ActiveDesktop is not shown, restart explorer.exe again, H.A crashes again. Idea here was to try and get H.A to load without the VD stuff enabled to see if the behavior is any different, but no luck.
Now I have a new problem 😦
Attempting to add ActiveDesktop back to my config, I open New Sensor, select ActiveDesktop, then click Store Sensor and I get an error: "Virtual Desktop management is unavailable on your machine. Usually this is due to the virtual desktop management library not being update to support your version of Windows".
So now I can't restart explorer, and also can't track virtual desktops any more.
That explains some things
Long story short, m$ doesn't provide any official interface fo vd mgmt because reasons.
To do this we (or rather the library that HASS.Agent uses) needs to make use of specific com objects on that specific wi dows version
So that means that windows update may equal to vd mgmt not working
Because m$ changed a number...
But still the above doesn't explain this
I'd expect it not to crash without vd mgmt sensor/commands
What is the exact windows version that you're running?
23H2 Build 22631.3085
Hello, i migrated from the old version and noticed hass agent was crashing after a while, so i uninstalled completely and reinstalled
the crashes still happen, it will just disapear in the background
this is from the logs
i think it might be related to this issue but i dont use virtual desktops at all
Thx, not sure if I'll get the same exact version but at leat I'll try to reproduce
Full logs please 😄
after a whileAnything specific that can allow me to reproduce it
not that i can think of, it seem random to me
Solution
Just installed 2.1.0-beta1 and the crash problem is resolved. Nice work!