Fix taskCompletionSourceVariable that gets 'nulled' when a task is co… #24
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.
Issue Summary:
An issue was identified in the dialog component, specifically when the same dialog is presented consecutively. The problem was that the task waiting for the result of the second dialog instance was being set to null, causing the response to never return.
Root Cause:
The root cause of the issue was the premature nullification of taskCompletionSource. When a task was completed, taskCompletionSource was set to null. If the dialog was shown again immediately, a new task was created, but the taskCompletionSource for this new task was also set to null, resulting in the loss of the task's result.
Solution:
To resolve this issue, the code that set taskCompletionSource to null upon task completion was removed. This change ensures that each new task is properly managed and retains its state until the dialog interaction completes. Additionally, the module is designed to handle past tasks by canceling them and relying on the garbage collector for disposal, ensuring that there are no lingering issues with task management.