Skip to content

[sharpie] Show a helpful error message when installed on x64#25359

Open
rolfbjarne wants to merge 9 commits into
mainfrom
dev/rolf/sharpie-x64
Open

[sharpie] Show a helpful error message when installed on x64#25359
rolfbjarne wants to merge 9 commits into
mainfrom
dev/rolf/sharpie-x64

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

When users try to install sharpie on x64 Macs, they previously got a
confusing 'DotnetToolSettings.xml was not found' error because the
nupkg only contained an arm64 binary.

Fix this by including a small x64 native binary in the nupkg that
prints a clear error message explaining that sharpie requires Apple
Silicon and suggests using an arm64 Mac.

Fixes #25339

When users try to install sharpie on x64 Macs, they previously got a
confusing 'DotnetToolSettings.xml was not found' error because the
nupkg only contained an arm64 binary.

Fix this by including a small x64 native binary in the nupkg that
prints a clear error message explaining that sharpie requires Apple
Silicon and suggests using an arm64 Mac.

Fixes #25339

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 7, 2026 08:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Packages an osx-x64 “shim” executable into the Sharpie.Bind.Tool .NET tool NuGet so that x64 installs fail with a clear, actionable message instead of the confusing “DotnetToolSettings.xml was not found” error (fixing #25339).

Changes:

  • Adds an osx-x64 NativeAOT shim project that prints a targeted unsupported-platform error and exits non-zero.
  • Extends the tool pack to include an osx-x64 DotnetToolSettings.xml plus the shim executable under tools/any/osx-x64/.
  • Updates the sharpie Makefile to publish the shim before packing the tool nupkg.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tools/sharpie/Sharpie.Bind.Tool/Sharpie.Bind.Tool.csproj Attempts to include x64 shim + x64 DotnetToolSettings into the packed tool nupkg.
tools/sharpie/Sharpie.Bind.Tool/DotnetToolSettings.osx-x64.xml Defines sharpie command for the osx-x64 runtime folder using an executable runner.
tools/sharpie/Sharpie.Bind.Tool.Unsupported/Sharpie.Bind.Tool.Unsupported.csproj New shim project that publishes an osx-x64 NativeAOT executable named Sharpie.Bind.Tool.
tools/sharpie/Sharpie.Bind.Tool.Unsupported/Program.cs Implements the shim’s user-facing error message and exit code.
tools/sharpie/Makefile Ensures shim is published prior to dotnet pack for the tool.

Comment on lines +55 to +68
<!-- Include the x64 shim in the nupkg so that x64 users get a helpful error message -->
<PropertyGroup>
<_X64ShimPublishDir>$([MSBuild]::NormalizePath('$(MSBuildThisFileDirectory)', '..', 'Sharpie.Bind.Tool.Unsupported', 'bin', 'Release', 'osx-x64', 'publish'))</_X64ShimPublishDir>
</PropertyGroup>

<Target Name="_IncludeX64Shim" AfterTargets="PackTool" Condition="'$(PackAsTool)' == 'true'">
<ItemGroup>
<TfmSpecificPackageFile Include="$(_X64ShimPublishDir)/Sharpie.Bind.Tool">
<PackagePath>tools/any/osx-x64/</PackagePath>
</TfmSpecificPackageFile>
<TfmSpecificPackageFile Include="$(MSBuildThisFileDirectory)DotnetToolSettings.osx-x64.xml">
<PackagePath>tools/any/osx-x64/DotnetToolSettings.xml</PackagePath>
</TfmSpecificPackageFile>
</ItemGroup>
<_X64ShimPublishDir>$([MSBuild]::NormalizePath('$(MSBuildThisFileDirectory)', '..', 'Sharpie.Bind.Tool.Unsupported', 'bin', 'Release', 'osx-x64', 'publish'))</_X64ShimPublishDir>
</PropertyGroup>

<Target Name="_IncludeX64Shim" AfterTargets="PackTool" Condition="'$(PackAsTool)' == 'true'">
Comment thread tools/sharpie/Makefile Outdated
Comment on lines +23 to +31
SHARPIE_BIND_TOOL_X64_SHIM=Sharpie.Bind.Tool.Unsupported/bin/Release/osx-x64/publish/Sharpie.Bind.Tool

pack: $(SHARPIE_BIND_TOOL_NUPKG)
$(SHARPIE_BIND_TOOL_NUPKG): $(Sharpie.Bind_dependencies)
$(SHARPIE_BIND_TOOL_NUPKG): $(Sharpie.Bind_dependencies) $(SHARPIE_BIND_TOOL_X64_SHIM)
$(Q_BUILD) $(DOTNET) pack Sharpie.Bind.Tool/Sharpie.Bind.Tool.csproj "/p:Version=$(SHARPIE_VERSION)" "/p:CurrentBranch=$(CURRENT_BRANCH)" "/p:CurrentHash=$(CURRENT_HASH_LONG)" $(DOTNET_PACK_VERBOSITY) -bl:$@.binlog

$(SHARPIE_BIND_TOOL_X64_SHIM):
$(Q_BUILD) $(DOTNET) publish Sharpie.Bind.Tool.Unsupported/Sharpie.Bind.Tool.Unsupported.csproj -c Release $(DOTNET_BUILD_VERBOSITY) -bl:$@.binlog

Console.Error.WriteLine ("error: sharpie is not supported on x64. Please use an Apple Silicon (arm64) Mac.");
Console.Error.WriteLine ();
Console.Error.WriteLine ("sharpie requires Apple's libclang, which is only available for arm64.");
Console.Error.WriteLine ("If you're running on an Intel Mac, consider using a Mac with Apple Silicon (M1 or later).");
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

rolfbjarne and others added 2 commits May 13, 2026 12:43
- Use TargetsForTfmSpecificContentInPackage instead of AfterTargets=PackTool
  so the x64 shim is included during packing, not after.
- Add an Exists check with a clear error message if the shim hasn't been
  published before packing.
- Add source file dependencies to the Makefile shim target so changes to
  the Unsupported project trigger a rebuild.
- Fix error message wording to not assume Intel hardware (could be Rosetta).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

rolfbjarne and others added 4 commits May 14, 2026 09:03
Replace the Sharpie.Bind.Tool.Unsupported NativeAOT project with a simple
bash script. This removes the need for a separate publish step and simplifies
the build pipeline.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Use None items with Pack=true instead of TfmSpecificPackageFile in a target,
and use the actual TargetFramework instead of 'any' to match the arm64 tool's
TFM folder structure.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Two issues found by inspecting the built nupkg:

1. NuGet treats extensionless PackagePath as a directory, so the script
   ended up at tools/.../Sharpie.Bind.Tool/sharpie-unsupported.sh instead
   of tools/.../Sharpie.Bind.Tool. Fix by renaming the script to
   sharpie-x64-shim (no extension), using a directory-style PackagePath
   (trailing /), and updating the DotnetToolSettings EntryPoint to match.

2. TFM mismatch: the arm64 tool is packed under tools/any/ but x64 was
   under tools/$(TargetFramework)/. Change x64 back to tools/any/ to
   match.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #38159fe] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 38159fee30d8652d5c0eb8e2edbd56d6f720f83b [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #38159fe] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 38159fee30d8652d5c0eb8e2edbd56d6f720f83b [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 38159fee30d8652d5c0eb8e2edbd56d6f720f83b [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #38159fe] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 38159fee30d8652d5c0eb8e2edbd56d6f720f83b [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

🔥 [CI Build #38159fe] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

1 tests crashed, 4 tests failed, 153 tests passed.

Failures

❌ introspection tests

4 tests failed, 2 tests passed.

Failed tests

  • introspection/iOS - simulator/Debug: LaunchTimedOut
  • introspection/iOS - simulator/Debug (ARM64): LaunchTimedOut
  • introspection/tvOS - simulator/Debug: LaunchTimedOut
  • introspection/tvOS - simulator/Debug (ARM64): LaunchTimedOut

Html Report (VSDrops) Download

❌ monotouch tests (MacCatalyst)

🔥 Failed catastrophically on VSTS: test results - monotouch_maccatalyst (no summary found).

Html Report (VSDrops) Download

Successes

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. (⚠️ Html Report Publish failed ⚠️) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. (⚠️ Html Report Publish failed ⚠️) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. (⚠️ Html Report Publish failed ⚠️) Download
✅ framework: All 2 tests passed. (⚠️ Html Report Publish failed ⚠️) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 16 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 18 tests passed. (⚠️ Html Report Publish failed ⚠️) Download
✅ monotouch (tvOS): All 16 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. (⚠️ Html Report Publish failed ⚠️) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. (⚠️ Html Report Publish failed ⚠️) Download

macOS tests

✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 38159fee30d8652d5c0eb8e2edbd56d6f720f83b [PR build]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sharpie.Bind.Tool install failed

4 participants