Skip to content

Bug: HASS.Agent crashes under Server 2016 #113

Closed

Description

@rstuke82

Updated to 2022.12, and whenever I start up HASS.Agent I get a message saying it has stopped working and crashes.

Application: HASS.Agent.exe
CoreCLR Version: 6.0.322.12309
.NET Version: 6.0.3
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeInitializationException: The type initializer for 'WinRT.ActivationFactory`1' threw an exception.
 ---> System.Runtime.InteropServices.COMException (0x80040154): ClassFactory cannot supply requested class

   at WinRT.BaseActivationFactory..ctor(String typeNamespace, String typeFullName)
   at WinRT.ActivationFactory`1..ctor()
   at WinRT.ActivationFactory`1..cctor()
   --- End of inner exception stack trace ---
   at WinRT.ActivationFactory`1.As(Guid iid)
   at Windows.Media.Control.GlobalSystemMediaTransportControlsSessionManager.Make___objRef_global__Windows_Media_Control_IGlobalSystemMediaTransportControlsSessionManagerStatics()
   at Windows.Media.Control.GlobalSystemMediaTransportControlsSessionManager.get__objRef_global__Windows_Media_Control_IGlobalSystemMediaTransportControlsSessionManagerStatics()
   at HASS.Agent.Media.MediaManager.MediaMonitor()
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(QueueUserWorkItemCallback quwi)
   at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext executionContext, Action`1 callback, TState& state)
   at System.Threading.QueueUserWorkItemCallback.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
   at System.Threading.Thread.StartCallback()
Faulting application name: HASS.Agent.exe, version: 2022.12.0.0, time stamp: 0x6283e0e1
Faulting module name: KERNELBASE.dll, version: 10.0.14393.5125, time stamp: 0x626ca997
Exception code: 0xe0434352
Fault offset: 0x0000000000034f08
Faulting process id: 0x1aa4
Faulting application start time: 0x01d8922a71a79c06
Faulting application path: C:\Users\Stuke00\AppData\Roaming\LAB02 Research\HASS.Agent\HASS.Agent.exe
Faulting module path: C:\Windows\System32\KERNELBASE.dll
Report Id: 5f2eb168-9d03-49de-b7ad-eee06894c52a
Faulting package full name: 
Faulting package-relative application ID: 

Activity

  1. LAB02-Admin commented on Jul 7, 2022

    @LAB02-Admin
    Member

    Can you run winver.exe and post a screenshot of its info

  2. rstuke82 commented on Jul 7, 2022

    @rstuke82
    Author

    Capture

    I've been using this for several months but after I updated, it stopped.

  3. LAB02-Admin commented on Jul 8, 2022

    @LAB02-Admin
    Member

    Hm, looks like it's fully up-to-date, so it should work since Server 2016 uses the same code base as Windows 10. Give me some time to setup a Server 2016 environment to test and see if I can get it working. In the meantime, you can uninstall the current version (no settings will get lost) and temporarily install the previous version.

  4. changed the title [-]HASS.Agent has stopped working[/-] [+]Bug: HASS.Agent crashes under Server 2016[/+] on Jul 8, 2022
  5. self-assigned this
    on Jul 8, 2022
  6. RafaelEstevamReis commented on Jul 8, 2022

    @RafaelEstevamReis

    MediaManager is a new adition (seems to be added with commit b348431 in this release

    As MediaMonitor() is started as a "free" Task, any exceptions crash the entire application

    Task.Run(MediaMonitor);

    Two optons are

    • Add a try to line 48
    • Move sessionManager request to outside of the task, so the exception will be catch by the media initialization
  7. Eckart0 commented on Jul 17, 2022

    @Eckart0

    I have the same Problem with Windows Server 2012R2 (Version 6.3, Build 9600, NET Framework 4.8)
    I can install HASS.agent, but can't call the program window to configure it.
    Greetings, Eckart

  8. LAB02-Admin commented on Jul 18, 2022

    @LAB02-Admin
    Member

    I'm currently on vacation, when I get back (end of the week) I'll work on it

  9. LAB02-Admin commented on Aug 3, 2022

    @LAB02-Admin
    Member

    @RafaelEstevamReis suggested workaround is effective, just tested on a W7 environment. Will be rolling out in the next beta.

    Thanks!

  10. LAB02-Admin commented on Aug 12, 2022

    @LAB02-Admin
    Member

    Implemented in the latest beta, let me know how it goes: https://github.com/LAB02-Research/HASS.Agent/releases/tag/2022.13.0-beta2

  11. rstuke82 commented on Aug 28, 2022

    @rstuke82
    Author

    Sorry for the delay, I finally got around to installing the new beta2 and it no longer crashes. However, it no longer reports storage capacity.
    storage sensor1
    Screenshot 2022-08-28 073745
    It only now shows the storage label and the number of disks.

  12. LAB02-Admin commented on Sep 22, 2022

    @LAB02-Admin
    Member

    Most multivalue sensors now use attributes:

    image

  13. rstuke82 commented on Sep 22, 2022

    @rstuke82
    Author
  14. LAB02-Admin commented on Sep 22, 2022

    @LAB02-Admin
    Member

    You can use template sensors to convert any of them into regular ones.

  15. rstuke82 commented on Sep 22, 2022

    @rstuke82
    Author
  16. LAB02-Admin commented on Sep 22, 2022

    @LAB02-Admin
    Member

    I took the liberty of writing an example for you:

    template:
      sensor:
      - storage_capacity_c:
          friendly_name: "Storage Capacity Drive C"
          unit_of_measurement: "MB"
          value_template: "{{ state_attr('sensor.hass_agent_storage_c', 'AvailableSpaceMB') | float(0) }}"
    

    Make sure to change sensor.hass_agent_storage_c to the drive's sensor, and AvailableSpaceMB to the attribute you want to use. The | float(0) part converts it to a number-based value, you can drop that if you want text.

    Reboot HA, and it'll show up as sensor.storage_capacity_c.

  17. rstuke82 commented on Sep 25, 2022

    @rstuke82
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions