Skip to content

Conversation

@FrankBakkerNl
Copy link
Contributor

by avoiding Result-Handling task from being cancelled

Breaking change

Proposed change

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the [development checklist][dev-checklist]
  • The code compiles without warnings (code quality chek)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

…ispose(Async) by avoiding Result-Handling task from being cancelled
.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?

@FrankBakkerNl FrankBakkerNl merged commit d7940c2 into net-daemon:dev Dec 22, 2022
@FrankBakkerNl FrankBakkerNl deleted the fix_815_CallSercvieFromDispose branch December 23, 2022 15:06
Ikcelaks pushed a commit to Ikcelaks/netdaemon that referenced this pull request Dec 23, 2022
…ispose(Async) by avoiding Result-Handling task from being cancelled (net-daemon#816)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants