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

Use SetFileInformationByHandle on FileStream.SetLength #44170

Merged
merged 4 commits into from
Nov 4, 2020

Conversation

jozkee
Copy link
Member

@jozkee jozkee commented Nov 2, 2020

As suggested in #43863 (comment), this should prevent Position from being set at the moment of calling SetLength on Windows.

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

Copy link
Member

@carlossanlop carlossanlop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I still think we could add at a manual test, as I suggested in the previous PR.

@jozkee
Copy link
Member Author

jozkee commented Nov 3, 2020

@carlossanlop done.

@@ -75,5 +75,65 @@ public static void Throw_FileStreamDispose_WhenRemoteMountRunsOutOfSpace()
destinationStream.Dispose();
});
}


const long InitialFileSize = 1024;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure whether it is worth adding this tests with the new implementation. The failure path that was there before does not exist anymore.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't the test prevent that we don't go back to the previous implementation? However, since it needs to be run manually, I don't think it would catch a potential functional regression before it gets merged.

cc @carlossanlop

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is very unlikely we would ever go back to the previous implementation.

And if we ever change the implementation again, we should think about test coverage for any interesting failure modes that the change would introduce.

since it needs to be run manually

Right, it makes the test very low value.

@jozkee jozkee merged commit c4feddb into dotnet:master Nov 4, 2020
@jozkee jozkee deleted the fs_setlength branch November 4, 2020 22:27
@ghost ghost locked as resolved and limited conversation to collaborators Dec 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants