Fix netstandard detection to support transitive references#212
Merged
andrewlock merged 2 commits intomainfrom Jan 3, 2026
Merged
Fix netstandard detection to support transitive references#212andrewlock merged 2 commits intomainfrom
andrewlock merged 2 commits intomainfrom
Conversation
…test transitive dependency detection
Contributor
There was a problem hiding this comment.
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
PackageReferenceitems to checkingReferencePathitems, which includes all resolved assemblies - Added a new
Dependencies.SystemMemorytest project that provides System.Memory as a transitive dependency - Removed unnecessary
InitialTargetsattribute 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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