Open
Conversation
Contributor
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Internal Changes 🔧Deps
Other
🤖 This preview updates automatically when you update the PR. |
Contributor
|
…wrapper, barebones SentrySdk entry point, move NativeBridge to Interop namespace, ExampleDotnet demo with buttons
TODO: revert before merge
…from settings, use SentryGodotOptions
project/addons/sentry/dotnet/Sentry.Godot/Internal/SentryGodotInitializer.cs
Show resolved
Hide resolved
bab556b to
9bc4c11
Compare
project/addons/sentry/dotnet/Sentry.Godot/ExceptionHandling/CoreClrExceptionHandler.cs
Show resolved
Hide resolved
project/addons/sentry/dotnet/Sentry.Godot/ExceptionHandling/LoggerExceptionHandler.cs
Show resolved
Hide resolved
Collaborator
Author
project/addons/sentry/dotnet/Sentry.Godot/ExceptionHandling/CoreClrExceptionHandler.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 742a0ab. Configure here.
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.

Adds .NET support to the SDK. Godot games written in C# can now use Sentry on par with GDScript projects, capturing exceptions, scopes, breadcrumbs, and everything else Sentry's .NET SDK supports. The .NET layer ships as a
Sentry.Godotlibrary inside the addon and can be wired into the user's.csprojvia a single<Import>ofSentry.Godot.props.How it works
The native C++ layer handles errors from GDScript and the engine, reports native crashes, and submits its own events. This PR adds a .NET layer that does the same for C# code, using Sentry's .NET SDK with its own transport, scopes, and event submission. The two layers are mostly independent - they connect for initialization, coordination and to share options at startup.
The native layer initializes during engine startup, before any .NET assembly loads. On auto-init, options are already resolved on the native side by the time .NET wakes up, so the .NET layer mirrors them across the native/managed boundary instead of re-resolving from scratch.
Initialization works from either side: whichever layer reaches
initfirst signals the other, and a recursion guard makes the second call a no-op. Both auto-init (via[ModuleInitializer]) and manualSentrySdk.Init(callback)end up in the same state.When Godot invokes managed user code, its managed bridge wraps the call in a try/catch and silently swallows any exception thrown. Godot logs an error, but the exception itself is lost. This PR adds first-chance exception handlers that detect those bridge catches and report them with
handled: false.Two handlers cover the cases:
LoggerExceptionHandleris the default and works on all runtimes;CoreClrExceptionHandleris used when the Godot debugger is attached (which suppresses the logger path) and works on CoreCLR only.On Godot API: The .NET layer doesn't depend on GodotSharp - calling into it early in the application lifecycle caused crashes on Android. Instead, the managed layer reaches Godot engine APIs through P/Invoke and native layer.
PR limitations
Sentry.Godot.SentrySdkdoes not expose other SentrySdk methodsWill be added in a separate PR. To address this, I want to try a code generation approach, which would make this PR even bigger than it has to be.
Sentry.SentrySdkis not internalWe add
Sentry.Godot.SentrySdk, but this creates a footgun situation for users - the originalSentry.SentrySdkremains visible. Initializing Sentry throughSentry.SentrySdkwill result in partial initialization. I plan to address this in a separate PR by adding a code analyzer which would produce a compilation warning ifSentry.SentrySdkis used directly.Follow-ups needed
SentrySdk.Dotnet.csto delegate all upstreamSentry.SentrySdkpublic methodsSentry.SentrySdkusageSentry.Godot.propsinto user's.csproj