Count `callback_error` for native Android events when `BeforeSend` throws

未关闭
#5,682 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
活跃
技术栈
android, csharp
领域
mobile-dev

调研方向

Start at src/Sentry/Platforms/Android/SentrySdk.cs lines 246-255 where BeforeSendWrapper returns null, and at BeforeSendCallback.Execute. The work is explicitly blocked on getsentry/sentry-java#6141 shipping and a Java SDK bump, so nothing is actionable yet: once it ships, bump the sentry-java dependency, then investigate on a physical/emulated Android device whether a thrown Java exception from the callback marshals across JNI so sentry-java counts callback_error instead of before_send. Done means a verified answer (with a device test) and, if it works, the wrapper changed from returning null to throwing.

由索引模型根据 Issue 内容生成。

描述

.NET Bug Platform: Android

Part of #5634.

[Was] blocked by getsentry/sentry-java#6141, and a Java SDK bump to the release that ships it... this is no longer the case.

Branch: main. No public API change, and getsentry/sentry-java#6141 targets sentry-java 8.x, so the fix arrives with a regular Java SDK bump.

When the user's BeforeSend throws on a native Android event, #5610's BeforeSendWrapper returns null (Platforms/Android/SentrySdk.cs:246-255). sentry-java then counts before_send / error (SentryClient.java:171-177). sentry-java 8.58.0 has no callback_error reason yet (DiscardReason.java).

getsentry/sentry-java#6141 (part of getsentry/sentry-java#6081) adds DiscardReason.CALLBACK_ERROR and records it when a beforeSend* callback throws. sentry-java already drops the event on a throw; it just counts it as before_send today.

To investigate once it ships

Instead of returning null, BeforeSendCallback.Execute could throw a Java exception. sentry-java would then drop the event and count callback_error itself. This depends on how .NET for Android marshals managed exceptions across JNI, which needs checking on a device.

主要语言
C#
星标
775
派生
262
平均合并
1 天 16 小时
30 天内合并 PR
118

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

getsentry/sentry-dotnet 的其他 Issue

查看 getsentry/sentry-dotnet 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。