Bug 26893 - OnElementChanged on CustomRenderer is not triggering on Android
Summary: OnElementChanged on CustomRenderer is not triggering on Android
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.1
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-02-10 00:38 UTC by Prashant Cholachagudda
Modified: 2015-02-27 03:51 UTC (History)
5 users (show)

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


Attachments
Test case (343.46 KB, application/zip)
2015-02-10 00:38 UTC, Prashant Cholachagudda
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 ANSWERED

Description Prashant Cholachagudda 2015-02-10 00:38:29 UTC
Created attachment 9733 [details]
Test case

In custom renderer OldElement with null value consistently is called in iOS (which is correct),
but never gets called in Android. 

In the attached test project. When we run it just press Go and Back buttons.
In iOS you will see messages "OldElement is NOT null" in Output window but in Android you will not.
Comment 1 Danish Akhtar 2015-02-10 02:17:05 UTC
I have checked this issue after following the steps mentioned in bug description and getting the same issue OldElement is NOT null" in Output window is not appears when we run Android project, however we are getting this if we run iOS application.

Hence marking this as Confirmed.

Supplement info:
Application output for Android: https://gist.github.com/Mohit-Kheterpal/244319d6ec8abb006d27
Application output for iOS: https://gist.github.com/Mohit-Kheterpal/6ce4b51fa65496dffd45
ide logs: https://gist.github.com/Mohit-Kheterpal/9e322195cf88e59c6226
adblogcat: https://gist.github.com/Mohit-Kheterpal/d253ab6e1def40fcb982

Environment info:=== Xamarin Studio ===

Version 5.7.1 (build 17)
Installation UUID: 3dbf10c4-ed30-4e55-8a8b-1704777c7b5f
Runtime:
	Mono 3.12.0 ((detached/de2f33f)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000076

=== Xamarin.Android ===

Version: 4.20.0.28 (Trial Edition)
Android SDK: /Users/apprpject/Desktop/android-sdk-macosx
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		4.0    (API level 14)
		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_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.iOS ===

Version: 8.9.1.44 (Trial Edition)
Hash: 5482a19
Branch: master
Build date: 2015-01-31 13:50:55-0500

=== Xamarin.Mac ===

Version: 1.12.0.4 (Trial Edition)

=== Build Information ===

Release ID: 507010017
Git revision: 0bc7d3550b6b088ac25b08dcf7bbe73bcc8658b3
Build date: 2015-02-03 19:43:29-05
Xamarin addins: f7b7d34419c9ec24501bfa7c658e80a6305613e0

=== Operating System ===

Mac OS X 10.8.5
Darwin localhost 12.5.0 Darwin Kernel Version 12.5.0
    Sun Sep 29 13:33:47 PDT 2013
    root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64
Comment 2 Danish Akhtar 2015-02-10 02:21:25 UTC
Screencast for above issue: http://www.screencast.com/t/APwR1QH8IvwA
Comment 3 Jason Smith [MSFT] 2015-02-27 03:51:05 UTC
Several bits of feedback here:

1) Use VisualElementRenderer<T> not ViewRenderer if you are not calling SetNativeControl. This will prevent crashing AND save some performance.

2) It is known that Element is not assigned back to null on android before dispose.  While we would very much like to do this, we view this as an ABI break now and feel it is too risky of a change to make. Too many existing renderers out there would break due to this change. On all platforms you must override dispose and handle disposing properly. In a 2.0 where we can do a full ABI break we will likely change this.