sleevezipper / hass-workstation-service

Provide useful sensors and services from your workstation to Home Assistant.
Apache License 2.0
615 stars 53 forks source link

Bug: Application crashes with TimeoutException #5

Open clough360 opened 3 years ago

clough360 commented 3 years ago

When launching the app from code in debug mode, the app crashes out in the config screen after a short period (say one minute) with the following error: image

System.TimeoutException: 'The operation has timed out.'

This exception was originally thrown at this call stack:
    System.IO.Pipes.NamedPipeClientStream.ConnectInternal(int, System.Threading.CancellationToken, int)
    System.IO.Pipes.NamedPipeClientStream.ConnectAsync.AnonymousMethod__0()
    System.Threading.Tasks.Task.InnerInvoke()
    System.Threading.Tasks.Task..cctor.AnonymousMethod__274_0(object)
    System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, object)
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, object)
    System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task, System.Threading.Thread)
    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
    ...
    [Call Stack Truncated]

Steps to recreate:

  1. start app in debug (from current Master branch)
  2. specifiy an MQTT server (no username or password)
  3. wait a short period
sleevezipper commented 3 years ago

Thanks for reporting!

The communication between the service and the UI has no error handling and this causes the UI to crash when the service doesn't respond (or responds too late). There is a lot of room for improvement here.

sleevezipper commented 3 years ago

While this doesn't solve the issue of not having error handling, please make sure to start both projects. Or make sure you have hass-workstation-service.exe running in the background before you start the UserInterface.