Repository navigation
Write enum defaults from packages by name - #111
Merged
Merged
Conversation
A library's build output holds only the library, so an enum from a package, `Formatting formatting = Formatting.Indented`, was written as a cast, `(Formatting)1`. The api command now reads each project's obj/project.assets.json and gives the reader the directories of the package assemblies the framework compiles against. A .dll, directory or .nupkg read on its own takes them with -r/--reference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mpdreamz
added a commit
that referenced
this pull request
Nov 15, 2026
…#112) Follow-up to #111. A `.nupkg` read on its own (`assembly-differ api MyLib.1.2.0.nupkg`) wrote an enum default from a dependency as a cast unless `-r` named the folder. It now finds its dependencies itself: - It reads the package's dependency group for each framework (the nearest one, as restore picks it), and does the same for each dependency in turn, transitively. - It looks for each one in the packages folder restore fills: `~/.nuget/packages`, `NUGET_PACKAGES`, or what NuGet.config says. - It takes the version restore would: the lowest the range allows, among versions whose restore finished (`.nupkg.metadata` present). - It reads the dependency's `ref/` assemblies when it has them, otherwise `lib/`, for the nearest framework. - **Nothing is downloaded:** a dependency that is not in the folder is skipped, and its enums stay casts, as before. `-r` still adds folders on top. **Verified:** - `A_package_finds_its_dependencies_in_the_packages_folder` packs a real project whose package declares the enum: - with the restored packages folder it writes `Mode.Auto`; - with an empty one it writes `(Mode)5`, with no error. - `A_package_takes_the_version_restore_would_through_its_dependencies_dependencies` uses a hand-made packages folder: - `Uses` depends on `Middle`, which depends on `Modes [1.1.0, )`; - `Modes` is there at 1.0.0, at 1.1.0 with an unfinished restore, at 1.2.0 and at 2.0.0, and each declares value 5 under a different name; - so the name written tells which version was read, and it is 1.2.0. - Mutations caught: taking the highest version, taking an unfinished restore, not following dependencies' dependencies, and not passing the folders to the reader. - Checked by hand on a packed library that depends on Newtonsoft.Json. - `mise run ci` is green locally. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
An optional parameter's enum default is stored as a number; writing it by name needs the assembly that declares the enum. A library's
bin/Releaseholds only the library, not its packages, so an enum from a package came out as a cast:apiasks MSBuild forProjectAssetsFileand readsobj/project.assets.json. It takes the package assemblies that framework compiles against, under the packages folders the file names, and passes their directories to the reader. Nothing new to configure..dll, a directory or a.nupkg: there is no project to read, so-r/--reference <dir>(repeatable) names the folders to look in. A missing folder is an error.--verify's suggested update command carries the flag.LogLevel, used to resolve only on machines with that runtime installed. Through the project's restore it now resolves everywhere.Verified:
ApiReferenceTestsbuild a project against a package on a local feed, withMode.Autoas a default:apiin the project writesMode.Auto;(Mode)5without-randMode.Autowith it;-rfolder is an error.mise run ciis green locally.🤖 Generated with Claude Code