Bug 41033 - Device.StartTimer does not stop when returning false from the action on Android
Summary: Device.StartTimer does not stop when returning false from the action on Android
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.2.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-05-11 19:07 UTC by Roger Peters
Modified: 2016-06-03 20:36 UTC (History)
2 users (show)

Tags: Android ac
Is this bug a regression?: ---
Last known good build:


Attachments
Simple test app showing Device.StartTimer issue (244.09 KB, application/x-zip-compressed)
2016-05-11 19:07 UTC, Roger Peters
Details


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 FIXED

Description Roger Peters 2016-05-11 19:07:44 UTC
Created attachment 15975 [details]
Simple test app showing Device.StartTimer issue

According to the documentation for Device.StartTimer() (https://developer.xamarin.com/api/member/Xamarin.Forms.Device.StartTimer/p/System.TimeSpan/System.Func%7BSystem.Boolean%7D/), returning false from the Action passed in should cause the timer to stop running. This is true on iOS, however on Android the timer runs indefinitely despite returning false.

Sample code:
      Device.StartTimer(TimeSpan.FromMilliseconds(1), () =>
      {
        _count++;
        Device.BeginInvokeOnMainThread(() =>  _outLabel.Text = _count.ToString());

        return false;
      });

I tried this on both 2.0.0.6482 and 2.2.0.31 and both had the issue. Simple repro attached.
Comment 1 E.Z. Hart [MSFT] 2016-06-03 20:36:36 UTC
This is fixed as of 2.3.0.46-pre3.