This is a work in progress.
The idea here is to simplify the .NET SDK by leaving the messy
#ifdefs, platform specific code (operating system, runtime, etc) out into its own library. It also helps by allowing us to share code between the new .NET SDK and the current .NET SDK.
Most of the platform information used by the SDK goes to Sentry's Context Interface. When implementing this on SharpRaven it was clear that to get reliable information is not as trivial as it seems. This repo is an attempt to create a package which will provide reliable information in different types of apps.
For details, check the example project.
If you are interested in the runtime information, with .NET Standard 1.5 onwards you can use:
RuntimeInformation.FrameworkDescription, which will give you a single string
For example, .NET Core 2.0.6 on Linux returns:
.NET Core 126.96.36.199.
Besides not telling you what was actually installed on the machine, to get the version number you would need to parse the string.
The following table compares the results of that API call to what this library returns:
|Target||OS||RuntimeInformation.FrameworkDescription||This library returns an object|
|.NET Framework 4.7.2||Windows||.NET Framework 4.7.3101.0||Name: .NET Framework
|.NET Core 1.1.7||macOS||.NET Core 4.6.26201.01||Name: .NET Core
|.NET Core 1.1.8||Linux||.NET Core 4.6.26328.01||Name: .NET Core
|.NET Core 2.0.6||macOS||.NET Core 188.8.131.52||Name: .NET Core
|.NET Core 2.0.6||Linux||.NET Core 184.108.40.206||Name: .NET Core
|Mono 220.127.116.11||macOS||18.104.22.168 (2017-12/8eb8f7d5e74
Fri Apr 13 20:18:12 EDT 2018)
Version: Mono 22.214.171.124
|Mono 126.96.36.199||Linux||188.8.131.52 (tarball Thu May 3 09:48:32 UTC 2018)||Name: Mono
It also includes extension methods to
This library supports:
- .NET Framework 3.5 and later
- .NET Standard 1.5 and later
Install .NET Core
.NET Core 2.0.x and 1.1.x SDKs.
.NET Framework, 4.7.1 or later
Linux and macOS
Install Mono 5.12 or later
- Follow @getsentry on Twitter for updates