Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Description of Problem:
Thread.Sleep never finishes. I.e. After the desired time has passed, the Thread does not resume.
Steps to reproduce the problem:
1. Try Sample project found here: http://developer.xamarin.com/guides/android/user_interface/creating_a_splash_screen/
(But basically any Thread.Sleep in UI or in ThreadPool.QueueUserWorkItem seems to get stuck)
It gets stuck at the sleep, never finishes, even after the desired sleep time.
Should not get stuck, should keep going after the desired sleep time has passed.
How often does this happen?
All the time.
Tested it on Android x86 4.0.3.
I've tried the same sample code project on Android x86 4.1 and it worked OK, so seems to be version specific.
It is also broken on on Android x86 2.3.
I have checked this issue and I am able to reproduce this issue .
Steps to reproduce this issue:
1. Download the sample application from “http://developer.xamarin.com/guides/android/user_interface/creating_a_splash_screen/”
2. Open the sample application on XS.
3. Deploy the “SplashScreen” application on API 15 x86 emulator.
4. Application gets stuck at the Thread.Sleep(1000).
I observed that when I run the “SplashScreen” application on “API 15 x86 emulator.” it gets stuck at the “Thread.Sleep(1000)". However, It is working on device(Samsung Note 3). I have also tried this issue with "API 16 emulator" and it is working fine for it.
Application output : https://gist.github.com/saurabh360/fc2beb672167ae2509d6
Mac OS X 10.9.2
Xamarin Studio: 5.0 (build 878)
Release ID: 500000878
Git revision: bcd66920d963483e7d638a2339c4022fe035b529
Build date: 2014-05-27 17:36:26-04
Xamarin addins: da9064ce55b0fa90930a7c437a4cc1ae0e5c778c
This is a showstopper for us and I suspect many others.
Worked on 4.04
What specifically would I have to install in terms of older versions so I could build without this issue?
We're starting to wonder if this is confined to x86 devices and emulators.
I was able to duplicate the bug in API 15 using Thread.Sleep as in the example posted above. However; by using Task.Delay instead, the program works; and moreover, it appears that for most purposes Task.Delay is a prefered method for most purposes; since Thread.Sleep effectively pauses the program entirely, whereas Task.Delay only pauses the associated task as discussed here:
Here are the changes that you would need to make in SplashActivity.cs to fix the bug in the "Creating a Splash Screen" sample:
> using System.Threading; -> using System.Threading.Tasks
[Activity(Theme = "@style/Theme.Splash", MainLauncher = true, NoHistory = true)]
public class SplashActivity : Activity
protected override void OnCreate(Bundle bundle)
> Thread.Sleep(2500); -> Task.Delay(2500);
Thanks a lot for taking a look at this so quickly, it's greatly
appreciated. For most purposes this workaround might be acceptable but
we have a lot of legacy code liberally peppered with Sleeps. So it's
no good for us I'm afraid. We really need Thread.Sleep to do exactly
what it used to before it was broken in the last release. It is
(unfortunately) a fundamental part of lots of .Net code out there.
Kent, u're completely wrong.
Task.Delay creates a new task and doesn't block anything.
My apologies if I misunderstood. Was the workaround at all helpful with your issue though?
No, it wasn't helpful. See previous comment of 18/06/14. Thanks for looking at it though.
I'm reluctant to release any new builds built with this version. Please get back to us soon about this issue.
I can't reproduce this on 4.12.6 Putting a thread sleep in the OnCreate as per Comment 8 does not lock up the application. This is running on a genymotion
Have you tried it on the regular emulator?
I can still reproduce this on both x86 images in Virtualbox and regular x86 emulators from Google. I have not tried genymotion.
I am not able to reproduce this with the Splash screen sample project on:
OSX Yosemite 10.10.2
Xamarin Studio: Version 5.8 (build 443)
Xamarin.Android: Version: 22.214.171.124
on an Android API 15, 4.0.3, x86 emulator. The thread wakes up after the Thread.Sleep
and continues execution. I tried to run it in the debugger and without it. It worked in
Alek, Could you please test this with the latest Xamarin Studio?
Unfortunately, we’re unable to reproduce this report. If this issue is still occurring for you, please reopen this issue and attach a reproduction to the bug by starting with a clean Xamarin.Android project adding just the code necessary to demonstrate the issue.