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

CSPROJ package autocomplete not working #44

Closed
SimantoR opened this issue Nov 14, 2018 · 19 comments
Closed

CSPROJ package autocomplete not working #44

SimantoR opened this issue Nov 14, 2018 · 19 comments

Comments

@SimantoR
Copy link

image

Autocomplete for packages not working

@tintoy
Copy link
Owner

tintoy commented Nov 14, 2018

Hmm, sorry about that; it seems the newest SDKs for .NET Core have changed a bit in ways the extension wasn't expecting and this is causing problems for some people (I thought I'd fixed this problem but perhaps not for everyone).

If you look in the output window under "MSBuild Project Tools", do you see any output there?

@SimantoR
Copy link
Author

SimantoR commented Nov 14, 2018

Where exactly should I be looking for "MSBuild Project Tools"?

And could it be because I have two MSBuild in my path?

@tintoy
Copy link
Owner

tintoy commented Nov 14, 2018

image

could it be because I have two MSBuild in my path?

I wouldn't think so, the extension doesn't use msbuild.exe, it uses the MSBuild engine as a library (bundled with the extension's language server) and then calls dotnet --info to determine where the .NET Core SDK base directory (containing common .props and .targets files) is located.

@tintoy
Copy link
Owner

tintoy commented Nov 14, 2018

@SimantoR
Copy link
Author

Starting MSBuild language service... MSBuild language service is running. [Info - 8:17:07 PM] Successfully loaded project "c:\Users\SimantoR\Documents\Projects\WorldFactory\VulkanCore.Framework\VulkanCore.Framework.csproj". [Info - 8:17:37 PM] Successfully loaded project "c:\Users\SimantoR\Documents\Projects\WorldFactory\WorldFactory\WorldFactory.csproj" as a sub-project of "VulkanCore.Framework.csproj". [Error - 8:17:47 PM] Failed to provide completions. System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found). at HttpResponseMessage System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode() at void NuGet.Protocol.HttpSource+<>c__DisplayClass13_0<T>+<<ProcessStreamAsync>b__0>d.MoveNext() at async Task<T> NuGet.Protocol.HttpSource.ProcessResponseAsync<T>(HttpSourceRequest request, Func<HttpResponseMessage, Task<T>> processAsync, ILogger log, CancellationToken token) at async Task<T> NuGet.Protocol.HttpSource.ProcessStreamAsync<T>(HttpSourceRequest request, Func<Stream, Task<T>> processAsync, ILogger log, CancellationToken token) at async Task<IEnumerable<string>> NuGet.Protocol.AutoCompleteResourceV2Feed.GetResults(Uri apiEndpointUri, ILogger logger, CancellationToken token) at async Task<IEnumerable<string>> NuGet.Protocol.AutoCompleteResourceV2Feed.IdStartsWith(string packageIdPrefix, bool includePrerelease, ILogger log, CancellationToken token) at async Task<SortedSet<string>> MSBuildProjectTools.LanguageServer.Utilities.NuGetHelper.SuggestPackageIds(IEnumerable<AutoCompleteResource> autoCompleteResources, string packageIdPrefix, bool includePrerelease, ILogger logger, CancellationToken cancellationToken) in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Common\Utilities\NuGetHelper.cs:line 142 at async Task<SortedSet<string>> MSBuildProjectTools.LanguageServer.Documents.ProjectDocument.SuggestPackageIds(string packageIdPrefix, bool includePrerelease, CancellationToken cancellationToken) in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Documents\ProjectDocument.cs:line 381 at async Task<List<CompletionItem>> MSBuildProjectTools.LanguageServer.CompletionProviders.PackageReferenceCompletion.HandlePackageReferenceAttributeCompletion(ProjectDocument projectDocument, XSAttribute attribute, CancellationToken cancellationToken) in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\CompletionProviders\PackageReferenceCompletion.cs:line 155 at async Task<CompletionList> MSBuildProjectTools.LanguageServer.CompletionProviders.PackageReferenceCompletion.ProvideCompletions(XmlLocation location, ProjectDocument projectDocument, CancellationToken cancellationToken) in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\CompletionProviders\PackageReferenceCompletion.cs:line 92 at async Task<CompletionList> MSBuildProjectTools.LanguageServer.Handlers.CompletionHandler.OnCompletion(TextDocumentPositionParams parameters, CancellationToken cancellationToken) in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Engine\Handlers\CompletionHandler.cs:line 197

