dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.83k stars 1.67k forks source link

Duplicate Default Style Behaves Strangely #23225

Open david-maw opened 1 week ago

david-maw commented 1 week ago

Description

I added a duplicate default style for "Border" in Styles.Xaml and the resulting Windows app failed to run, throwing an exception with the message "Position 10:37. Type converter failed: Exception has been thrown by the target of an invocation.". What I expected was at least an exception with a message indicationg the problem and ideally a compile-time error rather than a run time one. Once I figured out my mistake it was trivial to fix, so this is low priority.

Steps to Reproduce

  1. Create a new MAUI App targeted at .NET 8
  2. Open up Styles.Xaml and insert a copy of one of the default styles.
  3. Build and run it on Windows - the app should fault during initialization with the exception above

Link to public reproduction project repository

No response

Version with bug

8.0.21 SR4.1

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows, I was not able test on other platforms

Affected platform versions

Windows 11

Did you find any workaround?

Don't make the mistake in the first place!

Relevant log output

No response

github-actions[bot] commented 1 week ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

ninachen03 commented 1 week ago

I can repro this issue on the latest 17.11.0 Preview 2.1(8.0.60 & 8.0.21) When adding duplicate default style for "Border" or others in Styles.Xaml, No error message is reported during compilation, but the error will be displayed during debugging. Users hope that the error will be exposed during compilation.

image