Skip to content

Conversation

oii-nasif
Copy link
Contributor

@oii-nasif oii-nasif commented Oct 3, 2025

Summary

  • Removed misleading word "subsequent" from all FileShare enum member descriptions
  • Clarified that FileShare flags control access for all file operations, not just future ones
  • Updated descriptions for Delete, Read, ReadWrite, and Write enum members

Details

The original FileShare enum documentation used the word "subsequent" in descriptions like "Allows subsequent
opening of the file for reading", which incorrectly implied that these flags only affect future file open attempts
after the current one.

In reality, FileShare flags control whether any attempt to open the file (including the current one) will
succeed, based on how existing file handles were opened. This was demonstrated in issue #10572 with this example:

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);

The second open fails because the first handle has Write access, even though both specify FileShare.Read. The
original documentation's use of "subsequent" made this behavior unclear.

Changes

  • Delete: "Allows subsequent deleting" → "Allows the file to be deleted by this process or other processes"
  • Read: "Allows subsequent opening for reading" → "Allows the file to be opened for reading by this process or
    other processes"
  • ReadWrite: "Allows subsequent opening for reading or writing" → "Allows the file to be opened for reading or
    writing by this process or other processes"
  • Write: "Allows subsequent opening for writing" → "Allows the file to be opened for writing by this process or
    other processes"

Fixes #10572

 Removed misleading word "subsequent" from FileShare enum member
  descriptions. The previous wording implied these flags only affect
  future file operations, but they actually control access for both
  the current file open operation and all other attempts to access
  the file.

  Updated all four affected members (Delete, Read, ReadWrite, Write)
  to use clearer language: "Allows the file to be opened..." instead
  of "Allows subsequent opening..."

  Fixes dotnet#10572
@oii-nasif oii-nasif requested a review from a team as a code owner October 3, 2025 23:40
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Oct 3, 2025
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 community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FileShare Enum descriptions are incorrect/misleading

1 participant