Bug 23393 - [All platforms] PropertyChangedEventHandler causes 2 consecutive calls to changed property's getter
Summary: [All platforms] PropertyChangedEventHandler causes 2 consecutive calls to cha...
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.2
Hardware: PC All
: Normal minor
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-09-26 00:54 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2016-04-11 14:06 UTC (History)
8 users (show)

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


Attachments
Test case (91.12 KB, application/zip)
2014-09-26 00:54 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details
Test case (280.77 KB, application/zip)
2015-02-18 20:09 UTC, Brendan Zagaeski (Xamarin Team, assistant)
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:
VERIFIED FIXED

Description Brendan Zagaeski (Xamarin Team, assistant) 2014-09-26 00:54:36 UTC
Created attachment 8200 [details]
Test case

[All platforms] PropertyChangedEventHandler causes 2 consecutive calls to changed property's getter


If you follow the steps on [1] under "A Simple ViewModel" to create a `ClockViewModel` and its corresponding XAML page, each time `this.DateTime = DateTime.Now` runs, the DateTime's getter method is called twice, rather than just once.

Perhaps this double-call is required by the Xamarin.Forms data binding implementation?


> [1] http://developer.xamarin.com/guides/cross-platform/xamarin-forms/xaml-for-xamarin-forms/data_bindings_to_mvvm/


## Steps to reproduce

1. Run the attached test case on Android, iOS, or Windows Phone. This is just a slightly extended version of the Clock example that makes it a little easier to see the problem.

2. Tap the "Update Time" button a few times.


## Result

Each time the "Update Time" button is tapped, the "Get DateTime count" increases by 2 instead of 1.

([Android only] The text alignment on the "Update Time" button also changes from the center to the left on the first tap. That's another known issue (bug 21138).)


## Version information

Xamarin.Forms 1.2.3.6255-pre3
Xamarin.Android.Support 20.0.0.4
WPtoolkit 4.2013.08.16

Xamarin   3.7.126.0 (d5382b8b3a2baf01a2413b145b96b5563d75d4c8)
Xamarin.Android   4.18.0.24 (3ebb5e477e2d3a62f6ba7a0dbc774bdfba2da1c9)
Xamarin.iOS   8.2.57.0 (06491f39c4d42b5fe5b685ef91a843177f5e7247)

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2014-09-26 02:04:28 UTC
For searchability I should also mention that the ViewModel implements INotifyPropertyChanged.
Comment 3 Rajneesh Kumar 2014-09-30 02:38:49 UTC
I have checked this issue and able to reproduce this. To reproduce this issue I have followed the sample application and steps provided in bug description.

Steps to reproduce:

1. Open attached sample application in VS 
2. Set iOS as startup project and deploy it on simulator
3. It will deploy successfully, click on Update Time button
4. Observe that "Update Time" button is tapped, the "Get DateTime count" increases by 2 instead of 1.
5. Set Android as startup project and deploy it on emulator
6. Observe that "Update Time" button is tapped, the "Get DateTime count" increases by 2 instead of 1.
7. The text alignment on the "Update Time" button also changes from the center to the left on the first tap

Additional Information: Getting same behavior on devices for both iOS and Android.

Screencast(iOS): http://www.screencast.com/t/bVQC2Jzlt3

Screencast(Android): http://www.screencast.com/t/tP1FSZO9oiQ

Environment Info:

Mac:
Xamarin.iOS
Version: 8.2.0.57 (Trial Edition)

Windows:

Microsoft Visual Studio Professional 2012
Version 11.0.50727.1 RTMREL
Microsoft .NET Framework
Version 4.5.52742

Installed Version: Professional

LightSwitch for Visual Studio 2012   04938-004-0033001-02140
Microsoft LightSwitch for Visual Studio 2012

Office Developer Tools   04938-004-0033001-02140
Microsoft Office Developer Tools

Team Explorer for Visual Studio 2012   04938-004-0033001-02140
Microsoft Team Explorer for Visual Studio 2012

Visual Basic 2012   04938-004-0033001-02140
Microsoft Visual Basic 2012

Visual C# 2012   04938-004-0033001-02140
Microsoft Visual C# 2012

Visual C++ 2012   04938-004-0033001-02140
Microsoft Visual C++ 2012

Visual F# 2012   04938-004-0033001-02140
Microsoft Visual F# 2012

Visual Studio 2012 Code Analysis Spell Checker   04938-004-0033001-02140
MicrosoftÆ Visual StudioÆ 2012 Code Analysis Spell Checker

Portions of International CorrectSpellô spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American HeritageÆ Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Visual Studio 2012 SharePoint Developer Tools   04938-004-0033001-02140
Microsoft Visual Studio 2012 SharePoint Developer Tools

NuGet Package Manager   2.0.30625.9003
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.0
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   11.1.20627.00
Microsoft SQL Server Data Tools

Web Developer Tools   1.0.30710.0
Microsoft Web Developer Tools contains the following components:
Page Inspector: Tool that offers an efficient way to decompose Web Applications and diagnose front-end issues.
Web Publishing: Extensions required for Web Publishing for both hosted servers as well as on premises.
Web Form Templates: Includes the default templates for Web Form Applications.
Editor Extensions: Includes HTML, CSS, and JS editor extensions that greatly enhance the development experience.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   3.7.126.0 (d5382b8b3a2baf01a2413b145b96b5563d75d4c8)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   4.18.0.24 (3ebb5e477e2d3a62f6ba7a0dbc774bdfba2da1c9)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   8.2.57.0 (06491f39c4d42b5fe5b685ef91a843177f5e7247)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2015-02-18 20:09:05 UTC
Since this bug is getting a little stale, I've updated the test case to the latest Xamarin.Forms versions (starting with a fresh XF 1.3+ template project) to make sure the issue hasn't changed in the mean time. I'll attach the new test case in the next comment and mark the old attachment as obsolete.

The new test case does still show the original behavior: each button tap still increases the "Get DateTime count" by 2 instead of 1.


## Version info

Xamarin.Forms 1.3.5.6333-pre1

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3

Xamarin   3.9.302.0 (80f4e84)
Xamarin.Android   4.20.0.34 (49a04b966feb40dfdba49d57ba16249b66d606a6)
Xamarin.iOS   8.6.1.0 (3b3ef438017c7ecf486defa9e01567a5f2b3cb2a)
Comment 5 Brendan Zagaeski (Xamarin Team, assistant) 2015-02-18 20:09:45 UTC
Created attachment 9915 [details]
Test case

Up-to-date test case
Comment 6 Paul Diston 2015-03-10 05:50:18 UTC
This is still an issue for both 1.4.0.6341 and 1.4.1.6342-pre1.
Comment 7 E.Z. Hart [MSFT] 2016-03-25 17:50:21 UTC
This appears to have been fixed in 1.5.
Comment 8 Parmendra Kumar 2016-04-11 14:06:29 UTC
I have checked this issue with Xamarin.Forms 2.2.0-pre2 and its working fine on both Windows VS and Mac XS.

Hence closing this issue.