Skip to content

Fix native wrapper references pointing at a nonexistent libs path (breaks all AnyCPU/design-time builds)#50

Open
anagnorisis2peripeteia wants to merge 1 commit into
hbashton:mainfrom
anagnorisis2peripeteia:fix/native-lib-anycpu-resolution
Open

Fix native wrapper references pointing at a nonexistent libs path (breaks all AnyCPU/design-time builds)#50
anagnorisis2peripeteia wants to merge 1 commit into
hbashton:mainfrom
anagnorisis2peripeteia:fix/native-lib-anycpu-resolution

Conversation

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor

Fifth find from the mutation-testing campaign (#37 / #46): the three bundled wrapper references in DS4WinWPF.csproj point at a directory that doesn't exist.

FakerInputWrapper, SharpOSC, and Nefarius.ViGEm.Client are referenced via ..\libs\$(Platform)\…, which from the project directory resolves to a repo-root libs\ — but the DLLs actually live at DS4Windows\libs\{x64,x86}. Normal x64/x86 builds still work only by accident: the content items lower in the csproj use the correct libs\… path, and MSBuild's reference resolution falls back to those candidate files. Those items are conditionally removed unless Platform is exactly x64/x86 — so under AnyCPU, both mechanisms fail and compilation dies with CS0246 (ViGEmClient etc. not found).

AnyCPU is what evaluation-style builds use — IDE design-time builds, analyzers, and mutation/analysis tooling. Concretely, Stryker.NET's own suggested repro fails on this repo today:

dotnet build DS4WindowsTests.csproj -c Debug --property:Platform=AnyCPU

The change: point the HintPaths at the real location (libs\… under the project directory) and introduce NativeLibPlatform (x86 → x86, everything else → x64) so AnyCPU evaluation builds resolve the references. Normal x64/x86 builds are unchanged in behaviour.

Before / After

Same command (dotnet build DS4WindowsTests\DS4WindowsTests.csproj -c Debug --property:Platform=AnyCPU), same machine:

Run Result
Base (ba4bdcb) ❌ 41 errors — CS0246: ViGEmClient / IXbox360Controller / … (unresolvable references under AnyCPU)
This branch ✅ builds

x64 full test suite + x64/x86 publishes: no change (verified in CI evidence).


Local review history: https://gist.github.com/2695686d512cecd8c7f9921a969ff240

The FakerInputWrapper/SharpOSC/Nefarius.ViGEm.Client references pointed at
..\libs\$(Platform)\, which resolves to a non-existent repo-root libs\ folder
(the libs actually live under DS4Windows\libs\{x64,x86}), and $(Platform) is only
ever x64/x86. Normal x64/x86 builds tolerate the unresolved HintPath (the wrapper
DLLs are picked up as content), but design-time / analysis builds force
Platform=AnyCPU, which has no libs folder, so the references fail to resolve and the
project can't be analyzed by tooling such as Stryker.NET.

Point the HintPaths at the real location (libs\...) and add a NativeLibPlatform that
falls back to x64 when Platform is AnyCPU or empty, so both the normal builds and
AnyCPU analysis builds resolve the references.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant