dotnet / dotnet/dotnet-api-docs
Example for Process.EnableRaisingEvents Property (and for ExitTime) is incorrect, InvalidOperationException is thrown on access to StartTime
Open
area-System.Diagnostics.Process
Pri3
untriaged
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
---
**Issue moved from MicrosoftDocs/feedback#3325**
- Please respond to @apegushin.
---
_From @apegushin on Friday, December 11, 2020 11:22:15 PM_
Example for Process.EnableRaisingEvents (and ExitTime) Property shows how to handle 'Exited' event. In the handler process.StartTime is accessed, which throws InvalidOperationException for processes that are not running (which is 100% true for the process that Exited). Examples need to be revised and access to StartTime should be removed. I'm seeing this on WSL2/Ubuntu, but StartTime property documentation suggests that this behavior is consistent across OSes.
Contributor guide
Assessment
This issue has not been assessed yet.