Skip to content

Unused Property Check false positive - Title flagged as unused during packing #10597

@JanKrivanek

Description

@JanKrivanek

Context

A case that seems as a false positive of the BC0203

Repro steps

  1. Create project:
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
	  <OutputType>Library</OutputType>
	  <TargetFramework>net8.0</TargetFramework>
	  <IsPackable>true</IsPackable>
	  <!-- packaging properties -->
	  <PackageVersion>1.2.3</PackageVersion>
	  <Title>Some library</Title>
	  <authors>Microsoft</authors>
	  <owners>Microsoft</owners>
	  <PackageId>SomeLib</PackageId>
  </PropertyGroup>
</Project>
  1. Build: dotnet pack /check /v:d /bl
  2. Observe the owners property being flagged - which is correct:
C:\repro\TestProj.csproj (11,5): https://aka.ms/buildcheck/codes#BC0203 - Property: [owners] was declared/initialized, but it was never used.
  1. Observe the Title property being flagged - which is false positive:
C:\repro\TestProj.csproj (11,5): https://aka.ms/buildcheck/codes#BC0203 - Property: [Title] was declared/initialized, but it was never used.
  1. Check the binlog - that the property is being dereferenced:
    image

Repro Files

Repro.zip

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions