Bug 60203 - MultiTrigger with a BindingCondition and a PropertyCondition causes "Object reference not set to an instance of an object."
Summary: MultiTrigger with a BindingCondition and a PropertyCondition causes "Object r...
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.4.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Stephane Delcroix
Depends on:
Reported: 2017-10-16 12:09 UTC by Tejas
Modified: 2018-02-02 21:48 UTC (History)
3 users (show)

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

Repro Case (180.76 KB, application/x-zip-compressed)
2017-10-24 23:39 UTC, Tejas
Actual Repro Case (279.38 KB, application/x-zip-compressed)
2017-10-24 23:54 UTC, Tejas

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 Tejas 2017-10-16 12:09:30 UTC
Multi-Triggers work when I use one or more BindingConditions or PropertyConditions, but when I mix them to together, I'm not able to build the project, and get "Object reference not set to an instance of an object."

Sample code:

        <Trigger TargetType="productViews:ProductViewCell" Property="HighlightOffers" Value="False">
            <Setter Property="BackgroundColor" Value="{StaticResource PageBackgroundColor}" />
        <DataTrigger TargetType="productViews:ProductViewCell" Binding="{Binding ShowOfferImage}" Value="False">
            <Setter Property="BackgroundColor" Value="{StaticResource PageBackgroundColor}" />
        <MultiTrigger TargetType="productViews:ProductViewCell">
                <BindingCondition Binding="{Binding ShowOfferImage}" Value="True" />
                <PropertyCondition Property="HighlightOffers" Value="True" />
            <Setter Property="BackgroundColor" Value="{StaticResource TheGoodStuffColor}" />

Remove either BindingCondition or PropertyCondition, add more conditions to keep the types homogeneous, it works. This is my output:

>> 1>C:\Users\<REMOVED>\Source\Repos\<REMOVED>\<REMOVED>\Views\Product\ProductViewCell.xaml : error : Object reference not set to an instance of an object.
Comment 2 Tejas 2017-10-24 23:39:26 UTC
Created attachment 25431 [details]
Repro Case

System.Linq.Expressions.dll (.NETStandard 1.6 version) added manually. Note that doing this via NuGET doesnt hit the issue, since the Nuspec doesnt list any DLLs for MonoAndroid.

However, when using Paket to manage the project, it becomes an issue, since Paket adds .NETStandard DLLs to an Android Project.

You can argue the bug is in Paket, but there's also a bug in Xamarin.Android, since technically it must be capable of running all .NETStandard DLLs.
Comment 3 Tejas 2017-10-24 23:40:45 UTC
Crap, please delete this comment and attachment, this is a repro case for another bug I was submitting a repro for in another tab.
Comment 4 Tejas 2017-10-24 23:54:08 UTC
Created attachment 25433 [details]
Actual Repro Case

The XF PCL project won't compile.

Note that this bug happens only when XamlC is enabled for the PCL project. Without XAMLC, the project builds and runs fine.
Comment 5 Stephane Delcroix 2017-10-25 10:53:24 UTC
it also happens with 2 PropertyConditions in a MultiTrigger
Comment 6 Stephane Delcroix 2017-10-25 12:03:38 UTC