public void TaskContinuationChainLeak()
        {
            // Start cranking out tasks, starting each new task upon completion of and from inside the prior task.
            //
            var tester = new TaskContinuationChainLeakTester();

            tester.Run();
            tester.TasksPilledUp.WaitOne();

            // Head task should be out of scope by now.  Manually run the GC and expect that it gets collected.
            //
            GC.Collect();
            GC.WaitForPendingFinalizers();

            try
            {
                // It's important that we do the asserting while the task recursion is still going, since that is the
                // crux of the problem scenario.
                //
                tester.Verify();
            }
            finally
            {
                tester.Stop();
            }
        }
Exemple #2
0
		public void TaskContinuationChainLeak()
		{
			// Start cranking out tasks, starting each new task upon completion of and from inside the prior task.
			//
			var tester = new TaskContinuationChainLeakTester ();
			tester.Run ();
			tester.TasksPilledUp.WaitOne ();

			// Head task should be out of scope by now.  Manually run the GC and expect that it gets collected.
			// 
			GC.Collect ();
			GC.WaitForPendingFinalizers ();

			try {
				// It's important that we do the asserting while the task recursion is still going, since that is the 
				// crux of the problem scenario.
				//
				tester.Verify ();
			} finally {
				tester.Stop ();
			}
		}