Repository navigation
C#: Generate correct stub project references - #23351
Draft
michaelnebel wants to merge 2 commits into
Draft
michaelnebel wants to merge 2 commits into
michaelnebel wants to merge 2 commits into
Conversation
Project references used the minimum version of a dependency's version range, which may differ from the version that was restored and stubbed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The dependency manager keeps only the highest version of each assembly, so package assemblies superseded by a framework are stubbed in the framework. Reference that framework from the package project. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
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.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
32120bbf01a61ba42e15b52c951d5c417f521af1make_stubs_all.pyregeneration reproduces all six manual.csprojfixes.↑ All 18 stub-dependent CodeQL tests pass with the generated project files.
↓ Validated only with the current package list and the .NET 11 SDK.
↓ Final commit differs from the validated tree only by a code comment and README wording.
↑ Empty package folders come from
ResolveConflictsinDependencyManager.cs, which keeps only the highest assembly version.Regenerating the C# test stubs required manual
.csprojfixes. This PR fixes the two causes incsharp/scripts/stubs/helpers.py.ProjectReferenceused the minimum version of the dependency range (for example[8.0.0, )), not the version NuGet actually restored, so it could point to a stub folder that doesn't exist. It now uses the resolved version from theproject.assets.jsontarget keys.webappinput project referencesMicrosoft.AspNetCore.App, which ships newer copies ofMicrosoft.Extensions.*assemblies. The dependency manager keeps only the highest version of each assembly, so those types are stubbed only in the framework, and the package folders are left empty. A package whose DLLs were superseded this way now references the framework (for exampleMicrosoft.Extensions.Http→_frameworks/Microsoft.AspNetCore.App).Validation
make_stubs_all.py(ServiceStack pinned to 10.5.0) and compared the output with the manually corrected stubs from the .NET 11 stub update (C#: Generate .NET 11 stubs #23345). All six manual fixes are reproduced. The only other differences areMicrosoft.AspNetCore.Appreferences on 10 more empty packages..csprojfiles, all 18 stub-dependent tests pass: SQL injection, Dapper, EntityFramework, NHibernate, ServiceStack and stored flow sources.