-
Notifications
You must be signed in to change notification settings - Fork 234
Fix FileNotFoundEx crash when Fold happens on untitled: scheme doc #839
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
Merged
TylerLeonhardt
merged 2 commits into
master
from
rkeithhill/fix-vscode-1676-fold-untitled
Jan 8, 2019
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recently added a TryGetFile function that would do the soft check:
PowerShellEditorServices/src/PowerShellEditorServices/Workspace/Workspace.cs
Line 142 in 99f01ef
maybe that's better to use here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could (perhaps should) change the call site but there are 23 references to
GetFile()
so maybe we should still try to makeGetFile()
a little more robust? Either that OR wenukemakeGetFile()
private and replace all 23 references with calls toTryGetFile()
. Longer term, that may be the better strategy because it makes it clearer you may not get a file back.GetFile()
behaves similarly except that it returns anull
when there is no file to return - which is way less obvious and easier to ignore thenull
case - kind of like ignoring error return codes in C code. :-)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I don't think
GetFile()
handle's File exceptions:PowerShellEditorServices/src/PowerShellEditorServices/Workspace/Workspace.cs
Lines 118 to 119 in 99f01ef
If
FileStream
orStreamReader
throws an exception, that will bubble up I'm pretty sure, no?Where as
TryGetFile
actually does catch them.I think we should eventually move to using
TryGetFile
everywhere it makes sense... but we can call that out of scope for this PR if you'd like.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make the change to use
TryGetFile()
later tonight. Getting ready to head out to see Aquaman right now. :-)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have a great time! I want to hear the full @rkeithhill review 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, updated to use
TryGetFile()
instead - reverted change toGetFile()
. Although I did an "important" note onGetFile()
that shows up in Intellisense that recommendsTryGetFile()
instead. Also, fix an incorrect (copy/paste) log message.P.S. Aquaman was pretty good. Not as good as Wonder Woman IMO but way better than Dawn of Pustice. Then again, I've been a Jason Momoa fan since Stargate Atlantis. :-)