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

[BUG] Multiple Unloaded events in WinUI causes empty SKXamlCanvas #2967

Open
1 task done
Mangepange opened this issue Aug 7, 2024 · 0 comments
Open
1 task done
Labels

Comments

@Mangepange
Copy link

Description

I'm displaying different SKXamlCanvas controls in separate WinUI TabView tabs. When I remove multiple tabs, the currently selected tab drops its rendered content. I found that this is really a WinUI issue, microsoft/microsoft-ui-xaml#9880, where multiple Unloaded events are triggered on the wrong FrameworkElement. In the SKXamlCanvas code I can see that the backgound is cleared on Unloaded events, so that's why my content disappears. I also found my way to #1118 where you seem to have fixed a somewhat related issue.

It seems like WinUI has an erratic Load/Unload behavior in other circumstances as well, and that you maybe cannot rely on them coming in correct order.
microsoft/microsoft-ui-xaml#1900
microsoft/microsoft-ui-xaml#8342

When debugging this, I noticed that when the SKXamlCanvas recieves incorrect Unloaded events it actually has IsLoaded == true. Maybe the current fix with the loadUnloadCounter could be replaced with a private isLoaded flag which can be set in OnLoaded, and then prevent multiple Loaded events to be processed? The flag should then only get reset in OnUnloaded if IsLoaded actually is false.

Code

See microsoft/microsoft-ui-xaml#9880

Expected Behavior

No response

Actual Behavior

No response

Version of SkiaSharp

2.88.3 (Current)

Last Known Good Version of SkiaSharp

Other (Please indicate in the description)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

Windows

Platform / Operating System Version

No response

Devices

No response

Relevant Screenshots

No response

Relevant Log Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Ready For Work
Development

No branches or pull requests

1 participant