'Maui app hangs on splash screen when in release mode

I have a Maui app that runs perfectly in debug mode but as soon as I change it to release and either run it on the Android emulator or device it hangs at the splash screen.



Solution 1:[1]

After days of searching it turned out to be due to ZIndex being set in the xaml. I removed it from the xaml, gave the elements an x:Name and then set the ZIndex property in the code behind and it now works perfectly.

XAML: <Grid x:Name="MyGrid"

C#: MyGrid.ZIndex = 2;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Stefano Sansone