-
-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[UWP / WinUI] Operating system info missing in reports #3260
Comments
Thanks again @tipa! It looks like we're currently only setting this for MAUI and Android:
sentry-dotnet/src/Sentry/Platforms/Android/Extensions/OperatingSystemExtensions.cs Line 9 in e75d537
@bitsandfoxes we could look at capturing a bit more detail, ideally across various different platforms. It's the kind of static information that we'd ideally populate once, lazily, at program startup. |
I think that's super valuable feedback. We'd definitely like to provide information as relevant as possible. It might take a while to get around adding those. How do you feel about opening a PR adding those for your relevant platforms? |
I'd be willing to help with this work and I had a closer look at the source code, but I was kind of overwhelmed by the complexity. I don't know if I would be able to provide a mergeable PR in reasonable time. macOS (.NET 8): Windows (.NET 8 / WinUI 3 & UWP): |
@tipa we'd love the help! There's quite a bit going on right now so I suspect you'd be able to put something together before we'd have the bandwidth to prioritise this. I'm happy to help with advice and reviews. As you gleaned, there's a bit of complexity to the codebase. Much of this comes from two things:
That means sometimes we have to get a bit creative about implementing solutions. We have to write stuff that takes advantage of the special features of framework XYZ, without requiring people running the software in other environments from having to add unecessary dependencies. You might find it tricky to use |
Ok, I will see if I can wrap my head around the complexities and get some progress once I find some free time. Unfortunately, I have a very busy week as well |
@jamescrosswell Looking at the source code and Nuget - is macOS even really supported? I mean I can use it and it works (with the shortcomings that I reported in this and other issues) but I'd assume you would have to adjust the target frameworks when I wanted to add something |
I assume we can get OS Information on macOS... it should be possible to get this without appKit. This isn't available in the OperatingSystem Class? |
@jamescrosswell the OS version can also be queried using
Also, I don't think I can use precompiler directives for macOS like this unless it is targeted explicitly:
|
Ah I see. Yes DeviceInfo is a bit trickier. There are directives for compilation targeting Android, iOS and macCatalyst: sentry-dotnet/src/Sentry/Internal/DebugStackTrace.cs Lines 257 to 264 in fc96ff1
But we don't have separate builds for different operating systems. Anything like that would have to be a runtime check, I think: sentry-dotnet/src/Sentry/SentryOptions.cs Lines 191 to 192 in 0711c17
I don't think we can get at AppKit directly though (only via the Sentry.Maui integration). MAUI essentially does all the kinds of stuff Xamarin used to do (provide .NET abstractions around platform specific libraries). |
I think it must be. In .NET we have code to pull it from Android:
And from MAUI:
But I don't see anything for iOS specifically. The cocoa sdk definitely has code for this: We can't do the same for macOS because we don't wrap any "native" SDK when building .NET apps for macOS. So the .NET runtime is what we have available on macOS. The only exception to the above is when publishing applications with AOT compilation... in that case we wrap the sentry-native SDK for native crash reporting. Potentially when compiling AOT then, it would be possible to marshal some funtionality from sentry-native... that's not something I've dealt with yet. |
I am using AOT compilation ("Native AOT") for both my iOS and macOS apps - so when there's a way to populate the device info for macOS using the native SDK, that would be much appreciated. Unforunately, this would be too complex for me to contribute in a PR |
Yeah fair enough... it sounds like scope creep 😁 I've created #3313 that we can look into separately. Maybe we just keep this PR focused on the OS Information. |
Package
Sentry
.NET Flavor
.NET
.NET Version
8.0.2
OS
Windows
SDK Version
4.2.1
Self-Hosted Sentry Version
No response
Steps to Reproduce
Send test exception to Sentry from a UWP or WinUI3 app.
Expected Result
See detailed info about operating system - incl. build version, e.g. Windows 11 (build 22631.3374).
Actual Result
WinUI3:
22631.3374
or10.0.22631
)UWP: no OS information at all
The build information can be gathered via
Environment.OSVersion.Version
. Additionally, it could be helpful to enrich the exception with the machine name (e.g. laptop model), similar how on iOS it shows "device=iPhone 13 Pro". This information can be gathered usingEnvironment.MachineName
The text was updated successfully, but these errors were encountered: