Skip to content

Make Logger.WriteLine thread-safe and fix bug with UNC paths #4276

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
merged 2 commits into from
Nov 21, 2022

Conversation

andyleejordan
Copy link
Member

This adds a simple lock to Logger.WriteLine since it's not re-entrant, hence we were losing logs. Now concurrent calls to it wait for each other to finish. It also should fix #4202, as the bug appears to be with the scheme used in globalStorageUri being vscode-userdata instead of file, and vscode.Uri.fsPath claiming it does not care about the scheme, but in fact essentially requires it to be file.

When we moved to using `globalStorageUri` and passing `vscode.Uri`s
around, we did not test UNC shares. It turns out that while
`vscode.Uri.fsPath`'s documentation says that it "does not look at
scheme," it actually does look at the scheme and essentially requires it
to be `file`. The scheme of the `globalStorageUri` however is
`vscode-userdata`, so the `fsPath` fails to then handle the UNC share
path. We are now replacing the scheme with `file` to get around this bug.
@andyleejordan andyleejordan requested a review from a team November 21, 2022 21:30
@ghost ghost added the Issue-Bug A bug to squash. label Nov 21, 2022
Copy link
Collaborator

@SeeminglyScience SeeminglyScience left a comment

Choose a reason for hiding this comment

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

LGTM! Well done getting this figured out ❤️

@andyleejordan andyleejordan merged commit d630e29 into main Nov 21, 2022
@andyleejordan andyleejordan deleted the andschwa/lock-logger branch November 21, 2022 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VSCode Extension v2022.8.5 initializes wrong user profile path
2 participants