dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.25k stars 4.73k forks source link

Clarify documentation of Process.Start return value #109435

Open tmat opened 1 day ago

tmat commented 1 day ago

Description

Current documentation:

The return value true indicates that a new process resource was started. If the process resource specified by the FileName member of the StartInfo property is already running on the computer, no additional process resource is started. Instead, the running process resource is reused and false is returned.

This is generally not true. If UseShellExecute is false (or on Unix where UseShellExecute is ignored), Start will never return false. If UseShellExecute is true Start may return false if a new process isn't created... as the ShellExecuteEx docs call out:

hProcess will be NULL if no process was launched. For example, if a document to be launched is a URL and an instance of Internet Explorer is already running, it will display the document. No new process is launched, and hProcess will be NULL.

Reproduction Steps

n/a

Expected behavior

n/a

Actual behavior

n/a

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

dotnet-policy-service[bot] commented 1 day ago

Tagging subscribers to this area: @dotnet/area-system-diagnostics-process See info in area-owners.md if you want to be subscribed.