project-system icon indicating copy to clipboard operation
project-system copied to clipboard

New transitive dependency tree items may not appear if parent already created with no children

Open Varorbc opened this issue 3 years ago • 5 comments

Visual Studio Version:16.8.0 preview 1.0

Summary:

image

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>


Varorbc avatar Aug 11 '20 01:08 Varorbc

tag @drewnoakes

davkean avatar Aug 11 '20 01:08 davkean

I can repro this in Version 16.8.0 Preview 2.0 [30410.76.master], but only under very specific conditions:

  1. Create the empty parent project
  2. Create the empty child project
  3. Add a P2P reference from parent to child
  4. Expand the dependencies tree in the parent so you can see the child project reference, which will have no children
  5. 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 avatar Aug 11 '20 02:08 drewnoakes

@drewnoakes

  1. Create the empty parent project
  2. Create the empty child project

This problem also exists for non-empty projects

Varorbc avatar Aug 11 '20 02:08 Varorbc

@Varorbc those are minimal steps to repro the problem.

drewnoakes avatar Aug 12 '20 08:08 drewnoakes

This still repros.

drewnoakes avatar Feb 12 '24 22:02 drewnoakes