-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Fix assembly load when file path contains URI reserved chars #76617
Conversation
3077fa8
to
68ed6d9
Compare
src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/CustomExportAssemblyLoader.cs
Outdated
Show resolved
Hide resolved
var dllData = compilation.EmitToStream(); | ||
tempFile.WriteAllBytes(dllData.ToArray()); | ||
|
||
// Mark the file as read only to prevent mutations. |
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.
Does this break us cleaning up the temp files 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 didn't see issues, but let me check. I stole this from a compiler test
@dibarbet Just generally curious here:
|
Possibly. However we do want our own IASsemblyLoader here so we can load assemblies into matching ALCs. So they would have to provide us with some consistent way to get the file path. I don't think devkit has an issue here because they don't need the codebase to load it into a directory based ALC (we only need it for our extensions).
I do not know of one. As best as I can tell it is the only way to get the file path, which we need to put it in the directory ALC. |
Oh we absolutely need one. I was thinking that if we can't change the interface, then instead they could make a base class we inherit from, which implements the interface method and adds whatever magic we're putting here into that. That way at least all the codebase shenanigans are in one repo where we don't have to worry about things getting out of sync. |
Resolves microsoft/vscode-dotnettools#1686
When vscode is installed in (or an extension assembly is loaded from) a path that contains a URI reserved character, the server crashes. This is because VS-MEF (for compatibility with clr behavior) sets the code base to a file URI with an unencoded path.
When parsing the URI, some reserved characters cause the path component to be incorrectly split into query or fragment components if unescaped. Then we get an invalid file path from the URI and cannot load the extension dll.