MicrosoftEdge / MicrosoftEdge/WebView2Feedback
Browser processes killed on WM_QUERYENDSESSION
@aluhrs13 is already working on this.
Since Aug 11, 2023.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
My application is listening for the WM_QUERYENDSESSION message. If the user has not saved his work then a shutdown reason block is set (ShutdownBlockReasonCreate) and FALSE is returned.
When the user logoff, Windows display a screen showing applications that hang with the message defined with ShutdownBlockReasonCreate. If the user cancel the end of the Windows session because he realize that he haven't saved something, then the application is reshown but the browser processes have been killed and the application show balck screen insteed of the web page.
This is reproductible with the WebView2APISample, is you modify the WM_QUERYENDSESSION with:
case WM_QUERYENDSESSION:
{
// yes, we can shut down
// Register how we might be restarted
/*RegisterApplicationRestart(L"--restore", RESTART_NO_CRASH | RESTART_NO_HANG);
*result = TRUE;
*/
ShutdownBlockReasonCreate(m_mainWindow, L"Block");
*result = FALSE;
return true;
}
Before the user query the end of session:
After the user canceled the end of session:
I think that the browser process should not be terminated before the application is realy being terminated.
If I use SetProcessShutdownParameters(0x3FF, 0); in the main application to set the shutdown priority the "highest" then the problem disappear. Is this because the application receive early the WM_QUERYENDSESSION and respond FALSE and then others processes do not receive the WM_QUERYENDSESSION ?
Is this workaround will always works ?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.