Skip to content

PipelineBuilder throw a NullReferenceException #235

@zou-z

Description

@zou-z

Describe the bug

I copied sample code from BlurEffectAnimation to my project.Then it throw a NullReferenceException when i run my winui3 application.
image

Steps to reproduce

Copy sample code to MainWindow.xaml and run application

<?xml version="1.0" encoding="utf-8"?>
<Window
    x:Class="BlurTest.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:BlurTest"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
      xmlns:ani="using:CommunityToolkit.WinUI.Animations"
      xmlns:behaviors="using:CommunityToolkit.WinUI.Behaviors"
      xmlns:interactions="using:Microsoft.Xaml.Interactions.Core"
      xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
      xmlns:media="using:CommunityToolkit.WinUI.Media">
    <Grid>
        <Border Height="280">
            <Image VerticalAlignment="Center"
               Source="ms-appx:///Assets/StoreLogo.png" />

            <media:UIElementExtensions.VisualFactory>
                <media:PipelineVisualFactory>
                    <media:BlurEffect x:Name="ImageBlurEffect"
                                  IsAnimatable="True" />
                </media:PipelineVisualFactory>
            </media:UIElementExtensions.VisualFactory>

            <ani:Explicit.Animations>
                <ani:AnimationSet x:Name="BlurAnimation"
                              IsSequential="True">
                    <ani:BlurEffectAnimation EasingMode="EaseOut"
                                         EasingType="Linear"
                                         Target="{x:Bind ImageBlurEffect}"
                                         From="0"
                                         To="8"
                                         Duration="0:0:3" />

                    <ani:BlurEffectAnimation EasingMode="EaseOut"
                                         EasingType="Linear"
                                         Target="{x:Bind ImageBlurEffect}"
                                         From="8"
                                         To="0"
                                         Duration="0:0:3" />
                </ani:AnimationSet>
            </ani:Explicit.Animations>

            <interactivity:Interaction.Behaviors>
                <interactions:EventTriggerBehavior EventName="Loaded">
                    <behaviors:StartAnimationAction Animation="{x:Bind BlurAnimation}" />
                </interactions:EventTriggerBehavior>
            </interactivity:Interaction.Behaviors>
        </Border>

    </Grid>
</Window>


### Expected behavior

MainWindow play blur animation after start.

### Screenshots

![image](https://github.com/CommunityToolkit/Windows/assets/45748083/6dcdc196-7d1e-415f-8856-027e2678543e)
![image](https://github.com/CommunityToolkit/Windows/assets/45748083/700a2d6f-6475-4b4c-a550-f12cce423d7d)
![image](https://github.com/CommunityToolkit/Windows/assets/45748083/372d25c4-a096-4f48-94ab-60e7e5219508)
![image](https://github.com/CommunityToolkit/Windows/assets/45748083/ec486d65-1a7b-441b-951e-55d90bfb5999)


### Code Platform

- [ ] UWP
- [X] WinAppSDK / WinUI 3
- [ ] Web Assembly (WASM)
- [ ] Android
- [ ] iOS
- [ ] MacOS
- [ ] Linux / GTK

### 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 10 21H2 (Build 19044)
- [X] Windows 10 22H2 (Build 19045)
- [ ] Windows 11 21H2 (Build 22000)
- [ ] Other (specify)

### Other Windows Build number

_No response_

### App minimum and target SDK version

- [ ] Windows 10, version 1809 (Build 17763)
- [ ] Windows 10, version 1903 (Build 18362)
- [ ] Windows 10, version 1909 (Build 18363)
- [X] Windows 10, version 2004 (Build 19041)
- [ ] Windows 10, version 2104 (Build 20348)
- [ ] Windows 11, version 22H2 (Build 22000)
- [ ] Other (specify)

### Other SDK version

_No response_

### Visual Studio Version

2022

### Visual Studio Build Number

_No response_

### Device form factor

Desktop

### Additional context

_No response_

### Help us help you

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

Metadata

Metadata

Assignees

Labels

regressionWhat was working is now broke

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions