Skip to content

use the source instead of the name to find nuget packages#35397

Merged
jmarolf merged 1 commit intodotnet:masterfrom
jmarolf:bugfix/do-no-use-name-to-find-nuget-source
May 29, 2019
Merged

use the source instead of the name to find nuget packages#35397
jmarolf merged 1 commit intodotnet:masterfrom
jmarolf:bugfix/do-no-use-name-to-find-nuget-source

Conversation

@jmarolf
Copy link
Copy Markdown
Contributor

@jmarolf jmarolf commented May 1, 2019

fixes #27010

@jmarolf jmarolf requested a review from a team as a code owner May 1, 2019 16:08
@jmarolf jmarolf force-pushed the bugfix/do-no-use-name-to-find-nuget-source branch from a378d22 to 0d8d2af Compare May 28, 2019 16:28
@jmarolf jmarolf merged commit b5cd612 into dotnet:master May 29, 2019
@heejaechang
Copy link
Copy Markdown
Contributor

@jmarolf looks like this broke the nuget feature. can you take a look? just install latest d16.2stg and create Console app and add JObject and see whether newtonsoft package is offered for JObject.

what I see is _sourceToDatabase - http://source.roslyn.io/#Microsoft.CodeAnalysis.EditorFeatures.Wpf/SymbolSearch/SymbolSearchUpdateEngine.cs,28

is initialized with package source uri
image

but given source is package source name
image

so, _sourceToDatabase.TryGetValue never succeed.

// Always pull down the nuget.org index. It contains the MS reference assembly index
// inside of it.
Task.Run(() => UpdateSourceInBackgroundAsync(SymbolSearchUpdateEngine.NugetOrgSource));
Task.Run(() => UpdateSourceInBackgroundAsync(SymbolSearchUpdateEngine.NugetOrgSourceUri));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, this is the bug. this gives Uri which will make _sourceToDatabase to have its key with uri, but the call above _sourceToDatabase.TryGetValue gets NugetOrgSourceName. so it will never be found.

updateCancellationToken:=cancellationTokenSource.Token)

Await service.UpdateContinuouslyAsync(SymbolSearchUpdateEngine.NugetOrgSource, "TestDirectory")
Await service.UpdateContinuouslyAsync(SymbolSearchUpdateEngine.NugetOrgSourceName, "TestDirectory")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm.. why real code call Update with Uri and test call Update with SourceName?

@heejaechang
Copy link
Copy Markdown
Contributor

I think you need to change everything to use Uri rather than Name.

also, _sourceToDatabase (http://source.roslyn.io/#Microsoft.CodeAnalysis.EditorFeatures.Wpf/SymbolSearch/SymbolSearchUpdateEngine.cs,28) seems to use default string comparison for key which can also be a problem.

I think better way might be just using Uri type as key for the map. and give it comparer for Uri.

@jmarolf
Copy link
Copy Markdown
Contributor Author

jmarolf commented Jun 25, 2019

@heejaechang thanks for the analysis, and sorry for breaking this. I'll send a PR

@jmarolf jmarolf deleted the bugfix/do-no-use-name-to-find-nuget-source branch January 27, 2020 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resolve from NuGet doesn't work

5 participants