fix: Gracefully handle missing native SDK on consoles#2516
fix: Gracefully handle missing native SDK on consoles#2516bitsandfoxes wants to merge 3 commits intomainfrom
Conversation
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Internal Changes 🔧Deps
Release
Other
🤖 This preview updates automatically when you update the PR. |
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Fixes
- Gracefully handle missing native SDK on consoles ([#2516](https://github.com/getsentry/sentry-unity/pull/2516))If none of the above apply, you can opt out of this check by adding |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| public static bool Init(SentryUnityOptions options) | ||
| { | ||
| _useLibC = Application.platform | ||
| _useStructVaList = Application.platform |
There was a problem hiding this comment.
Xbox/PS5 stubs use wrong DllImport library name
High Severity
When using native stubs (no real sentry library present), Xbox and PS5 builds will fail to link because SentryLib is set to "sentry" but the stub functions are statically compiled into the IL2CPP build and require [DllImport("__Internal")] to be found. Only SENTRY_NATIVE_SWITCH uses "__Internal", but the newly added SENTRY_NATIVE_XBOX and existing SENTRY_NATIVE_PLAYSTATION do not. The P/Invoke calls will look for an external sentry library that doesn't exist in stub mode.
|
Well that's a bunch of nonsense. |


Follow-up on #2503
If there is no console specific lib found, the SDK needs to gracefully degrade as to not break builds.
This is achieved via a unified
sentry_native_stubs.cthat is getting managed at compile time via theNativePluginBuildPreProcess.cs. This should (tm) work even when installing the package via the package manager due toisOverridable: 1in the stubs' .meta file.