Skip to content

feat: native Xbox crash reporting through the BugSplat Xbox add-on - #262

Open
bobbyg603 wants to merge 7 commits into
mainfrom
feat/xbox
Open

bobbyg603 wants to merge 7 commits into
mainfrom
feat/xbox

Conversation

@bobbyg603

@bobbyg603 bobbyg603 commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Summary

The public-package half of the Xbox work in #261. The GDKX build of bugsplat-windows has the same BugSplat_* C API as the desktop build, so the existing Windows bindings now also compile for UNITY_GAMECORE. The GDKX binaries are only for verified Xbox developers and ship in a separate add-on. This package doesn't reference anything from it.

  • Fallback when the add-on is missing. BugSplat_Init throws DllNotFoundException, which is caught once at startup. The player logs where to get the add-on and keeps reporting managed exceptions. Every later native call already checks nativeCrashReportingEnabled.
  • Desktop-only features stay desktop-only. On Xbox the crash dialog is forced off. The WER status check, SetWindowsCrashDialogEnabled and SetWindowsHangDetectionTimeout stay UNITY_STANDALONE_WIN only.
  • New option. BugSplatOptions.UseNativeCrashReportingForXbox defaults to true, matching the other platforms.
  • Sample. The crash scenario menu now works with a gamepad or keyboard, which it needs on Xbox. It selects the first runnable row, outlines the focused button and scrolls it into view. The feedback dialog takes focus when it opens and closes on B or Escape.
  • Docs. The README gets a Consoles note and the CHANGELOG an Added entry.

Verification

This machine has no GameCore module, so the Xbox branches were exercised by adding #define UNITY_GAMECORE to a scratch copy of BugSplat.cs and building a Windows player (Unity 6000.5, Mono):

Run Result
Normal Windows build Builds
Windows build with the Xbox code path, desktop BugSplat.dll present Builds and runs: native reporting starts, the WER warning is skipped
Same build with BugSplat.dll removed (no add-on) Logs the add-on warning, native=False, managed reporting still initialized

EditMode tests pass 18/18 and PlayMode tests pass 158/158, including a new default test for UseNativeCrashReportingForXbox.

