-
Notifications
You must be signed in to change notification settings - Fork 1.9k
C#: Fix NuGet version bug and a .NET10 compatibility issue. #20964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…g non-existing framework targets.
… sorting for finding newest package version.
There was a problem hiding this 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 two critical issues in the dependency fetcher used by build mode none (BMN) to improve .NET framework version handling and ensure .NET 10 compatibility.
- Replaces custom version sorting logic with NuGet's
NuGetVersionclass for proper semantic versioning - Adds
/p:AllowMissingPrunePackageData=trueflag to handle .NET 10 breaking changes in restore operations - Refactors
DotNetVersionclass to useNuGetVersioninternally, eliminating custom version comparison code
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| csharp/ql/lib/change-notes/2025-12-04-bmn-dotnet-fixes.md | Documents the bug fixes for version sorting and .NET 10 compatibility |
| csharp/ql/integration-tests/posix/standalone_dependencies_executing_runtime/Assemblies.expected | Updates test expectations to include the new NuGet.Versioning.dll dependency |
| csharp/paket.main.bzl | Adds NuGet.Versioning 7.0.1 package configuration to the build system |
| csharp/paket.lock | Locks NuGet.Versioning 7.0.1 as a project dependency |
| csharp/paket.dependencies | Declares NuGet.Versioning as a required package |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/paket.references | References NuGet.Versioning for the DependencyFetching project |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/Sdk.cs | Updates regex and parsing to use NuGetVersion for SDK version detection |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/Runtime.cs | Updates regex and parsing to use NuGetVersion for runtime version detection |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs | Implements semantic version sorting for NuGet package directories using NuGetVersion |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DotNetVersion.cs | Simplifies implementation to delegate version comparison to NuGetVersion |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DotNet.cs | Adds AllowMissingPrunePackageData flag for .NET 10 compatibility in restore operations |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependencyManager.cs | Updates method call to match signature change from static to instance method |
| csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/BUILD.bazel | Adds nuget.versioning build dependency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hvitved
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks plausible to me.
This PR enhances the dependency fetcher utilized by BMN.
/p:AllowMissingPrunePackageData=trueto thedotnet restorearguments. This addresses a breaking change between .NET 9 and .NET 10, where restoring fails if we intentionally use fake framework directories to trigger framework downloads (these restores are intended as best-effort attempts).9to10.DotNetVersionclass to useNuGetVersioninternally, replacing the custom logic previously in use.