From 99105fe88e41223d60f39d87de23db30bb1c3d69 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Fri, 27 Oct 2023 13:33:56 +1300 Subject: [PATCH] Make Sentry.PlatformAbstractions.Runtime.Identifier get only (#2764) --- CHANGELOG.md | 1 + src/Sentry/PlatformAbstractions/Runtime.cs | 19 ++++--------------- .../ApiApprovalTests.Run.Core3_1.verified.txt | 3 +-- ...piApprovalTests.Run.DotNet6_0.verified.txt | 3 +-- ...piApprovalTests.Run.DotNet7_0.verified.txt | 3 +-- .../ApiApprovalTests.Run.Net4_8.verified.txt | 3 +-- 6 files changed, 9 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11c65865d1..c980dfff62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,7 @@ API Changes: }); ``` - `ISpan` and `ITransaction` have been renamed to `ISpanTracer` and `ITransactionTracer`. You will need to update any references to these interfaces in your code to use the new interface names ([#2731](https://github.com/getsentry/sentry-dotnet/pull/2731)) +- Removed obsolete setter from `Sentry.PlatformAbstractions.Runtime.Identifier` ([2764](https://github.com/getsentry/sentry-dotnet/pull/2764)) ## Unreleased diff --git a/src/Sentry/PlatformAbstractions/Runtime.cs b/src/Sentry/PlatformAbstractions/Runtime.cs index ca3c71b993..755dd9dea1 100644 --- a/src/Sentry/PlatformAbstractions/Runtime.cs +++ b/src/Sentry/PlatformAbstractions/Runtime.cs @@ -54,18 +54,7 @@ public class Runtime : IEquatable /// /// This property will be populated for .NET 5 and newer, or null otherwise. /// - public string? Identifier - { - get => _identifier; - - [Obsolete("This setter is nonfunctional, and will be removed in a future version.")] - // ReSharper disable ValueParameterNotUsed - set { } - // ReSharper restore ValueParameterNotUsed - } - - // TODO: Convert to get-only auto-property in next major version - private readonly string? _identifier; + public string? Identifier { get; } /// /// Creates a new Runtime instance @@ -81,7 +70,7 @@ public class Runtime : IEquatable Version = version; FrameworkInstallation = frameworkInstallation; Raw = raw; - _identifier = null; + Identifier = null; } #else public Runtime( @@ -93,7 +82,7 @@ public class Runtime : IEquatable Name = name; Version = version; Raw = raw; - _identifier = identifier; + Identifier = identifier; } #endif @@ -183,7 +172,7 @@ public override int GetHashCode() #if NETFRAMEWORK hashCode = (hashCode * 397) ^ (FrameworkInstallation?.GetHashCode() ?? 0); #else - hashCode = (hashCode * 397) ^ (_identifier?.GetHashCode() ?? 0); + hashCode = (hashCode * 397) ^ (Identifier?.GetHashCode() ?? 0); #endif return hashCode; } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Core3_1.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Core3_1.verified.txt index 1519ac6756..e6b4a09757 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.Core3_1.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.Core3_1.verified.txt @@ -1468,8 +1468,7 @@ namespace Sentry.PlatformAbstractions public class Runtime : System.IEquatable { public Runtime(string? name = null, string? version = null, string? raw = null, string? identifier = null) { } - [set: System.Obsolete("This setter is nonfunctional, and will be removed in a future version.")] - public string? Identifier { get; set; } + public string? Identifier { get; } public string? Name { get; } public string? Raw { get; } public string? Version { get; } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt index bd678b5074..8328be075c 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt @@ -1469,8 +1469,7 @@ namespace Sentry.PlatformAbstractions public class Runtime : System.IEquatable { public Runtime(string? name = null, string? version = null, string? raw = null, string? identifier = null) { } - [set: System.Obsolete("This setter is nonfunctional, and will be removed in a future version.")] - public string? Identifier { get; set; } + public string? Identifier { get; } public string? Name { get; } public string? Raw { get; } public string? Version { get; } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt index bd678b5074..8328be075c 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt @@ -1469,8 +1469,7 @@ namespace Sentry.PlatformAbstractions public class Runtime : System.IEquatable { public Runtime(string? name = null, string? version = null, string? raw = null, string? identifier = null) { } - [set: System.Obsolete("This setter is nonfunctional, and will be removed in a future version.")] - public string? Identifier { get; set; } + public string? Identifier { get; } public string? Name { get; } public string? Raw { get; } public string? Version { get; } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt index 0a4d695c05..86f9c49598 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt @@ -1468,8 +1468,7 @@ namespace Sentry.PlatformAbstractions { public Runtime(string? name = null, string? version = null, Sentry.PlatformAbstractions.FrameworkInstallation? frameworkInstallation = null, string? raw = null) { } public Sentry.PlatformAbstractions.FrameworkInstallation? FrameworkInstallation { get; } - [set: System.Obsolete("This setter is nonfunctional, and will be removed in a future version.")] - public string? Identifier { get; set; } + public string? Identifier { get; } public string? Name { get; } public string? Raw { get; } public string? Version { get; }