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.
Created attachment 11065 [details]
[XA 5.1] Event handlers subscribed to (some?) events that are bound to Java callbacks no longer work.
This might be related to how `Java.Interop.EventHelper.AddEventHandler()` works behind the scenes?
Regression status: REGRESSION between XA 4.20 and XA 5.1 (d23da36)
## Steps to reproduce
Build and run the attached test case on emulator or device.
(The test case is just a new template app that adds an event handler on `button.ViewTreeObserver.GlobalLayout`.)
## Actual results
A. The app does _not_ run `Button_ViewTreeObserver_GlobalLayout()`.
B. The application output does _not_ show the `Console.WriteLine()` output.
## Expected results
A. On Xamarin.Android 4.20, the app _does_ run `Button_ViewTreeObserver_GlobalLayout()`.
B. The application output _does_ show the `Console.WriteLine()` output:
> ### GlobalLayout even handler called
## Version information
### Android devices
Xamarin Android Player 0.3.7 (1), Nexus 4 (KitKat)
### OS X 10.9.5, MacBook Air
=== Xamarin Studio ===
Version 5.9 (build 431)
Installation UUID: 2c0ea975-8f73-4920-8414-3e9ae359fbf4
Mono 4.0.0 ((detached/d136b79)
GTK+ 2.24.23 (Raleigh theme)
Package version: 400000143
=== Xamarin.Android ===
Version: 188.8.131.52 (Business Edition)
Android SDK: /Users/macuser/Library/Developer/Xamarin/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: /Users/macuser
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
=== Build Information ===
Release ID: 509000431
Git revision: 7560726734fc7267de2fa9abed2509968deefaa8
Build date: 2015-04-17 19:25:48-04
Xamarin addins: 2e772c734ab3148054eae7bf8949f340fdeb5e5e
Created attachment 11066 [details]
Logcat and diagnostic build output
Use the `button.ViewTreeObserver.AddOnGlobalLayoutListener()` method rather than the `button.ViewTreeObserver.GlobalLayout` event.
For a more complete example of that approach see .
>  https://github.com/xamarin/monodroid-samples/blob/1be38c07916d1fc30adfcd5247e141ea9daa5da2/GooglePlayServices/GooglePlayServicesTest/Source/MarkerDemoActivity.cs#L217
> [XA 5.1] Event handlers subscribed to (some?) events that are bound to Java
> callbacks no longer work.
Does this happen for any other events, or just for the ViewTreeObserver.GlobalLayout event?
If it's just the ViewTreeObserver.GlobalLayout event, then you're probably hitting the fix for Bug #17257.
*** Bug 17257 has been marked as a duplicate of this bug. ***
Commits monodroid/35fe327c and monodroid-5.1-series/690e31db revert behavior to the previous Xamarin.Android 4.20 behavior, reintroducing Bug #17257.
I have checked this issue with Xamarin.Android 184.108.40.206 and observed that now 'Button_ViewTreeObserver_GlobalLayout()' is getting called and in application output we are getting '### GlobalLayout even handler called'.
Hence I am closing this issue. Screencast : http://www.screencast.com/t/43EUUtbiTYN
Environment Info :
Mac OS X 10.9.5
Xamarin Studio 5.9.1 (build 3)
Mono 4.0.1 ((detached/88674ce)
GTK+ 2.24.23 (Raleigh theme)
Xcode 6.2 (6776)
Xamarin.Android 220.127.116.11 (Enterprise Edition)
An update to the comment 9 : I have checked this issue with XAP 0.3.4(1) and NEXUS 5 (android 5.0.1) and observed that this is working fine with both. Thanks!