Improve Unity WebGL handling for stackless Unity log-callback exception reports.#282
Merged
Improve Unity WebGL handling for stackless Unity log-callback exception reports.#282
Conversation
Add helper for Unity log-callback diagnostics and stackless classification
ILogHandler that intercepts Debug.LogException
…n no managed frames exist
Add BT_CaptureJavaScriptStack jslib export for stack-at-capture
Capture original Debug.LogException Classify stackless logs Lock background queue
Collaborator
Author
|
can be improved to not send directly from
|
Collaborator
Author
|
Addressables integration is a great feature but is better suited for a subsequent PR. |
Make AddAnnotation internal Remove chaining Add no-fallback factory
Remove chaining in custom annotation overload
Add candidate model for original exception capture
Add candidate store with prefix matching
Add factory that picks stack source per Unity log callback
Wire candidate store and report factory Drop suppression queue
Add factory tests for stack-source
Update source-code flow tests for stackless and frame bearing paths
Restrict candidate prefixes to type+message Fall back to type only when empty
Filter capture-path by prefix and fall back to log type
Update Test case to assert reports with recovered frames drop stackless reason
…stack is empty Update Test case to cover original exception unparsed-stack diagnostic
Pass thread id to helper tests and assert it
Add Test case for candidate thread id propagation for background-thread captures
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.
Summary
Improve Unity WebGL handling for stackless Unity log-callback exception reports.
This change adds diagnostics for reports where Unity supplies an
ErrororExceptionlog message but an emptystackTracestring throughApplication.logMessageReceivedorApplication.logMessageReceivedThreaded.It also adds WebGL-default observation of original exceptions passed through
Debug.LogException(exception)by wrappingDebug.unityLogger.logHandler.The log handler does not send reports directly. It records the original exception as a short-lived candidate, forwards to Unity's original/custom log handler, and waits for Unity's log callback. The Unity log callback remains the single send trigger.
When the Unity callback returns, the SDK chooses the best available stack source:
stackTrace, if present and parseable.Problem
Some Unity WebGL reports arrive with an exception message but no stack frames.
The raw payload has an empty exception
stackTraceand an empty thread stack, so there are no frames for the server or UI to symbolize.The existing Unity log-callback path builds reports from:
messagestackTraceLogTypeUnity does not provide the original
Exceptionobject throughApplication.logMessageReceived.This made stackless WebGL events difficult to triage because the report did not clearly explain whether the SDK received an empty Unity callback stack, recovered an original exception stack, or had no usable stack source.
Changes
Add capture-path diagnostics for Unity log-callback reports:
backtrace.unity.capture_pathbacktrace.unity.log.typebacktrace.unity.log.stacktrace.emptybacktrace.unity.log.stacktrace.lengthbacktrace.unity.log.message.lengthbacktrace.unity.log.thread.idbacktrace.unity.log.thread.is_mainbacktrace.unity.stacktrace_log_type.errorbacktrace.unity.stacktrace_log_type.exceptionbacktrace.unity.stack_sourcebacktrace.unity.report.frames.emptybacktrace.unity.stackless.reasonAdd WebGL-default
Debug.unityLogger.logHandlerexception observation:Exceptionobjects passed throughDebug.LogExceptionAdd internal no-environment-fallback stack construction for SDK-owned Unity log-callback reports so stackless original exceptions do not create SDK capture-time frames.
Preserve recent Unity log/source context even when a report has zero frames.
Preserve enriched
BacktraceReportattributes and annotations through background-thread queueing.Make background log handling and log-manager access thread-safe.
Add internal report annotations:
Unity log captureUnity log handler exceptionWebGL JavaScript stack at captureAdd optional WebGL JavaScript stack-at-capture annotation, disabled by default.
What this does not do
This does not synthesize managed C# stack frames when Unity provides neither a callback stack nor an original exception object with a usable stack.
If Unity supplies
stackTrace == ""and the original exception object is unavailable or stackless, Backtrace records that fact and preserves the best available context.Tests
ref : BT-6857