Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ private async Task<Task<HassMessage>> SendCommandAsyncInternal<T>(T command, Can
// this task will be returned and handled by caller
var resultEvent = _hassMessageSubject
.Where(n => n.Type == "result" && n.Id == command.Id)
.FirstAsync().ToTask(cancelToken);
.FirstAsync().ToTask(CancellationToken.None);
// We dont want to pass the incoming CancellationToken here because it will throw a TaskCanceledException
// when calling services from an Apps Dispose(Async) and hide possible actual exceptions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling services from Dispose feels kind of a anti-pattern. Dispose should only be used as clean up. Now potentially (but not likely) a call could block an App from stopping. Not sure about this one. What is the use case to use services in Dispose?


await _transportPipeline.SendMessageAsync(command, cancelToken);

Expand Down