Bug 29133

Summary: [XVS 3.11] Visual Studio hangs when debugging some iOS and Android applications that use multiple threads
Product: Visual Studio Extensions Reporter: Brendan Zagaeski (Xamarin Team, assistant) <brendan.zagaeski>
Component: DebuggerAssignee: Jose Gallardo <joe>
Severity: normal CC: adrian.murphy, akhileshk, Ian.Ceicys, joe, kzu, mono-bugs+bugzilla, pj.beaman, pm, r.schindler, vsx
Priority: Normal    
Version: 3.11 (C5)   
Target Milestone: 3.11.1 (C5SR1)   
Hardware: PC   
OS: Windows   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: Test case
Log files

Description Brendan Zagaeski (Xamarin Team, assistant) 2015-04-15 17:16:25 UTC
Created attachment 10777 [details]
Test case

Visual Studio hangs with Xamarin Android Player when debugging some Android applications that use multiple threads

Regression status: REGRESSION between 3.9.547 (20fd2f0) and 3.11.428.0 (b305980).

## Steps to reproduce

1. Open the attached test case in Visual Studio. This is just a new template project with the following line added in the `OnCreate()` override:
> System.Threading.ThreadPool.QueueUserWorkItem((c) => { System.Threading.Thread.Sleep(10000); Console.WriteLine("Hello world"); });

2. Run the Android app on the Nexus 4 (KitKat) Xamarin Android Player. (I tested this on a Windows VM, so I had XAP running on the Mac host machine [1].)

> [1] http://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/android-player-with-visual-studio-in-vm/

3. Wait until about 10 seconds have elapsed.

## Results

Visual Studio hangs. The app on the device becomes non-responsive as well.

It looks like maybe the "Main Thread" gets stuck somewhere during `Mono.Debugger.Soft.Connection.SendReceive()`. (See "VSThreads.tsv" in the attached logs.)

## Expected results

Xamarin Studio on Windows does not hang or create a non-responsive app state.

Visual Studio does _not_ hang when running the app on an LG Optimus L9 (Android 4.1.2) device.

## Version information

### Windows 8.1 64-bit, in VMWare Fusion 6.0.5 (2209127)

Xamarin   3.11.428.0 (b305980)
Xamarin.Android (218021d1c15e4f6165061767f800f31efb02b72f)

### OS X 10.9.5, MacBook Air

Xamarin Android Player 0.3.7 (1)
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2015-04-15 17:17:09 UTC
Created attachment 10778 [details]
Log files
Comment 4 Akhilesh kumar 2015-04-24 10:24:55 UTC
I have checked this issue with attached test project and I am able to run/deploy project on XAP successfully and VS does not hang.

Screencast: http://screencast.com/t/SjR1hhwX

So closing this issue.

Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.6.00030

Installed Version: Professional

Xamarin   3.11.465.0 (d878473)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (9c313ed01b0da39262c5ba3a1a06a0c28f2369e0)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.Forms Intellisense   1.0
Provides intellisense for Xamarin.Forms in the XML editor.

Xamarin.iOS (7741cc495ab0baf04ff0405d0604bc27f0ecae2e)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified

Xamarin.TestCloud.Integration   1.0
Early preview of Xamarin Test Cloud integration
Comment 6 Brendan Zagaeski (Xamarin Team, assistant) 2015-05-04 21:35:34 UTC
Updating the summary of the bug for accuracy. According to my tests today, this bug affects both iOS and Android apps.
Comment 7 Brendan Zagaeski (Xamarin Team, assistant) 2015-05-08 13:44:28 UTC
Just for extra bookkeeping, I'll note that as tracked by the current forum release threads [1], [2], the fix for this issue has been released to the Alpha channel as of XVS 3.11.507 on May 5, 2015.

> [1] http://forums.xamarin.com/discussion/40277/alpha-service-release-xamarinvs-3-11-507-bug-fixes-for-3-11-445/p1
> [2] http://forums.xamarin.com/discussion/37275/stable-release-xamarinvs-3-11-445-new-features-and-bug-fixes/p1