Process.GetProcessById bugfix - #64723
Conversation
|
Tagging subscribers to this area: @dotnet/area-system-diagnostics-process Issue Details
|
There was a problem hiding this comment.
@adamsitnik, do you know why we fall back to the IndexOf here for the !IsRemoteMachine case? I'm wondering why the using block below can't just contain return !processHandle.IsInvalid && !HasExited(processHandle, ref signaled, out _);.
There was a problem hiding this comment.
I want to continue working on this code to get rid of this fallback in most of cases. This fallback needed because it's not always possible to open process handle, e.g. corner cases is Idle process (pid = 0) and csrss processes. We probably should fall back only if processId == 0 or if error code of OpenProcess is ERROR_ACCESS_DENIED but it may be a controversial topic, so I decide to implement it in another PR, separated from bugfix.
|
Thanks for working on this. Can you please add a test that would have failed before and will now succeed? |
|
I've added test for this |
|
Thanks for the contribution @epeshk |
#63937