Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release throws exception with local styles since last VS update #12316

Closed
eli191 opened this issue Dec 28, 2022 · 15 comments
Closed

Release throws exception with local styles since last VS update #12316

eli191 opened this issue Dec 28, 2022 · 15 comments
Labels
area-xaml XAML, CSS, Triggers, Behaviors platform/iOS 🍎 s/needs-attention Issue has more information and needs another look t/bug Something isn't working

Comments

@eli191
Copy link

eli191 commented Dec 28, 2022

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.
@eli191 eli191 added the t/bug Something isn't working label Dec 28, 2022
@eli191
Copy link
Author

eli191 commented Dec 29, 2022

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.

@AbstractionsAs
Copy link

I started getting this problem as well with the latest version. Only affects iOS in release

@AbstractionsAs
Copy link

I should point out that this has worked well in .net7 as well as .net6, but not after the latest update (first service release?)

@jsuarezruiz jsuarezruiz added area-xaml XAML, CSS, Triggers, Behaviors s/needs-repro Attach a solution or code which reproduces the issue labels Jan 11, 2023
@ghost
Copy link

ghost commented Jan 11, 2023

Hi @eli191. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Jan 12, 2023
@fgiacomelli
Copy link

fgiacomelli commented Jan 12, 2023

I totally agree with @eli191 in any point of view: for a person that writes code as professional it's not reasonable spending so much time to look for workarounds for platform bugs, and to work with a so unaffordable situation.

I have a similar problem using datatriggers only in iOS only in release mode and only with physical device: the difference is that in my situation I can build without problem and I can only see the app crash runtime (and without other info because I'm in release).

p.s. @eli191 how do you solved with converters?

@fgiacomelli
Copy link

fgiacomelli commented Jan 13, 2023

In the meantime I created a sample that crashes only in release mode on physical device on iOS, here: https://github.com/fgiacomelli/iosBug

I made some other test founding that:

  • with .NET 7.0.100 my app work as expected
  • with .NET 7.0.101 and .NET 7.0.102 my app doesn't work

so it seems to be a regression. This sample crashes with both frameworks.

In the meantime I can work with the older framework version but loosing all the improvements of latest versions, so we need a quick fix.

Can you give us a timeline of when we can expect it will be fixed?

@eli191
Copy link
Author

eli191 commented Jan 16, 2023

Hi @fgiacomelli

Yes, it is the same problem for me. Release is building without errors, but when executing the app on the device, the app crashes, and built with the previous VS version, it was working.

For exemple, a trigger like this

<DataTrigger TargetType="Label" Binding="{Binding ImagesCount}" Value="0">
<Setter Property="IsVisible" Value="False"/>
</DataTrigger>

can be changed to a Binding with a Converter like this

IsVisible="{Binding ImagesCount, Converter={toolkit:IntToBoolConverter}}"

Thank you for the sample!

@AbstractionsAs
Copy link

It'sbeen three weeks, for a major bug that effectively renders the entire framework unusable, and there still hasn't been a single response from the team...

@AbstractionsAs
Copy link

@eli191 Perhaps if you update the bufæg description with the repro link from @fgiacomelli someone will take notice?

@eli191
Copy link
Author

eli191 commented Jan 16, 2023

@eli191 Perhaps if you update the bufæg description with the repro link from @fgiacomelli someone will take notice?

@AbstractionsAs Done

@fgiacomelli
Copy link

fgiacomelli commented Jan 17, 2023

Hi @fgiacomelli

Yes, it is the same problem for me. Release is building without errors, but when executing the app on the device, the app crashes, and built with the previous VS version, it was working.

For exemple, a trigger like this

<DataTrigger TargetType="Label" Binding="{Binding ImagesCount}" Value="0">
<Setter Property="IsVisible" Value="False"/>
</DataTrigger>

can be changed to a Binding with a Converter like this

IsVisible="{Binding ImagesCount, Converter={toolkit:IntToBoolConverter}}"

Thank you for the sample!

Welcome, hoping the fix will be quick. Thank you for the suggestion, in my situation I drive more than one property on each trigger, so it would be a lot of work translate all of them with converters. So I want to be trustful on MAUI, trying to use the previous sdk only for build the release version for iOS and hoping that we can found this and a lot of critical bugs fixed in next releases. @msftbot?

@PureWeen
Copy link
Member

Duplicate of #12316

@eli191
Copy link
Author

eli191 commented Feb 22, 2023

@PureWeen
I am sorry, this IS NOT the same issue, as it happens with the linker behaviour set to None.

@fgiacomelli
Copy link

news about this? I currently can't get the release version usable on ios physical device, this is a big issue

@fgiacomelli
Copy link

in the meantime I found a workaround, as suggested here by @rolfbjarne , setting the interpreter in the csproj:

<PropertyGroup>
<UseInterpreter Condition="$(TargetFramework.EndsWith('-ios'))">true</UseInterpreter>
</PropertyGroup>

solve the problem for me

@ghost ghost locked as resolved and limited conversation to collaborators Apr 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-xaml XAML, CSS, Triggers, Behaviors platform/iOS 🍎 s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants