dotnet/runtime

Kill(entireProcessTree: true) - cannot terminate self (?)

已關閉

#85,383 建立於 2023年4月26日

 (9 則留言) (0 個反應) (0 位負責人)C# (5,445 個分叉)batch import
area-System.Diagnostics.Processhelp wanted

倉庫指標

星標
 (17,886 顆星)
PR 合併指標
 (平均合併 12天 11小時) (30 天內合併 661 個 PR)

描述

This works as expected and terminates application : Process.GetCurrentProcess().Kill(entireProcessTree: false);

This throws InvalidOperation Process.GetCurrentProcess().Kill(entireProcessTree: true);

Exception origin here ; https://github.com/dotnet/runtime/blob/10438a57b888cbdc6dc15771dc662adde9fd6b14/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.NonUap.cs#L25

image

**

Would it be possible to allow also the 'self-termination-with-children' scenario gracefully ?

貢獻者指南