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

Use .Net 8.0 will make CommunityToolkit.WinUI.UI.Media crash always on WinUI3 #4963

Closed
2 of 14 tasks
zhuxb711 opened this issue Jan 10, 2024 · 2 comments
Closed
2 of 14 tasks
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior needs triage 🔍

Comments

@zhuxb711
Copy link

Describe the bug

Windows App SDK:
On .Net 7.0, everything works well. However, this exception will always throw on .Net 8.0 if using the AcrylicBrush

Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
StackTrace:
        at System.RuntimeType.CreateInstanceOfT()
        at System.Activator.CreateInstance[T]()
        at WinRT.WeakLazy`1.get_Value()
        at WinRT.ActivationFactory`1.ActivateInstance[I]()
        at Microsoft.Graphics.Canvas.Effects.GaussianBlurEffect..ctor()
        at CommunityToolkit.WinUI.UI.Media.Pipelines.PipelineBuilder.<>c__DisplayClass13_0.<<Blur>g__Factory|0>d.MoveNext()
        --- End of stack trace from previous location ---
        at CommunityToolkit.WinUI.UI.Media.Pipelines.PipelineBuilder.BuildAsync()
        at CommunityToolkit.WinUI.UI.Media.XamlCompositionEffectBrushBase.OnConnected()
        at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
        at Microsoft.UI.Dispatching.DispatcherQueueSynchronizationContext.<>c__DisplayClass2_0.<Post>b__0()

Regression

No response

Reproducible in sample app?

  • This bug can be reproduced in the sample app.

Steps to reproduce

<Rectangle>
    <Rectangle.Fill>
        <Media:AcrylicBrush TintColor="Black"
                            FallbackColor="Transparent"
                            BlurAmount="5"
                            TintOpacity="0.5" />
    </Rectangle.Fill>
</Rectangle>

Expected behavior

Works just like on .Net 7.0

Screenshots

No response

Windows Build Number

  • Windows 10 1809 (Build 17763)
  • Windows 10 1903 (Build 18362)
  • Windows 10 1909 (Build 18363)
  • Windows 10 2004 (Build 19041)
  • Windows 10 20H2 (Build 19042)
  • Windows 10 21H1 (Build 19043)
  • Windows 11 21H2 (Build 22000)
  • Other (specify)

Other Windows Build number

Windows 11 22621

App minimum and target SDK version

  • Windows 10, version 1809 (Build 17763)
  • Windows 10, version 1903 (Build 18362)
  • Windows 10, version 1909 (Build 18363)
  • Windows 10, version 2004 (Build 19041)
  • Other (specify)

Other SDK version

No response

Visual Studio Version

2022

Visual Studio Build Number

17.8.4

Device form factor

Desktop

Nuget packages

CommunityToolkit.WinUI.UI.Media 7.1.2

Additional context

No response

Help us help you

No.

@zhuxb711 zhuxb711 added the bug 🐛 An unexpected issue that highlights incorrect behavior label Jan 10, 2024
@ghost ghost added the needs triage 🔍 label Jan 10, 2024
@ghost
Copy link

ghost commented Jan 10, 2024

Hello zhuxb711, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

@zhuxb711
Copy link
Author

I think this is the issue related to the Win2D team. CommunityToolkit.WinUI.UI.Media 7.1.2 only require Microsoft.Graphics.Win2D >= 1.0.0.30, which is too old and released on 2021/11/17. So the solution is installing the Microsoft.Graphics.Win2D directly on your project to manually upgrade it to 1.1.1. Which solved this issue.

@ghost ghost locked as resolved and limited conversation to collaborators Mar 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior needs triage 🔍
Projects
None yet
Development

No branches or pull requests

1 participant