Fix bftree_garnet.dll NuGet packaging#1963
Merged
Merged
Conversation
tiagonapoli
force-pushed
the
tiagonapoli/fix-bftree-native-packaging
branch
2 times, most recently
from
July 21, 2026 22:45
216896c to
d29798e
Compare
tiagonapoli
force-pushed
the
tiagonapoli/fix-bftree-native-packaging
branch
from
July 21, 2026 22:47
d29798e to
bc66f03
Compare
tiagonapoli
marked this pull request as ready for review
July 21, 2026 22:52
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes NuGet packaging for the new Bf-Tree range index native binary by ensuring bftree_garnet.dll is not placed under lib/<tfm>/ (where NuGet/MSBuild treats it as a managed reference), and bumps the package version to ship the corrected layout.
Changes:
- Bump
VersionPrefixfrom2.0.1-beta.9to2.0.1-beta.10. - Update
Garnet.host.csprojpack globs to exclude the nativebftree_garnet.dllfromlib/net8.0andlib/net10.0, while continuing to pack native assets viaruntimes/**.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Version.props | Bumps version to 2.0.1-beta.10 to publish the packaging fix. |
| libs/host/Garnet.host.csproj | Excludes bftree_garnet.dll from lib/<tfm> pack items so consumers don’t attempt to load it as a managed assembly; leaves runtime-native packing intact. |
tiagonapoli
force-pushed
the
tiagonapoli/fix-bftree-native-packaging
branch
from
July 22, 2026 03:54
bc66f03 to
f979d8b
Compare
This reverts commit 7265524.
Reintroduces the parts of #1933 that were unrelated to the packaging leak, which the preceding full revert removed: - Refresh the committed win-x64 and linux-x64 native binaries to match the current Rust FFI (bftree_delete returns an int status), fixing RangeIndex RI.DEL "invalid arguments" failures. - Drop the CI step that built the cdylib with cargo for BfTreeInterop.test; CI consumes the committed binaries. The output-root fallback ItemGroup from #1933 (the packaging leak source) is deliberately NOT reintroduced. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 714ad8a9-ef8b-4d41-8085-982b4cf952b9
tiagonapoli
force-pushed
the
tiagonapoli/fix-bftree-native-packaging
branch
from
July 22, 2026 04:17
f979d8b to
ff37813
Compare
tiagonapoli
force-pushed
the
tiagonapoli/fix-bftree-native-packaging
branch
2 times, most recently
from
July 22, 2026 16:52
8a77ba9 to
5af9e7d
Compare
tiagonapoli
force-pushed
the
tiagonapoli/fix-bftree-native-packaging
branch
from
July 22, 2026 17:13
5af9e7d to
253533e
Compare
badrishc
approved these changes
Jul 23, 2026
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.
Problem
Microsoft.Garnetfails to consume on Windows with:The native Rust library
bftree_garnet.dllleaked into the package'slib/<tfm>/folder,where NuGet treats every DLL as a managed assembly. Because the native has no assembly
manifest, restore/build of any consumer emits MSB3246.
Root cause
PR #1933 added a fallback to
BfTreeInterop.csprojthat copies the committedruntimes/<rid>/native/binary to the build output root whenever a fresh cargo buildis absent (i.e. no Rust — the packaging build). From the output root the native propagated
through
ProjectReferenceintoGarnet.host's output root and was swept intolib/<tfm>by
Garnet.host.csproj'slib\*.dllwildcard.#1933 added that fallback because, at the time,
BfTreeInterop.testreferenced onlyBfTreeInteropand could not otherwise find the native without Rust. That is no longertrue (see below), so the fallback is pure liability now.
Fix
Structured as a clean, auditable revert-and-reapply:
native binaries to match the current Rust FFI (
bftree_deletereturns an int status;fixes RangeIndex
RI.DEL: invalid arguments), and drop the CI step that built thecdylib with cargo. The output-root fallback is deliberately NOT reintroduced.
Net change vs
main: the 13-line output-root fallback removed fromBfTreeInterop.csproj.(The revert/re-apply of the CI step and binaries nets to zero.)
Why no resolver / no output-root copy is needed
bftree_garnetis a ProjectReference native staged only underruntimes/<rid>/native/.A native library is loadable when its directory is on the
NATIVE_DLL_SEARCH_DIRECTORIESlist, which the host builds from
nativeruntimeTargetsentries in the app'sdeps.json.ProjectReference natives get no such entry — but NuGet-packaged natives (diskann, lua54)
do, and they register
runtimes/win-x64/native/andruntimes/linux-x64/native/. Sincebftree_garnetis staged in that same directory, it loads for free ("free-rides").Since #1939,
BfTreeInterop.testreferencesGarnet.test(→ GarnetServer → diskann/lua54),so its
deps.jsonregistersruntimes/<rid>/native/and it free-rides exactly like everyother test host (e.g.
Garnet.test.rangeindex). No output-root copy and no customDllImportResolverare required.Verification
Windows (the actual bug), Release pack with no Rust:
lib/runtimes/mainlib/net8.0/bftree_garnet.dll,lib/net10.0/bftree_garnet.dll(leak)runtimes/{win-x64,linux-x64}/native/Clean-room Linux Docker container (
dotnet/sdk:10.0, no Rust toolchain, cloned freshfrom a git bundle — no host files copied):
Garnet.slnxbuild (Release): 0 warnings, 0 errors, no MSB3246.BfTreeInterop.test: 46/46 pass with no output-root copy and no resolver — provingthe diskann free-ride is sufficient.
Garnet.test.rangeindex: 63/63 pass.Also verified on Windows: full solution build plus
BfTreeInterop.test46/46 andGarnet.test.rangeindex63/63 without Rust.