project-system
project-system copied to clipboard
New transitive dependency tree items may not appear if parent already created with no children
Visual Studio Version:16.8.0 preview 1.0
Summary:
Steps to Reproduce:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ClassLibrary2\ClassLibrary2.csproj" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageId>Test</PackageId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
</Project>
tag @drewnoakes
I can repro this in Version 16.8.0 Preview 2.0 [30410.76.master], but only under very specific conditions:
- Create the empty parent project
- Create the empty child project
- Add a P2P reference from parent to child
- Expand the dependencies tree in the parent so you can see the child project reference, which will have no children
- Add the package reference to the child project, and the parent's tree will not reflect that
Not pre-expanding the parent tree causes it to show. Reloading the project/solution causes it to show. Removing the project reference and re-adding it causes it to show.
My assumption is that the attached collection is being lazily created in such a way as to not receive future updates when they arrive. Note though that once the node has children, future children can be added without problem.
Potentially relevant code: https://github.com/NuGet/NuGet.Client/pull/3392/files#diff-a5a55c7613fcaf2f4fbe63fbcfa1eb7cR45
@drewnoakes
- Create the empty parent project
- Create the empty child project
This problem also exists for non-empty projects
@Varorbc those are minimal steps to repro the problem.
This still repros.