Skip to content

Conversation

@rkeithhill
Copy link
Collaborator

Fix #4174

try
{
Stream openfilestream = File.OpenRead(path);
openfilestream = File.OpenRead(path);
Copy link
Member

Choose a reason for hiding this comment

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

How about 'using' instead?

@rkeithhill
Copy link
Collaborator Author

rkeithhill commented Jul 2, 2017

I went with that approach first but with the catch statement it seemed to read better with try/catch/finally than try {using()} / catch. That said, I can certainly remove the finally and put a using statement inside the try. It's about six of one / half dozen the other. :-)

@iSazonov
Copy link
Collaborator

iSazonov commented Jul 3, 2017

LGTM.

@SteveL-MSFT
Copy link
Member

@rkeithhill looking at the entire file, keeping it try...finally is probably more consistent with other try...catch usage in this file, so LGTM

@rkeithhill
Copy link
Collaborator Author

Sure would be nice to get this fix into beta.4. Got some Plaster users on Linux who are hitting this bug.

@lzybkr lzybkr merged commit fa02e84 into PowerShell:master Jul 7, 2017
@rkeithhill rkeithhill deleted the rkeithhill/fix-get-filehash-open-handle branch May 29, 2019 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants