Skip to content

fix: SPM manifest compilation on Swift 6.1#7800

Open
WhiteHyun wants to merge 1 commit intogetsentry:v8.xfrom
WhiteHyun:fix/spm-manifest-swift-6.1
Open

fix: SPM manifest compilation on Swift 6.1#7800
WhiteHyun wants to merge 1 commit intogetsentry:v8.xfrom
WhiteHyun:fix/spm-manifest-swift-6.1

Conversation

@WhiteHyun
Copy link
Copy Markdown

@WhiteHyun WhiteHyun commented Apr 14, 2026

📜 Description

Remove the encoding: argument from String(cString:) in Package@swift-6.1.swift so the manifest compiles on Swift 6.1 / Xcode 16+.

💡 Motivation and Context

String(cString:encoding:) is a Foundation extension on String and is not available in the manifest context. On Swift 6.1 / Xcode 16+, manifest compilation fails with:

/Package@swift-6.1.swift:72:51: error: extra argument 'encoding' in call
/Package@swift-6.1.swift:72:51: error: cannot infer contextual base in reference to member 'utf8'

This breaks swift package resolve for downstream projects consuming affected 8.x versions on Xcode 16+.

The stdlib String(cString:) already decodes the C string as UTF-8, so behavior is preserved.

Fixes #7797

💚 How did you test it?

  • swift package dump-package now succeeds on Xcode 16 / Swift 6.1.
  • End-to-end dependency resolution was verified on a consumer project pinning sentry-cocoa in the 8.x range.

No unit tests added — this is a manifest-only change, and the current
test/CI setup does not include a dedicated manifest-compilation check.

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

@sdk-maintainer-bot
Copy link
Copy Markdown

This PR has been automatically closed. All non-maintainer contributions must reference an existing GitHub issue.

Next steps:

  1. Find or open an issue describing the problem or feature
  2. Discuss the approach with a maintainer in the issue
  3. Once a maintainer has acknowledged your proposed approach, open a new PR referencing the issue

Please review our contributing guidelines for more details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Bug Fixes 🐛

  • SPM manifest compilation on Swift 6.1 by WhiteHyun in #7800

🤖 This preview updates automatically when you update the PR.

`String(cString:encoding:)` is a Foundation extension on `String`
and is not available in the SwiftPM manifest context, where only
`PackageDescription` is imported. On Swift 6.1 / Xcode 16+,
`swift package resolve` now fails with:

    error: extra argument 'encoding' in call

Use the stdlib `String(cString:)` initializer, which already
decodes as UTF-8 and matches the original intent.
@WhiteHyun WhiteHyun force-pushed the fix/spm-manifest-swift-6.1 branch from 7f1a959 to 1f578da Compare April 14, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants