Open czmirek opened 7 months ago
Can repro this issue at Android platform on the latest 17.10 preview 2(8.0.10&8.0.14).
I just had the same problem with a Style
targeted for a Label
type and being applied (accidently) to a VerticalStackLayout
.
Is there not a tool that can walk the XAML and styles and report the errors at compile time?
Description
Invalid XAML throws exception in Release but not in Debug. It should be thrown in both or better it should become a compilation error.
The content page below contains a
Border
that has aStyle="{StaticResource BlackButton}"
.But the
BlackButton
is targetted only at Buttons. This works perfectly fine in Debug but throws an exception in Release. This makes it difficult to spot when you make this mistake.TestPage.xaml
App.xaml
See log output below.
Steps to Reproduce
Link to public reproduction project repository
https://github.com/czmirek/MauiReleaseXamlBug
Version with bug
Unknown/Other
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
iOS, Android
Affected platform versions
Android 14, iOS 17 (iPhone 12)
Did you find any workaround?
Simply fix the style: make duplicate style to target the Border element or remove the style and apply it directly.
Relevant log output