Skip to content

Discrepancies in System.Diagnostics.Process and API docs #97132

Open
@yahoo0742

Description

@yahoo0742

Description

Some properties of the System.Diagnostics.Process (e.g., PrivateMemorySize64) don't work on MacOS or other OSs as described in the API document https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process.privatememorysize64?view=net-6.0#system-diagnostics-process-privatememorysize64.

I realized the problem when checking the test file on GitHub at src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs, rather than relying solely on the documentation or the IDE,

I recommend updating the documentation to reflect accurate behavior or making it platform-specific until resolved. This ensures developers receive accurate information for effective use.

Thanks

Reproduction Steps

Just compare the docs here https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process
and tests at System.Diagnostics.Process/tests/ProcessTests.cs.

Expected behavior

  1. At least, the API doc is updated to reflect the accurate behavior.
  2. Add OSPlatformAttribute to APIs that don't function properly on some OSs.
  3. It would be fantastic if these APIs could behave consistently across different platforms.

Actual behavior

The API documentation does not specify that APIs may not return actual values on some OSs, and no warning from IDE or compiler when using these APIs, whereas, in reality, the APIs do not return actual values on some OSs.

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions