Bug 24485 - Binding the BindingContext with Converter causes application to hang (but not crash)
Summary: Binding the BindingContext with Converter causes application to hang (but not...
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.3
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Stephane Delcroix
Depends on:
Reported: 2014-11-13 03:45 UTC by me
Modified: 2015-06-11 16:45 UTC (History)
5 users (show)

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

Sample Project (15.21 KB, application/octet-stream)
2014-11-14 00:54 UTC, me
The bug in action (1.99 MB, video/mp4)
2014-11-14 00:58 UTC, me
Xamarin Log (9.52 KB, application/x-zip-compressed)
2014-11-14 00:59 UTC, me
Android Log (Copied from Log Window as instructed) (165.00 KB, application/x-zip-compressed)
2014-11-14 01:02 UTC, me
VS Info (4.18 KB, text/plain)
2014-11-14 01:03 UTC, me

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:

Description me 2014-11-13 03:45:57 UTC
Consider to following Converter Class:

    public class Test

    public class ToBasicItem : IValueConverter
        public object Convert(object value, Type targetType,
                              object parameter, CultureInfo culture)
            if (value == null)
                return null;

            return new Test();

        public object ConvertBack(object value, Type targetType,
                                  object parameter, CultureInfo culture)
            throw new NotImplementedException();

If used for Binding the BindingContext (which is a Bindable Property) such as this:

<ContentPage BindingContext={Set from Code Behind}>
    <StackLayout BindingContext="{Binding PropertyOfParentContext, Converter={StaticResource ToBasicItem}}">
         <Label Text="{Binding Title}"

will hangs the application, but the app does not got killed and no "this app is not responding" message on Android.

If we put breakpoint on the Line "return new Test();" the breakpoint will be hit repeatedly. If there is a property inside Test class, the property also got read repeatedly.

However, if the line "return new Test();" was modified to:

1) return value; (no conversion at all) - the application run successfully.

2) return new { Title = "Sample", Test = 1 } - the application run successfully. (anonymous type, no reference property)

3) return new object() - hangs the application.

4) return new { Title = "Sample", Object = new object() } - hangs to application (anonymous type, but with reference property)

We wanted to do this because we want to avoid creating many Converters to format the display and make the formatting consistent, so we "Converts" the context class into another class which does all the formatting. (We did this in our Windows Phone Projects.)
Comment 1 Udham Singh 2014-11-13 09:49:39 UTC
We have tried to reproduce this issue but not able to reproduce.

Could you please provide a sample app/test case/screencast that demonstrate the issue, so that we can reproduce this issue at our end.

Also please include application output, android device log, adb logcat, Zip Xamarin Logs and complete build info.

You can get logs at following path :

1. Zip Xamarin Logs via 'Help -> Zip Xamarin Logs'.
2. Android device log via 'View ->Other Windows ->Android Device Logging' and Select your device. OR provide adb logcat of your device.
3. Build info via 'Help ->About Microsoft Visual Studio' and copy info.

Comment 2 me 2014-11-14 00:54:41 UTC
Created attachment 8734 [details]
Sample Project

Sample Project file created from scratch.

* Have Used NuGet Update Package right after project creation.
Comment 3 me 2014-11-14 00:58:22 UTC
Created attachment 8735 [details]
The bug in action

- Recorded while testing the sample project
Comment 4 me 2014-11-14 00:59:36 UTC
Created attachment 8736 [details]
Xamarin Log
Comment 5 me 2014-11-14 01:02:34 UTC
Created attachment 8737 [details]
Android Log (Copied from Log Window as instructed)
Comment 6 me 2014-11-14 01:03:43 UTC
Created attachment 8738 [details]
VS Info
Comment 7 me 2014-11-14 01:13:38 UTC
My lunch break is lost to this :D , hope I did everything correctly and it helps you! (I believe my code is correct and it can be done?)
Comment 8 Udham Singh 2014-11-14 03:04:20 UTC
Thank you very much for providing sample app and other info.

I have checked this issue with the sample app attached in comment 2 and observed the same behaviour mentioned in bug description. Please refer the screencast : http://www.screencast.com/t/ugWCHYbnpw9t

Environment Info:

Windows 8
VS 2013
Xsmarin.iOS Build Host
Comment 9 Jason Smith [MSFT] 2015-06-11 16:45:26 UTC
Should be fixed in 1.4.3 final