Skip to content
Abstractions to simplify retrieving platform information in .NET
C# PowerShell Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.craft.yml Target github with craft Jul 27, 2018
.gitattributes hello world Apr 21, 2018
LICENSE discord badge Sep 12, 2019


Travis AppVeyor

Package name NuGet
Sentry.PlatformAbstractions NuGet

The goal of this package 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.

Runtime information

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 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
Version: 4.7.2
.NET Core 1.1.7 macOS .NET Core 4.6.26201.01 Name: .NET Core
Version: 1.1.7
.NET Core 1.1.8 Linux .NET Core 4.6.26328.01 Name: .NET Core
Version: 1.1.8
.NET Core 2.0.6 macOS .NET Core Name: .NET Core
Version: 2.0.6
.NET Core 2.0.6 Linux .NET Core Name: .NET Core
Version: 2.0.6
Mono macOS (2017-12/8eb8f7d5e74
Fri Apr 13 20:18:12 EDT 2018)
Name: Mono
Version: Mono
Mono Linux (tarball Thu May 3 09:48:32 UTC 2018) Name: Mono

It also includes extension methods to Runtime:

  • IsMono()
  • IsNetCore()
  • IsNetFx()

Supported frameworks

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



You can’t perform that action at this time.