From 26aa50c6d212cf85c77ef7e00ac41eb1f4790e96 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Wed, 4 Oct 2023 23:18:10 +1300 Subject: [PATCH 1/2] Removed Scope.Platform as it would never be applied. --- src/Sentry/IEventLike.cs | 10 ---------- src/Sentry/ITransactionData.cs | 9 +++++++++ src/Sentry/Internal/Enricher.cs | 3 --- src/Sentry/Scope.cs | 5 ----- test/Sentry.Tests/ScopeTests.cs | 2 -- 5 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/Sentry/IEventLike.cs b/src/Sentry/IEventLike.cs index 112d017566..36edead55e 100644 --- a/src/Sentry/IEventLike.cs +++ b/src/Sentry/IEventLike.cs @@ -50,16 +50,6 @@ public interface IEventLike : IHasTags, IHasExtra /// User User { get; set; } - /// - /// The name of the platform. - /// - /// - /// In most cases, the platform will be "csharp". However, it may differ if the event - /// was generated from another embeded SDK. For example, when targeting net6.0-android, - /// events generated by the Sentry Android SDK will have the platform "java". - /// - public string? Platform { get; set; } - /// /// The release version of the application. /// diff --git a/src/Sentry/ITransactionData.cs b/src/Sentry/ITransactionData.cs index 2a552a27c3..5752b9f3d8 100644 --- a/src/Sentry/ITransactionData.cs +++ b/src/Sentry/ITransactionData.cs @@ -5,4 +5,13 @@ namespace Sentry; /// public interface ITransactionData : ISpanData, ITransactionContext, IEventLike { + /// + /// The name of the platform. + /// + /// + /// In most cases, the platform will be "csharp". However, it may differ if the event + /// was generated from another embeded SDK. For example, when targeting net6.0-android, + /// events generated by the Sentry Android SDK will have the platform "java". + /// + public string? Platform { get; set; } } diff --git a/src/Sentry/Internal/Enricher.cs b/src/Sentry/Internal/Enricher.cs index fd945e2eff..2b24da4990 100644 --- a/src/Sentry/Internal/Enricher.cs +++ b/src/Sentry/Internal/Enricher.cs @@ -54,9 +54,6 @@ public void Apply(IEventLike eventLike) eventLike.Sdk.AddPackage("nuget:" + SdkVersion.Instance.Name, SdkVersion.Instance.Version); } - // Platform - eventLike.Platform ??= Sentry.Constants.Platform; - // Release eventLike.Release ??= _options.SettingLocator.GetRelease(); diff --git a/src/Sentry/Scope.cs b/src/Sentry/Scope.cs index 4c4a1d7045..1301ce75fd 100644 --- a/src/Sentry/Scope.cs +++ b/src/Sentry/Scope.cs @@ -137,9 +137,6 @@ public User User } } - /// - public string? Platform { get; set; } - /// public string? Release { get; set; } @@ -345,7 +342,6 @@ public void Clear() Request = new(); Contexts.Clear(); User = new(); - Platform = default; Release = default; Distribution = default; Environment = default; @@ -435,7 +431,6 @@ public void Apply(IEventLike other) Request.CopyTo(other.Request); User.CopyTo(other.User); - other.Platform ??= Platform; other.Release ??= Release; other.Distribution ??= Distribution; other.Environment ??= Environment; diff --git a/test/Sentry.Tests/ScopeTests.cs b/test/Sentry.Tests/ScopeTests.cs index dbd8e9308d..2cf0079294 100644 --- a/test/Sentry.Tests/ScopeTests.cs +++ b/test/Sentry.Tests/ScopeTests.cs @@ -624,7 +624,6 @@ public static void ApplyFakeValues(this Scope scope, string salt = "fake") scope.Request = new() { Data = $"{salt} request" }; scope.Contexts.Add($"{salt} context", "{}"); scope.User = new User() { Username = $"{salt} username" }; - scope.Platform = $"{salt} platform"; scope.Release = $"{salt} release"; scope.Distribution = $"{salt} distribution"; scope.Environment = $"{salt} environment"; @@ -643,7 +642,6 @@ public static void ShouldBeEquivalentTo(this Scope source, Scope target) source.Request.Should().BeEquivalentTo(target.Request); source.Contexts.Should().BeEquivalentTo(target.Contexts); source.User.Should().BeEquivalentTo(target.User); - source.Platform.Should().Be(target.Platform); source.Release.Should().Be(target.Release); source.Distribution.Should().Be(target.Distribution); source.Environment.Should().Be(target.Environment); From 0740bdecef26f43f52a76f199678532fb8031b6c Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Wed, 4 Oct 2023 23:35:10 +1300 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b68f7de1a..5dca85610b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ API Changes: - Change `StackFrame`'s `ImageAddress`, `InstructionAddress` and `FunctionId` to `long?`. ([#2691](https://github.com/getsentry/sentry-dotnet/pull/2691)) - Enable `CaptureFailedRequests` by default ([2688](https://github.com/getsentry/sentry-dotnet/pull/2688)) - Additional constructors removed from `TransactionTracer`. ([#2694](https://github.com/getsentry/sentry-dotnet/pull/2694)) +- Removed the `Scope.Platform` property as it was never applied ([#2695](https://github.com/getsentry/sentry-dotnet/pull/2695)) ## Unreleased