fix(webgl): invoke callback when the upload guard skips a report - #205
Open
bobbyg603 wants to merge 1 commit into
Open
fix(webgl): invoke callback when the upload guard skips a report#205bobbyg603 wants to merge 1 commit into
bobbyg603 wants to merge 1 commit into
Conversation
WebGLReporter bare `yield break`d on both guard-skip paths, so callers that await the callback to learn a report's fate hang forever on WebGL. DotNetStandardExceptionReporter already invokes the callback with a skip result, so the two reporters advertised the same IExceptionReporter contract while honouring different ones. Both early returns now invoke the callback with the same ExceptionReporterPostResult shape and message wording the DotNet reporter uses. Post hoists ex.ToString() so the skip result carries the same stack trace the upload path would have sent. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR aligns WebGLReporter with the IExceptionReporter contract by ensuring the caller-provided callback is invoked even when the report upload guard prevents posting, matching the skip-result shape and wording used by DotNetStandardExceptionReporter.
Changes:
- Invoke the callback with a “skipped”
ExceptionReporterPostResultonWebGLReporterguard-skip paths (LogMessageReceivedandPost(Exception)). - Hoist the exception string generation in
WebGLReporter.Post(Exception)so the skip path returns the same exception/stack trace representation as the upload path. - Add Unity tests asserting the callback fires and that
Uploaded/Exception/Messagematch the expected skip result.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Runtime/Reporter/WebGLReporter.cs | Ensures callbacks are invoked on guard-skip paths with standardized “skipped” results. |
| Tests/Runtime/Reporter/WebGLReporterTests.cs | Adds tests validating callback invocation and skipped-result contents for guard skips. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
60
to
64
| public IEnumerator Post(Exception ex, IReportPostOptions options = null, Action<ExceptionReporterPostResult> callback = null) | ||
| { | ||
| var stackTrace = ex.ToString(); | ||
|
|
||
| if (!reportUploadGuardService.ShouldPostException(ex)) |
daveplunkett
approved these changes
Aug 12, 2026
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.
Closes #165
Problem
WebGLReporterdid a bareyield breakon both of its guard-skip paths, so the caller'sAction<ExceptionReporterPostResult>was never invoked.DotNetStandardExceptionReporterinvokes it with a skip result (Uploaded = falseplus a "skipped" message), so the two reporters advertised the sameIExceptionReportercontract while honouring different ones. Anything awaiting the callback to learn a report's fate hung forever on WebGL.Fix
Both early returns in
WebGLReporternow invoke the callback with the sameExceptionReporterPostResultshape and message wordingDotNetStandardExceptionReporteruses:LogMessageReceived->"BugSplat upload skipped due to ShouldPostLogMessage check.",Exception = stackTracePost(Exception)->"BugSplat upload skipped due to ShouldPostException check.",Exception = ex.ToString()Posthoistsex.ToString()into a local so the skip result carries the same stack trace the upload path would have sent, matching the DotNet reporter line for line.Audited every exit in the WebGL report flow: those two
yield breaks were the only callback-less ones.WebGLReporter.Post(string, ...)has no early return, andWebGLExceptionClient.PostExceptionalready invokes the callback on both its success and failure paths.Tests
Added to
Tests/Runtime/Reporter/WebGLReporterTests.cs, alongside the existing guard-returns-false tests, using the existingFakeFalseReportUploadGuardService/FakeWebGLExceptionClientfakes:LogMessageReceived_WhenReportUploadGuardServiceReturnsFalse_ShouldInvokeCallbackWithSkippedResultPost_WhenReportUploadGuardServiceReturnsFalse_ShouldInvokeCallbackWithSkippedResultEach asserts the callback fires and that
Uploaded,Exception, andMessagematch the DotNet reporter's skip result.Verification
Runtime/**+Tests/Runtime/**compile clean against the Unity 6000.5.6f1 managed assemblies, both with no platform define and withUNITY_WEBGLdefined —WebGLReporterandWebGLClientSettingsRepositoryare compiled on all platforms, so the change had to build everywhere. 0 errors in both configurations; the only warnings are the two pre-existingCS0649s inRuntime/BugSplat.cs.Both changed paths were also executed directly (a throwaway driver compiled into the same assembly, driving the coroutines to completion with a false guard): each invokes its callback exactly once with
Uploaded = false, the expected message, the expected stack trace, and zero calls through to the exception client. Unity[UnityTest]cases were not run in the editor here; the test runner needs a licensed Unity session.🤖 Generated with Claude Code