-
Notifications
You must be signed in to change notification settings - Fork 258
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
Restore may write nulls to project.assets.json #13563
Comments
Reproducible in VS 17.11, P1. |
The nominations in P1 seem to not be sending PackageVersion. I'm guessing VS has plenty of NU1008 errors which are the real problem. I'll debug further to figure out whether the bug is NuGet or project-system. |
The nominations are missing the central package versions. Updating to P2 to try it out and see if it's fixed there. |
VS 17.11, P2 has the same issue. The data coming it at the NuGet entry point through https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Clients/NuGet.VisualStudio/SolutionRestoreManager/IVsTargetFrameworkInfo3.cs doesn't have the PackageVersion items. Sometimes, in the past we've had issues where a target fails and not all the data gets populated in the nomination event. How did we get from the null write here? NuGet/NuGet.Client@2be8680 changed the return from |
cc @tmeschter, @drewnoakes, @zivkan I thought that the root cause might be a failing CollectCentralPackageVersions, but that wasn't the case. It seems like the collect target isn't running in VS to begin with. Not sure why that might be. |
Could this be related to dotnet/sdk#39316? |
I'd expect dotnet/sdk#39316 is a symptom of this issue yes. I think there's 2 sides to it.
|
There's 17.10 reports for this as well: https://developercommunity.visualstudio.com/t/Misleading-error-message-when-an-entry-i/10686346. I think we need to start making the "safety" changes because without those it can lead to many errors, making it challenging to recognize the first issue. |
Agreed. Some hardening of these code paths would be great. E.g. using C# nullable attributes might have prevented the bug. |
NuGet side fix: NuGet/NuGet.Client#5900 |
Regarding #2, the .NET SDK's code is probably just fine. One discrepancy I did notice is that STJ & NJ parsing behave differently. |
NuGet Product Used
MSBuild.exe
Product Version
9.0.100-preview.5.24307.3
Worked before?
9.0.100-preview.3.24204.13
Impact
I'm unable to use this version
Repro Steps & Context
SDK task ResolvePackageAssets throws NRE while enumerating
NuGet.ProjectModel.ProjectFileDependencyGroup.Dependencies
, which returns null.I'm guessing that's because the
project.assets.json
contains nulls inprojectFileDependencyGroups
, which it probably shouldn't. Somehow nuget restore managed to produce these:Verbose Logs
Can share full binlog. DM me on Teams.
Searching for
null,
:The text was updated successfully, but these errors were encountered: