Bug 7236 - LongRunning tasks should be background threads
Summary: LongRunning tasks should be background threads
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: 2.10.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Jérémie Laval
Depends on:
Reported: 2012-09-17 15:26 UTC by Mikayla Hutchinson [MSFT]
Modified: 2012-11-15 10:41 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Mikayla Hutchinson [MSFT] 2012-09-17 15:26:24 UTC
Tasks created with TaskCreationOptions.LongRunning or TaskContinuationOptions.LongRunning should use background threads.
Comment 2 Mikayla Hutchinson [MSFT] 2012-09-17 15:34:22 UTC
It's not invalid, it affects Mono 2.10.10 and can cause apps to hang on quit.
Comment 3 Jérémie Laval 2012-09-21 09:06:54 UTC
Provide a test case, the following snippet is working:

using System;
using System.Threading;
using System.Threading.Tasks;

class T
	public static void Main ()
		var task = new Task (() => {});
		task.ContinueWith (t => Console.WriteLine (Thread.CurrentThread.IsBackground), TaskContinuationOptions.LongRunning);
		task.Start ();
		Thread.Sleep (500);
Comment 4 Mikayla Hutchinson [MSFT] 2012-09-21 16:27:53 UTC
csharp> using System.Threading.Tasks;
csharp> using System.Threading;
csharp> Task.Factory.StartNew (() => {}).ContinueWith (t => Console.WriteLine (Thread.CurrentThread.IsBackground), TaskContinuationOptions.LongRunning).Wait ();  
Comment 5 Mikayla Hutchinson [MSFT] 2012-09-21 16:32:59 UTC
The same returns true on .NET.
Comment 6 Jérémie Laval 2012-09-21 17:23:38 UTC
csharp> using System.Threading.Tasks;
csharp> using System.Threading;
csharp> Task.Factory.StartNew (() => {}).ContinueWith (t => Console.WriteLine(Thread.CurrentThread.IsBackground), TaskContinuationOptions.LongRunning).Wait();

Upgrade your Mono
Comment 7 Mikayla Hutchinson [MSFT] 2012-09-21 19:45:57 UTC
This isn't a question of "my Mono", it's a question of making MonoDevelop work correctly for all our users.

To what version of Mono do we need to upgrade MonoDevelop's dependency?
Comment 8 Jérémie Laval 2012-11-15 10:41:10 UTC
IIRC, that was sorted out.