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

[skia] Issue with SKXamlCanvas - Process Crashes when Exceptions are Thrown in PaintSurface Event Triggered by Background Thread #15123

Closed
lindexi opened this issue Jan 19, 2024 · 3 comments · Fixed by mono/SkiaSharp#2720
Labels
area/skia ✏️ Categorizes an issue or PR as relevant to Skia difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working project/third-party 3️⃣ Categorizes an issue or PR as relevant to 3rd party libraries

Comments

@lindexi
Copy link
Contributor

lindexi commented Jan 19, 2024

Current behavior

I am writing to report an issue I am experiencing with the use of SKXamlCanvas. The problem arises when any exception is thrown within the PaintSurface event, particularly when this event is triggered by a background thread. This situation leads to a crash of my process.

Expected behavior

The expected behavior is that the application should continue to function normally and be able to collect the exception, even if any exception is thrown in the PaintSurface event. Ideally, this could be achieved through the TaskScheduler.UnobservedTaskException event.

How to reproduce it (as minimally and precisely as possible)

To reproduce this issue, please follow the steps below:

  1. Add SKXamlCanvas to xaml.
  2. Subscribe to the PaintSurface event of SKXamlCanvas and throw an exception in the event implementation method.
  3. Call the Invalidate method of SKXamlCanvas from a background thread.

You can find my demo in https://github.com/lindexi/lindexi_gd/tree/dde76effc23ebb9ee974b6ec276b242c39a50bdf/JagobawearjiNeewhiqakerki

Workaround

No response

Works on UWP/WinUI

None

Environment

No response

NuGet package version(s)

No response

Affected platforms

No response

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

I fixed the issues in mono/SkiaSharp#2720

Reference: #15097

Reference: dotnet/runtime#76367

@lindexi lindexi added difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Jan 19, 2024
@jeromelaban
Copy link
Member

Background thread manipulations of the SKXamlCanvas are not supported at this time.

@MartinZikmund MartinZikmund changed the title [skia] Issue with SKXamlCanvas - Process Crashes when Exceptions are Thrown in PaintSurface Event Triggered by Background Thread [skia] Issue with SKXamlCanvas - Process Crashes when Exceptions are Thrown in PaintSurface Event Triggered by Background Thread Jan 29, 2024
@MartinZikmund MartinZikmund added difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI project/third-party 3️⃣ Categorizes an issue or PR as relevant to 3rd party libraries area/skia ✏️ Categorizes an issue or PR as relevant to Skia and removed triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Jan 29, 2024
@lindexi
Copy link
Contributor Author

lindexi commented Mar 22, 2024

Thank you @jeromelaban . Fix by mono/SkiaSharp#2720

@lindexi lindexi closed this as completed Mar 22, 2024
@jeromelaban
Copy link
Member

Thanks for the fix!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/skia ✏️ Categorizes an issue or PR as relevant to Skia difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working project/third-party 3️⃣ Categorizes an issue or PR as relevant to 3rd party libraries
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants