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

Version autocomplete no longer works for .netstandard2.1 (Linux, .NET 6) #91

Closed
karabaja4 opened this issue Nov 22, 2021 · 8 comments
Closed
Assignees

Comments

@karabaja4
Copy link

karabaja4 commented Nov 22, 2021

Hi all. After upgrade to v0.4.1 version autocomplete no longer works when I hit Ctrl+Space in my .netstandard2.1 assemblies.

Here is the example csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
  </PropertyGroup>
  
  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
  </ItemGroup>

</Project>

Here is the output:

Result was "System.Threading.Tasks.Task`1[[OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializeResult, OmniSharp.Extensions.LanguageProtocol, Version=0.7.9.0, Culture=neutral, PublicKeyToken=null]]"
Response value was "OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializeResult"
Finished: Routing Request (0) "initialize" in 37ms
Finding descriptor for "initialized"
Finding descriptor for "workspace/didChangeConfiguration"
Starting: Routing Notification "initialized"
Finished: Routing Notification "initialized" in 6ms
Starting: Routing Notification "workspace/didChangeConfiguration"
Converting params for Notification "workspace/didChangeConfiguration" to "MSBuildProjectTools.LanguageServer.CustomProtocol.DidChangeConfigurationObjectParams"
Finished: Routing Notification "workspace/didChangeConfiguration" in 68ms
Finding descriptor for "textDocument/didOpen"
Created attribute "xml::file:///home/igor/git/bitmex-ws-core/Bot.Business/Bot.Business.csproj"
Looking for handler for method ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]
Checking handler ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]:"MSBuildProjectTools.LanguageServer.Handlers.DocumentSyncHandler"
Registration options "OmniSharp.Extensions.LanguageServer.Protocol.Models.TextDocumentRegistrationOptions"
Document Selector "[msbuild, file, **/*.*], [xml, file, **/*.*proj], [xml, file, **/*.props], [xml, file, **/*.targets]"
Starting: Routing Notification "textDocument/didOpen"
Converting params for Notification "textDocument/didOpen" to "OmniSharp.Extensions.LanguageServer.Protocol.Models.DidOpenTextDocumentParams"
[Info  - 1:41:47 PM] Using MSBuild engine v6.0.100 from "/usr/share/dotnet/sdk/6.0.100/".
Language server initialised by client.
[Info  - 1:41:47 PM] 1 package sources configured for project "/home/igor/git/bitmex-ws-core/Bot.Business/Bot.Business.csproj".
[Info  - 1:41:47 PM]   Locally-configured package source "nuget.org" (v3) => https://api.nuget.org/v3/index.json
Finding descriptor for "textDocument/documentSymbol"
Found attributes 1, ["msbuild::file:///home/igor/git/bitmex-ws-core/Bot.Business/Bot.Business.csproj"]
Looking for handler for method ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]
Checking handler ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]:"MSBuildProjectTools.LanguageServer.Handlers.DocumentSymbolHandler"
Registration options "OmniSharp.Extensions.LanguageServer.Protocol.Models.TextDocumentRegistrationOptions"
Document Selector "[msbuild, file, **/*.*], [xml, file, **/*.*proj], [xml, file, **/*.props], [xml, file, **/*.targets]"
Launching "dotnet --info"...
Launched "dotnet --info". Waiting for process 19054 to terminate...
"dotnet --info" terminated with exit code 0.
"dotnet --info" returned the following text on STDOUT / STDERR.

.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     arch
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  6.0.100 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.20 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

Requesting suggestions from 1 package source(s) for NuGet package Ids matching prefix "Newtonsoft.Json" (include pre-release: False)...
[Info  - 1:41:49 PM] Successfully loaded project "/home/igor/git/bitmex-ws-core/Bot.Business/Bot.Business.csproj".
===========================
 - Project uses package source "nuget.org" ("https://api.nuget.org/v3/index.json")
===========================
MSBuild project loaded (9 MSBuild objects).
MSBuildSdkImport: SdkImport "Microsoft.NET.Sdk" spanning "[1,10..1,33)"
MSBuildProperty: Property "TargetFramework" spanning "[4,5..4,54)"
MSBuildItemGroup: Item "ProjectReference" spanning "[8,5..8,63)"
MSBuildItemGroup: Item "ProjectReference" spanning "[9,5..9,73)"
MSBuildItemGroup: Item "PackageReference" spanning "[13,5..13,80)"
MSBuildItemGroup: Item "PackageReference" spanning "[14,5..14,92)"
MSBuildItemGroup: Item "PackageReference" spanning "[15,5..15,91)"
MSBuildItemGroup: Item "PackageReference" spanning "[16,5..16,77)"
MSBuildItemGroup: Item "PackageReference" spanning "[17,5..17,68)"
Finished: Routing Notification "textDocument/didOpen" in 1456ms
Starting: Routing Request (1) "textDocument/documentSymbol"
Converting params for Request (1) "textDocument/documentSymbol" to "OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentSymbolParams"
Result was "System.Threading.Tasks.Task`1[[OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentSymbolInformationContainer, OmniSharp.Extensions.LanguageProtocol, Version=0.7.9.0, Culture=neutral, PublicKeyToken=null]]"
Response value was "OmniSharp.Extensions.LanguageServer.Protocol.Models.DocumentSymbolInformationContainer"
Finished: Routing Request (1) "textDocument/documentSymbol" in 12ms
Found 1 suggestions from 7 package source(s) for NuGet package Ids matching prefix "Newtonsoft.Json" (include pre-release: False).
Finding descriptor for "textDocument/hover"
Found attributes 1, ["msbuild::file:///home/igor/git/bitmex-ws-core/Bot.Business/Bot.Business.csproj"]
Looking for handler for method ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]
Checking handler ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]:"MSBuildProjectTools.LanguageServer.Handlers.HoverHandler"
Registration options "OmniSharp.Extensions.LanguageServer.Protocol.Models.TextDocumentRegistrationOptions"
Document Selector "[msbuild, file, **/*.*], [xml, file, **/*.*proj], [xml, file, **/*.props], [xml, file, **/*.targets]"
Starting: Routing Request (2) "textDocument/hover"
Converting params for Request (2) "textDocument/hover" to "OmniSharp.Extensions.LanguageServer.Protocol.Models.TextDocumentPositionParams"
Examining location 17,63 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65))...
Result was "System.Threading.Tasks.Task`1[[OmniSharp.Extensions.LanguageServer.Protocol.Models.Hover, OmniSharp.Extensions.LanguageProtocol, Version=0.7.9.0, Culture=neutral, PublicKeyToken=null]]"
Response value was "OmniSharp.Extensions.LanguageServer.Protocol.Models.Hover"
Finished: Routing Request (2) "textDocument/hover" in 12ms
Finding descriptor for "textDocument/hover"
Found attributes 1, ["msbuild::file:///home/igor/git/bitmex-ws-core/Bot.Business/Bot.Business.csproj"]
Looking for handler for method ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]
Checking handler ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]:"MSBuildProjectTools.LanguageServer.Handlers.HoverHandler"
Registration options "OmniSharp.Extensions.LanguageServer.Protocol.Models.TextDocumentRegistrationOptions"
Document Selector "[msbuild, file, **/*.*], [xml, file, **/*.*proj], [xml, file, **/*.props], [xml, file, **/*.targets]"
Starting: Routing Request (3) "textDocument/hover"
Converting params for Request (3) "textDocument/hover" to "OmniSharp.Extensions.LanguageServer.Protocol.Models.TextDocumentPositionParams"
Examining location 17,64 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65))...
Result was "System.Threading.Tasks.Task`1[[OmniSharp.Extensions.LanguageServer.Protocol.Models.Hover, OmniSharp.Extensions.LanguageProtocol, Version=0.7.9.0, Culture=neutral, PublicKeyToken=null]]"
Response value was "OmniSharp.Extensions.LanguageServer.Protocol.Models.Hover"
Finished: Routing Request (3) "textDocument/hover" in 0ms
Finding descriptor for "textDocument/completion"
Found attributes 1, ["msbuild::file:///home/igor/git/bitmex-ws-core/Bot.Business/Bot.Business.csproj"]
Looking for handler for method ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]
Checking handler ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]:"MSBuildProjectTools.LanguageServer.Handlers.CompletionHandler"
Registration options "OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionRegistrationOptions"
Document Selector "[msbuild, file, **/*.*], [xml, file, **/*.*proj], [xml, file, **/*.props], [xml, file, **/*.targets]"
Starting: Routing Request (4) "textDocument/completion"
Converting params for Request (4) "textDocument/completion" to "OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionParams"
Completion requested for 17,58
Completion will target 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65))
Evaluate completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65))
Not offering any completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65)) (cannot insert or replace an element here).
Evaluate completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65)) (trigger characters = null)
Not offering any completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65)) (not a direct child of a 'ItemGroup' element).
Evaluate completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65))
Evaluate completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65))
Evaluate attribute completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65))
Not offering any attribute completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65)) (not a location where we can offer attribute completion.
Evaluate element completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65))
Not offering any element completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65)) (not a location where an item metadata element can be created or replaced by completion).
Evaluate completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65))
Evaluate completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65))
Offering completions for value of attribute "Version" of "PackageReference" element @ 17,58
Requesting suggestions for NuGet package versions matching Id "Newtonsoft.Json" (include pre-release: False)...
Evaluate completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65))
Not offering any completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65)) (not a direct child of a 'PropertyGroup' element).
Evaluate completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65))
Evaluate completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65))
Not offering any completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65)) (not the value of a supported attribute on a 'Target' element).
Not offering task element completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65)) (task completions not enabled in extension settings).
Not offering task attribute completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65)) (task completions not enabled in extension settings).
Evaluate completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65)) (trigger characters = null)
Not offering any completions for 17,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([17,49..17,65)) (not a direct child of the 'Project' element).
[Error - 1:42:19 PM] Failed to provide completions.
System.ArgumentNullException: Value cannot be null. (Parameter 'cacheContext')
   at HttpSourceCacheContext NuGet.Protocol.Core.Types.HttpSourceCacheContext.Create(SourceCacheContext cacheContext, bool isFirstAttempt)
   at async Task<IEnumerable<JObject>> NuGet.Protocol.RegistrationUtility.LoadRanges(HttpSource httpSource, Uri registrationUri, string packageId, VersionRange range, SourceCacheContext cacheContext, ILogger log, CancellationToken token)
   at async Task<IEnumerable<JObject>> NuGet.Protocol.RegistrationResourceV3.GetPackageMetadata(string packageId, VersionRange range, bool includePrerelease, bool includeUnlisted, SourceCacheContext cacheContext, ILogger log, CancellationToken token)
   at async Task<IEnumerable<JObject>> NuGet.Protocol.RegistrationResourceV3.GetPackageMetadata(string packageId, bool includePrerelease, bool includeUnlisted, SourceCacheContext cacheContext, ILogger log, CancellationToken token)
   at async Task<IEnumerable<NuGetVersion>> NuGet.Protocol.AutoCompleteResourceV3.VersionStartsWith(string packageId, string versionPrefix, bool includePrerelease, SourceCacheContext sourceCacheContext, ILogger log, CancellationToken token)
   at async Task<SortedSet<NuGetVersion>> MSBuildProjectTools.LanguageServer.Utilities.NuGetHelper.SuggestPackageVersions(IEnumerable<AutoCompleteResource> autoCompleteResources, string packageId, bool includePrerelease, string versionPrefix, ILogger logger, CancellationToken cancellationToken) in /home/igor/git/bitmex-ws-core/D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Common\Utilities\NuGetHelper.cs:line 252
   at async Task<SortedSet<NuGetVersion>> MSBuildProjectTools.LanguageServer.Documents.ProjectDocument.SuggestPackageVersions(string packageId, bool includePrerelease, CancellationToken cancellationToken) in /home/igor/git/bitmex-ws-core/D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Documents\ProjectDocument.cs:line 603
   at async Task<List<CompletionItem>> MSBuildProjectTools.LanguageServer.CompletionProviders.PackageReferenceCompletion.HandlePackageReferenceAttributeCompletion(ProjectDocument projectDocument, XSAttribute attribute, CancellationToken cancellationToken) in /home/igor/git/bitmex-ws-core/D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\CompletionProviders\PackageReferenceCompletion.cs:line 194
   at async Task<CompletionList> MSBuildProjectTools.LanguageServer.CompletionProviders.PackageReferenceCompletion.ProvideCompletions(XmlLocation location, ProjectDocument projectDocument, string triggerCharacters, CancellationToken cancellationToken) in /home/igor/git/bitmex-ws-core/D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\CompletionProviders\PackageReferenceCompletion.cs:line 95
   at async Task<CompletionList> MSBuildProjectTools.LanguageServer.Handlers.CompletionHandler.OnCompletion(CompletionParams parameters, CancellationToken cancellationToken) in /home/igor/git/bitmex-ws-core/D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Handlers\CompletionHandler.cs:line 202
Result was "System.Threading.Tasks.Task`1[[OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionList, OmniSharp.Extensions.LanguageProtocol, Version=0.7.9.0, Culture=neutral, PublicKeyToken=null]]"
Response value was null
Finished: Routing Request (4) "textDocument/completion" in 115ms
@tintoy
Copy link
Owner

tintoy commented Nov 22, 2021

Does it work for you with any other projects or is it broken globally? It looks like a NuGet cache problem; I’ll see how far away from the latest version of the NuGet client libraries we are…

@tintoy tintoy self-assigned this Nov 22, 2021
@tintoy
Copy link
Owner

tintoy commented Nov 22, 2021

I've created a build of the language service that uses the very latest NuGet client libraries; can you try installing it from the package below (you'll need to unzip it first), and see if it works for you?

msbuild-project-tools-0.4.3-dev.zip

@karabaja4
Copy link
Author

karabaja4 commented Nov 22, 2021

Doesn't seem to work with the provided vsix either. I tried a clean dotnet new console:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
  </ItemGroup>

</Project>

with the same result:

Result was "System.Threading.Tasks.Task`1[[OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializeResult, OmniSharp.Extensions.LanguageProtocol, Version=0.7.9.0, Culture=neutral, PublicKeyToken=null]]"
Response value was "OmniSharp.Extensions.LanguageServer.Protocol.Models.InitializeResult"
Finished: Routing Request (0) "initialize" in 106ms
Finding descriptor for "initialized"
Finding descriptor for "workspace/didChangeConfiguration"
Starting: Routing Notification "initialized"
Finished: Routing Notification "initialized" in 4ms
Starting: Routing Notification "workspace/didChangeConfiguration"
Converting params for Notification "workspace/didChangeConfiguration" to "MSBuildProjectTools.LanguageServer.CustomProtocol.DidChangeConfigurationObjectParams"
Finished: Routing Notification "workspace/didChangeConfiguration" in 51ms
Finding descriptor for "textDocument/didOpen"
Created attribute "xml::file:///home/igor/test/test.csproj"
Looking for handler for method ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]
Checking handler ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]:"MSBuildProjectTools.LanguageServer.Handlers.DocumentSyncHandler"
Registration options "OmniSharp.Extensions.LanguageServer.Protocol.Models.TextDocumentRegistrationOptions"
Document Selector "[msbuild, file, **/*.*], [xml, file, **/*.*proj], [xml, file, **/*.props], [xml, file, **/*.targets]"
Starting: Routing Notification "textDocument/didOpen"
Converting params for Notification "textDocument/didOpen" to "OmniSharp.Extensions.LanguageServer.Protocol.Models.DidOpenTextDocumentParams"
[Info  - 12:16:10 AM] Using MSBuild engine v6.0.100 from "/usr/share/dotnet/sdk/6.0.100/".
Language server initialised by client.
[Info  - 12:16:10 AM] 1 package sources configured for project "/home/igor/test/test.csproj".
[Info  - 12:16:10 AM]   Locally-configured package source "nuget.org" (v3) => https://api.nuget.org/v3/index.json
Launching "dotnet --info"...
Launched "dotnet --info". Waiting for process 22318 to terminate...
"dotnet --info" terminated with exit code 0.
"dotnet --info" returned the following text on STDOUT / STDERR.

.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     arch
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  6.0.100 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.20 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download



Finding descriptor for "textDocument/hover"
Found attributes 1, ["msbuild::file:///home/igor/test/test.csproj"]
Looking for handler for method ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]
Checking handler ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]:"MSBuildProjectTools.LanguageServer.Handlers.HoverHandler"
Registration options "OmniSharp.Extensions.LanguageServer.Protocol.Models.TextDocumentRegistrationOptions"
Document Selector "[msbuild, file, **/*.*], [xml, file, **/*.*proj], [xml, file, **/*.props], [xml, file, **/*.targets]"
Finding descriptor for "$/cancelRequest"
Requesting suggestions from 1 package source(s) for NuGet package Ids matching prefix "Newtonsoft.Json" (include pre-release: False)...
[Info  - 12:16:12 AM] Successfully loaded project "/home/igor/test/test.csproj".
===========================
 - Project uses package source "nuget.org" ("https://api.nuget.org/v3/index.json")
===========================
MSBuild project loaded (6 MSBuild objects).
MSBuildSdkImport: SdkImport "Microsoft.NET.Sdk" spanning "[1,10..1,33)"
MSBuildProperty: Property "OutputType" spanning "[4,5..4,33)"
MSBuildProperty: Property "TargetFramework" spanning "[5,5..5,46)"
MSBuildProperty: Property "ImplicitUsings" spanning "[6,5..6,44)"
MSBuildProperty: Property "Nullable" spanning "[7,5..7,32)"
MSBuildItemGroup: Item "PackageReference" spanning "[11,5..11,68)"
Finished: Routing Notification "textDocument/didOpen" in 1669ms
Starting: Routing Request (1) "textDocument/hover"
Converting params for Request (1) "textDocument/hover" to "OmniSharp.Extensions.LanguageServer.Protocol.Models.TextDocumentPositionParams"
Examining location 11,63 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))...
Result was "System.Threading.Tasks.Task`1[[OmniSharp.Extensions.LanguageServer.Protocol.Models.Hover, OmniSharp.Extensions.LanguageProtocol, Version=0.7.9.0, Culture=neutral, PublicKeyToken=null]]"
Response value was "OmniSharp.Extensions.LanguageServer.Protocol.Models.Hover"
Finished: Routing Request (1) "textDocument/hover" in 19ms
Starting: Routing Notification "$/cancelRequest"
Converting params for Notification "$/cancelRequest" to "OmniSharp.Extensions.LanguageServer.Protocol.Models.CancelParams"
Request 1 was not found to cancel
Finished: Routing Notification "$/cancelRequest" in 0ms
Finding descriptor for "textDocument/completion"
Found attributes 1, ["msbuild::file:///home/igor/test/test.csproj"]
Looking for handler for method ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]
Checking handler ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]:"MSBuildProjectTools.LanguageServer.Handlers.CompletionHandler"
Registration options "OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionRegistrationOptions"
Document Selector "[msbuild, file, **/*.*], [xml, file, **/*.*proj], [xml, file, **/*.props], [xml, file, **/*.targets]"
Starting: Routing Request (2) "textDocument/completion"
Converting params for Request (2) "textDocument/completion" to "OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionParams"
Completion requested for 11,58
Completion will target 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Not offering any completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (cannot insert or replace an element here).
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (trigger characters = null)
Not offering any completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (not a direct child of a 'ItemGroup' element).
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Evaluate attribute completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Not offering any attribute completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (not a location where we can offer attribute completion.
Evaluate element completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Not offering any element completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (not a location where an item metadata element can be created or replaced by completion).
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Offering completions for value of attribute "Version" of "PackageReference" element @ 11,58
Requesting suggestions for NuGet package versions matching Id "Newtonsoft.Json" (include pre-release: False)...
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Not offering any completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (not a direct child of a 'PropertyGroup' element).
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Not offering any completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (not the value of a supported attribute on a 'Target' element).
Not offering task element completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (task completions not enabled in extension settings).
Not offering task attribute completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (task completions not enabled in extension settings).
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (trigger characters = null)
Not offering any completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (not a direct child of the 'Project' element).
[Error - 12:16:12 AM] Failed to provide completions.
System.ArgumentNullException: Value cannot be null. (Parameter 'cacheContext')
   at HttpSourceCacheContext NuGet.Protocol.Core.Types.HttpSourceCacheContext.Create(SourceCacheContext cacheContext, bool isFirstAttempt)
   at async Task<IEnumerable<JObject>> NuGet.Protocol.RegistrationUtility.LoadRanges(HttpSource httpSource, Uri registrationUri, string packageId, VersionRange range, SourceCacheContext cacheContext, ILogger log, CancellationToken token)
   at async Task<IEnumerable<JObject>> NuGet.Protocol.RegistrationResourceV3.GetPackageMetadata(string packageId, VersionRange range, bool includePrerelease, bool includeUnlisted, SourceCacheContext cacheContext, ILogger log, CancellationToken token)
   at async Task<IEnumerable<JObject>> NuGet.Protocol.RegistrationResourceV3.GetPackageMetadata(string packageId, bool includePrerelease, bool includeUnlisted, SourceCacheContext cacheContext, ILogger log, CancellationToken token)
   at async Task<IEnumerable<NuGetVersion>> NuGet.Protocol.AutoCompleteResourceV3.VersionStartsWith(string packageId, string versionPrefix, bool includePrerelease, SourceCacheContext sourceCacheContext, ILogger log, CancellationToken token)
   at async Task<SortedSet<NuGetVersion>> MSBuildProjectTools.LanguageServer.Utilities.NuGetHelper.SuggestPackageVersions(IEnumerable<AutoCompleteResource> autoCompleteResources, string packageId, bool includePrerelease, string versionPrefix, ILogger logger, CancellationToken cancellationToken) in /home/igor/test/D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Common\Utilities\NuGetHelper.cs:line 252
   at async Task<SortedSet<NuGetVersion>> MSBuildProjectTools.LanguageServer.Documents.ProjectDocument.SuggestPackageVersions(string packageId, bool includePrerelease, CancellationToken cancellationToken) in /home/igor/test/D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Documents\ProjectDocument.cs:line 603
   at async Task<List<CompletionItem>> MSBuildProjectTools.LanguageServer.CompletionProviders.PackageReferenceCompletion.HandlePackageReferenceAttributeCompletion(ProjectDocument projectDocument, XSAttribute attribute, CancellationToken cancellationToken) in /home/igor/test/D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\CompletionProviders\PackageReferenceCompletion.cs:line 194
   at async Task<CompletionList> MSBuildProjectTools.LanguageServer.CompletionProviders.PackageReferenceCompletion.ProvideCompletions(XmlLocation location, ProjectDocument projectDocument, string triggerCharacters, CancellationToken cancellationToken) in /home/igor/test/D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\CompletionProviders\PackageReferenceCompletion.cs:line 95
   at async Task<CompletionList> MSBuildProjectTools.LanguageServer.Handlers.CompletionHandler.OnCompletion(CompletionParams parameters, CancellationToken cancellationToken) in /home/igor/test/D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Handlers\CompletionHandler.cs:line 202
Result was "System.Threading.Tasks.Task`1[[OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionList, OmniSharp.Extensions.LanguageProtocol, Version=0.7.9.0, Culture=neutral, PublicKeyToken=null]]"
Response value was null
Finished: Routing Request (2) "textDocument/completion" in 257ms
Found 1 suggestions from 7 package source(s) for NuGet package Ids matching prefix "Newtonsoft.Json" (include pre-release: False).
Finding descriptor for "textDocument/hover"
Found attributes 1, ["msbuild::file:///home/igor/test/test.csproj"]
Looking for handler for method ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]
Checking handler ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]:"MSBuildProjectTools.LanguageServer.Handlers.HoverHandler"
Registration options "OmniSharp.Extensions.LanguageServer.Protocol.Models.TextDocumentRegistrationOptions"
Document Selector "[msbuild, file, **/*.*], [xml, file, **/*.*proj], [xml, file, **/*.props], [xml, file, **/*.targets]"
Starting: Routing Request (3) "textDocument/hover"
Converting params for Request (3) "textDocument/hover" to "OmniSharp.Extensions.LanguageServer.Protocol.Models.TextDocumentPositionParams"
Examining location 11,63 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))...
Result was "System.Threading.Tasks.Task`1[[OmniSharp.Extensions.LanguageServer.Protocol.Models.Hover, OmniSharp.Extensions.LanguageProtocol, Version=0.7.9.0, Culture=neutral, PublicKeyToken=null]]"
Response value was "OmniSharp.Extensions.LanguageServer.Protocol.Models.Hover"
Finished: Routing Request (3) "textDocument/hover" in 0ms
Finding descriptor for "textDocument/completion"
Found attributes 1, ["msbuild::file:///home/igor/test/test.csproj"]
Looking for handler for method ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]
Checking handler ["OmniSharp.Extensions.LanguageServer.Server.HandlerDescriptor"]:"MSBuildProjectTools.LanguageServer.Handlers.CompletionHandler"
Registration options "OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionRegistrationOptions"
Document Selector "[msbuild, file, **/*.*], [xml, file, **/*.*proj], [xml, file, **/*.props], [xml, file, **/*.targets]"
Starting: Routing Request (4) "textDocument/completion"
Converting params for Request (4) "textDocument/completion" to "OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionParams"
Completion requested for 11,58
Completion will target 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Not offering any completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (cannot insert or replace an element here).
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (trigger characters = null)
Not offering any completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (not a direct child of a 'ItemGroup' element).
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Evaluate attribute completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Not offering any attribute completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (not a location where we can offer attribute completion.
Evaluate element completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Not offering any element completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (not a location where an item metadata element can be created or replaced by completion).
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Offering completions for value of attribute "Version" of "PackageReference" element @ 11,58
Requesting suggestions for NuGet package versions matching Id "Newtonsoft.Json" (include pre-release: False)...
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Not offering any completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (not a direct child of a 'PropertyGroup' element).
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65))
Not offering any completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (not the value of a supported attribute on a 'Target' element).
Not offering task element completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (task completions not enabled in extension settings).
Not offering task attribute completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (task completions not enabled in extension settings).
Evaluate completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (trigger characters = null)
Not offering any completions for 11,58 -> [Attribute, Value]:/Project/ItemGroup/PackageReference/Version ([11,49..11,65)) (not a direct child of the 'Project' element).
[Error - 12:16:24 AM] Failed to provide completions.
System.ArgumentNullException: Value cannot be null. (Parameter 'cacheContext')
   at HttpSourceCacheContext NuGet.Protocol.Core.Types.HttpSourceCacheContext.Create(SourceCacheContext cacheContext, bool isFirstAttempt)
   at async Task<IEnumerable<JObject>> NuGet.Protocol.RegistrationUtility.LoadRanges(HttpSource httpSource, Uri registrationUri, string packageId, VersionRange range, SourceCacheContext cacheContext, ILogger log, CancellationToken token)
   at async Task<IEnumerable<JObject>> NuGet.Protocol.RegistrationResourceV3.GetPackageMetadata(string packageId, VersionRange range, bool includePrerelease, bool includeUnlisted, SourceCacheContext cacheContext, ILogger log, CancellationToken token)
   at async Task<IEnumerable<JObject>> NuGet.Protocol.RegistrationResourceV3.GetPackageMetadata(string packageId, bool includePrerelease, bool includeUnlisted, SourceCacheContext cacheContext, ILogger log, CancellationToken token)
   at async Task<IEnumerable<NuGetVersion>> NuGet.Protocol.AutoCompleteResourceV3.VersionStartsWith(string packageId, string versionPrefix, bool includePrerelease, SourceCacheContext sourceCacheContext, ILogger log, CancellationToken token)
   at async Task<SortedSet<NuGetVersion>> MSBuildProjectTools.LanguageServer.Utilities.NuGetHelper.SuggestPackageVersions(IEnumerable<AutoCompleteResource> autoCompleteResources, string packageId, bool includePrerelease, string versionPrefix, ILogger logger, CancellationToken cancellationToken) in /home/igor/test/D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Common\Utilities\NuGetHelper.cs:line 252
   at async Task<SortedSet<NuGetVersion>> MSBuildProjectTools.LanguageServer.Documents.ProjectDocument.SuggestPackageVersions(string packageId, bool includePrerelease, CancellationToken cancellationToken) in /home/igor/test/D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Documents\ProjectDocument.cs:line 603
   at async Task<List<CompletionItem>> MSBuildProjectTools.LanguageServer.CompletionProviders.PackageReferenceCompletion.HandlePackageReferenceAttributeCompletion(ProjectDocument projectDocument, XSAttribute attribute, CancellationToken cancellationToken) in /home/igor/test/D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\CompletionProviders\PackageReferenceCompletion.cs:line 194
   at async Task<CompletionList> MSBuildProjectTools.LanguageServer.CompletionProviders.PackageReferenceCompletion.ProvideCompletions(XmlLocation location, ProjectDocument projectDocument, string triggerCharacters, CancellationToken cancellationToken) in /home/igor/test/D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\CompletionProviders\PackageReferenceCompletion.cs:line 95
   at async Task<CompletionList> MSBuildProjectTools.LanguageServer.Handlers.CompletionHandler.OnCompletion(CompletionParams parameters, CancellationToken cancellationToken) in /home/igor/test/D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Handlers\CompletionHandler.cs:line 202
