This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Commit ac25be6
authored
Fix use of AddTo/RemoveFromActiveTasks in async methods (#25915)
When we rewrote the async methods implementation with AsyncStateMachineBox, we neglected to call AddToActiveTasks if the debugger is paying attention to tasks. This hasn't mattered as the debugger's support for Tasks hasn't worked for other reasons in .NET Core, but there is now a renewed focus on it, and this is preventing some of that support from working.
This change is a minimal fix to ensure that we're adding the state machine box task when it's created and removing it when it completes. Post-3.0, we should look at overhauling this, e.g. to clean up a lot of this logging and tracking that's done, to use a weak table in order to avoid keeping task objects alive artificially if they're dropped without completing by the developer code, etc.
This only affects when the debugger is attached, as the s_asyncDebuggingEnabled field is only ever set by the debugger.1 parent 3d4806e commit ac25be6
File tree
1 file changed
+15
-20
lines changed1 file changed
+15
-20
lines changedLines changed: 15 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
520 | | - | |
| 520 | + | |
521 | 521 | | |
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
525 | 525 | | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
526 | 532 | | |
527 | 533 | | |
528 | 534 | | |
| |||
618 | 624 | | |
619 | 625 | | |
620 | 626 | | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
621 | 633 | | |
622 | 634 | | |
623 | 635 | | |
| |||
716 | 728 | | |
717 | 729 | | |
718 | 730 | | |
719 | | - | |
720 | | - | |
721 | | - | |
722 | | - | |
723 | | - | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | | - | |
735 | 731 | | |
736 | 732 | | |
737 | 733 | | |
738 | 734 | | |
739 | 735 | | |
740 | | - | |
741 | | - | |
| 736 | + | |
742 | 737 | | |
743 | | - | |
| 738 | + | |
744 | 739 | | |
745 | 740 | | |
746 | 741 | | |
| |||
0 commit comments