Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had a use case for the UpdateDetected event where I wanted to call asynchronous code inside the event handler. With the current code, it doesn't seem possible to call async code within the handler and actually ensure that code finishes executing before SparkleUpdater continues it's normal flow.
I'm proposing in this PR to make SparkleUpdater's events AsyncEventHandlers, so the completion of all handler for each event can be awaited inside the SparkleUpdater code using InvokeAsync. I'm using the implementation provided by the Microsoft.VisualStudio.Threading package. (This package adds a ton of warnings related to async code, so I set the NoWarn flag for them)
This is a breaking change, as current handlers will now have to return "Task.CompletedTask" since the handlers are expected to return Task instead of void. I'm submitting this as a draft PR with only UpdateDetected converted to AsyncEventHandler. If you agree with this approach, I can convert the remaining events as well.