maui: Release throws exception with local styles since last VS update

Description

Hi,

Styles set like this

 <ContentPage.Resources>
         <ResourceDictionary>
             <Style x:Key="InvalidEntryStyle" TargetType="Editor">
                <Setter Property="TextColor" Value="Red" />
             </Style>
             <Style x:Key="ValidEntryStyle" TargetType="Editor">
                <Setter Property="TextColor" Value="Black" />
             </Style>
         </ResourceDictionary>
    </ContentPage.Resources>

or like this

<BoxView.Triggers>
                        <DataTrigger TargetType="BoxView"
                                     Binding="{Binding Source={x:Reference _codeLabel},Path=Text.Length}"
                                     Value="0"  >
                            <Setter Property="IsVisible" Value="False" />
                            </DataTrigger>
                    </BoxView.Triggers>

compile in Release mode but crashes the app, with exception in device console :

Cannot assign property "Property": Property does not exist or is not assignable, or mismatching type between value and property.

In InitializeComponent()

Debug still fine.

Release was working before update.

Build uses Don’t link option.

Please Help as this is blocking!

Steps to Reproduce

  1. Create a new .Net MAUI app
  2. Add some local styles

Link to public reproduction project repository

https://github.com/fgiacomelli/iosBug

Version with bug

7.0 (current)

Last version that worked well

6.0 Release Candidate 2 or older

Affected platforms

iOS, I was not able test on other platforms

Affected platform versions

iOS 16.2

Did you find any workaround?

No

Relevant log output

Cannot assign property "Property": Property does not exist or is not assignable, or mismatching type between value and property.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 15 (1 by maintainers)

Most upvoted comments

Found workarounds:

  • Move local styles to global styles

  • For triggers, do a Binding with a Converter.

I have so many problems each time I want to release my application with .Net MAUI and spend a lot of time searching why. Who can imagine styles and triggers stopped working in release? I work as a professional, I am not a hobbyist so please, ensure things do work properly.