microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

Report better errors when a library doesn't support AoT

Open dotMorten opened this issue 1 year ago • 2 comments

Describe the bug

This is a follow up to https://github.com/microsoft/microsoft-ui-xaml/issues/9980 If you reference a library that hasn't done the work to upgrade to WinAppSDK 1.6, upgraded CSWinRT and generated the new projections, what you're met with is this obscure error on launch: image

There's no way to identify what is causing this crash. If we could have a build error/warning when PublishAoT is enabled, or a better exception at runtime that lets us identify which dependency doesn't support AoT, so that we can contact the library authors and have them address it.

Steps to reproduce the bug

  1. Create a new WinUI3 project and enabled it for AoT
  2. Reference WinUIEx v2.4.0
  3. Run the app.
  4. Boom!

Expected behavior

No response

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.6.0: 1.6.240829007

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

dotMorten avatar Sep 19 '24 16:09 dotMorten

@manodasanw I reckon I can just reuse the logic we have in the RCW fallback generator, check that IsAotCompatible or PublishAot is set, and if so then just emit a whole bunch of warnings for all of those old types? Or perhaps one per assembly. Does that make sense? I can take this one if you think that approach makes sense 🙂

Sergio0694 avatar Sep 19 '24 16:09 Sergio0694

i think this issue is related to this https://github.com/microsoft/microsoft-ui-xaml/issues/10020 refrencing any class library which contains resources dictionary (added in app.xaml) will be crashed Even if the dictionary is empty

ghost1372 avatar Sep 19 '24 20:09 ghost1372