docs(godot): Document C#/.NET support#18295
Conversation
Add documentation for the Godot SDK's C#/.NET support (available in 2.0.0). Introduce a dedicated "C#/.NET Support" page covering setup, initialization, the Sentry.Godot.SentrySdk API, how the native and .NET layers stay in sync, and current limitations. Add GDScript/C# code tabs to the shared snippet includes (usage, enriching events, configuration, sensitive data) so C# examples appear across the Godot docs, and document managed-code stack trace symbolication on the stack traces page. Refs getsentry/sentry-godot#752 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
Missed a bunch of samples, let me add them to this PR. |
|
All the code samples I checked and verified with |
|
Since you added a bunch more samples, there are still a few places without C# snippets https://sentry-docs-git-docs-godot-csharp-dotnet-support.sentry.dev/platforms/godot/enriching-events/attachments/#uploading-attachments (code) https://sentry-docs-git-docs-godot-csharp-dotnet-support.sentry.dev/platforms/godot/configuration/options/ - both init and the hooks examples (code) |
There was a problem hiding this comment.
Good work overall — the C# additions are technically accurate and well-structured. A few issues worth addressing before merge.
Functional issues
-
dotnet/index.mdx—IpAddresssentinel value is wrong.
Inenriching-events/set-user/godot.mdxyou correctly use"{{auto}}", but indotnet/index.mdx(Set the User and Tags section) the C# example doesn't showIpAddressat all. That's fine, but a comment or note thatIpAddress = "{{auto}}"infers the IP would help — the GDScript side callsuser.infer_ip_address()explicitly. -
unset-user/godot.mdx— resetting the user withnew SentryUser()is incorrect.
An emptySentryUserobject is not the same as removing the user. The correct call isscope.User = null(orSentrySdk.ConfigureScope(scope => scope.User = null)). Setting an empty user object may still report a user record to Sentry. -
metrics/usage/godot.mdx— the Alert aboutSetBeforeSendMetricbeing the only way to add global attributes is inaccurate for the common case.
Thebefore_send_metrichook isn't a close equivalent toset_attribute— it runs per-metric and applies attributes on the way out, it doesn't set them on the scope. The Alert text says "it applies attributes to every log" but this is in the metrics section, not the logs section. Fix the copy: it applies to every metric, not every log.
Minor style/clarity issues
-
dotnet/index.mdx— headline "Use the SDK in C#" is followed immediately by the sub-headline "Capture an Exception" with no prose between them.
The style guide requires text between consecutive headings. Add a sentence introducing what the following subsections cover. -
dotnet/index.mdx—options.Release = "my-game@{app_version}";uses a placeholder that looks like a C# format string.
The{app_version}placeholder is ambiguous — it reads like a C# string interpolation hole but it's actually a Sentry template. Either escape it clearly or replace with a concrete string like"my-game@2.0.0"in the Verify section. The same pattern appears in the Manual Initialization snippet ("my-game@{app_version}","{auto}"). -
dotnet/index.mdx— "Don't callSentry.SentrySdk..." alert uses passive voice.
"It skips Godot-specific initialization" — fine. But "The bundled analyzer flags this" could be "The bundled Roslyn analyzer flags this with a warning" to be more precise (already saysSENTRYGD1001, so this is a minor quibble). -
options.mdx— the Alert forbefore_capture_screenshotusestitle="Note".
Sentry docs style uses<Alert>without a title for a plain informational note, or a specific level likelevel="warning". A title of "Note" is redundant with the component itself.
Nit
stack-traces.mdx— "What you need to do depends on the platform" is passive/wordy.
Could be "The steps vary by platform:" — shorter and more direct.
The new dotnet/index.mdx page is well-organized and the two-layer sync explanation is clear and useful. The code tab additions across the platform includes are consistent and correct (tabs, {mdExpandTabs}, etc.). Items 2 and 3 above are the ones that could mislead users.
There was a problem hiding this comment.
Good work overall — the C#/.NET page is well-structured, the code examples are clean, and the scope-sync/trace-linking explanations are clear. A few things to tighten up:
docs/platforms/godot/dotnet/index.mdx
- The
{app_version}/{auto}placeholders in the manual-init example look like Sentry token syntax, but they aren't — they won't be substituted at runtime. If these are meant as literal strings the user replaces, use<your-app-version>/<your-environment>or add a comment. - "Initializing Sentry from either language brings up both layers" — "brings up" is a bit informal; prefer "initializes both layers."
- The
SentryGodotOptionsparagraph says "which extends the .NET SDK'sSentryOptionswith Godot-specific settings such asAttachLog,AttachSceneTree, andAttachScreenshot" but the preceding init example doesn't useSentryGodotOptions— theoptionslambda parameter appears to be a plainSentryOptions. Either update the example to useSentryGodotOptions(if that's the correct type for the callback) or clarify whereSentryGodotOptionsis used. - "Don't enable session tracking in C# — it would double-count sessions." — good warning, but worth making it an
<Alert level="warning">block so it stands out.
docs/platforms/godot/configuration/stack-traces.mdx
- "No upload is required if you ship debug symbols with your game. The SDK then resolves file names and line numbers at runtime from the
.pdbfiles next to your game" — this implies PDB resolution happens inside the SDK; in practice it's the .NET runtime /System.Diagnostics. Minor but worth being precise: "the .NET runtime resolves file names and line numbers from the.pdbfiles shipped alongside your game."
platform-includes/logs/usage/godot.mdx
- The C# "global attributes" example uses
SetBeforeSendLogas the equivalent ofset_attribute, and the<Alert>says "The C# SDK doesn't have a scope-level attribute API yet." The same pattern and alert appear again inplatform-includes/metrics/usage/godot.mdxwith a copy-paste bug: the metrics alert reads "it applies attributes to every log" instead of "every metric."
platform-includes/enriching-events/set-user/godot.mdx
IpAddress = "{{auto}}"— double-brace syntax is GDScript-flavored; the .NET SDK uses"{{auto}}"as a literal sentinel string too, so this is technically correct, but a comment like// tells Sentry to infer the IPwould help readers who don't already know the convention.
Minor nits
- Several new C# snippets use
SentrySdk.ConfigureScope(scope => scope.User = new SentryUser());to unset the user. Readers may not realize this replaces the user with an empty object rather than clearing it. IfSentrySdk.ConfigureScope(scope => scope.User = null);is valid in this SDK version, that's clearer intent. - Trailing comma after the last dictionary entry in the
breadcrumbs-exampleC# snippet (["spawn_point"] = "forest",) — fine in C#, just noting it's intentional and not a bug.
There was a problem hiding this comment.
Reviewed the C#/.NET docs addition. The content is clear, well-structured, and technically accurate. One small copy-paste issue to fix:
In platform-includes/metrics/usage/godot.mdx, the Alert under Global Attributes reads:
it applies attributes to every log.
But this is in the metrics section — should be "every metric".
Everything else looks good: the two-layer sync explanation is clear, the limitations section is honest about current gaps, the symbolication instructions per-platform are correct, and the {mdExpandTabs} flags are applied correctly throughout (GDScript vs. C# tabs are genuinely too different for an LLM to infer one from the other).
This comment was marked as duplicate.
This comment was marked as duplicate.
|
Sorry for all the continued additions, team 😅 |
JoshuaMoelans
left a comment
There was a problem hiding this comment.
very small remark about rewording a sentence (either comment resolves the other 😅 )
DESCRIBE YOUR PR
Documents the Godot SDK's C#/.NET support, available in the upcoming 2.0.0 release.
Sentry.Godot.SentrySdkAPI, how the native and .NET layers stay in sync, and current limitations.Tracking issue: getsentry/sentry-godot#752
IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs to go live.
SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST
Make sure you've checked the following before merging your changes:
EXTRA RESOURCES