Still to do on a devkit (#261)

  • A Unity GameCore build compiles with the real module (Series and Xbox One).
  • A native crash uploads and symbolicates from an Xbox player with the add-on installed.
  • Check the crash type. Native crashes are tagged 15 (Unity native) so the backend applies the IL2CPP line mappings; confirm that's right for Xbox dumps.
  • Check the crash-completion behavior (hard terminate after upload) against the platform's process rules.
  • Gated add-on: the GDKX binaries, their import settings, the post-build layout and symbol upload.

🤖 Generated with Claude Code

https://claude.ai/code/session_0153YxLptnAqnBKq5T1hyrtC

Copilot AI balanced review requested due to automatic review settings October 30, 2026 21:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Testing was limited to a desktop Mono simulation, leaving real GameCore builds and Xbox devkit validation of native-library loading/fallback, crash upload/symbolication, and process termination outstanding.

No open issues 🎉

What changed in this PR

Adds the public-package support for native Xbox crash reporting by reusing the Windows bindings with the separately distributed BugSplat Xbox add-on. Real GameCore builds and devkit validation remain pending.

Changes:

  • Enables native bindings for UNITY_GAMECORE, with managed-only fallback when the native library is missing.
  • Adds a default-enabled Xbox option while keeping desktop-specific controls off Xbox.
  • Documents console support and tests the new option’s default.
File Description
Tests/​Runtime/​BugSplatInitializationTests.cs Tests that native Xbox reporting defaults to enabled.
Runtime/​Client/​BugSplatOptions.cs Adds the Xbox native reporting option and add-on guidance.
Runtime/​BugSplat.cs Extends Windows bindings to Xbox and handles a missing native library.
README.md Explains console support and gated add-on access.
CHANGELOG.md Records Xbox support, fallback behavior, and desktop-only options.

Review effort: Balanced

Base automatically changed from fix/postbuild-without-asset to main October 31, 2026 10:06
The GDKX build of bugsplat-windows has the same BugSplat_* C API as the
desktop build, so the Windows bindings now compile for UNITY_GAMECORE
too. The GDKX binaries are gated to verified Xbox developers and ship
in a separate add-on; this package references nothing from it. When the
add-on is missing, BugSplat_Init throws DllNotFoundException, which is
caught once at startup: the player logs where to get the add-on and
keeps reporting managed exceptions. Every later native call already
checks nativeCrashReportingEnabled.

On Xbox the crash dialog is forced off, and the Windows Error Reporting
status, the WindowsShowCrashDialog setter and hang detection stay
desktop-only. UseNativeCrashReportingForXbox (default true) turns it
off.

No GameCore module here, so the Xbox branches were compiled by adding
#define UNITY_GAMECORE to a scratch copy of BugSplat.cs and building a
Windows player. That player started native reporting on the desktop
BugSplat.dll and skipped the WER check, and with BugSplat.dll removed
it logged the add-on warning and still initialized managed reporting.

Refs #261

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0153YxLptnAqnBKq5T1hyrtC
bobbyg603 and others added 6 commits October 31, 2026 07:06
…oard

uGUI only navigates from a selected control, and the menu's buttons
are built in code, so nothing was selected and a controller on Xbox
had no way to move through the list. The menu now selects the first
runnable row, keeps a row selected when focus is lost, outlines the
focused button, and scrolls it into view. Non-runnable rows are
skipped because they're not interactable.

The feedback dialog takes focus on Cancel when it opens, closes on
Cancel (B, or Escape), and dims buttons until focused. The menu is made
non-interactable while it's open, because navigation is spatial and
the stick would otherwise move focus onto the rows behind the dialog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0153YxLptnAqnBKq5T1hyrtC
The sample treated Xbox as an unknown platform: its status line said
native crash reporting was unsupported and it offered no native
scenarios. Xbox now gets a NATIVE group - null write, the same on a
background thread, Unity's ForceCrash access violation, and a stack
overflow - and the status line and hint name Xbox and the BugSplat for
Xbox package.

The faults avoid the kernel32 P/Invokes the Windows scenarios use,
which a Game Core title may not be able to load by name. Consoles are
IL2CPP only, so a null write through Marshal is a real native fault
there. Fail-fast and hang scenarios are left out: there is no WER on
Xbox, and hang detection is desktop only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0153YxLptnAqnBKq5T1hyrtC
ForceCrash goes through Unity's own crash path rather than the
process's exception handler, so BugSplat doesn't capture it - the
reason no other platform's scenarios use it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0153YxLptnAqnBKq5T1hyrtC
The Xbox add-on needs to upload the PDBs and binaries an Xbox build
produces, which the package's own build step knows nothing about.
BugSplatSymbolUpload.Upload(directory, globPattern, options) exposes
the existing upload - the pinned, SHA-256-verified symbol-upload, the
per-database credentials, and the options' database, application and
version - instead of the add-on carrying its own copy.

UploadDebugSymbolsForXbox defaults to true, as Windows does: Xbox
crashes don't symbolicate without the upload, and Unity's public
symbol server doesn't have the Xbox player's symbols.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0153YxLptnAqnBKq5T1hyrtC
The access-violation scenarios walk AccessViolationWrite through
NativeCrashFrame0..2 so a report shows a game-code call stack, but each
was an expression-bodied call in tail position. MSVC compiled those
calls to jumps, so on Xbox (IL2CPP) the frames never existed and the
report went straight from UnityAction.Invoke to Marshal.WriteInt32.
NoInlining stops inlining, not tail calls.

Each frame, and the Crash helper that runs the scenario, now writes the
volatile Sink after its call, which keeps the call out of tail position
on Windows and Xbox alike.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0153YxLptnAqnBKq5T1hyrtC
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.

3 participants