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

Page specific ResourceDictionary crashes the app on iOS and Android, and not working on Windows #26638

Open
dhindrik opened this issue Dec 14, 2024 · 1 comment
Labels
t/bug Something isn't working

Comments

@dhindrik
Copy link
Contributor

dhindrik commented Dec 14, 2024

Description

When having a ResourceDictionary in a page with for example double values and you use them in the page it will crash the app on iOS and Android. On Windows elements where I set HeightRequest="{StaticResource MyHeightValue}" will not show up.

This only happens in Release, in Debug it works. ANd for iOS and Android I have only tested on physical devices.

On iOS i found this error message when I open the console via XCode: MainPage.InitializeComponent: Store local stack type mismatch 3 4

It worked fine with .NET 8. We found this problem when testing our app after updating to .NET 9.

Steps to Reproduce

  1. Create a new .NET MAUI app
  2. Add a ResourceDictionary in the MainPage.xaml
  3. Add a double value to the ResourceDictionary
  4. Use the value as Height for the bot image.
  5. Switch to release configuration
  6. Deploy the app to the device.
<ContentPage
    x:Class="StaticResourcesBug.MainPage"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
    <ContentPage.Resources>
        <ResourceDictionary>
            <x:Double x:Key="BotHeight">185</x:Double>
        </ResourceDictionary>
    </ContentPage.Resources>
    <ScrollView>
        <VerticalStackLayout Padding="30,0" Spacing="25">
            <Image
                Aspect="AspectFit"
                HeightRequest="{StaticResource BotHeight}"
                SemanticProperties.Description="dot net bot in a hovercraft number nine"
                Source="dotnet_bot.png" />
        </VerticalStackLayout>
    </ScrollView>

</ContentPage>

Link to public reproduction project repository

https://github.com/dhindrik/StaticResourcesBug

Version with bug

9.0.21 SR2.1

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.100 SR10

Affected platforms

iOS, Android, Windows, I was not able test on other platforms

Affected platform versions

iOS 18.2, Android 14, WIndows 10.0.19041.0

Did you find any workaround?

Put the values on each place instead of in a ResourceDictionary.

Relevant log output

@dhindrik dhindrik added the t/bug Something isn't working label Dec 14, 2024
Copy link

We've found some similar issues:

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant