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

#8261 - terminating WinUIComposition loop on process exit to avoid cr… #9000

Merged

Conversation

HermanKirshin
Copy link
Contributor

…ashes

What does the pull request do?

Infinite message loop is terminated on process exit, so WinUIComposition native code does not attempt to assess managed code during cleanup.

What is the current behavior?

In some cases process crashes on exit, see bug for details

Fixed issues

Fixes #8261

@dnfadmin
Copy link

dnfadmin commented Sep 20, 2022

CLA assistant check
All CLA requirements met.

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0023982-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

@kekekeks
Copy link
Member

I suspect that we need to make the thread non-background too -

@HermanKirshin
Copy link
Contributor Author

With non-background thread it will hang process, because ProcessExit event will not be triggered and this cancellation token will not be switched. For non-background thread cancellation token should be triggered from somewhere else i.e. when UIThread dispatcher's main loop ends. I tried to find some way how to link UIThread loop end and WinUICompositorConnection, but it led to many doubtful changes.

@kekekeks
Copy link
Member

Let's try to merge as is, and see if the problem persists in some cases (I suspect there can be a rare race condition).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[.NET Framework] Windows app crashes when closing
5 participants