mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-19 15:16:20 +00:00
Fix dead-lock on shutdown
This commit is contained in:
@@ -163,7 +163,12 @@ namespace ElectronNET.AspNet.Runtime
|
||||
|
||||
private void SignalRFacade_Disconnected(object sender, EventArgs e)
|
||||
{
|
||||
this.HandleStopped();
|
||||
// IMPORTANT: Do NOT call HandleStopped synchronously here!
|
||||
// This event fires from within SignalR's OnDisconnectedAsync, and calling
|
||||
// StopApplication() synchronously causes a deadlock: the host waits for
|
||||
// OnDisconnectedAsync to complete, but we're waiting for the host to stop.
|
||||
// Fire and forget to break the deadlock.
|
||||
_ = Task.Run(() => this.HandleStopped());
|
||||
}
|
||||
|
||||
private void ElectronProcess_Stopped(object sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user