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

ArgumentNullException when using the Update attribute #68

Open
cdonnellytx opened this issue Jan 14, 2020 · 0 comments · May be fixed by #71
Open

ArgumentNullException when using the Update attribute #68

cdonnellytx opened this issue Jan 14, 2020 · 0 comments · May be fixed by #71

Comments

@cdonnellytx
Copy link

cdonnellytx commented Jan 14, 2020

Installed product versions

Description

Code completion fails to work if the PackageReference tag uses the Update attribute instead of Include, throwing an exception.

This is in a repo where we have a Directory.Build.targets file to keep the versions of NuGet packages in sync by using the Update attribute to set a version that overrides any version specified in individual .csproj files. (We typically do not set a version in the .csproj anymore.)

Example syntax:

    <PackageReference Update="System.Buffers" Version="4.5.0" />

Steps to recreate

  1. Open a .csproj or .targets file with at least one PackageReference
  2. Change the PackageReference from Include to Update. (Or add example above)
  3. Go to the Version attribute and invoke Intellisense to display the list of available versions.

Current behavior

Throws an exception (see below)

Expected behavior

Code complete version based off the Update key instead of the nonexistent Include key.

Error with stack trace

System.AggregateException: One or more errors occurred. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: key
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at ProjectFileTools.NuGetSearch.Search.PackageSearchManager.SearchPackageInfo(String packageId, String version, String tfm)
   at ProjectFileTools.PackageInfoControl..ctor(String packageId, String version, String tfm, IPackageSearchManager searcher)
   at ProjectFileTools.QuickInfo.MsBuildPropertyQuickInfoSource.<GetQuickInfoItemAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Language.Intellisense.Implementation.AsyncQuickInfoSession.<ComputeSourceContentAsync>d__39.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
   --- End of inner exception stack trace ---
   at Microsoft.VisualStudio.Language.Intellisense.Implementation.AsyncQuickInfoSession.<UpdateAsync>d__32.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Language.Intellisense.Implementation.AsyncQuickInfoPresentationSession.<UpdateAsync>d__5.MoveNext()
---> (Inner Exception #0) System.ArgumentNullException: Value cannot be null.
Parameter name: key
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at ProjectFileTools.NuGetSearch.Search.PackageSearchManager.SearchPackageInfo(String packageId, String version, String tfm)
   at ProjectFileTools.PackageInfoControl..ctor(String packageId, String version, String tfm, IPackageSearchManager searcher)
   at ProjectFileTools.QuickInfo.MsBuildPropertyQuickInfoSource.<GetQuickInfoItemAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Language.Intellisense.Implementation.AsyncQuickInfoSession.<ComputeSourceContentAsync>d__39.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)<---
cdonnellytx added a commit to cdonnellytx/ProjFileTools that referenced this issue May 5, 2020
This fixes dotnet#68, at least the ArgumentNullException part -- targets files without an Sdk attribute don't seem to work.
cdonnellytx added a commit to cdonnellytx/ProjFileTools that referenced this issue May 15, 2020
This fixes dotnet#68, at least the ArgumentNullException part -- targets files without an Sdk attribute don't seem to work.
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

Successfully merging a pull request may close this issue.

1 participant