Skip to content

Warn when direct package reference is unused#121

Open
stan-sz wants to merge 4 commits intodfederm:mainfrom
stan-sz:issue-119
Open

Warn when direct package reference is unused#121
stan-sz wants to merge 4 commits intodfederm:mainfrom
stan-sz:issue-119

Conversation

@stan-sz
Copy link
Contributor

@stan-sz stan-sz commented Jan 7, 2026

Repro for #119

@stan-sz stan-sz marked this pull request as ready for review January 21, 2026 13:24
@stan-sz stan-sz force-pushed the issue-119 branch 2 times, most recently from 3c539ed to 05faa75 Compare February 13, 2026 09:35

_compileTimeAssemblies ??= new(compileTimeAssemblies.Count);
_compileTimeAssemblies.AddRange(compileTimeAssemblies);
_compileTimeAssemblies.AddRange(compileTimeAssemblies.Select(assemblyPath => Tuple.Create(packageName, assemblyPath)));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid the allocation. A value tuple would be best.

"RT0003",
"Unnecessary package reference",
"PackageReference {0} can be removed",
"PackageReference {0} can be removed{1}",
Copy link
Owner

@dfederm dfederm Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the whole point of the change, to have a slightly different error message?

Its also unclear on how this relates to #119

namespace ReferenceTrimmer.Shared;

internal readonly record struct DeclaredReference(string AssemblyPath, DeclaredReferenceKind Kind, string Spec);
internal readonly record struct DeclaredReference(string AssemblyPath, DeclaredReferenceKind Kind, string Spec, string AdditionalSpec);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's "additional spec"? There's only one "spec" (Include value)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants