Skip to content

feat(native): enable the native backend on Xbox#1666

Merged
tustanivsky merged 17 commits intomasterfrom
feat/native-backend-xbox
Apr 24, 2026
Merged

feat(native): enable the native backend on Xbox#1666
tustanivsky merged 17 commits intomasterfrom
feat/native-backend-xbox

Conversation

@tustanivsky
Copy link
Copy Markdown
Collaborator

@tustanivsky tustanivsky commented Apr 23, 2026

Summary

This PR enables the native (out-of-process) backend for the Xbox GDK (XSX, XboxOne) and WinGDK targets that previously fell back to breakpad by default and couldn't select native due to build-time link errors plus a handful of runtime-API usages incompatible with the Xbox gaming partition.

Now, SENTRY_BACKEND=native produces a working out-of-process daemon that spawns at sentry_init, captures minidumps via MiniDumpWriteDump, and uploads envelopes over WinHTTP on Xbox.

Enabler for https://github.com/getsentry/sentry-xbox/pull/128.

Changes

Build

  • Skip the explicit dbghelp.lib link and the #pragma comment(lib, "dbghelp.lib") directive when targeting Xbox. On consoles, MiniDumpWriteDump is provided by xgameplatform.lib (via an API set), while the desktop dbghelp.lib is intentionally excluded by the Xbox toolchain’s /NODEFAULTLIB list. Verified via the Xbox GDK sample AdvancedExceptionHandling, where XSX configurations link $(Console_Libs) (without Dbghelp.lib) and successfully call MiniDumpWriteDump.

Thread enumeration

  • Guard enumerate_threads_from_process with SENTRY_PLATFORM_XBOX - the ToolHelp32 API (CreateToolhelp32Snapshot, THREADENTRY32, Thread32First/Next) is not available in the Xbox gaming partition. MiniDumpWriteDump still captures all thread contexts from the target PID; the skipped code only populated supplementary per-thread metadata for the Sentry event payload.

Daemon startup on Xbox

  • Call XGameRuntimeInitialize at daemon main entry - required before any XNetworking calls made by the transport during crash upload. Pair with XGameRuntimeUninitialize on exit.

  • Pre-warm XNetworking on a detached thread rather than inline. Per the GDK docs on network initialization:

    Network initialization usually takes a couple of seconds on both resume and title launch and varies based on console type and the user's network environment.

Running the warm-up inline could push the daemon’s ready signal past the parent’s SENTRY_CRASH_DAEMON_READY_TIMEOUT_MS window on retail cold boots; backgrounding keeps sentry_init fast while ensuring the network stack is typically ready by the time a crash occurs.

Related items

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 23, 2026

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against a0a8d05

@tustanivsky tustanivsky marked this pull request as ready for review April 24, 2026 06:10
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 34c081d. Configure here.

Comment thread src/backends/native/sentry_crash_daemon.c Outdated
Comment thread src/backends/native/minidump/sentry_minidump_windows.c Outdated
Comment thread src/backends/native/sentry_crash_daemon.c Outdated
Copy link
Copy Markdown
Member

@JoshuaMoelans JoshuaMoelans left a comment

Choose a reason for hiding this comment

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

LGTM, just two very minor nits

Comment thread src/backends/native/sentry_crash_daemon.c Outdated
Comment thread CHANGELOG.md Outdated
tustanivsky and others added 3 commits April 24, 2026 12:33
Co-authored-by: JoshuaMoelans <60878493+JoshuaMoelans@users.noreply.github.com>
Co-authored-by: JoshuaMoelans <60878493+JoshuaMoelans@users.noreply.github.com>
Comment thread src/backends/native/sentry_crash_daemon.c
@tustanivsky tustanivsky merged commit 73fb1e8 into master Apr 24, 2026
60 checks passed
@tustanivsky tustanivsky deleted the feat/native-backend-xbox branch April 24, 2026 10:56
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.

4 participants