Skip to content

Add documentation for Process.Kill(bool entireProcessTree) #2828

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 29, 2019

Conversation

wtgodbe
Copy link
Member

@wtgodbe wtgodbe commented Jul 25, 2019

Adds documentation for method System.Diagnostics.Process.Kill(bool entireProcessTree)

CC @krwq for area co-ownership, @bgribaudo who added this method, @carlossanlop for CoreFx documentation effort ownership, and @rpetrusha @mairaw for grammar concerns.

@mairaw mairaw added 🏁 Release: .NET Core 3.0 :checkered_flag: Release: .NET Core 3.0 new-content Indicates PRs that contain new articles labels Jul 25, 2019
@mairaw mairaw added this to the July 2019 milestone Jul 25, 2019
Copy link
Contributor

@mairaw mairaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Here's what I've done:
Since the remarks were exactly the same as the other overload, I've moved them to be higher on the page and applicable to the whole page, not just the individual overloads. Let me know what you think!

@mairaw mairaw added verify-build-before-merge waiting-on-feedback Indicates PRs that are waiting for feedback from SMEs before they can be merged labels Jul 25, 2019
@carlossanlop
Copy link
Contributor

I think it looks good. If @wtgodbe aggrees with the additional commits, then maybe we can get it merged.

@mairaw
Copy link
Contributor

mairaw commented Jul 26, 2019

The reflection tool will undo your last change @carlossanlop from what I can tell 😉

@mairaw
Copy link
Contributor

mairaw commented Jul 26, 2019

Copy link

@rpetrusha rpetrusha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left a couple of suggestions and a comment, @wtgodbe.

<summary>To be added.</summary>
<remarks>To be added.</remarks>
<param name="entireProcessTree">
<see langword="true" /> to kill the associated process and its descendants; <see langword="false" /> to kill only associated process.</param>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<see langword="true" /> to kill the associated process and its descendants; <see langword="false" /> to kill only associated process.</param>
<see langword="true" /> to kill the associated process and its descendants; <see langword="false" /> to kill only the associated process.</param>

The `Kill` method forces a termination of the process, while <xref:System.Diagnostics.Process.CloseMainWindow%2A> 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 <xref:System.Diagnostics.Process.CloseMainWindow%2A> 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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Calling <xref:System.Diagnostics.Process.CloseMainWindow%2A> 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 <xref:System.Diagnostics.Process.CloseMainWindow%2A> 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.


-or-

The associated process is a Win16 executable.</exception>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't this and line 2136 legacy conditions -- perhaps they should be deleted? (Are there still Win16 executables running on .NET Framework?)

Calling <xref:System.Diagnostics.Process.CloseMainWindow%2A> 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 <xref:System.Diagnostics.Process.CloseMainWindow%2A> 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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To force the application to quit, use the `Kill` method.
To force the application to quit, use the `Kill` method.

@bgribaudo
Copy link
Contributor

Thanks for working on this, @wtgodbe! I added a couple change ideas as comments on code.

@carlossanlop
Copy link
Contributor

@bgribaudo do you mean you backported the comments added here into the source code, or did you mean to add suggestions to this PR?

@wtgodbe
Copy link
Member Author

wtgodbe commented Jul 26, 2019

Thanks for the feedback @rpetrusha, I've pushed a commit to address it. @bgribaudo I couldn't find your comments, could you point me towards them?

@bgribaudo
Copy link
Contributor

@carlossanlop:

@bgribaudo do you mean you backported the comments added here into the source code, or did you mean to add suggestions to this PR?

Oops! I meant as comments on this change's Markdown code diff. Sorry for the confunsion. :-(


> [!NOTE]
> The <xref:System.Diagnostics.Process.Kill%2A> method executes asynchronously.
> After calling the `Kill` method, call the <xref:System.Diagnostics.Process.WaitForExit%2A> method to wait for the process to exit, or check the <xref:System.Diagnostics.Process.HasExited%2A> property to determine if the process has exited.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make very clear that these ways of checking exit status only apply to the current process instance, maybe add something along the lines of the following?

"Note: WaitForExit() and HasExited do not reflect the status of descendant processes. When Kill(entireProcessTree: true) is used, WaitForExit() and HasExited will indicate that exiting has completed after the given process exits, even if all descendants have not yet exited."

<param name="entireProcessTree">To be added.</param>
<summary>To be added.</summary>
<param name="entireProcessTree"><see langword="true" /> to kill the associated process and its descendants; <see langword="false" /> to kill only the associated process.</param>
<summary>Immediately stops the associated process, and optionally all of its child/descendent processes.</summary>
<remarks>To be added.</remarks>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Drop the word "all" above (from "optionally all of its child...") and note here that, when 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.

@bgribaudo
Copy link
Contributor

bgribaudo commented Jul 26, 2019

@wtgodbe:

@bgribaudo I couldn't find your comments, could you point me towards them?

Maybe they didn't show up because I hadn't submitted the review (didn't realize that might be necessary :-(). Can you see them now?

@mairaw
Copy link
Contributor

mairaw commented Jul 26, 2019

Now they appear @bgribaudo!

@wtgodbe
Copy link
Member Author

wtgodbe commented Jul 26, 2019

@rpetrusha
Copy link

The build failed. I've corrected the error, and a new build has started.

@rpetrusha rpetrusha closed this Jul 26, 2019
@rpetrusha rpetrusha reopened this Jul 26, 2019
@carlossanlop
Copy link
Contributor

@rpetrusha thanks for correcting the error, the build passed. This is fully baked and ready to get merged.

@carlossanlop carlossanlop removed the waiting-on-feedback Indicates PRs that are waiting for feedback from SMEs before they can be merged label Jul 29, 2019
@rpetrusha
Copy link

Thanks for the additional changes, @wtgodbe. I'll merge your PR now.

@rpetrusha rpetrusha merged commit aafba2c into dotnet:master Jul 29, 2019
@bgribaudo
Copy link
Contributor

Thank you, @wtgodbe and team!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏁 Release: .NET Core 3.0 :checkered_flag: Release: .NET Core 3.0 new-content Indicates PRs that contain new articles
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants