project-system: Diagnostics not shown under packages in the dependencies node

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="FooBar" Version="1.0.0" />
  </ItemGroup>
</Project>

Expected: For the error to be listed under “FooBar” within the dependency node and for the icon to be an error.

Actual:

image

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (14 by maintainers)

Most upvoted comments

It’s not every day that you see a two digit issue referenced

So I found a couple of things near there:

  1. ResolvePackageAssets hits this error and stops the DT build dead, before it gets to creating the diagnostic item. Seems this was relying on an ErrorAndContinue when the build still used the crazy DT targets.
  2. Adjusting to ErrorAndContinue on DT build produces an item, but there doesn’t seem to be a node for FooBar parenting it.

I will dig in some more later.

@raffaeler Maybe you are seeing https://github.com/dotnet/project-system/issues/2509 then, but I’m not a project-system eng, they’ll know better 😃

After restoring this project, project.assets.json contains:

  "logs": [
    {
      "code": "NU1102",
      "level": "Error",
      "message": "Unable to find package FooBar with version (>= 1.0.0)\r\n  - Found 4 version(s) in nuget.org [ Nearest version: 0.1.8.12 ]\r\n  - Found 0 version(s) in Microsoft Visual Studio Offline Packages\r\n  - Found 0 version(s) in NuGet Local\r\n  - Found 0 version(s) in dotnet.myget.org roslyn",
      "libraryId": "FooBar",
      "targetGraphs": [
        ".NETCoreApp,Version=v2.1"
      ]
    }
  ]

This appears in the error list:

image

The Dependencies node is currently expecting a ResolvedPackageReference item (or PackageItem, but I don’t think we’ll see these during evaluation) with ProjectItemMetadata.Type metadata of Diagnostic to be provided in the IProjectSubscriptionUpdate. However we don’t see these.

@davkean mentions above that @nguerrera may have said (a long time ago) that there was a change to how this works. Can either of you provide some guidance so I can get this fixed?

This problem is also blocking https://github.com/dotnet/project-system/issues/2582#issuecomment-507994415.