MAUI: Document debug behavior
DESCRIBE YOUR PR
Documentation clarification: Copies from the ~MSBuild~ Diagnostic Logger page the important behavior about only logging to the local console when debug is enabled.
IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs to go live.
- [ ] Urgent deadline (GA date, etc.):
- [ ] Other deadline:
- [x] None: Not urgent, can wait up to 1 week+
PRE-MERGE CHECKLIST
- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts)
- [ ] PR was reviewed and approved by a member of the Sentry docs team
LEGAL BOILERPLATE
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
@breyed is attempting to deploy a commit to the Sentry Team on Vercel.
A member of the Team first needs to authorize it.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| sentry-docs | ❌ Failed (Inspect) | Jun 12, 2024 9:42pm |
@vivianyentran Unfortunately, since I created this PR, I’ve observed that the ~MSBuild~ Diagnostic Logger page that I got the behavior description from appears to be incorrect. I set Debug = true but still saw issues created on a simulator show up in sentry.io. I ended up adding this line to an #if DEBUG region:
options.SetBeforeSend((sentryEvent, hint) => { Debug.WriteLine(sentryEvent.Exception?.ToString() ?? sentryEvent.Message); return null; });
I think the best design would be for Debug = true to keep everything local, but if that’s not the case, the documentation should be updated to reflect it.
@bitsandfoxes can you have a look and help @breyed to resolve this? Thanks! 🙏
Hey @breyed, could you help me out here? Where/when do you have trouble with the debug logging?
@bitsandfoxes I built a .NET MAUI project in the debug configuration with this setup code:
builder.UseSentry(options => {
options.Dsn = <mydns>;
options.ConfigureScope(<myscope>);
options.Debug = true;
});
I ran the app on the iOS simulator without the debugger attached (but still the debug build). I caused the app to throw an unhandled exception. If debug was local only, I wouldn’t have expected anything to appear in Sentry. Instead this issue appeared.
If debug was local only, I wouldn’t have expected anything to appear in Sentry.
The Debug flag refers to the logging behaviour of the SDK. If set to true the SDK will start emitting debug logs based on the set DiagnosticLevel. It's not related to the Debug vs Release builds.
@bitsandfoxes I expected the Sentry Debug flag to be independent of the Debug configuration for building the app. I just mentioned the configuration for completeness. Based on your response and my tests, the Debug flag is also independent of whether Sentry sends the diagnostic info to the cloud.
That means that this PR is incorrect, as the existing Diagnostic Logger page, describing Debug = true, which my PR borrowed the text from:
Logging details will be written to one of the logger implementations described below and won't be sent to Sentry automatically.
The Diagnostic Logger page should be corrected. It would also be helpful to document how to make Sentry not upload error info, since it’s useful to include Sentry in debug builds to view in the console warnings that it captures (such as type converter problems in MAUI) while not having it uploading any errors.
This pull request has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you add the label WIP, I will leave it alone unless WIP is removed ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
WIP