Open nkolev92 opened 1 month ago
I also have this error after converting to Central Package References:
By conversion, I mean the following:
I've double-checked that all PackageReference elements present in any project file have a corresponding PackageVersion element in Directory.Packages.props.
I also get an error in the error list, but no project name/path mentioned there:
If I try to restore the Nuget Packages for the solution, I get a few errors like this one:
The PackageReference items Microsoft.Graph;Microsoft.Identity.Client do not have corresponding PackageVersion.
But the corresponding PackageVersion elements are present in Directory.Packages.props.
Visual Studio Professional 2022 (64bit), Version 17.10.0
Never mind - I was actually checking/editing the wrong Directory.Packages.props in a different working copy. The relevant one was actually missing some PackageVersion elements.
Time to have a break, I guess.
Running into this as well trying to use a private GitHub org NuGet feed. I'm trying to "Manage NuGet Packages for Solution in VS 2022: Microsoft Visual Studio Enterprise 2022 (64-bit) - Current Version 17.10.5
Output:
Looking at an individual project works - it's when I try for the whole solution that the error occurs.
This issue also reproes for creating iOS App (Xamarin).
Repro steps:
Error occurred while restoring NuGet packages: System.NullReferenceException: Object reference not set to an instance of an object. at NuGet.ProjectModel.PackagesLockFileUtilities.<>c.
b6_3(LibraryDependency e) at System.Linq.Enumerable.WhereSelectListIterator 2.MoveNext() at System.Linq.Buffer
1..ctor(IEnumerable1 source) at System.Linq.OrderedEnumerable
1.d1.MoveNext() at System.String.Join(String separator, IEnumerable 2>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.SolutionRestoreManager.RestoreOperationLogger.1 values) at NuGet.ProjectModel.PackagesLockFileUtilities.HasDirectPackageDependencyChanged(IEnumerable
1 newDependencies, IEnumerable`1 lockFileDependencies, NuGetFramework nuGetFramework) at NuGet.ProjectModel.PackagesLockFileUtilities.IsLockFileValid(DependencyGraphSpec dgSpec, PackagesLockFile nuGetLockFile) at NuGet.Commands.RestoreCommand.d 78.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.Commands.RestoreCommand.d71.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.Commands.RestoreRunner. d 7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.Commands.RestoreRunner.d6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.Commands.RestoreRunner. d 10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at NuGet.Commands.RestoreRunner.d2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.Commands.RestoreRunner. d 0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.PackageManagement.DependencyGraphRestoreUtility.d2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.SolutionRestoreManager.SolutionRestoreJob.<>cDisplayClass29_0.< b d35.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at NuGet.SolutionRestoreManager.RestoreOperationLogger. d 35.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.SolutionRestoreManager.SolutionRestoreJob.d29.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.SolutionRestoreManager.SolutionRestoreJob. d 27.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at NuGet.SolutionRestoreManager.SolutionRestoreJob.d27.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.SolutionRestoreManager.SolutionRestoreJob. d 26.MoveNext() Value cannot be null. Parameter name: versionRange
This issue also reproes for creating iOS App (Xamarin).
Repro steps:
- Create a iOS App (Xamarin)(iPhone Master-Detail App) ...
@SueSu01 this sounds like a different issue. Could you check this one I filed recently and comment there if you feel it's what you encountered? I see your Restore hasn't completed, so thinking it might be that restore is disabled and not related to CPM.
Developer Community VS Feedback ticket: https://developercommunity.visualstudio.com/t/ResolvePackageAssets-fails-when-using-ce/10740120
Affected Branch: main Affected Build: Version 17.12.0 Preview 1.0 [35110.85.main] Affected Product Language: English/All
Steps to reproduce:
Construct a package using Central Package Management but miss a PackageVersion for one of the PackageReference items
Open in Visual Studio
Solution Explorer -> Right click on Solution node -> Manage Nuget Packages for Solution...
Displayed yellow bar for "Error Occurred"
Click on "Show Errors in Output" RESULT:
EXPECT:
I see errors in several places in this condition, but for all of them, they say "Value cannot be null, Parameter name: versionRange". If they included what package was the issue, then I can track it down. In fact, because the version is empty/null/not displayed, the only piece of information I have to track this down is the packageName. If it had a version and the version was simply not valid SemVer or not found in a source, I could look at the small set of packages with that version to find the cause.
NOTE There is a warning in the Error List: Severity Code Description Project File Line Suppression State Details Error NU1010 The PackageReference items Microsoft.VisualStudio.Editor do not have corresponding PackageVersion. EntityDesigner D:\dd\ef6tools\src\EFTools\EntityDesignEntityDesigner\EntityDesigner.csproj 1
But the link in the UI brings me to the Package Manager Output window, which doesn't have such a clear message.