Forum Xamarin.Forms

ConstraintExpressionExtension not found when using with RelativeLayout


The following Xaml seem to throw an error, but then successfully shows the screen. It would be all fine, except that I normally run with Exceptions thown to user and this throws 4 times every time the screen is loaded. Additionally - I am curios to know if there is anything wrong that I have no noticed yet.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage    xmlns=""
        <RelativeLayout x:Name="relativeLayout" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
                <local:CustomView x:Name="customView"
                    RelativeLayout.XConstraint="{ConstraintExpression Type=Constant, Constant=0}"
                    RelativeLayout.YConstraint="{ConstraintExpression Type=Constant, Constant=0}"
                    RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
                 RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"/>

When this Xaml is loaded, it throws with the following exception:

        Xamarin.Forms.Xaml.XamlParseException: Type ConstraintExpressionExtension not found in xmlns

I click continue (F5) 4 times (one for each constraint I assume) and the application continues.

Any ideas why this would be happening?



  • TomPajonkTomPajonk CZMember, University
    edited September 2014

    Same problem here. When testing in Windows Phone 8 it works without issues.

  • I've moved away from xaml until this is sorted.

  • JustinJonesJustinJones USMember

    I get the same exception in, but only when I have a breakpoint set for System.Exception.

    Remove the exception breakpoint and the code runs correctly.

    Leave it in and the exception occurs in InitializeComponent() on this line:



  • MikeEEEMikeEEE USMember ✭✭✭

    I, too, am getting this issue. Has this been reported yet?

  • RezaMousaviRezaMousavi GBMember

    May not immediately seem like it, but I think it is related to this bug, feel free to add comments as it may get solved if there is enough of a push.

  • MikeEEEMikeEEE USMember ✭✭✭

    Hm. No, this is different. There is definitely an exception being thrown in Xamarin.Forms code, although it is not-breaking user code. I have created a bug report here:

  • RezaMousaviRezaMousavi GBMember

    If you press F5 (maybe a few times), does it continue as you would expect?

    If so, the issue is simply down to the fact that Xamarin tends to throw back to user ANY exception that is thrown internally to the Xamarin binaries, ignoring its type. If you go to Debug > Exceptions and remove all "thrown" check boxes, it will begin to "work". The issue is, as soon as you tick a single box, all Xamarin exceptions will start being thrown back to user code.

    As I have mentioned in the bug report, if Just My Code is enabled, this should never happen.

  • MikeEEEMikeEEE USMember ✭✭✭

    No, it does not break user code. So there are really two issues. One that you mention, and then the other that I mention. :) Furthermore, as you say, this isn't a show stopper, just something users (and the XF team) should be aware of.

    Ideally, there shouldn't be any exceptions thrown from the Xamarn.Forms.* libraries if they can help it. For instance, loading the page specified in the bug I submitted causes 20 messages to render to the debugger. Not exactly something you want to see everytime you load a page.

  • JustinJones, thanks a lot :) . Some sort of weird bug

Sign In or Register to comment.