Skip to content
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

AvaloniaLanguageServer passing string to GetForTargetAssembly where IAssemblyProvider is expected #109

Open
BinToss opened this issue Feb 13, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@BinToss
Copy link
Contributor

BinToss commented Feb 13, 2024

Describe the bug

I'm in the middle of writing a patch for this.
By the way, only repo admins can assign issues to users.
cannotAssign


AvaloniaLanguageServer does not compile.
It's passing a string to a method that expects an IAssemblyProvider. It used to have mostly-correct behavior.
return _metadataReader.GetForTargetAssembly(new AvaloniaCompilationAssemblyProvider(intermediateOutputPath));

But it was missing something. It was passing the raw intermediateOutputPath.
AvaloniaDesigner.xaml.cs contains a private function showing how the path is supposed to be transformed:
https://github.com/AvaloniaUI/AvaloniaVS/blob/9568ba154fd6a808d78548fef8f0bbb9e4238f5a/AvaloniaVS.Shared/Views/AvaloniaDesigner.xaml.cs#L522-L540

This is one of the many pitfalls of Avalonia.Ide.CompletionEngine's poorly documented API. Here are some others:
Where the constructor of AvaloniaCompilationAssemblyProvider takes a string parameter named path, it's actually expecting the path to a text file containing a newline-separate array of directory paths.
https://github.com/AvaloniaUI/AvaloniaVS/blob/9568ba154fd6a808d78548fef8f0bbb9e4238f5a/CompletionEngine/Avalonia.Ide.CompletionEngine/AssemblyMetadata/AvaloniaCompilationAssemblyProvider.cs#L22
https://github.com/AvaloniaUI/AvaloniaVS/blob/9568ba154fd6a808d78548fef8f0bbb9e4238f5a/CompletionEngine/Avalonia.Ide.CompletionEngine.DnlibMetadataProvider/DnlibMetadataProvider.cs#L13-L25

To Reproduce

dotnet build ./src/AvaloniaLSP/AvaloniaLanguageServer/AvaloniaLanguageServer.csproj

Avalonia for VS Code

since 0f777aa

Avalonia version

No response

VS Code version

No response

Relevant log output

__ __

Additional context

No response

@BinToss BinToss added the bug Something isn't working label Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant