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 8163 [details]
Example solution referenced in description
Test environment ->
Running on - Android tablet: 4.0.3;
Debugging in - latest stable Xamarin: 5.4 (build 240); latest stable Xamarin.Android: 4.16.0 (Business Edition)
Receive the runtime exception (below) in TestBinding.ViewModels.OneVM#OnPropertyChanged() whenever I attempt to modify the "LabelText" property that is bound to a label in TestBinding.Views.One.
In the attached .ZIP file I have a simple "Xamarin.Forms Portable" solution with two screens each containing only a few views. I can update the Forms.Entry views on the "One" screen by clicking buttons on the "Two" screen which send messages. Attempting to update the Forms.Label text causes the error to be thrown.
In the attached solution I am not setting the Forms.Label.BindingContext, but setting it to the ViewModel did not have an affect.
The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2<Xamarin.Forms.View, bool>.get_Item (Xamarin.Forms.View) <IL 0x000a7, 0x0030c>
at Xamarin.Forms.RelativeLayout/<>c__DisplayClass11.<CanSolveView>b__10 (Xamarin.Forms.View) <IL 0x00007, 0x00057>
at System.Linq.Enumerable.All<Xamarin.Forms.View> (System.Collections.Generic.IEnumerable`1<Xamarin.Forms.View>,System.Func`2<Xamarin.Forms.View, bool>) <0x0017b>
at Xamarin.Forms.RelativeLayout.CanSolveView (Xamarin.Forms.View,System.Collections.Generic.Dictionary`2<Xamarin.Forms.View, bool>) <IL 0x00054, 0x0031f>
at Xamarin.Forms.RelativeLayout.get_ChildrenInSolveOrder () <IL 0x0008c, 0x005cb>
at Xamarin.Forms.RelativeLayout.LayoutChildren (double,double,double,double) <IL 0x00001, 0x0008b>
at Xamarin.Forms.Layout.UpdateChildrenLayout () <IL 0x000c8, 0x0066f>
at Xamarin.Forms.Layout.OnSizeAllocated (double,double) <IL 0x00010, 0x000ab>
at Xamarin.Forms.VisualElement.SizeAllocated (double,double) <IL 0x00003, 0x00083>
at Xamarin.Forms.Layout.OnChildMeasureInvalidated (object,System.EventArgs) <IL 0x00075, 0x0035f>
at Xamarin.Forms.VisualElement.InvalidateMeasure () <IL 0x00014, 0x00083>
at Xamarin.Forms.Label.<.cctor>b__0 (Xamarin.Forms.BindableObject,object,object) <IL 0x00006, 0x0007f>
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty,object,bool,bool,bool) <IL 0x000b9, 0x0058f>
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty,object,bool,bool,bool) <IL 0x00213, 0x00aeb>
at Xamarin.Forms.BindingExpression.ApplyCore (object,Xamarin.Forms.BindableObject,Xamarin.Forms.BindableProperty,bool) <IL 0x00206, 0x01287>
at Xamarin.Forms.BindingExpression.Apply (bool) <IL 0x00041, 0x0018b>
at Xamarin.Forms.BindingExpression/BindingExpressionPart.<PropertyChanged>b__12 () <IL 0x00007, 0x00053>
at Java.Lang.Thread/RunnableImplementor.Run () [0x0000b] in /Users/builder/data/lanes/1131/2a7b6821/source/monodroid/src/Mono.Android/src/Java.Lang/Thread.cs:36
at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) [0x00009] in /Users/builder/data/lanes/1131/2a7b6821/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Java.Lang.IRunnable.cs:71
at (wrapper dynamic-method) object.7e31cd30-e194-4917-bc6e-4ae0f9d1f890 (intptr,intptr) <IL 0x00011, 0x0003b>
Also attempting to set the "username" Forms.Entry on screen "One" to invisible in a similar manner causes a similar error.
Also reproduced on an iPod Touch: iOS 6.1.6.
I have checked this issue and able to reproduce. To reproduce this issue I have followed the sample application and instruction provided in bug description.
Steps I have followed:
1. Open attached sample application in XS
2. Build an deploy the application on Android device
3. It will deploy successfully, you will see a page titled "One"
4. Enter something in username and password and click on Button named "Two"
5. you will see a page titled "two"
6. Now click on Label/Visible yow will get the following exception:
=== Xamarin Studio ===
Version 5.4 (build 240)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Mono 3.8.0 ((no/45d0ba1)
GTK+ 2.24.23 (Raleigh theme)
Package version: 308000009
=== Xamarin.Android ===
Version: 4.16.0 (Enterprise Edition)
Android SDK: /Users/MM/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)
3.2 (API level 13)
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)
4.5 (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 6.0 (6299)
=== Xamarin.iOS ===
Version: 18.104.22.168 (Enterprise Edition)
Build date: 2014-09-18 09:12:55-0400
=== Xamarin.Mac ===
Version: 22.214.171.124 (Enterprise Edition)
=== Build Information ===
Release ID: 504000240
Git revision: 01786bc67c7024ec33d327ed27e4416d7a846f4e
Build date: 2014-09-17 10:58:48-04
Xamarin addins: 7cd7dfcd6b7b7b53281508954ec080f1cd153ad3
=== Operating System ===
Mac OS X 10.9.4
Darwin MacMini.local 13.3.0 Darwin Kernel Version 13.3.0
Tue Jun 3 21:27:35 PDT 2014
*** Bug 23703 has been marked as a duplicate of this bug. ***
The error could be better, but you're setting up views as relative to views that you're later removing. Views that you've created relationships too must be in the RelativeLayout and must stay there. This works fine at first because the view is present, but after that cycle you're removing it. Some operations, especially those that bring in the keyboard, can trigger a relayout which will go through the relationships again.