dotnet/runtime

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

Fermée

#85 383 ouverte le 26 avr. 2023

 (9 commentaires) (0 réaction) (0 personne assignée)C# (5 445 forks)batch import
area-System.Diagnostics.Processhelp wanted

Métriques du dépôt

Stars
 (17 886 étoiles)
Métriques de merge PR
 (Merge moyen 12j 11h) (661 PRs mergées en 30 j)

Description

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 ?

Guide contributeur