Skip to content

Fix netstandard detection to support transitive references#212

Merged
andrewlock merged 2 commits intomainfrom
fix-netstandard-detection
Jan 3, 2026
Merged

Fix netstandard detection to support transitive references#212
andrewlock merged 2 commits intomainfrom
fix-netstandard-detection

Conversation

@andrewlock
Copy link
Owner

@andrewlock andrewlock commented Jan 3, 2026

The previous implementation would only detect direct System.Memory references, but we should look for transitive references too, as the types are available in that case too.

Added a pure "dependencies" project to make sure we can test this scenario

Also removed the InitialTargets, as that was cargo-cult copy-pasta

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the System.Memory detection mechanism in the MSBuild targets to support transitive references. Previously, the detection only worked for direct PackageReference dependencies, but now it correctly identifies System.Memory whether it's referenced directly or transitively through project dependencies.

  • Changed the detection mechanism from checking PackageReference items to checking ReferencePath items, which includes all resolved assemblies
  • Added a new Dependencies.SystemMemory test project that provides System.Memory as a transitive dependency
  • Removed unnecessary InitialTargets attribute and improved the target name for clarity

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/NetEscapades.EnumGenerators/NetEscapades.EnumGenerators.targets Updated the System.Memory detection logic to check resolved references instead of direct package references, enabling transitive dependency detection
tests/Dependencies.SystemMemory/Dependencies.SystemMemory.csproj New test project that provides System.Memory and System.ComponentModel.Annotations as dependencies for testing transitive reference scenarios
tests/NetEscapades.EnumGenerators.NetStandard.SystemMemory/NetEscapades.EnumGenerators.NetStandard.SystemMemory.csproj Refactored to use the new Dependencies.SystemMemory project reference instead of direct package references
tests/NetEscapades.EnumGenerators.Nuget.NetStandard.SystemMemory/NetEscapades.EnumGenerators.Nuget.NetStandard.SystemMemory.csproj Refactored to use the new Dependencies.SystemMemory project reference instead of direct package references
NetEscapades.EnumGenerators.sln Added the new Dependencies.SystemMemory project to the solution with proper build configurations and folder nesting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

github-actions bot commented Jan 3, 2026

Test Results

    180 files  ±0      180 suites  ±0   5h 49m 15s ⏱️ + 3m 47s
 21 841 tests ±0   21 837 ✅ ±0   4 💤 ±0  0 ❌ ±0 
389 280 runs  ±0  389 208 ✅ ±0  72 💤 ±0  0 ❌ ±0 

Results for commit cbbb620. ± Comparison against base commit 87e6d83.

@andrewlock andrewlock merged commit a17549f into main Jan 3, 2026
11 checks passed
@andrewlock andrewlock deleted the fix-netstandard-detection branch January 3, 2026 12:11
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