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 ?

贡献者指南