Skip to content

C#: preserve declared dependency version ranges on ResolvedPackage - #8735

Open
macsux wants to merge 2 commits into
mainfrom
macsux/dependencyvulnerabilitycheck
Open

C#: preserve declared dependency version ranges on ResolvedPackage#8735
macsux wants to merge 2 commits into
mainfrom
macsux/dependencyvulnerabilitycheck

Conversation

@macsux

@macsux macsux commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

The NuGet lock file records both a resolved version and the version range each package declared for its children, but only the resolved version was carried into the MSBuildProject marker — so consumers could not tell what range a dependency was originally declared with (needed for dependency vulnerability analysis).

This adds a dependencyRanges map (child package id → normalized version range) to ResolvedPackage on both the Java and C# sides, populates it from the lock file dependencies section in MSBuildProjectHelper, and serializes it over RPC as parallel key/value lists. Tests were added on both sides covering a package with declared ranges and one without.

:rewrite-csharp:test --tests "*MSBuildProjectTest*" and :rewrite-csharp:csharpTest (2363 tests) both pass locally.

The lock file records both a resolved version and the version range each
package declared for its children. Only the resolved version was carried
into the MSBuildProject marker, so consumers could not tell what range a
dependency was originally declared with. Add a `dependencyRanges` map to
`ResolvedPackage` on both the Java and C# sides, populate it from the
NuGet lock file `dependencies` section, and send it over RPC as parallel
key/value lists.
…nstances

The RPC layer materializes 'before' skeletons without running the
constructor, so dependencyRanges is null despite its default. The list
fields already tolerate this via receiveList; the new map codec
dereferenced the map directly and NPE'd on every marker round-trip
(CSharpRecipeTest/CSharpParseProjectTest in integTest). Guard both the
send and receive paths on both the Java and C# sides.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant