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

AvaloniaLSP looks for assemblies in obj/Debug, but it should be looking in obj/Debug/$(TFM)/ #84

Open
BinToss opened this issue Dec 27, 2023 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@BinToss
Copy link
Contributor

BinToss commented Dec 27, 2023

Describe the bug

intermediateOutputPath = exeProj?.IntermediateOutputPath ?? "";
return _metadataReader.GetForTargetAssembly(new AvaloniaCompilationAssemblyProvider(intermediateOutputPath));
}

https://github.com/AvaloniaUI/AvaloniaVS/blob/4190a20de1cfa27324d82c1258ad6d03540ec98f/CompletionEngine/Avalonia.Ide.CompletionEngine/AssemblyMetadata/AvaloniaCompilationAssemblyProvider.cs#L11-L33

For a multi-targeting project, dotnet publish requires the --framework $TFM argument. However, dotnet build will build the project for each target framework specified via the TargetFrameworks project property.
Regardless, single-target projects will output intermediate files to per-framework sub-folders.

To Reproduce

Start debugging the extension, create a new Avalonia App in the extension development host, open an axaml file, check logs.

If this doesn't reproduce the issue, I will have time to rectify it on Saturday.

Avalonia for VS Code

v0.0.25

Avalonia version

v11.0.4

VS Code version

v1.85.1

Relevant log output

2023-12-27 06:57:25.297 [info] [Error - 6:57:25 AM] OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker: Failed to handle request textDocument/didOpen - System.Exception: Failed to initialize workspace: file:///c:/Repos/BinToss/GroupBox.Avalonia/GroupBox.Avalonia.Sample/App.axaml
 ---> System.Exception: Failed to build completion metadata: c:\Repos\BinToss\GroupBox.Avalonia\GroupBox.Avalonia.Sample\obj\Debug\Avalonia\references
 ---> System.InvalidOperationException: Sequence contains no elements
   at System.Linq.ThrowHelper.ThrowNoElementsException()
   at System.Linq.Enumerable.First[TSource](IEnumerable\`1 source)
   at Avalonia.Ide.CompletionEngine.MetadataConverter.ConvertMetadata(IMetadataReaderSession provider) in C:\Repos\AvaloniaVSCode\src\AvaloniaVS\CompletionEngine\Avalonia.Ide.CompletionEngine\AssemblyMetadata\MetadataConverter.cs:line 109
   at Avalonia.Ide.CompletionEngine.AssemblyMetadata.MetadataReader.GetForTargetAssembly(IAssemblyProvider assemblyProvider) in C:\Repos\AvaloniaVSCode\src\AvaloniaVS\CompletionEngine\Avalonia.Ide.CompletionEngine\AssemblyMetadata\MetadataReader.cs:line 15
   at AvaloniaLanguageServer.Models.Workspace.BuildCompletionMetadata(DocumentUri uri) in C:\Repos\AvaloniaVSCode\src\AvaloniaLSP\AvaloniaLanguageServer\Models\Workspace.cs:line 51
   --- End of inner exception stack trace ---
   at AvaloniaLanguageServer.Models.Workspace.BuildCompletionMetadata(DocumentUri uri) in C:\Repos\AvaloniaVSCode\src\AvaloniaLSP\AvaloniaLanguageServer\Models\Workspace.cs:line 55
   at AvaloniaLanguageServer.Models.Workspace.InitializeAsync(DocumentUri uri) in C:\Repos\AvaloniaVSCode\src\AvaloniaLSP\AvaloniaLanguageServer\Models\Workspace.cs:line 22
   --- End of inner exception stack trace ---
   at AvaloniaLanguageServer.Models.Workspace.InitializeAsync(DocumentUri uri) in C:\Repos\AvaloniaVSCode\src\AvaloniaLSP\AvaloniaLanguageServer\Models\Workspace.cs:line 26
   at AvaloniaLanguageServer.Handlers.TextDocumentSyncHandler.Handle(DidOpenTextDocumentParams request, CancellationToken cancellationToken) in C:\Repos\AvaloniaVSCode\src\AvaloniaLSP\AvaloniaLanguageServer\Handlers\TextDocumentSyncHandler.cs:line 27
   at OmniSharp.Extensions.LanguageServer.Server.Pipelines.SemanticTokensDeltaPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.<RouteNotification>g__InnerRoute|6_0(IServiceScopeFactory serviceScopeFactory, TDescriptor descriptor, Object params, CancellationToken token)
   at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.RouteNotification(IRequestDescriptor`1 descriptors, Notification notification, CancellationToken token)
   at OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker.<>c__DisplayClass11_0.<<RouteNotification>b__3>d.MoveNext() | Method='textDocument/didOpen'

Additional context

I found this while debugging createPreviewerAssets.ts and its dependency files.

@BinToss BinToss added the bug Something isn't working label Dec 27, 2023
@prashantvc prashantvc added the good first issue Good for newcomers label Jan 4, 2024
@BinToss
Copy link
Contributor Author

BinToss commented Feb 7, 2024

This may be related to #99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants