Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit affc049

Browse files
committed
Merge pull request #2811 from stephentoub/reenable_cesp_test
Fix and enable a disabled Task test
2 parents 3d919b8 + df0c068 commit affc049

File tree

1 file changed

+5
-26
lines changed

1 file changed

+5
-26
lines changed

src/System.Threading.Tasks/tests/CESchedulerPairTests.cs

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -420,12 +420,8 @@ public static void TestCompletionTask()
420420

421421
/// <summary>
422422
/// Ensure that CESPs can be layered on other CESPs.
423-
/// There is and assert in src\Threading\System\Threading\Tasks\ConcurrentExclusiveSchedulerPair.cs
424-
/// line 355 - the scheduler enters in exclusive processing mode when should not
425-
/// it needs more investigations
426423
/// </summary
427424
[Fact]
428-
[ActiveIssue(2797)]
429425
public static void TestSchedulerNesting()
430426
{
431427
// Create a hierarchical set of scheduler pairs
@@ -490,30 +486,13 @@ public static void TestSchedulerNesting()
490486
}
491487
}
492488

493-
// Once all tasks have completed, complete the schedulers
494-
Task.Factory.StartNew(() =>
495-
{
496-
Debug.WriteLine(string.Format("Waiting for all tasks", tasks.Count));
497-
Task.WaitAll(tasks.ToArray());
498-
foreach (var cesp in cesps) cesp.Complete();
499-
}, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default);
500-
501-
// In the meantime, wait for all schedulers to complete
502-
Debug.WriteLine("Waiting for all csps");
503-
foreach (var cesp in cesps) cesp.Completion.Wait();
504-
505-
Debug.WriteLine("Done waiting");
506-
// All tasks should now be done for the schedulers to have completed
507-
foreach (var task in tasks)
489+
// Wait for all tasks to complete, then complete the schedulers
490+
Task.WaitAll(tasks.ToArray());
491+
foreach (var cesp in cesps)
508492
{
509-
if (task.Status != TaskStatus.RanToCompletion)
510-
{
511-
Debug.WriteLine("Task didn't run to completion");
512-
}
493+
cesp.Complete();
494+
cesp.Completion.Wait();
513495
}
514-
515-
// All tasks should now be done for the schedulers to have completed
516-
foreach (var task in tasks) Assert.True(task.Status == TaskStatus.RanToCompletion, "All tasks should now be complete");
517496
}
518497

519498
/// <summary>

0 commit comments

Comments
 (0)