CommunityToolkit / Windows

Collection of controls for WinUI 2, WinUI 3, and Uno Platform developers. Simplifies and demonstrates common developer tasks building experiences for Windows with .NET.
https://aka.ms/windowstoolkitdocs
Other
603 stars 76 forks source link

[WinUI] nre at CommunityToolkit.WinUI.Media.Pipelines.PipelineBuilder #238

Open Cornmarket opened 1 year ago

Cornmarket commented 1 year ago

Describe the bug

Getting null reference exception on a WinUI application when using UIElementExtensions.VisualFactory

Regression

No response

Reproducible in sample app?

Steps to reproduce

Stack trace:
  _at CommunityToolkit.WinUI.Media.Pipelines.PipelineBuilder.<BuildAsync>d__9.MoveNext()
   at CommunityToolkit.WinUI.Media.PipelineVisualFactoryBase.<GetAttachedVisualAsync>d__0.MoveNext()
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at CommunityToolkit.WinUI.Media.PipelineVisualFactory.<GetAttachedVisualAsync>d__8.MoveNext()
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at CommunityToolkit.WinUI.Media.UIElementExtensions.<OnVisualFactoryPropertyChanged>d__3.MoveNext()
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at Microsoft.UI.Dispatching.DispatcherQueueSynchronizationContext.<>c__DisplayClass2_0.<Post>b__0()_

use the following xaml:

            <Grid>
                <Grid>
                    <Viewbox Margin="10">
                        <Grid>
                            <Path Data="F0M6.69808,19.74842  ...14.82079,16.64823 z"
                                  Fill="#FF409CC5"
                                  Stretch="None" />
                        </Grid>
                    </Viewbox>
                </Grid>
            </Grid>
            <Border Grid.RowSpan="2">
                <media:UIElementExtensions.VisualFactory>
                    <media:PipelineVisualFactory Source="{media:BackdropSource}">
                        <media:LuminanceToAlphaEffect />
                        <media:OpacityEffect Value="0.4" />
                        <media:BlendEffect Mode="Multiply" Source="{media:BackdropSource}" />
                        <media:BlurEffect Amount="16" />
                        <media:ShadeEffect Intensity="0.2" Color="#FF222222" />
                    </media:PipelineVisualFactory>
                </media:UIElementExtensions.VisualFactory>
            </Border>

the project references:   

CommunityToolkit.Mvvm 8.2.1
CommunityToolkit.WinUI.Behaviors 8.0.230907
CommunityToolkit.WinUI.Media 8.0.230907
CommunityToolkit.WinUI.UI.Controls 7.1.2
Microsoft.Extensions.Hosting 6.0.1
Microsoft.WindowsAppSDK 1.3.230502000
Microsoft.Xaml.Behaviors.WinUI.Managed 2.0.9
System.Configuration.ConfigurationManager 7.0.0
WinUIEx 2.2

Expected behavior

no nre

Screenshots

No response

Windows Build Number

Other Windows Build number

No response

App minimum and target SDK version

Other SDK version

No response

Visual Studio Version

No response

Visual Studio Build Number

No response

Device form factor

No response

Nuget packages

No response

Additional context

No response

Help us help you

Yes, I'd like to be assigned to work on this item.

ghost commented 1 year ago

Hello Cornmarket, 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 🙌

michael-hawker commented 1 year ago

This should be a duplicate of #235 I believe