-
Notifications
You must be signed in to change notification settings - Fork 115
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
Extensions written in C# fail when opening files from remote repo and a non-default branch #375
Comments
Can you please provide guidance? We need to be able to parse the URIs for documents. Thanks. |
Thanks for investigating. These are valid VS Code URIs based on our current validation logic which aims to match http://tools.ietf.org/html/rfc3986. The |
Understood, but that still leaves us and who knows how many other language servers vulnerable if we can't parse your URIs? Do you want us to disable our extension being loaded when it's not loaded locally? It looks like that might be what C# did, but feels like it kind of defeats the purpose of your extension? |
While your extension is unable to handle these URIs with the .NET runtime's curent URI parsing implementation, it might be preferable to temporarily declare that your extension can't support virtual workspaces. You can do this in the package.json manifest with |
We have disabled virtual workspaces. |
I've now seen this in two of our extensions:
Azure/bicep#11467
microsoft/vscode-azurearmtools#1647
Hard to believe no one else has seen this.
To repro:
Follow steps here: Azure/bicep#11467 (comment)
My investigation results are here: Azure/bicep#11467 (comment)
The problem is that for non-default branches, the URI we get for the document looks like this:
This appears to technically be a valid URI, but OmniSharp (language server framework) and C#'s own System.Uri do not seem to handle it.
Example: System.Uri failing (whether the "+" is encoded or not):
new System.Uri("vscode-vfs://github+7b2276223a312c22726566223a7b2274797065223a342c226964223a225374657068656e57656174686572666f72642d70617463682d31227d7d/StephenWeatherford/template-examples/bicep/templatespec/client.bicep", System.UriKind.Absolute)
'new System.Uri("vscode-vfs://github+7b2276223a312c22726566223a7b2274797065223a342c226964223a225374657068656e57656174686572666f72642d70617463682d31227d7d/StephenWeatherford/template-examples/bicep/templatespec/client.bicep", System.UriKind.Absolute)' threw an exception of type 'System.UriFormatException'
System.Uri.IsWellFormedUriString() returns false.
By contrast, on the default branch the URI has this format:
github://github/StephenWeatherford/template-examples/bicep/main.bicep
The text was updated successfully, but these errors were encountered: