Bug 27857 - Strange debugger behavior when using async/await
Summary: Strange debugger behavior when using async/await
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Debugger ()
Version: unspecified
Hardware: All All
: Normal normal
Target Milestone: ---
Assignee: Joaquin Jares
Depends on:
Reported: 2015-03-10 20:17 UTC by Gutemberg
Modified: 2017-06-08 19:29 UTC (History)
8 users (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 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 Gutemberg 2015-03-10 20:17:07 UTC
If you try to debug line by line on an async method invocation it somehow just jump to some other code line without any reason. Sometimes it just jump to the end of the method. If I remove the await keyword and instead use the .Wait(); method, the debugger works just fine.

I've noticed this behavior on Xamarin for VS and Xamarin Studio(including on OSX) and for Android and iOS. 

(Just for reference)This same behavior happens when I'm debugging Mono apps remotely on Visual Studio and Mono debugger and Linux app, which in turns looks like use the same sdb soft debugger methods.

It is really annoying we have to fill our code with #if DEBUG so use .Wait() instead of await when debugging in order to keep (barely) working.
Comment 1 Jeremy Kolb 2015-04-08 12:25:58 UTC
I see the same thing.  Xamarin's support for multithreading on Android leaves much to be desired.
Comment 2 Ram Chandra 2015-07-07 11:34:38 UTC
I have checked this issue but I am unable to reproduce this issue. If you have a chance, it might also be helpful to include sample application, environment info, IDE logs and device logs.

You can get the environment info from here:
Visual Studio => HELP => About Microsoft Visual Studio => Copy Info

You can get IDE logs from here: 
Visual Studio => Help => Xamarin => Zip Xamarin Logs

You can device logs with the help of following command: {Andorid_SDK_Path} > adb logcat

Environment Info:

Windows 8.1
Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.6.00057
Installed Version: Professional
Xamarin   3.11.666.0 (ebae43a)
Xamarin.Android (5f55a9ef61c11b6ce0890bc91e4c71b1b92be214)
Xamarin.Forms Intellisense   1.0
Xamarin.iOS (67b390d0d1bd741582cf7b7fd3ffea08583a3f83)
Comment 3 Joaquin Jares 2017-06-08 19:29:10 UTC
Async has now been fixed (since 4.1, aprox). I'm resolving this bug as fixed for verification.