microsoft / WindowsAppSDK

The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.
https://docs.microsoft.com/windows/apps/windows-app-sdk/
MIT License
3.85k stars 323 forks source link

Svg image used in toast notification failed to render when pop up the first time #4589

Open HO-COOH opened 4 months ago

HO-COOH commented 4 months ago

Describe the bug

I have a clean install of windows 10 18363. I found out my svg image used in a toast notification will fail to render (only showing a background color but not the shape) when it is shown the first time. This is extremely bothering. Successive notification will show up correctly as expected.

Steps to reproduce the bug

  1. Create a new packaged winui3 C++ project
  2. In the button handler, use this code

    void MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&)
    {
        winrt::Windows::Data::Xml::Dom::XmlDocument doc;
        doc.LoadXml(LR"(
        <toast launch="action=viewFriendRequest&amp;userId=49183">
    
          <visual>
            <binding template="ToastGeneric">
              <text>Matt sent you a friend request</text>
              <text>Hey, wanna dress up as wizards and ride around on our hoverboards together?</text>
              <image placement="appLogoOverride" hint-crop="circle" src="ms-appx:///Assets/mi-icon-success.svg"/>
            </binding>
          </visual>
    
          <actions>
            <action content="Accept" activationType="background" arguments="action=acceptFriendRequest&amp;userId=49183"/>
            <action content="Decline" activationType="background" arguments="action=declineFriendRequest&amp;userId=49183"/>
          </actions>
    
        </toast>
    )");
        winrt::Windows::UI::Notifications::ToastNotification notification{doc};
        winrt::Windows::UI::Notifications::ToastNotificationManager::CreateToastNotifier()
            .Show(
                notification
            );
    }
  3. Buld the app, click the button. See the toast.

The svg I am using: mi-icon-success

Expected behavior

No response

Screenshots

  1. First time

https://github.com/user-attachments/assets/5bc9d157-b7f8-4f52-b94f-4c1e3623c91c

  1. Second time image

NuGet package version

Windows App SDK 1.5.5: 1.5.240627000

Packaging type

Packaged (MSIX)

Windows version

Windows 10 version 1909 (18363, November 2019 Update)

IDE

Visual Studio 2022

Additional context

No response