Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileShare Enum descriptions are incorrect/misleading #10572

Open
BillArmstrong opened this issue Oct 15, 2024 · 1 comment
Open

FileShare Enum descriptions are incorrect/misleading #10572

BillArmstrong opened this issue Oct 15, 2024 · 1 comment
Labels
area-System.IO Pri3 Indicates issues/PRs that are low priority untriaged New issue has not been triaged by the area owner

Comments

@BillArmstrong
Copy link

Type of issue

Other (describe below)

Description

The enum values state/imply that the effect is applied on "subsequent opening of the file". This is not correct because the value can cause the current file open request to fail based on previously opened file handles.

For example, the FileShare.Read value states the following:

Allows subsequent opening of the file for reading. If this flag is not specified, any request to open the file for reading (by this process or another process) will fail until the file is closed.

In the code below, the second attempt to open the file will fail because it is specifying FileShare.Read and the previous file open request has Write access to the file.

using var fileStream1 = new FileStream("test.file", FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read);
using var fileStream2 = new FileStream("test.file", FileMode.Open, FileAccess.Read, FileShare.Read);

Please update the documentation so that it is clear that the FileShare value applies to existing file handles as well as future attempts to open the file.

Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.io.fileshare?view=net-8.0

Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.IO/FileShare.xml

Document Version Independent Id

3bd9dbb8-0a53-ad3f-cd5d-c18d47f7f1a1

Article author

@dotnet-bot

@issues-automation issues-automation bot added the Pri3 Indicates issues/PRs that are low priority label Oct 15, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Oct 15, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.IO Pri3 Indicates issues/PRs that are low priority untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

1 participant