Skip to content

Commit 4bdcb8d

Browse files
authored
Fix invalid continuation caused by exception after inlining in TryRunInline (#115659)
1 parent b5abdd1 commit 4bdcb8d

File tree

1 file changed

+2
-1
lines changed
  • src/libraries/System.Private.CoreLib/src/System/Threading/Tasks

1 file changed

+2
-1
lines changed

src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,8 @@ internal void InternalRunSynchronously(TaskScheduler scheduler, bool waitForComp
10821082
// to the guideline that an exception implies that no state change took place),
10831083
// so it is safe to catch the exception and move the task to a final state. The
10841084
// same cannot be said for Wait()/WaitAll()/FastWaitAll().
1085-
if (!scheduler.TryRunInline(this, false))
1085+
taskQueued = scheduler.TryRunInline(this, false);
1086+
if (!taskQueued)
10861087
{
10871088
scheduler.InternalQueueTask(this);
10881089
taskQueued = true; // only mark this after successfully queuing the task.

0 commit comments

Comments
 (0)