Open tgreenman opened 5 years ago
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.
Wait, an issue about the SDK not automatically populating the device context? That doesn't sound right. Is this about the NLog integration specifically?
This issue is still not resolved 5 years after it was found. What the current plan to solve it? Without OS and device data, it's much harder to figure out the root causes of the issues.
This issue is still not resolved 5 years after it was found. What the current plan to solve it? Without OS and device data, it's much harder to figure out the root causes of the issues.
Which data exactly are you missing? The SDK sends OS name and version, runtime name and version and a lot of other context.
A list of things we could add and if possible, what APIs are available to get them, would be very helpful.
This is what I see for Sentry UWP SDK events:
@hemulator could you share the SDK version you're on? If you could share a link to an event in Sentry, that'd be helpful
And this is the event details:
There's obviously things missing.
It looks like some UWP thing. Since .NET Core 4.6 doesn't exist, that already looks off.
I'm using the same nuget package as for any other .NET. It compatible works fine except device/OS context. https://www.nuget.org/packages/Sentry/4.13.0?_src=template
I'm using the same nuget package as for any other .NET. It compatible works fine except device/OS context. https://www.nuget.org/packages/Sentry/4.13.0?_src=template
I understand it's the same package, we don't have one just for UWP. That said, UWP isn't .NET, so some of .NET's APIs to get device data might not be available there.
How would you get device information from a UWP app? Which APIs would you use?
We might be able to add a net8.0-windows
target, and use Windows-only APIs to get additional data. If that makes sense.
These folks are adding additional context to the SDK based on some other APIs available. We could learn something from them:
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