【发布时间】:2021-03-11 22:18:30
【问题描述】:
我正在尝试使用 c# 将用户和设备上下文添加到 SentrySdk,但该信息从未显示在哨兵门户中。
这里是代码
SentrySdk.ConfigureScope(scope =>
{
scope.SetTag("SStGAppAId", sstgAppId);
scope.User = new User
{
Id = sstgAppId
};
scope.Contexts.Device.Model= DeviceInfo.Model;
scope.Contexts.Device.Manufacturer = DeviceInfo.Manufacturer;
scope.Contexts.Device.Name = DeviceInfo.Name;
scope.Contexts.Device.Simulator = DeviceInfo.DeviceType != DeviceType.Physical;
});
上下文信息没有被发送到哨兵做什么?
【问题讨论】:
-
问题是 AsyncLocal 的流在 Xamarin 上可能很奇怪。尝试在应用程序的静态构造函数中设置 datqa(也在那里初始化 SDK)。但通常这是 SDK 需要改进的地方。这里有个问题:github.com/getsentry/sentry-dotnet/issues/628
标签: c# xamarin.forms sentry