sentry-dotnet
sentry-dotnet copied to clipboard
device context not included in new sentry .net sdk
When attempting to integrate with sentry .net using the nlog integration, I noticed that device context wasn't being sent up like other platforms already do.
The older raven-csharp sdk appears to support adding this information based on https://github.com/getsentry/raven-csharp/blob/4fdc94eb514d96c22a83d851e2141fa9df10f613/src/app/SharpRaven/Data/Context/Device.cs#L212. (I haven't actually integrated with raven-csharp to verify, just assuming based on this file).
Is sentry-dotnet intended to not add this information by default? Example information I'm looking for is cpu arch, screen_resolution, storage, memory, and etc
That part should have been moved to Sentry.PlatformAbstractions but that's right it seems not to have been there.
CPU arch is straight forward to add (the code in SharpRaven) but I'm afraid screen resolution is going to be less platform independent.
Could you please share what framework are you using? Is this Xamarin, WPF, UWP etc?
There's actually an issue on PlatformAbstractions:
https://github.com/getsentry/sentry-dotnet-platform-abstractions/issues/7
I'm planning to sunset that lib and just bring the relevant bits to this repo, inside the Sentry
package. With that we can drop support .NET Framework 3.5 to 4.6.0 which simplifies things a lot.
I'm using WPF, but saw this with a c# console application too. For clarity, here's a picture of the section I was expecting on the sentry website after a report https://i.imgur.com/MkaJFL1.png. Windows would obviously be different (android shown), but that information seems to come for free on the current MacOS and Android SDKs
We use the APIs available in the specific frameworks. Like Unity gives us some API as well as Android and unfortunately we don't have some in .NET. We could try to fetch data when running on .NET Framework but I'm unaware of a multi-platform (.NET Core/.NET Standard) way to get it.
For example to get battery level one can use System.Windows.Forms.SystemInformation.PowerStatus
.
That namespace is for WinForms, which was ported to .NET Core (Windows only).
We can investigate what information to retrieve and try to find a way to get it for .NET Standard, or at least for the .NET Framework target.
TODO: we will confirm all the context we have and if anything is missing.