Bug 688 - iOS simulator debugger hangs when using Task inside generic method
Summary: iOS simulator debugger hangs when using Task inside generic method
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 4.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-09-09 14:42 UTC by Startcom
Modified: 2011-09-29 19:52 UTC (History)
2 users (show)

Tags:
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 Developer Community or GitHub 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:
Status:
RESOLVED NOT_REPRODUCIBLE

Description Startcom 2011-09-09 14:42:26 UTC
If I call Task.Factory.StartNew() inside of a generic method, it hangs the iOS simulator when running under the debugger. It works fine if it's in release, on the device, or a non-generic method.

DoThingAsync<string>(); // This hangs simulator debugger
DoThingAsync(); // This doesn't hang

public static void DoThingAsync<T>()
{
	DoThingAsync(); 
}

public static void DoThingAsync()
{
	var task = Task.Factory.StartNew(() => {});
	task.Wait();
}

The last line in the application output while it's hung is always related to a resolved pending breakpoint, e.g.:

Resolved pending breakpoint at '/Users/macbookair/Dropbox/Projects/Apps/Startcom_BizApps/DataStore.cs:69' to Void Startcom.BizApps.DataStore:LoadCalendarEvents () [0x0002f].

MonoTouch 4.0.7
Mono 2.10.5
MonoDevelop 2.6

I'm just using the default simulator version.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2011-09-29 19:42:49 UTC
I just tried adding the following code to my application class:

public static void DoThingAsync<T>()
{
    DoThingAsync(); 
}
	
public static void DoThingAsync()
{
    var task = Task.Factory.StartNew(() => {});
    task.Wait();
}
	
// This is the main entry point of the application.
static void Main (string[] args)
{
    DoThingAsync<string> ();
    DoThingAsync ();
}

and it doesn't hang at all. I also added breakpoints on every single line, and it still doesn't hang.

Which MonoTouch version are you using? Does it still happen if you remove the breakpoint at DataStore.cs:69?
Comment 2 Startcom 2011-09-29 19:51:26 UTC
I can't repro it either after upgrading to more recent versions of Mono/Touch. I know a recent update of Mono included some TPL fixes, so perhaps it was fixed as part of that. 

Thanks for looking into it.
Comment 3 Rolf Bjarne Kvinge [MSFT] 2011-09-29 19:52:31 UTC
Closing.