dotnet / dotnet/dotnet-api-docs

Example for Process.EnableRaisingEvents Property (and for ExitTime) is incorrect, InvalidOperationException is thrown on access to StartTime

Open
#5,178 1 comment 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.