Canceling a build can fail if a process running on the computer is protected #6477
Labels
bug
help wanted
Issues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim.
triaged
Milestone
Issue Description
Canceling a NMake project (not relevant here but it's Unreal Engine 4) through CTRL+BREAK in Visual Studio doesn't work when some (unrelated) processes are running on the computer.
Steps to Reproduce
Prerequisites: have a process running which will deny access to its start time (for instance, OpenVPN, see Analysis section).
Notice an MSBuild error (see Actual Behavior section).
Expected Behavior
We should be able to cancel a build without an error. (Or at least just #5508 😄)
Actual Behavior
Cancelling a build doesn't work and provokes the following error:
Analysis
Looking at the code, I think the issue is with Shared.NativeMethodsShared.GetChildProcessIds which fails if, while iterating through the processes currently running, one of them is protected.
In my case, I managed to identify the faulty process: OpenVPN 2.5.1. When connected to the VPN, it creates a process which makes
GetChildProcessIds()
fail.More precisely, Process.StartTime throws Win32Exception 0x80004005 "Access is denied" and it's not caught.
I also managed to reproduce the error by copying the following code from msbuild in a simple project and calling it:
Versions & Configurations
16.9.0.16703
Attach a binlog
The text was updated successfully, but these errors were encountered: