Skip to content
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

feat: Renamed Sentry.Runtime to SentryRuntime #3016

Merged
merged 13 commits into from Jan 11, 2024
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -6,7 +6,8 @@

#### Changed APIs

- Class renamed `Sentry.User` to `Sentry.SentryUser` ([#3015](https://github.com/getsentry/sentry-dotnet/pull/3015))
- Renamed `Sentry.User` to `SentryUser` ([#3015](https://github.com/getsentry/sentry-dotnet/pull/3015))
- Renamed `Sentry.Runtime` to `SentryRuntime` ([#3016](https://github.com/getsentry/sentry-dotnet/pull/3016))
bitsandfoxes marked this conversation as resolved.
Show resolved Hide resolved

### Dependencies

Expand Down
2 changes: 1 addition & 1 deletion src/Sentry/Integrations/NetFxInstallationsIntegration.cs
Expand Up @@ -10,7 +10,7 @@ public void Register(IHub hub, SentryOptions options)
{
try
{
if (!Runtime.Current.IsMono())
if (!SentryRuntime.Current.IsMono())
{
options.AddEventProcessor(new NetFxInstallationsEventProcessor(options));
}
Expand Down
4 changes: 2 additions & 2 deletions src/Sentry/Internal/Enricher.cs
Expand Up @@ -12,7 +12,7 @@ internal class Enricher

private readonly Lazy<Runtime> _runtimeLazy = new(() =>
{
var current = PlatformAbstractions.Runtime.Current;
var current = PlatformAbstractions.SentryRuntime.Current;
return new Runtime
{
Name = current.Name,
Expand All @@ -36,7 +36,7 @@ public void Apply(IEventLike eventLike)
if (!eventLike.Contexts.ContainsKey(OperatingSystem.Type))
{
// RuntimeInformation.OSDescription is throwing on Mono 5.12
if (!PlatformAbstractions.Runtime.Current.IsMono())
if (!PlatformAbstractions.SentryRuntime.Current.IsMono())
{
#if NETFRAMEWORK
// RuntimeInformation.* throws on .NET Framework on macOS/Linux
Expand Down
12 changes: 6 additions & 6 deletions src/Sentry/PlatformAbstractions/RuntimeExtensions.cs
@@ -1,7 +1,7 @@
namespace Sentry.PlatformAbstractions;

/// <summary>
/// Extension method to the <see cref="Runtime"/> class.
/// Extension method to the <see cref="SentryRuntime"/> class.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static class RuntimeExtensions
Expand All @@ -11,14 +11,14 @@
/// </summary>
/// <param name="runtime">The runtime instance to check.</param>
/// <returns>True if it's .NET Framework, otherwise false.</returns>
public static bool IsNetFx(this Runtime runtime) => runtime.StartsWith(".NET Framework");
public static bool IsNetFx(this SentryRuntime runtime) => runtime.StartsWith(".NET Framework");

Check failure on line 14 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 14 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / Analyze

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 14 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (ubuntu-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 14 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 14 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-13)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 14 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 14 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

/// <summary>
/// Is the runtime instance .NET Core (or .NET).
/// </summary>
/// <param name="runtime">The runtime instance to check.</param>
/// <returns>True if it's .NET Core (or .NET), otherwise false.</returns>
public static bool IsNetCore(this Runtime runtime) =>
public static bool IsNetCore(this SentryRuntime runtime) =>

Check failure on line 21 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / Analyze

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 21 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (ubuntu-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 21 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 21 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-13)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 21 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 21 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)
runtime.StartsWith(".NET Core") ||
(runtime.StartsWith(".NET") && !runtime.StartsWith(".NET Framework"));

Expand All @@ -27,16 +27,16 @@
/// </summary>
/// <param name="runtime">The runtime instance to check.</param>
/// <returns>True if it's Mono, otherwise false.</returns>
public static bool IsMono(this Runtime runtime) => runtime.StartsWith("Mono");
public static bool IsMono(this SentryRuntime runtime) => runtime.StartsWith("Mono");

Check failure on line 30 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / Analyze

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 30 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (ubuntu-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 30 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 30 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-13)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 30 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 30 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

/// <summary>
/// Is the runtime instance Browser Web Assembly.
/// </summary>
/// <param name="runtime">The runtime instance to check.</param>
/// <returns>True if it's Browser WASM, otherwise false.</returns>
internal static bool IsBrowserWasm(this Runtime runtime) => runtime.Identifier == "browser-wasm";
internal static bool IsBrowserWasm(this SentryRuntime runtime) => runtime.Identifier == "browser-wasm";

Check failure on line 37 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / Analyze

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 37 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 37 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-13)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 37 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

private static bool StartsWith(this Runtime? runtime, string runtimeName) =>
private static bool StartsWith(this SentryRuntime? runtime, string runtimeName) =>

Check failure on line 39 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / Analyze

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 39 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 39 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-13)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 39 in src/Sentry/PlatformAbstractions/RuntimeExtensions.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)
runtime?.Name?.StartsWith(runtimeName, StringComparison.OrdinalIgnoreCase) == true ||
runtime?.Raw?.StartsWith(runtimeName, StringComparison.OrdinalIgnoreCase) == true;
}
32 changes: 16 additions & 16 deletions src/Sentry/PlatformAbstractions/RuntimeInfo.cs
Expand Up @@ -13,53 +13,53 @@
/// Gets the current runtime.
/// </summary>
/// <returns>A new instance for the current runtime</returns>
internal static Runtime GetRuntime()
internal static SentryRuntime GetRuntime()

Check failure on line 16 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 16 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / Analyze

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 16 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / .NET (ubuntu-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 16 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 16 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-13)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 16 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)
{
var runtime = GetFromRuntimeInformation();
runtime ??= GetFromMonoRuntime();
runtime ??= GetFromEnvironmentVariable();
return runtime.WithAdditionalProperties();
}

internal static Runtime WithAdditionalProperties(this Runtime runtime)
internal static SentryRuntime WithAdditionalProperties(this SentryRuntime runtime)

Check failure on line 24 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 24 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 24 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / Analyze

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 24 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / Analyze

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 24 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / .NET (ubuntu-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 24 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / .NET (ubuntu-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 24 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 24 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 24 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-13)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 24 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-13)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 24 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)
{
#if NETFRAMEWORK
GetNetFxInstallationAndVersion(runtime, out var inst, out var ver);
var version = runtime.Version ?? ver;
var installation = runtime.FrameworkInstallation ?? inst;
return new Runtime(runtime.Name, version, installation, runtime.Raw);
return new SentryRuntime(runtime.Name, version, installation, runtime.Raw);
#elif NET5_0_OR_GREATER
var version = runtime.Version ?? GetNetCoreVersion(runtime);
var identifier = runtime.Identifier ?? GetRuntimeIdentifier(runtime);
return new Runtime(runtime.Name, version, runtime.Raw, identifier);
return new SentryRuntime(runtime.Name, version, runtime.Raw, identifier);
#else
var version = runtime.Version ?? GetNetCoreVersion(runtime);
return new Runtime(runtime.Name, version, runtime.Raw);
return new SentryRuntime(runtime.Name, version, runtime.Raw);
#endif
}

internal static Runtime? Parse(string? rawRuntimeDescription, string? name = null)
internal static SentryRuntime? Parse(string? rawRuntimeDescription, string? name = null)

Check failure on line 41 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 41 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / Analyze

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 41 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / .NET (ubuntu-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 41 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 41 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-13)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)
{
if (rawRuntimeDescription == null)
{
return name == null ? null : new Runtime(name);
return name == null ? null : new SentryRuntime(name);
}

var match = RuntimeParseRegex.Match(rawRuntimeDescription);
if (match.Success)
{
return new Runtime(
return new SentryRuntime(
name ?? (match.Groups["name"].Value == string.Empty ? null : match.Groups["name"].Value.Trim()),
match.Groups["version"].Value == string.Empty ? null : match.Groups["version"].Value.Trim(),
raw: rawRuntimeDescription);
}

return new Runtime(name, raw: rawRuntimeDescription);
return new SentryRuntime(name, raw: rawRuntimeDescription);
}

#if NETFRAMEWORK
internal static void GetNetFxInstallationAndVersion(
Runtime runtime,
SentryRuntime runtime,

Check failure on line 62 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / .NET (macos-13)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)
out FrameworkInstallation? frameworkInstallation,
out string? version)
{
Expand All @@ -85,7 +85,7 @@
}
}
#else
private static string? GetNetCoreVersion(Runtime runtime)
private static string? GetNetCoreVersion(SentryRuntime runtime)

Check failure on line 88 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 88 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / Analyze

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 88 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / .NET (ubuntu-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 88 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)
{
var description = RuntimeInformation.FrameworkDescription;
return RemovePrefixOrNull(description, ".NET Core")
Expand All @@ -101,7 +101,7 @@
#endif

#if NET5_0_OR_GREATER
internal static string? GetRuntimeIdentifier(Runtime runtime)
internal static string? GetRuntimeIdentifier(SentryRuntime runtime)

Check failure on line 104 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)
{
try
{
Expand All @@ -114,7 +114,7 @@
}
#endif

private static Runtime? GetFromRuntimeInformation()
private static SentryRuntime? GetFromRuntimeInformation()

Check failure on line 117 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 117 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / .NET (ubuntu-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)
{
try
{
Expand All @@ -132,7 +132,7 @@
}
}

private static Runtime? GetFromMonoRuntime()
private static SentryRuntime? GetFromMonoRuntime()

Check failure on line 135 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 135 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / .NET (ubuntu-latest)

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)
=> Type.GetType("Mono.Runtime", false)
?.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static)
?.Invoke(null, null) is string monoVersion
Expand All @@ -146,7 +146,7 @@
: null;

// This should really only be used on .NET 1.0, 1.1, 2.0, 3.0, 3.5 and 4.0
private static Runtime GetFromEnvironmentVariable()
private static SentryRuntime GetFromEnvironmentVariable()

Check failure on line 149 in src/Sentry/PlatformAbstractions/RuntimeInfo.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'SentryRuntime' could not be found (are you missing a using directive or an assembly reference?)
{
// Environment.Version: NET Framework 4, 4.5, 4.5.1, 4.5.2 = 4.0.30319.xxxxx
// .NET Framework 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1 = 4.0.30319.42000
Expand All @@ -158,6 +158,6 @@
1 => "",
_ => version.ToString()
};
return new Runtime(".NET Framework", friendlyVersion, raw: "Environment.Version=" + version);
return new SentryRuntime(".NET Framework", friendlyVersion, raw: "Environment.Version=" + version);
}
}
2 changes: 1 addition & 1 deletion src/Sentry/Protocol/SampleProfile.cs
Expand Up @@ -30,7 +30,7 @@ public void WriteTo(Utf8JsonWriter writer, IDiagnosticLogger? logger)
writer.WriteEndObject();

#if NETFRAMEWORK
if (PlatformAbstractions.Runtime.Current.IsMono())
if (PlatformAbstractions.SentryRuntime.Current.IsMono())
{
// STJ doesn't like HashableGrowableArray on Mono, failing with:
// Invalid IL code in (wrapper dynamic-method) object:.ctor (): IL_0005: ret
Expand Down
4 changes: 2 additions & 2 deletions src/Sentry/SentryOptions.cs
Expand Up @@ -68,7 +68,7 @@ public bool IsGlobalModeEnabled
/// </summary>
public bool IsGlobalModeEnabled
{
get => _isGlobalModeEnabled ??= Runtime.Current.IsBrowserWasm();
get => _isGlobalModeEnabled ??= SentryRuntime.Current.IsBrowserWasm();
set => _isGlobalModeEnabled = value;
}
#endif
Expand Down Expand Up @@ -938,7 +938,7 @@ public StackTraceMode StackTraceMode
{
// from 3.0.0 uses Enhanced (Ben.Demystifier) by default which is a breaking change
// unless you are using .NET Native which isn't compatible with Ben.Demystifier.
_stackTraceMode = Runtime.Current.Name == ".NET Native"
_stackTraceMode = SentryRuntime.Current.Name == ".NET Native"
? StackTraceMode.Original
: StackTraceMode.Enhanced;
}
Expand Down
@@ -1,5 +1,4 @@
using Sentry.PlatformAbstractions;
using Runtime = Sentry.PlatformAbstractions.Runtime;

namespace Sentry.Tests.PlatformAbstractions;

Expand All @@ -16,7 +15,7 @@ public class RuntimeExtensionsTests
[InlineData("Mono Foo", false)]
public void IsNetFx(string name, bool shouldMatch)
{
var runtime = new Runtime(name);
var runtime = new SentryRuntime(name);
var result = runtime.IsNetFx();
Assert.Equal(shouldMatch, result);
}
Expand All @@ -32,7 +31,7 @@ public void IsNetFx(string name, bool shouldMatch)
[InlineData("Mono Foo", false)]
public void IsNetCore(string name, bool shouldMatch)
{
var runtime = new Runtime(name);
var runtime = new SentryRuntime(name);
var result = runtime.IsNetCore();
Assert.Equal(shouldMatch, result);
}
Expand All @@ -48,7 +47,7 @@ public void IsNetCore(string name, bool shouldMatch)
[InlineData("Mono Foo", true)]
public void IsMono(string name, bool shouldMatch)
{
var runtime = new Runtime(name);
var runtime = new SentryRuntime(name);
var result = runtime.IsMono();
Assert.Equal(shouldMatch, result);
}
Expand Down
12 changes: 0 additions & 12 deletions test/Sentry.Tests/PlatformAbstractions/RuntimeTests.cs

This file was deleted.

12 changes: 12 additions & 0 deletions test/Sentry.Tests/PlatformAbstractions/SentryRuntimeTests.cs
@@ -0,0 +1,12 @@
using Sentry.PlatformAbstractions;

namespace Sentry.Tests.PlatformAbstractions;

public class SentryRuntimeTests
{
[Fact]
public void Current_Equal()
{
Assert.Equal(SentryRuntime.Current, SentryRuntime.Current);
}
}
@@ -1,10 +1,10 @@
namespace Sentry.Tests.Protocol.Context;

public class RuntimeTests
public class SentryRuntimeTests
{
private readonly IDiagnosticLogger _testOutputLogger;

public RuntimeTests(ITestOutputHelper output)
public SentryRuntimeTests(ITestOutputHelper output)
{
_testOutputLogger = new TestOutputDiagnosticLogger(output);
}
Expand Down