AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.72k stars 2.22k forks source link

The application crashes if the same content is displayed twice in WindowNotificationManager #15766

Open afunc233 opened 5 months ago

afunc233 commented 5 months ago

Describe the bug

this pr #15628 use a Dictionary<object, NotificationCard> to interim storage . but Key of Dictionary should unique. crashes happend

To Reproduce

ControlCatalog.NetCore

image

Expected behavior

solve the problem

Avalonia version

last master

OS

No response

Additional context

No response

timunie commented 5 months ago

/cc @wieslawsoltes

emmauss commented 5 months ago

content, which is the key for the notification, can be any avalonia content that can be rendered, including Visual. If it isn't unique, it will still cause errors when the content is attached to the visual tree multiple times, as you can't attach a visual more than once.

afunc233 commented 5 months ago

yep , so i can't fix it , But it's still a problem, isn't it?

timunie commented 5 months ago

@afunc233 in my understanding it is an issue. Sure the same visual can't be shown twice. The same content can however be shown twice if DataTemplates are used. Need to check the sample carefully.

emmauss commented 5 months ago

Yes, it is still an issue.

Coloryr commented 2 months ago
for(i=0;i<5;i++)
{
notificationManager.Show(model.Notify);
}

crash in 11.2.0-beta1, work in 11.1.3

image