hotfix: _ANR detector and Sentry reporting Minidump files#8859
Open
NickKhalow wants to merge 1 commit into
Open
hotfix: _ANR detector and Sentry reporting Minidump files#8859NickKhalow wants to merge 1 commit into
NickKhalow wants to merge 1 commit into
Conversation
Contributor
|
Windows and Mac build successful in Unity Cloud! You can find a link to the downloadable artifact below. |
7463d03 to
6969a53
Compare
Collaborator
|
PR #8859, run #26292798681 Builds: Windows change, Windows baseline, macOS change, macOS baseline Framework 13 i7
|
Integrate custom ANR detector with Sentry reporting, native Windows minidump collection, background archival/upload, debug chat commands, and CI flags for opt-in builds.
6969a53 to
aca6f8b
Compare
mikhail-dcl
approved these changes
May 22, 2026
Collaborator
|
PR #8859, run #26296225401 Builds: Windows change, Windows baseline, macOS change, macOS baseline Framework 13 i7
|
Collaborator
|
PR #8859, run #26397329283 Builds: Windows change, Windows baseline, macOS change, macOS baseline Framework 13 i7
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Description
What does this PR change?
Features
MiniDumpWriteDumpAPI/anr-simulate [ms]— Freeze the main thread to trigger ANR detection (default 10s)/anr-dump— Manually collect and archive a process dump (Windows only)Key components
DclAnrIntegration— SentryISdkIntegrationthat creates and registers the watchdogDclAnrWatchDog(abstract) — Base watchdog with pause/resume awareness, configurable timeout, and minidump collection on reportDclAnrWatchDogMultiThreaded— Desktop implementation: a background thread monitors main-thread heartbeats via a coroutine tick counterDclAnrWatchDogSingleThreaded— WebGL fallback: coroutine-based elapsed-time check (single-threaded environment)DclApplicationNotRespondingException— Custom exception type with Sentry mechanism metadata; on Windows, carries the dump file path for attachmentThreadsDumpUtility— Windows-only utility that:MiniDumpWriteDumpWin32 API (viaMiniDumpNative) to generate a.dmpfile — no external binaries requiredPROCESS_QUERY_INFORMATION | PROCESS_VM_READviaProcessInfoNative, with properIDisposablehandle cleanupApplication.persistentDataPathandApplication.streamingAssetsPathon the main thread ([RuntimeInitializeOnLoadMethod]) since Unity APIs are unavailable from background threadsTools/ProcDump/Dump Current) for quick testing during developmentMiniDumpNative— Static class wrapping theDbghelp.dllMiniDumpWriteDumpP/Invoke with thread-info, handle-data, and unloaded-modules dump flagsProcessInfoNative/ProcessHandle— Win32 process handle management withIDisposablefor safe cleanupDclProcesses.ExecuteBlocking/dcl_start_process_blocking— New native C function for blocking process execution (waits for child exit and returns exit code), available on both Windows (_spawnvp _P_WAIT) and macOS (posix_spawnp+waitpid)Debug chat commands (registered in
DynamicWorldContainer)/anr-simulate [ms]— Freezes the main thread for the specified duration (default 10s) to trigger ANR detection/anr-dump— Manually collects and archives a process dump to the app directory (Windows only); runs on a background thread viaExecuteOnThreadPoolScopeSentry diagnostics & CI
DiagnosticInfoUtilsnow logs whether Sentry is enabled, plus its environment, release, and DSN status at startupenable-sentryPR label — Thebuild-unitycloud.ymlworkflow now checks for anenable-sentrylabel on PR builds, allowing Sentry to be activated for specific PRs without requiring a manual workflow inputscript-debuggingPR label /script_debuggingworkflow input — EnablesAllowDebuggingbuild option (forces aDevelopmentbuild). Can be toggled via thescript-debugginglabel on PR builds or thescript_debugginginput forworkflow_dispatch/workflow_calltriggersReportHub.LogErrorin addition to the user-facing error messageNative code changes
dcl_processes.c/.h— Addeddcl_start_process_blocking()for synchronous child process execution; also fixed aCloseHandleleak inget_process_nameon Windows (handle was closed after the buffer was freed)DCLProcesses.dll/.exp/.lib— Rebuilt native binaries with the new blocking exportDclProcessesNativeMethods.cs— Added managed P/Invoke binding fordcl_start_process_blockingThe built-in Sentry ANR integration is explicitly disabled (
DisableAnrIntegration()) to avoid duplicate detection.Test Instructions
Steps (standard run):
Expected result:
Steps (fresh account):
Expected result:
Prerequisites
Test Steps
/anr-simulatechat command (or/anr-simulate 8000for 8s) to freeze the main thread and trigger ANR detectionDclApplicationNotRespondingExceptionevent with a.dmpfile attachment (ZIP-compressed)/anr-dumpchat command to manually collect a dump and confirm the file paths are printedTools > ProcDump > Dump Currentto verify the editor integration worksenable-sentrylabel to a test PR and verify Sentry is enabled in the resulting buildscript-debugginglabel to a test PR and verify the build includesAllowDebuggingandDevelopmentflagsAdditional Testing Notes
MiniDumpWriteDumptakes longer, the dump will fail gracefullyMiniDumpNormal | WithThreadInfo | WithHandleData | WithUnloadedModulesflags (equivalent to procdump-mt)Quality Checklist
Code Review Reference
Please review our Branch & PR Standards before submitting. It explains the automated review flow, QA/DEV approval requirements, and what each label does — especially useful for first-time contributors.