dotnet / dotnet-api-docs

.NET API reference documentation (.NET 5+, .NET Core, .NET Framework)
https://docs.microsoft.com/dotnet/api/
Other
685 stars 1.52k forks source link

System.Diagnostic.Process.Start(string) API documentation still assuming UseShellExecute being true by default. #8727

Open elgonzo opened 1 year ago

elgonzo commented 1 year ago

Issue description

The API documentation page for the System.Diagnostic.Process.Start(string) method for .NET Core 2.1 up to .NET 7 incorrectly describes that it is possible to provide the path to a document file instead of an executable file. A list of quotes from the .NET 7-related API documentation (https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process.start?view=net-7.0#system-diagnostics-process-start(system-string)):

Starts a process resource by specifying the name of a document or application file and associates the resource with a new Process component.

Parameters fileName String The name of a document or application file to run in the process.

Therefore, the file name does not need to represent an executable file. It can be of any file type for which the extension has been associated with an application installed on the system. For example the file name can have a .txt extension if you have associated text files with an editor, such as Notepad, or it can have a .doc if you have associated .doc files with a word processing tool, such as Microsoft Word.

All the explanations regarding document files are wrong with respect to .NET Core 2.1 and newer, due to a change of the default value of ProcessStartInfo.UseShellExecute (https://learn.microsoft.com/en-us/dotnet/core/compatibility/fx-core#change-in-default-value-of-useshellexecute).

Target framework

dotnet-issue-labeler[bot] commented 1 year ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

ghost commented 1 year ago

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

Issue Details
**Issue description** The API documentation page for the `System.Diagnostic.Process.Start(string)` method for .NET Core 2.1 up to .NET 7 incorrectly describes that it is possible to provide the path to a document file instead of an executable file. A list of quotes from the .NET 7-related API documentation (https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process.start?view=net-7.0#system-diagnostics-process-start(system-string)): > Starts a process resource by specifying the name of a document or application file and associates the resource with a new [Process](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process?view=net-7.0) component. > Parameters > fileName String > The name of a document or application file to run in the process. > Therefore, the file name does not need to represent an executable file. It can be of any file type for which the extension has been associated with an application installed on the system. For example the file name can have a .txt extension if you have associated text files with an editor, such as Notepad, or it can have a .doc if you have associated .doc files with a word processing tool, such as Microsoft Word. All the explanations regarding document files are _wrong_ with respect to .NET Core 2.1 and newer, due to a change of the default value of ProcessStartInfo.UseShellExecute (https://learn.microsoft.com/en-us/dotnet/core/compatibility/fx-core#change-in-default-value-of-useshellexecute). **Target framework** - [*] .NET Core 2.1 and newer
Author: elgonzo
Assignees: -
Labels: `untriaged`, `area-System.Diagnostics.Process`
Milestone: -