Thats the output from VSCode

@tintoy
Copy link
Owner

tintoy commented Nov 14, 2018

Ok, it sounds like it can't connect to one or more package feeds specified in NuGet.config (either in the solution directory or in %UserProfile%\AppData\Roaming\NuGet\NuGet.Config). Are you able to open those feed URLs in your browser?

@SimantoR
Copy link
Author

Ok so fixed it. Apparently I installed Xenko game engine and xenko pushed some of its feed into the sources. I commented them out and autocomplete is back on track. What a pain from Xenko. Thank you though. Nuget feed was the problem.

@tintoy
Copy link
Owner

tintoy commented Nov 15, 2018

No worries - glad it was easy to fix :)

I'll add some logging so that next time it will explicitly log the set of package sources that it's using.

@SimantoR
Copy link
Author

Funnily enough it cant find SixLabors.ImageSharp or any package with x.x.x-betaXXXX version. Just letting you know

@tintoy
Copy link
Owner

tintoy commented Nov 15, 2018

Hi - there is a command called "toggle prerelease" that will make them show up or hide them. Does that not work for you?

@SimantoR
Copy link
Author

Not for packages with 'betaXXXX' format in their version. Works fine for 0.X.X versioned packages.

FbxSharp is on v0.9.0
image

SixLabors.ImageSharp is on 1.0.0-beta0005
image

@tintoy
Copy link
Owner

tintoy commented Nov 21, 2018

Can you open the VS Code settings editor, then open the raw settings.json file, and then post all the msbuildProjectTools* settings listed in it?

@SimantoR
Copy link
Author

{ "window.titleBarStyle": "custom", "files.exclude": { "**/bin": true, "**/obj": true, "**/www*": true }, "editor.fontFamily": "'Fira Code'", "editor.fontLigatures": true, "editor.fontSize": 16, "editor.scrollBeyondLastLine": false, "zenMode.centerLayout": false, "editor.codeLens": false, "workbench.iconTheme": "material-icon-theme", "editor.minimap.enabled": false, "msbuildProjectTools.nuget.includePreRelease": true, "editor.quickSuggestions": { "other": false, "comments": false, "strings": false }, "git.confirmSync": false, "git.autofetch": true }

@tintoy
Copy link
Owner

tintoy commented Nov 21, 2018

Thanks! I'll try this out when I get home :)

@SimantoR
Copy link
Author

I have seen this problem a few months ago too. I didn't know there was a repo I would've reported this then. I love the extension. I hate to come forward issues like this. But I'd love to keep using this as the only solution to multiple features. I have made quite a bit of enhanced csproj build systems that targets multi-OS+multi-framework, using this amazing extension (and that's awesome!). I'd love to see this become a beast.

@tintoy
Copy link
Owner

tintoy commented Nov 21, 2018

No worries - thanks for reporting it! The only way this extension gets better is through users like you :)

I'll let you know as soon as I've worked out what the problem is.

@tintoy
Copy link
Owner

tintoy commented Nov 21, 2018

Ok, so I've looked into this, and it appears to be a bug in the NuGet client library.

The client is supposed to do an HTTP GET from https://api-v2v3search-1.nuget.org/autocomplete?q=SixLabors&prerelease=true, but is instead using https://api-v2v3search-1.nuget.org/autocomplete?q=SixLabors&includePrerelease=true

I'll log an issue with the NuGet folks to see if we can get this resolved.

@tintoy
Copy link
Owner

tintoy commented Nov 21, 2018

Created NuGet/Home#7540.

@tintoy
Copy link
Owner

tintoy commented Dec 2, 2018

I've opened a new issue for the pre-release version problem, so I'm closing this one :)

@tintoy tintoy closed this as completed Dec 2, 2018
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

2 participants