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

Crash when using PublishTrimmed with Packaged app and attempting to reference IValueConverters from external library #9021

Open
kazo0 opened this issue Oct 23, 2023 · 1 comment
Labels
bug Something isn't working team-Markup Issue for the Markup team

Comments

@kazo0
Copy link

kazo0 commented Oct 23, 2023

Describe the bug

We are trying to use <PublishTrimmed>True</PublishTrimmed> in our application publish profiles but are encountering a crash when using Styles coming from our external Material library of XAML styles.

The error we see in the logs is:

Exception thrown at 0x00007FFB487A535C (KernelBase.dll) in MaterialTestApp.Windows.exe: WinRT originate error - 0x802B000A : 'Failed to assign to property 'Microsoft.UI.Xaml.UIElement.Visibility'. [Line: 0 Position: 0]'.

And it seems to be happening with any style that is using converters defined in our Material library

Visibility="{Binding Path=..., RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource MaterialNullToCollapsedConverter}, FallbackValue=Collapsed, TargetNullValue=Collapsed}"

It's not only isolated to Visibility, all converters are simply not being applied. And this is crashing only when running as a Packaged app. Running as Unpackaged does not lead to a crash and the converters are working

Removing the PublishTrimmed from the .pubxmls avoids the crash on Packaged apps

Steps to reproduce the bug

CrashingWinSample.zip

  1. Launch sample app (Windows - Packaged)
  2. Note crash

Expected behavior

No crash

Screenshots

No response

NuGet package version

Windows App SDK 1.4.2: 1.4.231008000

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 22H2 (22621, 2022 Update)

IDE

Visual Studio 2022-preview, Visual Studio 2022

Additional context

Interestingly, just adding a class that inherits from IValueConverter anywhere in my sample app will workaround the crash. I don't even need to use the converter in the XAML, just having it in the project will avoid the crash

@ghost1372
Copy link
Contributor

@kazo0 test this:
TrimMode=partial

@duncanmacmichael duncanmacmichael added the bug Something isn't working label Oct 31, 2023
@bpulliam bpulliam added the team-Markup Issue for the Markup team label Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working team-Markup Issue for the Markup team
Projects
None yet
Development

No branches or pull requests

4 participants