Bug 28953 - Device.StartTimer (still) behaves differently on different platforms
Summary: Device.StartTimer (still) behaves differently on different platforms
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 1.4.1
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-04-09 17:24 UTC by Adam Kemp
Modified: 2017-01-30 16:43 UTC (History)
8 users (show)

See Also:
Tags: functional consistancy ac
Is this bug a regression?: ---
Last known good build:


Attachments
Test case (176.04 KB, application/zip)
2015-04-09 17:24 UTC, Adam Kemp
Details

Description Adam Kemp 2015-04-09 17:24:10 UTC
Created attachment 10695 [details]
Test case

On Android you can call Device.StartTimer from any thread. On iOS you have to call it from the UI thread. Who knows what happens on Windows Phone. These all need to do the same thing. The behavior should be that you can start a timer from any thread, and the callback runs on the UI thread. On iOS it should use NSTimer (it does). On Android it should use a Handler (it does not). On Windows Phone it should use a DispatcherTimer (I don't know whether it does). Under no circumstances should any platform use System.Threading.Timer, which should probably be banned from your codebase.

To reproduce the issue run the attached project. On Android you see a counter. On iOS you just see the stock Xamarin.Forms welcome message.
Comment 1 Abhishek 2015-04-28 13:27:07 UTC
I have tried this issue and able to reproduce the reported behavior at my end.

Steps To Reproduce:
1. Download the attached sample.
2. Update the xamarin.forms package of the application.
3. Run the application on Emulator/Android Device.It will show the timer count.
4. Run the application on Simulator/Device.It will show the welcome page of the Xamarin.Forms.

Screencast: http://www.screencast.com/t/vkn0BUcuF
IDE Log: https://gist.github.com/Abhishekk360/e1601fe67fd1e4c8f6c5
Android Device Log: https://gist.github.com/Abhishekk360/88f52fe93a713027bfb6
iOS Device Log:https://gist.github.com/Abhishekk360/b0bdd3282497900dc08c

Environment Info:

Xamarin.Forms 1.4.3.6358-pre2
=== Xamarin Studio ===

Version 5.9 (build 436)
Installation UUID: 93e693b0-b53d-40f4-b29c-b61ff5cbe892
Runtime:
	Mono 4.0.1 ((detached/735f5b3)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400000008

=== Apple Developer Tools ===

Xcode 6.3 (7569)
Build 6D570

=== Xamarin.iOS ===

Version: 8.10.0.269 (Enterprise Edition)
Hash: 62f9f08
Branch: master
Build date: 2015-04-27 22:39:33-0400

=== Xamarin.Android ===

Version: 5.1.0.115 (Enterprise Edition)
Android SDK: /Users/xamarin23/Desktop/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.0.0.269 (Enterprise Edition)

=== Build Information ===

Release ID: 509000436
Git revision: 7e8ba4cbccf7b188ce5e80a90fdc4acdedb5a83f
Build date: 2015-04-23 13:19:57-04
Xamarin addins: 21fd95f743742c5237e22023996c2800ce3f8db3

=== Operating System ===

Mac OS X 10.10.0
Darwin 800BC.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 2 Chris King 2015-05-27 16:25:44 UTC
Indeed, counter is not update on iOS.
Comment 3 adrianknight89 2016-09-23 22:28:31 UTC
See https://github.com/xamarin/Xamarin.Forms/pull/374
Comment 4 Samantha Houts [MSFT] 2017-01-12 18:06:46 UTC
Should be fixed in 2.3.4-pre2. Thank you!
Comment 5 Parmendra Kumar 2017-01-30 16:43:01 UTC
I have checked this issue with Xamarin.Forms 2.3.4.184-pre1 and observed that this issue has been fixed. on iOS timer count shows successfully. 

Thanks.

Note You need to log in before you can comment on or make changes to this bug.