From ab45e8f36030a2729b6f9140e2ea2de0b13ffd48 Mon Sep 17 00:00:00 2001 From: wtgodbe Date: Thu, 25 Jul 2019 13:20:12 -0700 Subject: [PATCH 1/6] Add documentation for Process.Kill(bool entireProcessTree) --- xml/System.Diagnostics/Process.xml | 48 ++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/xml/System.Diagnostics/Process.xml b/xml/System.Diagnostics/Process.xml index 6cf57c43a53..5086b858f0f 100644 --- a/xml/System.Diagnostics/Process.xml +++ b/xml/System.Diagnostics/Process.xml @@ -2150,9 +2150,51 @@ There are problems accessing the performance counter API's used to get process i - To be added. - To be added. - To be added. + + to kill the associated process and its descendants; to kill only associated process. + Immediately stops the associated process, and (optionally) all of its child/descendent processes. + + forces a termination of the process, while only requests a termination. When a process with a graphical interface is executing, its message loop is in a wait state. The message loop executes every time a Windows message is sent to the process by the operating system. Calling sends a request to close to the main window, which, in a well-formed application, closes child windows and revokes all running message loops for the application. The request to exit the process by calling does not force the application to quit. The application can ask for user verification before quitting, or it can refuse to quit. To force the application to quit, use the method. The behavior of is identical to that of a user closing an application's main window using the system menu. Therefore, the request to exit the process by closing the main window does not force the application to quit immediately. + +> [!NOTE] +> The method executes asynchronously. After calling the method, call the method to wait for the process to exit, or check the property to determine if the process has exited. + + Data edited by the process or resources allocated to the process can be lost if you call . causes an abnormal process termination and should be used only when necessary. enables an orderly termination of the process and closes all windows, so it is preferable for applications with an interface. If fails, you can use to terminate the process. is the only way to terminate processes that do not have graphical interfaces. + + You can call and only for processes that are running on the local computer. You cannot cause processes on remote computers to exit. You can only view information for processes running on remote computers. + +> [!NOTE] +> If the call to the method is made while the process is currently terminating, a is thrown for Access Denied. + + ]]> + + The associated process could not be terminated. + + -or- + + The process is terminating. + + -or- + + The associated process is a Win16 executable. + You are attempting to call for a process that is running on a remote computer. The method is available only for processes running on the local computer. + The process has already exited. + + -or- + + There is no process associated with this object. + +-or- + +The calling process is a member of the associated process' descendant tree. + Not all processes in the associated process' descendant tree could be terminated. + for full trust for the immediate caller. This member cannot be used by partially trusted code. + + + From d063abf2fe1c3d09d3342947836b78a8461c34da Mon Sep 17 00:00:00 2001 From: Maira Wenzel Date: Thu, 25 Jul 2019 16:51:00 -0700 Subject: [PATCH 2/6] Update Process.xml --- xml/System.Diagnostics/Process.xml | 82 ++++++++++++++++-------------- 1 file changed, 43 insertions(+), 39 deletions(-) diff --git a/xml/System.Diagnostics/Process.xml b/xml/System.Diagnostics/Process.xml index 5086b858f0f..d698f252e44 100644 --- a/xml/System.Diagnostics/Process.xml +++ b/xml/System.Diagnostics/Process.xml @@ -2054,6 +2054,44 @@ There are problems accessing the performance counter API's used to get process i + + + To be added. + + only requests a termination. +When a process with a graphical interface is executing, its message loop is in a wait state. +The message loop executes every time a Windows message is sent to the process by the operating system. +Calling sends a request to close to the main window, which, in a well-formed application, closes child windows and revokes all running message loops for the application. +The request to exit the process by calling does not force the application to quit. +The application can ask for user verification before quitting, or it can refuse to quit. +To force the application to quit, use the `Kill` method. +The behavior of is identical to that of a user closing an application's main window using the system menu. +Therefore, the request to exit the process by closing the main window does not force the application to quit immediately. + +> [!NOTE] +> The method executes asynchronously. +> After calling the `Kill` method, call the method to wait for the process to exit, or check the property to determine if the process has exited. + +Data edited by the process or resources allocated to the process can be lost if you call `Kill`. +`Kill` causes an abnormal process termination and should be used only when necessary. + enables an orderly termination of the process and closes all windows, so it is preferable for applications with an interface. +If fails, you can use `Kill` to terminate the process. +`Kill` is the only way to terminate processes that do not have graphical interfaces. + +You can call `Kill` and only for processes that are running on the local computer. +You cannot cause processes on remote computers to exit. You can only view information for processes running on remote computers. + +> [!NOTE] +> If the call to the `Kill` method is made while the process is currently terminating, a is thrown for Access Denied. + + ]]> + + + @@ -2086,24 +2124,7 @@ There are problems accessing the performance counter API's used to get process i Immediately stops the associated process. - - forces a termination of the process, while only requests a termination. When a process with a graphical interface is executing, its message loop is in a wait state. The message loop executes every time a Windows message is sent to the process by the operating system. Calling sends a request to close to the main window, which, in a well-formed application, closes child windows and revokes all running message loops for the application. The request to exit the process by calling does not force the application to quit. The application can ask for user verification before quitting, or it can refuse to quit. To force the application to quit, use the method. The behavior of is identical to that of a user closing an application's main window using the system menu. Therefore, the request to exit the process by closing the main window does not force the application to quit immediately. - -> [!NOTE] -> The method executes asynchronously. After calling the method, call the method to wait for the process to exit, or check the property to determine if the process has exited. - - Data edited by the process or resources allocated to the process can be lost if you call . causes an abnormal process termination and should be used only when necessary. enables an orderly termination of the process and closes all windows, so it is preferable for applications with an interface. If fails, you can use to terminate the process. is the only way to terminate processes that do not have graphical interfaces. - - You can call and only for processes that are running on the local computer. You cannot cause processes on remote computers to exit. You can only view information for processes running on remote computers. - -> [!NOTE] -> If the call to the method is made while the process is currently terminating, a is thrown for Access Denied. - - ]]> - + To be added. The associated process could not be terminated. -or- @@ -2151,26 +2172,9 @@ There are problems accessing the performance counter API's used to get process i - to kill the associated process and its descendants; to kill only associated process. - Immediately stops the associated process, and (optionally) all of its child/descendent processes. - - forces a termination of the process, while only requests a termination. When a process with a graphical interface is executing, its message loop is in a wait state. The message loop executes every time a Windows message is sent to the process by the operating system. Calling sends a request to close to the main window, which, in a well-formed application, closes child windows and revokes all running message loops for the application. The request to exit the process by calling does not force the application to quit. The application can ask for user verification before quitting, or it can refuse to quit. To force the application to quit, use the method. The behavior of is identical to that of a user closing an application's main window using the system menu. Therefore, the request to exit the process by closing the main window does not force the application to quit immediately. - -> [!NOTE] -> The method executes asynchronously. After calling the method, call the method to wait for the process to exit, or check the property to determine if the process has exited. - - Data edited by the process or resources allocated to the process can be lost if you call . causes an abnormal process termination and should be used only when necessary. enables an orderly termination of the process and closes all windows, so it is preferable for applications with an interface. If fails, you can use to terminate the process. is the only way to terminate processes that do not have graphical interfaces. - - You can call and only for processes that are running on the local computer. You cannot cause processes on remote computers to exit. You can only view information for processes running on remote computers. - -> [!NOTE] -> If the call to the method is made while the process is currently terminating, a is thrown for Access Denied. - - ]]> - + to kill the associated process and its descendants; to kill only the associated process. + Immediately stops the associated process, and optionally all of its child/descendent processes. + To be added. The associated process could not be terminated. -or- @@ -6255,4 +6259,4 @@ There is a similar issue when you read all text from both the standard output an - \ No newline at end of file + From f4e74218df8eeb9f4527213ae75ca27be94251ff Mon Sep 17 00:00:00 2001 From: Carlos Sanchez Lopez <1175054+carlossanlop@users.noreply.github.com> Date: Thu, 25 Jul 2019 17:37:38 -0700 Subject: [PATCH 3/6] minor fix: parm summary in single line --- xml/System.Diagnostics/Process.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xml/System.Diagnostics/Process.xml b/xml/System.Diagnostics/Process.xml index d698f252e44..b1be9e6a2e8 100644 --- a/xml/System.Diagnostics/Process.xml +++ b/xml/System.Diagnostics/Process.xml @@ -2171,8 +2171,7 @@ You cannot cause processes on remote computers to exit. You can only view inform - - to kill the associated process and its descendants; to kill only the associated process. + to kill the associated process and its descendants; to kill only the associated process. Immediately stops the associated process, and optionally all of its child/descendent processes. To be added. The associated process could not be terminated. From 9b8e826e40e685959ce3a6f8c4376063bfebfa18 Mon Sep 17 00:00:00 2001 From: wtgodbe Date: Fri, 26 Jul 2019 09:10:47 -0700 Subject: [PATCH 4/6] Address feedback --- xml/System.Diagnostics/Process.xml | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/xml/System.Diagnostics/Process.xml b/xml/System.Diagnostics/Process.xml index b1be9e6a2e8..6753502798a 100644 --- a/xml/System.Diagnostics/Process.xml +++ b/xml/System.Diagnostics/Process.xml @@ -705,7 +705,7 @@ process.BeginOutputReadLine(); sends a request to close to the main window, which, in a well-formed application, closes child windows and revokes all running message loops for the application. The request to exit the process by calling does not force the application to quit. The application can ask for user verification before quitting, or it can refuse to quit. To force the application to quit, use the method. The behavior of is identical to that of a user closing an application's main window using the system menu. Therefore, the request to exit the process by closing the main window does not force the application to quit immediately. + When a process is executing, its message loop is in a wait state. The message loop executes every time a Windows message is sent to the process by the operating system. Calling sends a request to close the main window, which, in a well-formed application, closes child windows and revokes all running message loops for the application. The request to exit the process by calling does not force the application to quit. The application can ask for user verification before quitting, or it can refuse to quit. To force the application to quit, use the method. The behavior of is identical to that of a user closing an application's main window using the system menu. Therefore, the request to exit the process by closing the main window does not force the application to quit immediately. Data edited by the process or resources allocated to the process can be lost if you call . causes an abnormal process termination, and should be used only when necessary. enables an orderly termination of the process and closes all windows, so it is preferable for applications with an interface. If fails, you can use to terminate the process. is the only way to terminate processes that do not have graphical interfaces. @@ -2065,10 +2065,11 @@ There are problems accessing the performance counter API's used to get process i The `Kill` method forces a termination of the process, while only requests a termination. When a process with a graphical interface is executing, its message loop is in a wait state. The message loop executes every time a Windows message is sent to the process by the operating system. -Calling sends a request to close to the main window, which, in a well-formed application, closes child windows and revokes all running message loops for the application. +Calling sends a request to close the main window, which, in a well-formed application, closes child windows and revokes all running message loops for the application. The request to exit the process by calling does not force the application to quit. The application can ask for user verification before quitting, or it can refuse to quit. To force the application to quit, use the `Kill` method. + The behavior of is identical to that of a user closing an application's main window using the system menu. Therefore, the request to exit the process by closing the main window does not force the application to quit immediately. @@ -2129,11 +2130,7 @@ You cannot cause processes on remote computers to exit. You can only view inform -or- - The process is terminating. - - -or- - - The associated process is a Win16 executable. + The process is terminating. You are attempting to call for a process that is running on a remote computer. The method is available only for processes running on the local computer. The process has already exited. @@ -2178,11 +2175,7 @@ You cannot cause processes on remote computers to exit. You can only view inform -or- - The process is terminating. - - -or- - - The associated process is a Win16 executable. + The process is terminating. You are attempting to call for a process that is running on a remote computer. The method is available only for processes running on the local computer. The process has already exited. From 61b1a6dc107dd0c81f130bef36bca62cb1611245 Mon Sep 17 00:00:00 2001 From: wtgodbe Date: Fri, 26 Jul 2019 13:28:53 -0700 Subject: [PATCH 5/6] Address Feedback --- xml/System.Diagnostics/Process.xml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xml/System.Diagnostics/Process.xml b/xml/System.Diagnostics/Process.xml index 6753502798a..34dfc90cc2f 100644 --- a/xml/System.Diagnostics/Process.xml +++ b/xml/System.Diagnostics/Process.xml @@ -2076,6 +2076,10 @@ Therefore, the request to exit the process by closing the main window does not f > [!NOTE] > The method executes asynchronously. > After calling the `Kill` method, call the method to wait for the process to exit, or check the property to determine if the process has exited. + +> [!NOTE] +> The method and the property do not reflect the status of descendant processes. +> When `Kill(entireProcessTree: true)` is used, and will indicate that exiting has completed after the given process exits, even if all descendants have not yet exited. Data edited by the process or resources allocated to the process can be lost if you call `Kill`. `Kill` causes an abnormal process termination and should be used only when necessary. @@ -2169,8 +2173,8 @@ You cannot cause processes on remote computers to exit. You can only view inform to kill the associated process and its descendants; to kill only the associated process. - Immediately stops the associated process, and optionally all of its child/descendent processes. - To be added. + Immediately stops the associated process, and optionally its child/descendent processes. + When is set to true, processes where the call lacks permissions to view details will be silently skipped by the descendant termination process because the termination process is unable to determine whether those processes are descendants. The associated process could not be terminated. -or- From 0a2e347dd79a2a469ee726ca8e37741ec15a86f9 Mon Sep 17 00:00:00 2001 From: Ron Petrusha Date: Fri, 26 Jul 2019 14:16:44 -0700 Subject: [PATCH 6/6] Fixed bad xml element --- xml/System.Diagnostics/Process.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xml/System.Diagnostics/Process.xml b/xml/System.Diagnostics/Process.xml index 34dfc90cc2f..ffc47a0e0f5 100644 --- a/xml/System.Diagnostics/Process.xml +++ b/xml/System.Diagnostics/Process.xml @@ -2174,7 +2174,7 @@ You cannot cause processes on remote computers to exit. You can only view inform to kill the associated process and its descendants; to kill only the associated process. Immediately stops the associated process, and optionally its child/descendent processes. - When is set to true, processes where the call lacks permissions to view details will be silently skipped by the descendant termination process because the termination process is unable to determine whether those processes are descendants. + When is set to , processes where the call lacks permissions to view details are silently skipped by the descendant termination process because the termination process is unable to determine whether those processes are descendants. The associated process could not be terminated. -or-