NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): VS UI
NuGet version (x.x.x.xxx): 5.7.0.6726
dotnet.exe --version (if appropriate):
VS version (if appropriate): Dev16 16.7.0
OS version (i.e. win10 v1607 (14393.321)): 18363.959
Install SpecFlow extension for VS 2019
Create a .net framework 4.7.2 class library
Open Package manage UI, install following package.
Error: object reference not set to an instance of an object
System.NullReferenceException: Object reference not set to an instance of an object.
at NuGet.PackageManagement.UI.UIActionEngine.<>c.
at System.Linq.Enumerable.WhereListIterator1.MoveNext()
at System.Linq.Enumerable.Any[TSource](IEnumerable1 source)
at NuGet.PackageManagement.UI.UIActionEngine.
--- 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 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at NuGet.PackageManagement.UI.UIActionEngine.<>c__DisplayClass12_0.<
Time Elapsed: 00:00:00.0005881
========== Finished ==========
Very helpful if you can zip a project and paste into this issue!
@AndyTian-Devops Does it repro if pressing the refresh button in the UI _before_ selecting "Update all packages"?
@zkat Yes, repro after pressing the refresh button in the UI.

Same issue here:
System.NullReferenceException: Object reference not set to an instance of an object.
at NuGet.PackageManagement.UI.UIActionEngine.<>c.
at System.Linq.Enumerable.WhereListIterator1.MoveNext()
at System.Linq.Enumerable.Any[TSource](IEnumerable1 source)
at NuGet.PackageManagement.UI.UIActionEngine.
--- 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 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at NuGet.PackageManagement.UI.UIActionEngine.<>c__DisplayClass12_0.<
Time Elapsed: 00:00:00.0006027
Hi,
Running Visual Studio 2019 in the administrator mode seems to be fixing the issue!
As a matter of fact, running it in admin mode has nothing to do with the problem. There seem to be conflicting dependencies between some packages. In my case, it was between JwtBearerToken, ef core assemblies, and the other .netCore packages after updating to dotnet-sdk-3.1.401.
Picking some related packages (for example ef core assembelies, the jwt bearer token and so forth) and updating them group by group solved the issue
Same issue for me too.
Hi all,
I also reproduced this behavior.
Microsoft Visual Studio Professional 2019
Version 16.7.2
Steps to reproduce:
Sample project:
WebApplication2.zip
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at NuGet.PackageManagement.UI.UIActionEngine.<>c.<ResolveActionsForUpdateAsync>b__11_0(PackageIdentity package)
at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
at NuGet.PackageManagement.UI.UIActionEngine.<ResolveActionsForUpdateAsync>d__11.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 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at NuGet.PackageManagement.UI.UIActionEngine.<>c__DisplayClass12_0.<<PerformActionImplAsync>b__0>d.MoveNext()
Clicking the "Refresh" button on the "Updates" page seems to fix the issue - it is possible to update the packages after that.
Same issue here. I can only get it to work by doing each update one at a time.
Microsoft Visual Studio Professional 2019
Version 16.7.5
I was able to reproduce this bug on my local, but didn't look into cause of problem.
I managed to work around it just now, by instead of using the select all box checking each checkbox individually. So perhaps the issue is the select all checkbox?
@donnie-msft is this a dupe of the issue you're looking into?
Same for me
Same for me
Did you try what worked for me, i.e. not using the select all box and individually selecting each box?
I'm usually deselect one or pair packages and issue is gone.
I believe this is a dupe of https://developercommunity.visualstudio.com/content/problem/1116050/manage-nuget-packages-for-solution-object-referenc.html
I'm pretty sure I broke this here https://github.com/NuGet/NuGet.Client/commit/218880ef0274a8de5223509eddb9c4dcc4948690#diff-80991ce1edef4f242608751b70dd2d48dad8e24a28dbefd2b68a3a7784a12f21R1486
I can't repro right now, either from scratch or from the .zip attachment. I think it's by chance (race condition) whether it'll be null by the time the Update action reads it. I'll try to get a PR out quickly but would like to consistently repro it first.
Workaround may be simply waiting a few seconds on the Updates tab for LatestVersions to populate. Curious if folks have 'nuget.org' or a larger assortment of Package Sources selected in the upper-right?
Found a fairly consistent way to get a repro... go to Updates Tab, click Refresh, quickly press Select all packages and Update.
Curious if folks have 'nuget.org' or a larger assortment of Package Sources selected in the upper-right?
I have one additional private nuget package source
@donnie-msft i hit this pretty regularly. you mention speed being a factor. are you saying that if i give it more time before i change tabs it shouldn't happen?
@mrtristan Yes, as a workaround until the bug is fixed, you'd need to wait until the Latest Version is determined for all packages in the list, which are checked against all package sources (as shown in your Dropdown in the upper right).
The null is because the latest hadn't been determined yet for at least 1 package selected for update.
So, either wait longer or reduce the selected package sources.
sure. as an fyi (in case it's relevant) my flow involves (all clicking as quickly as possible)
all of the visible search results had resolved already i thought (which is how they got in the list in the beginning)
i just did things super slowly and seemed like it worked fine. glad i finally took the time to search github... :-)
This is happening on VS 16.8.0 after it was updated. It didn't happen before. 16.8.0 is the .NET 5 update and the NuGet is waiting to update 19 v3 packages to v5 in .NET Core.
It was a package dependency issue. Updating by splitting them worked for me.
Ditto @djwia - only started happening in 16.8 of VS. Selecting all of the packages causes the issue as above. Selecting one at a time is a workaround.
@djwia & @olivegamestudio if you encounter that again, could you please post the stack trace as was done in this Issue description? Curious if it's the same root cause.
not sure if same NRE, but customer saw this in 16.8 doing update all packages: https://twitter.com/FransBouma/status/1326852242830487552?s=09
@djwia & @olivegamestudio if you encounter that again, could you please post the stack trace as was done in this Issue description? Curious if it's the same root cause.
Yes the callstack is the same. I checked that before posting.
I did notice that after a couple of single installs, the select all starts to work.
Hi, "C:\Users\
@donnie-msft you say that speed if the issue here, but as a test I have waited 5 minutes and it still gives me the same issue:
Severity Code Description Project File Line Suppression State
Error System.NullReferenceException: Object reference not set to an instance of an object.
at NuGet.PackageManagement.UI.UIActionEngine.<>c.<ResolveActionsForUpdateAsync>b__9_0(PackageIdentity package)
at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
at NuGet.PackageManagement.UI.UIActionEngine.<ResolveActionsForUpdateAsync>d__9.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 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at NuGet.PackageManagement.UI.UIActionEngine.<>c__DisplayClass11_0.<<PerformActionImplAsync>b__0>d.MoveNext()
Also, when I delselect "Select all packages", then individually click all the packages (which ironically selects Select all packages again), and then hit update it always works.
It seems that hitting that checkbox select all packages does something more than just selecting them all.
@rogerfar The error is fairly generic, so likely there's multiple root causes. I understand what you're saying about selecting all... In your case, did you open the Package Manager window directly to the Updates tab, or did you have to switch tabs?
Can you give me an idea of the scope of package sources selected in the dropdown in the upper-right? Is there a single remote or local source? Is it "All" and if so, how many are enabled, and are those single/remote or mixed?
I have played a bit with, various projects, various types of projects (.NET Core 3.1, .NET Core 5, 4.8, console, web, WPF).
Right click solution file -> Manage NuGet Packages for solution opens on the Installed tab, then I switch to Updates, after it shows the number of updates available on the Updates tab title, click Select all pages, then Update, works.
The package manager seems to remember which tab you close out at, when I re-open the NuGet PM again, it starts at Updates.
The list of packages gets populates with packages that need updating. It looks like it's done, but doing Select all packages -> Update will throw the error, BUT still update a handful of packages. If I wait a bit longer for the number to appear again in the Updates tab, but still doesn't want to update all packages. Going back and forth between the Installed tab and Updates tab, makes it kinda work. It definitely looks like a timing issue.
My Pacakge source is set to nuget.org, the only other options are All and Microsoft Visual Studio Offline Packages. I don't have any other NuGet feeds and changing this option doesn't seem to affect the outcome of above.
We just got a similar report here: https://developercommunity2.visualstudio.com/t/Manage-nugets-solution-packages-fails-af/1286016
I think there are a few different causes going on and it's going to take some more digging. In the meantime, I'd ask if possible that you submit a VS Feedback ticket, and ideally link it to the one above (for now) so I can review the stacks, logs, etc.
How to report a problem with Visual Studio
Most helpful comment
I believe this is a dupe of https://developercommunity.visualstudio.com/content/problem/1116050/manage-nuget-packages-for-solution-object-referenc.html
I'm pretty sure I broke this here https://github.com/NuGet/NuGet.Client/commit/218880ef0274a8de5223509eddb9c4dcc4948690#diff-80991ce1edef4f242608751b70dd2d48dad8e24a28dbefd2b68a3a7784a12f21R1486
I can't repro right now, either from scratch or from the .zip attachment. I think it's by chance (race condition) whether it'll be
nullby the time the Update action reads it. I'll try to get a PR out quickly but would like to consistently repro it first.Workaround may be simply waiting a few seconds on the Updates tab for LatestVersions to populate. Curious if folks have 'nuget.org' or a larger assortment of Package Sources selected in the upper-right?