Result was "System.Threading.Tasks.Task`1[[OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionList, OmniSharp.Extensions.LanguageProtocol, Version=0.7.9.0, Culture=neutral, PublicKeyToken=null]]"
Response value was null
Finished: Routing Request (4) "textDocument/completion" in 6ms

so it seems like a global problem.

BTW, Include="" autocomplete works, but Version="" does not.

@tintoy
Copy link
Owner

tintoy commented Nov 23, 2021

Interesting - so it can make some API calls (get packages) but not others (get package versions). This seems to be an issue in the NuGet client library (behaviour has changed regarding an optional parameter).

Can you try this build and see if it works for you?

msbuild-project-tools-0.4.3-dev.zip

(yes, the version number hasn't changed 🙂)

tintoy added a commit to tintoy/msbuild-project-tools-server that referenced this issue Nov 23, 2021
tintoy added a commit to tintoy/msbuild-project-tools-server that referenced this issue Nov 23, 2021
@karabaja4
Copy link
Author

It works with that latest vsix build. Thank you for a quick fix!

@tintoy
Copy link
Owner

tintoy commented Nov 23, 2021

Great! Will get a proper package published sometime tonight :)

@tverboon
Copy link

Can confirm this build fixes the cache nullref also..

tintoy added a commit that referenced this issue Dec 1, 2021
tintoy added a commit that referenced this issue Dec 1, 2021
@tintoy
Copy link
Owner

tintoy commented Dec 10, 2021

Published v0.4.3. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants