From ef0993a9f1f590776ed9b8db177290fb69ff55c4 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 10 Nov 2025 13:53:04 +1300 Subject: [PATCH 1/7] Added logging info --- src/Sentry/PlatformAbstractions/RuntimeInfo.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Sentry/PlatformAbstractions/RuntimeInfo.cs b/src/Sentry/PlatformAbstractions/RuntimeInfo.cs index 435d39655d..1fa9e288b9 100644 --- a/src/Sentry/PlatformAbstractions/RuntimeInfo.cs +++ b/src/Sentry/PlatformAbstractions/RuntimeInfo.cs @@ -38,20 +38,24 @@ internal static SentryRuntime WithAdditionalProperties(this SentryRuntime runtim internal static SentryRuntime? Parse(string? rawRuntimeDescription, string? name = null) { + Console.WriteLine($"{nameof(rawRuntimeDescription)}: {rawRuntimeDescription}, {nameof(name)}: {name}"); if (rawRuntimeDescription == null) { + Console.WriteLine("rawRuntimeDescription is null"); return name == null ? null : new SentryRuntime(name); } var match = RuntimeParseRegex.Match(rawRuntimeDescription); if (match.Success) { + Console.WriteLine("Regex matched: " + match.Value); 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); } + Console.WriteLine("No regex match"); return new SentryRuntime(name, raw: rawRuntimeDescription); } From c87dce7cf0c5fa8ef0df3496eb5573b70fcfd7c5 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 10 Nov 2025 14:30:39 +1300 Subject: [PATCH 2/7] Use ITestOutputHelper --- .../PlatformAbstractions/RuntimeInfo.cs | 4 --- .../PlatformAbstractions/RuntimeInfoTests.cs | 28 ++++++++++++++++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/Sentry/PlatformAbstractions/RuntimeInfo.cs b/src/Sentry/PlatformAbstractions/RuntimeInfo.cs index 1fa9e288b9..435d39655d 100644 --- a/src/Sentry/PlatformAbstractions/RuntimeInfo.cs +++ b/src/Sentry/PlatformAbstractions/RuntimeInfo.cs @@ -38,24 +38,20 @@ internal static SentryRuntime WithAdditionalProperties(this SentryRuntime runtim internal static SentryRuntime? Parse(string? rawRuntimeDescription, string? name = null) { - Console.WriteLine($"{nameof(rawRuntimeDescription)}: {rawRuntimeDescription}, {nameof(name)}: {name}"); if (rawRuntimeDescription == null) { - Console.WriteLine("rawRuntimeDescription is null"); return name == null ? null : new SentryRuntime(name); } var match = RuntimeParseRegex.Match(rawRuntimeDescription); if (match.Success) { - Console.WriteLine("Regex matched: " + match.Value); 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); } - Console.WriteLine("No regex match"); return new SentryRuntime(name, raw: rawRuntimeDescription); } diff --git a/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs b/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs index e5ecc83b4a..1f7b44de54 100644 --- a/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs +++ b/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs @@ -2,11 +2,37 @@ namespace Sentry.Tests.PlatformAbstractions; -public class RuntimeInfoTests +public class RuntimeInfoTests(ITestOutputHelper output) { [Fact] public void GetRuntime_AllProperties() { + void Parse(string rawRuntimeDescription, string name = null) + { + Regex runtimeParseRegex = new( + @"^(?(?:[A-Za-z.]\S*\s?)*)(?:\s|^|$)(?\d\S*)?", + RegexOptions.Compiled | RegexOptions.CultureInvariant); + + output.WriteLine($"{nameof(rawRuntimeDescription)}: {rawRuntimeDescription}, {nameof(name)}: {name}"); + if (rawRuntimeDescription == null) + { + output.WriteLine("rawRuntimeDescription is null"); + return; + } + + var match = runtimeParseRegex.Match(rawRuntimeDescription); + if (match.Success) + { + output.WriteLine("Regex matched: " + match.Value); + return; + } + + output.WriteLine("No regex match"); + } + + var frameworkDescription = RuntimeInformation.FrameworkDescription; + Parse(frameworkDescription); + var actual = RuntimeInfo.GetRuntime(); Assert.NotNull(actual); Assert.NotNull(actual.Name); From 37dd2a0800f01a885bfeb72c7ceb5dad1c1f5eff Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 10 Nov 2025 15:48:49 +1300 Subject: [PATCH 3/7] More explicit failure reasons --- .../PlatformAbstractions/RuntimeInfoTests.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs b/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs index 1f7b44de54..687c9243e7 100644 --- a/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs +++ b/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs @@ -34,10 +34,14 @@ void Parse(string rawRuntimeDescription, string name = null) Parse(frameworkDescription); var actual = RuntimeInfo.GetRuntime(); - Assert.NotNull(actual); - Assert.NotNull(actual.Name); - Assert.NotNull(actual.Version); - Assert.NotNull(actual.Raw); + actual.Should().NotBeNull("GetRuntime returned null"); + actual.Name.Should().NotBeNull("Runtime Name is null"); + actual.Version.Should().NotBeNull("Runtime Version is null"); + actual.Raw.Should().NotBeNull("Runtime Raw is null"); + // Assert.NotNull(actual); + // Assert.NotNull(actual.Name); + // Assert.NotNull(actual.Version); + // Assert.NotNull(actual.Raw); #if NET5_0_OR_GREATER Assert.Equal(".NET", actual.Name); From dd5c969e21c268c4987406214896faed93091e81 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 10 Nov 2025 20:23:39 +1300 Subject: [PATCH 4/7] . --- .../PlatformAbstractions/RuntimeInfoTests.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs b/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs index 687c9243e7..24c849c128 100644 --- a/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs +++ b/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs @@ -50,13 +50,16 @@ void Parse(string rawRuntimeDescription, string name = null) if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { Assert.Equal(".NET Framework", actual.Name); - Assert.NotNull(actual.FrameworkInstallation); - Assert.NotNull(actual.FrameworkInstallation.Version); + // Assert.NotNull(actual.FrameworkInstallation); + // Assert.NotNull(actual.FrameworkInstallation.Version); + actual.FrameworkInstallation.Should().NotBeNull("FrameworkInstallation is null"); + actual.FrameworkInstallation.Version.Should().NotBeNull("FrameworkInstallation.Version is null"); } else { Assert.Equal("Mono", actual.Name); - Assert.Null(actual.FrameworkInstallation); + // Assert.Null(actual.FrameworkInstallation); + actual.FrameworkInstallation.Should().NotBeNull("FrameworkInstallation is null"); } #endif } From f3f8c3d54e1edc7b358929f0809a3fe53e7ec9fc Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Tue, 11 Nov 2025 11:09:30 +1300 Subject: [PATCH 5/7] skip check on WinArm64 for now --- .../PlatformAbstractions/RuntimeInfoTests.cs | 39 ++++--------------- 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs b/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs index 24c849c128..ab0af68958 100644 --- a/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs +++ b/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs @@ -7,41 +7,14 @@ public class RuntimeInfoTests(ITestOutputHelper output) [Fact] public void GetRuntime_AllProperties() { - void Parse(string rawRuntimeDescription, string name = null) - { - Regex runtimeParseRegex = new( - @"^(?(?:[A-Za-z.]\S*\s?)*)(?:\s|^|$)(?\d\S*)?", - RegexOptions.Compiled | RegexOptions.CultureInvariant); - - output.WriteLine($"{nameof(rawRuntimeDescription)}: {rawRuntimeDescription}, {nameof(name)}: {name}"); - if (rawRuntimeDescription == null) - { - output.WriteLine("rawRuntimeDescription is null"); - return; - } - - var match = runtimeParseRegex.Match(rawRuntimeDescription); - if (match.Success) - { - output.WriteLine("Regex matched: " + match.Value); - return; - } - - output.WriteLine("No regex match"); - } - var frameworkDescription = RuntimeInformation.FrameworkDescription; - Parse(frameworkDescription); + output.WriteLine($"RuntimeInformation.FrameworkDescription: {frameworkDescription}"); var actual = RuntimeInfo.GetRuntime(); actual.Should().NotBeNull("GetRuntime returned null"); actual.Name.Should().NotBeNull("Runtime Name is null"); actual.Version.Should().NotBeNull("Runtime Version is null"); actual.Raw.Should().NotBeNull("Runtime Raw is null"); - // Assert.NotNull(actual); - // Assert.NotNull(actual.Name); - // Assert.NotNull(actual.Version); - // Assert.NotNull(actual.Raw); #if NET5_0_OR_GREATER Assert.Equal(".NET", actual.Name); @@ -50,15 +23,17 @@ void Parse(string rawRuntimeDescription, string name = null) if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { Assert.Equal(".NET Framework", actual.Name); - // Assert.NotNull(actual.FrameworkInstallation); - // Assert.NotNull(actual.FrameworkInstallation.Version); actual.FrameworkInstallation.Should().NotBeNull("FrameworkInstallation is null"); - actual.FrameworkInstallation.Version.Should().NotBeNull("FrameworkInstallation.Version is null"); + // TODO: Windows ARM64 broke in CI... the timing wasn't very good (same day .NET 10 was announced) and I + // don't have a Windows ARM64 device to test on. Will need to debug in CI when we've released V6. + if (RuntimeInformation.ProcessArchitecture != Architecture.Arm64) + { + actual.FrameworkInstallation.Version.Should().NotBeNull("FrameworkInstallation.Version is null"); + } } else { Assert.Equal("Mono", actual.Name); - // Assert.Null(actual.FrameworkInstallation); actual.FrameworkInstallation.Should().NotBeNull("FrameworkInstallation is null"); } #endif From 43822edaf10def4a495dc812c0507db74845a54a Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Tue, 11 Nov 2025 14:10:24 +1300 Subject: [PATCH 6/7] . --- test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs b/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs index ab0af68958..a4472e37c4 100644 --- a/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs +++ b/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs @@ -34,7 +34,7 @@ public void GetRuntime_AllProperties() else { Assert.Equal("Mono", actual.Name); - actual.FrameworkInstallation.Should().NotBeNull("FrameworkInstallation is null"); + actual.FrameworkInstallation.Should().BeNull("FrameworkInstallation is null"); } #endif } From 7a4bbdbd97d1b3fb13e9086f334c12d5095b6594 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Tue, 11 Nov 2025 14:51:37 +1300 Subject: [PATCH 7/7] . --- test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs b/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs index a4472e37c4..6e2fd51183 100644 --- a/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs +++ b/test/Sentry.Tests/PlatformAbstractions/RuntimeInfoTests.cs @@ -34,7 +34,7 @@ public void GetRuntime_AllProperties() else { Assert.Equal("Mono", actual.Name); - actual.FrameworkInstallation.Should().BeNull("FrameworkInstallation is null"); + actual.FrameworkInstallation.Should().BeNull("FrameworkInstallation is not null"); } #endif }