Work around Unity's async cancellation #246
Merged
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.
Under certain circumstances, task cancellation in Unity will happen later in the same frame, instead of synchronously.
Due to this, state strings during errors often get updated only after the error has been propagated, causing them to be waiting (
[.]
) instead of canceled ([-]
). This also caused the tests for Unity to have to be slightly different from .NET tests.To work around this, we can
await Task.Yield()
before propagating errors.It caused some breaking changes in
RunAsLoop
, which can no longer be synchronous, so I'm starting a v5 branch now, as there are other breaking changes I'd also like to make.