-
-
Notifications
You must be signed in to change notification settings - Fork 57
fix: Handle WebGL specific options explicitly #2322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
…ntry/sentry-unity into feat/update-webgl-handling
mujacica
approved these changes
Sep 23, 2025
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
- Handle WebGL specific options explicitly ([#2322](https://github.com/getsentry/sentry-unity/pull/2322))If none of the above apply, you can opt out of this check by adding |
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.
Fixes #2190, #2249
The WebGL support was lacking in a couple of areas:
Exception Capture & Stack Traces
When targeting WebGL, exception support is controlled via Publishing Setting
Enable Exceptions. This has multiple levels:The exception capture needs to be raised above
Nonefor the SDK to function. When set toNone, managed exceptions crash the game - we now halt the build if we detect this misconfiguration.With the default setting of
Explicitly Thrown Exceptions Only, the SDK'sStackTraceFactoryfails to create stack traces, resulting in events without stack trace information.Solution: When targeting WebGL, the SDK now captures exceptions through the logging integration (
UnityApplicationLoggingIntegration) instead of the incompatibleUnityLogHandlerIntegration. This allows the SDK to parse stack traces from Unity's log messages, providing better error context even with the default WebGL exception settings.Implementation
UnityLogHandlerIntegration(for exceptions) andUnityApplicationLoggingIntegration(for logs)UnityApplicationLoggingIntegrationwith exception handling enabled (captureExceptions: true)Before:
After:
Alternative
An alternative approach would have been to use .NET SDK's
StringStackTraceFactory. But this comes with some drawback such as the lack ofin-appand the missingmechanismkey. Additionally, this would regress the state we have withFull With Stack Traceas this is a build time setting we have no access to at runtime.Crashed Last Run
We were defaulting to
false. But since the SDK does not provide native support for WebGL, this creates the false impression that the last run did not crash. We're setting the callback tonullno and log the state of support when the last run state gets fetched by the user.Improved Logging & Error Messages
Updated WebGL-specific warning messages to be clearer about known limitations:
Previously:
Now:
Build-time Validation
Fixed a bug in the build pre-processor that prevented disabling the SDK when WebGL exception settings were misconfigured, ensuring developers can always build their projects.