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

Bug: HASS.Agent crashes as soon as I run Civilization 5 #115

Closed
2 of 4 tasks
knezmilos13 opened this issue Jul 10, 2024 · 4 comments
Closed
2 of 4 tasks

Bug: HASS.Agent crashes as soon as I run Civilization 5 #115

knezmilos13 opened this issue Jul 10, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@knezmilos13
Copy link

HASS.Agent crashes as soon as I run Civilization 5. It also crashes if I run Civ 5, alt+tab to desktop, start HASS.Agent again, then alt+tab back to Civ 5 for a second. Crashes are silent, and there's nothing interesting in the regular log file, however, some stuff appears when more detailed logging is turned on. This is the section of log file that appears after running Civ 5; entire file provided at the bottom.

System.Runtime.InteropServices.COMException (0x80070490): Element not found. (0x80070490)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
   at CoreAudio.MMDeviceEnumerator.GetDefaultAudioEndpoint(DataFlow dataFlow, Role role)
   at HASS.Agent.Shared.HomeAssistant.Sensors.GeneralSensors.MultiValue.AudioSensors.HandleAudioInputSensors(String parentSensorSafeName, String deviceName) in D:\a\HASS.Agent\HASS.Agent\src\HASS.Agent\HASS.Agent.Shared\HomeAssistant\Sensors\GeneralSensors\MultiValue\AudioSensors.cs:line 127
   at HASS.Agent.Shared.HomeAssistant.Sensors.GeneralSensors.MultiValue.AudioSensors.UpdateSensorValues() in D:\a\HASS.Agent\HASS.Agent\src\HASS.Agent\HASS.Agent.Shared\HomeAssistant\Sensors\GeneralSensors\MultiValue\AudioSensors.cs:line 177
2024-07-11 00:53:22.929 +02:00 [INF] [MQTT] Initial registration completed
2024-07-11 00:55:42.120 +02:00 [FTL] [PROGRAM] FirstChanceException: The method or operation is not implemented.
System.NotImplementedException: The method or operation is not implemented.
   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)
   at WindowsDesktop.Interop.ComWrapperBase`1..ctor(ComInterfaceAssembly assembly)
   at WindowsDesktop.Interop.Build10240.ApplicationViewCollection..ctor(ComInterfaceAssembly assembly)
   at WindowsDesktop.Interop.Build10240.VirtualDesktopProvider10240.InitializeCore(ComInterfaceAssembly assembly)
   at WindowsDesktop.Interop.VirtualDesktopProvider.Initialize(ComInterfaceAssembly assembly)
   at WindowsDesktop.VirtualDesktop.InitializeCore()
   at WindowsDesktop.VirtualDesktop.HandleExplorerRestarted()
   at WindowsDesktop.VirtualDesktop.<>c.<.cctor>b__70_0()
   at WindowsDesktop.Utils.ExplorerRestartListenerWindow.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   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)
2024-07-11 00:55:42.121 +02:00 [FTL] [MAIN] ThreadException: The method or operation is not implemented.
System.NotImplementedException: The method or operation is not implemented.
   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)
   at WindowsDesktop.Interop.ComWrapperBase`1..ctor(ComInterfaceAssembly assembly)
   at WindowsDesktop.Interop.Build10240.ApplicationViewCollection..ctor(ComInterfaceAssembly assembly)
   at WindowsDesktop.Interop.Build10240.VirtualDesktopProvider10240.InitializeCore(ComInterfaceAssembly assembly)
   at WindowsDesktop.Interop.VirtualDesktopProvider.Initialize(ComInterfaceAssembly assembly)
   at WindowsDesktop.VirtualDesktop.InitializeCore()
   at WindowsDesktop.VirtualDesktop.HandleExplorerRestarted()
   at WindowsDesktop.VirtualDesktop.<>c.<.cctor>b__70_0()
   at WindowsDesktop.Utils.ExplorerRestartListenerWindow.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   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)

To Reproduce
Steps to reproduce the behavior:

  1. Run Civilization 5
  2. HASS.Agent silently crashes

Misc info (please complete the following information):

  • Windows build (ideally screenshot/info of winver.exe output):
    image

  • Windows' UI language: English

  • HASS.Agent version: 2.1.0-beta1

  • Installed via installer

  • Installed manually

  • Problem occurs in HASS.Agent

  • Problem occurs in Satellite Service

Logs
[2024-07-11] HASS.Agent_20240711.log

@knezmilos13 knezmilos13 added the bug Something isn't working label Jul 10, 2024
@amadeo-alex
Copy link
Collaborator

I must say, that's hell of a issue title :D
I think that the crash root cause lies with virtual desktop management library - IoT Enterprise LTSC is not the most used OS version (although I have daily run LTSC for years before so I'm not surprised that you use it) and might not be supported by it.
Not sure though how it might be connected to Civ.

Most likely "duplicate" of #86 and not really fixable on our side.
But I might have a fix for you:

Please try if you're comfortable with it.
I've created a PR to the library that we're using but unfortunately it didn't get any traction - Slion/VirtualDesktop#24

@knezmilos13
Copy link
Author

An update relating to this bug - literally - I've updated to Windows 11 IoT Enterprise LTSC 24H2 that's conveniently became available recently, and now HASS.Agent no longer crashes.

Something to note - I don't think I have been using any virtual desktops. If I understand correctly, virtual desktop is a desktop that is being streamed from another device, possibly from a VM?

@amadeo-alex
Copy link
Collaborator

No, virtual desktops are additional "desktops" where you can have separate icons, programs and windows running. For example tou have one for gaming/fun and other for work - multiple programs can be running at the same time but on different desktops.

The virtual desktop library needs to talk with a lot of system com objects so all window/desktop changes on "non-compatible" os versions can cause issues.

@amadeo-alex
Copy link
Collaborator

Closing for now as the upgrade helped with the issue. Please feel free to open a new one if it comes back :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants