Soenneker.Utils.Runtime
4.0.1082
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Utils.Runtime --version 4.0.1082
NuGet\Install-Package Soenneker.Utils.Runtime -Version 4.0.1082
<PackageReference Include="Soenneker.Utils.Runtime" Version="4.0.1082" />
<PackageVersion Include="Soenneker.Utils.Runtime" Version="4.0.1082" />
<PackageReference Include="Soenneker.Utils.Runtime" />
paket add Soenneker.Utils.Runtime --version 4.0.1082
#r "nuget: Soenneker.Utils.Runtime, 4.0.1082"
#:package Soenneker.Utils.Runtime@4.0.1082
#addin nuget:?package=Soenneker.Utils.Runtime&version=4.0.1082
#tool nuget:?package=Soenneker.Utils.Runtime&version=4.0.1082
Soenneker.Utils.Runtime
A collection of helpful runtime-based operations.
Installation
dotnet add package Soenneker.Utils.Runtime
Quick start
using Soenneker.Utils.Runtime;
Call the static RuntimeUtil methods directly; no dependency-injection registration is required.
Platform checks
if (RuntimeUtil.IsWindows())
{
// Windows-specific behavior
}
bool browser = RuntimeUtil.IsBrowser();
IsWindows, IsMacOs, IsLinux, IsAndroid, IsBrowser, and IsIos directly wrap the
corresponding OperatingSystem checks. They describe the current runtime platform; they do not
infer a deployment environment or distribution.
Hosting environment hints
bool actions = RuntimeUtil.IsGitHubAction;
bool functions = RuntimeUtil.IsAzureFunction;
bool appService = RuntimeUtil.IsAzureAppService;
IsGitHubActionrequiresGITHUB_ACTIONS=true; a genericCI=truemarker is not enough.IsAzureFunctionchecks for a non-emptyFUNCTIONS_WORKER_RUNTIMEvalue.IsAzureAppServicechecks for a non-emptyWEBSITE_SITE_NAMEorWEBSITE_INSTANCE_IDvalue.
Each property caches its first result for the process lifetime. Set environment variables before the first access; later environment changes are not observed.
Container detection
bool container = await RuntimeUtil.IsContainer(cancellationToken);
Detection first checks DOTNET_RUNNING_IN_CONTAINER/DOTNET_RUNNING_IN_CONTAINERS. On Linux it
then checks /.dockerenv and scans /proc/1/cgroup for Docker, Kubernetes, or containerd markers.
On Windows it checks the common container identity and ContainerType registry value. Other
platforms return false.
The first successful detection result is cached. The cancellation token applies while the initial Linux cgroup file is read; later calls normally return the cached value. Detection is heuristic and can have false negatives on container runtimes that expose none of these markers. Do not use it as a security boundary or authorization decision. Filesystem access errors from the Linux cgroup probe can propagate.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Soenneker.Atomics.ValueNullableBools (>= 4.0.34)
- Soenneker.Extensions.String (>= 4.0.733)
- Soenneker.Utils.AsyncSingleton (>= 4.0.829)
NuGet packages (9)
Showing the top 5 NuGet packages that depend on Soenneker.Utils.Runtime:
| Package | Downloads |
|---|---|
|
Soenneker.Utils.Json
Serializes, deserializes, validates, formats, and writes JSON with System.Text.Json or Newtonsoft.Json. |
|
|
Soenneker.Utils.HttpClientCache
Providing thread-safe singleton HttpClients |
|
|
Soenneker.Git.Util
Asynchronous Git operations, repository discovery, and bounded batch processing using bundled Git distributions. |
|
|
Soenneker.Utils.Process
A utility library implementing useful process operations |
|
|
Soenneker.Utils.LogPath
Chooses a writable log-file path across cloud, container, CI, and local environments. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.1086 | 15 | 8/31/2026 |
| 4.0.1085 | 650 | 8/31/2026 |
| 4.0.1084 | 3,192 | 8/31/2026 |
| 4.0.1083 | 35 | 8/31/2026 |
| 4.0.1082 | 3,363 | 8/31/2026 |
| 4.0.1081 | 1,395 | 8/30/2026 |
| 4.0.1080 | 40 | 8/30/2026 |
| 4.0.1079 | 1,382 | 8/30/2026 |
| 4.0.1078 | 52 | 8/30/2026 |
| 4.0.1077 | 3,966 | 8/30/2026 |
| 4.0.1076 | 1,970 | 8/30/2026 |
| 4.0.1075 | 55 | 8/30/2026 |
| 4.0.1074 | 4,583 | 8/30/2026 |
| 4.0.1073 | 62 | 8/30/2026 |
| 4.0.1072 | 1,997 | 8/29/2026 |
| 4.0.1070 | 11,517 | 8/29/2026 |
| 4.0.1068 | 4,352 | 8/29/2026 |
| 4.0.1067 | 42,876 | 8/26/2026 |
| 4.0.1066 | 5,566 | 8/26/2026 |
| 4.0.1065 | 6,464 | 8/25/2026 |
Update dependency Soenneker.Utils.AsyncSingleton to 4.0.829 (#1507)