From f661d07fc69f355046dc7b713e8adfc3b126d34a Mon Sep 17 00:00:00 2001 From: Ivan Dlugos <6349682+vaind@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:44:31 +0100 Subject: [PATCH] Refactor: move DebugImage and DebugMeta to Sentry.Protocol (#2815) --- CHANGELOG.md | 1 + src/Sentry/Internal/DebugStackTrace.cs | 1 + .../Internal/Extensions/PEReaderExtensions.cs | 1 + src/Sentry/Internal/ILSpy/SingleFileApp.cs | 1 + src/Sentry/Platforms/Native/CFunctions.cs | 1 + src/Sentry/{ => Protocol}/DebugImage.cs | 2 +- src/Sentry/{ => Protocol}/DebugMeta.cs | 2 +- ...piApprovalTests.Run.DotNet6_0.verified.txt | 30 +++++++++---------- ...piApprovalTests.Run.DotNet7_0.verified.txt | 30 +++++++++---------- ...piApprovalTests.Run.DotNet8_0.verified.txt | 30 +++++++++---------- .../ApiApprovalTests.Run.Net4_8.verified.txt | 30 +++++++++---------- 11 files changed, 67 insertions(+), 62 deletions(-) rename src/Sentry/{ => Protocol}/DebugImage.cs (99%) rename src/Sentry/{ => Protocol}/DebugMeta.cs (96%) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff9776d24a..c07522af42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,7 @@ Additionally, we're dropping support for some of the old target frameworks, plea - `DebugImage.ImageAddress` changed to `long?`. ([#2725](https://github.com/getsentry/sentry-dotnet/pull/2725)) - Contexts now inherits from `IDictionary` rather than `ConcurrentDictionary`. The specific dictionary being used is an implementation detail. ([#2729](https://github.com/getsentry/sentry-dotnet/pull/2729)) - Transaction names for ASP.NET Core are now consistently named `HTTP-VERB /path` (e.g. `GET /home`). Previously the leading forward slash was missing for some endpoints. ([#2808](https://github.com/getsentry/sentry-dotnet/pull/2808)) +- `DebugImage` and `DebugMeta` moved to `Sentry.Protocol` namespace. ([#2815](https://github.com/getsentry/sentry-dotnet/pull/2815)) ### Fixes diff --git a/src/Sentry/Internal/DebugStackTrace.cs b/src/Sentry/Internal/DebugStackTrace.cs index 6035180c1a..1b9bc55709 100644 --- a/src/Sentry/Internal/DebugStackTrace.cs +++ b/src/Sentry/Internal/DebugStackTrace.cs @@ -2,6 +2,7 @@ using Sentry.Extensibility; using Sentry.Native; using Sentry.Internal.ILSpy; +using Sentry.Protocol; namespace Sentry.Internal; diff --git a/src/Sentry/Internal/Extensions/PEReaderExtensions.cs b/src/Sentry/Internal/Extensions/PEReaderExtensions.cs index ae612ac6d7..dba8455671 100644 --- a/src/Sentry/Internal/Extensions/PEReaderExtensions.cs +++ b/src/Sentry/Internal/Extensions/PEReaderExtensions.cs @@ -1,4 +1,5 @@ using Sentry.Extensibility; +using Sentry.Protocol; namespace Sentry.Internal.Extensions; diff --git a/src/Sentry/Internal/ILSpy/SingleFileApp.cs b/src/Sentry/Internal/ILSpy/SingleFileApp.cs index fa9ca49671..5368fddd96 100644 --- a/src/Sentry/Internal/ILSpy/SingleFileApp.cs +++ b/src/Sentry/Internal/ILSpy/SingleFileApp.cs @@ -1,5 +1,6 @@ using Sentry.Extensibility; using Sentry.Internal.Extensions; +using Sentry.Protocol; namespace Sentry.Internal.ILSpy; diff --git a/src/Sentry/Platforms/Native/CFunctions.cs b/src/Sentry/Platforms/Native/CFunctions.cs index dff3396ee3..2f6eb6d69a 100644 --- a/src/Sentry/Platforms/Native/CFunctions.cs +++ b/src/Sentry/Platforms/Native/CFunctions.cs @@ -1,5 +1,6 @@ using Sentry.Extensibility; using Sentry.Internal.Extensions; +using Sentry.Protocol; namespace Sentry.Native; diff --git a/src/Sentry/DebugImage.cs b/src/Sentry/Protocol/DebugImage.cs similarity index 99% rename from src/Sentry/DebugImage.cs rename to src/Sentry/Protocol/DebugImage.cs index afce6ab282..6f6a41b9c3 100644 --- a/src/Sentry/DebugImage.cs +++ b/src/Sentry/Protocol/DebugImage.cs @@ -1,7 +1,7 @@ using Sentry.Extensibility; using Sentry.Internal.Extensions; -namespace Sentry; +namespace Sentry.Protocol; /// /// The Sentry Debug Meta Images interface. diff --git a/src/Sentry/DebugMeta.cs b/src/Sentry/Protocol/DebugMeta.cs similarity index 96% rename from src/Sentry/DebugMeta.cs rename to src/Sentry/Protocol/DebugMeta.cs index e140bbd69a..be18118b45 100644 --- a/src/Sentry/DebugMeta.cs +++ b/src/Sentry/Protocol/DebugMeta.cs @@ -1,7 +1,7 @@ using Sentry.Extensibility; using Sentry.Internal.Extensions; -namespace Sentry; +namespace Sentry.Protocol; /// /// The Sentry Debug Meta interface. diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt index 3b0687998e..39648308f6 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt @@ -97,20 +97,6 @@ namespace Sentry Managed = 0, ManagedBackgroundThread = 1, } - public sealed class DebugImage : Sentry.IJsonSerializable - { - public DebugImage() { } - public string? CodeFile { get; set; } - public string? CodeId { get; set; } - public string? DebugChecksum { get; set; } - public string? DebugFile { get; set; } - public string? DebugId { get; set; } - public long? ImageAddress { get; set; } - public long? ImageSize { get; set; } - public string? Type { get; set; } - public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } - public static Sentry.DebugImage FromJson(System.Text.Json.JsonElement json) { } - } [System.Flags] public enum DeduplicateMode { @@ -517,7 +503,7 @@ namespace Sentry public SentryEvent(System.Exception? exception) { } public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } public Sentry.Contexts Contexts { get; set; } - public System.Collections.Generic.List? DebugImages { get; set; } + public System.Collections.Generic.List? DebugImages { get; set; } public string? Distribution { get; set; } public string? Environment { get; set; } public Sentry.SentryId EventId { get; } @@ -1502,6 +1488,20 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.Browser FromJson(System.Text.Json.JsonElement json) { } } + public sealed class DebugImage : Sentry.IJsonSerializable + { + public DebugImage() { } + public string? CodeFile { get; set; } + public string? CodeId { get; set; } + public string? DebugChecksum { get; set; } + public string? DebugFile { get; set; } + public string? DebugId { get; set; } + public long? ImageAddress { get; set; } + public long? ImageSize { get; set; } + public string? Type { get; set; } + public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } + public static Sentry.Protocol.DebugImage FromJson(System.Text.Json.JsonElement json) { } + } public sealed class Device : Sentry.IJsonSerializable { public const string Type = "device"; diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt index 3b0687998e..39648308f6 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt @@ -97,20 +97,6 @@ namespace Sentry Managed = 0, ManagedBackgroundThread = 1, } - public sealed class DebugImage : Sentry.IJsonSerializable - { - public DebugImage() { } - public string? CodeFile { get; set; } - public string? CodeId { get; set; } - public string? DebugChecksum { get; set; } - public string? DebugFile { get; set; } - public string? DebugId { get; set; } - public long? ImageAddress { get; set; } - public long? ImageSize { get; set; } - public string? Type { get; set; } - public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } - public static Sentry.DebugImage FromJson(System.Text.Json.JsonElement json) { } - } [System.Flags] public enum DeduplicateMode { @@ -517,7 +503,7 @@ namespace Sentry public SentryEvent(System.Exception? exception) { } public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } public Sentry.Contexts Contexts { get; set; } - public System.Collections.Generic.List? DebugImages { get; set; } + public System.Collections.Generic.List? DebugImages { get; set; } public string? Distribution { get; set; } public string? Environment { get; set; } public Sentry.SentryId EventId { get; } @@ -1502,6 +1488,20 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.Browser FromJson(System.Text.Json.JsonElement json) { } } + public sealed class DebugImage : Sentry.IJsonSerializable + { + public DebugImage() { } + public string? CodeFile { get; set; } + public string? CodeId { get; set; } + public string? DebugChecksum { get; set; } + public string? DebugFile { get; set; } + public string? DebugId { get; set; } + public long? ImageAddress { get; set; } + public long? ImageSize { get; set; } + public string? Type { get; set; } + public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } + public static Sentry.Protocol.DebugImage FromJson(System.Text.Json.JsonElement json) { } + } public sealed class Device : Sentry.IJsonSerializable { public const string Type = "device"; diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt index 3b0687998e..39648308f6 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt @@ -97,20 +97,6 @@ namespace Sentry Managed = 0, ManagedBackgroundThread = 1, } - public sealed class DebugImage : Sentry.IJsonSerializable - { - public DebugImage() { } - public string? CodeFile { get; set; } - public string? CodeId { get; set; } - public string? DebugChecksum { get; set; } - public string? DebugFile { get; set; } - public string? DebugId { get; set; } - public long? ImageAddress { get; set; } - public long? ImageSize { get; set; } - public string? Type { get; set; } - public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } - public static Sentry.DebugImage FromJson(System.Text.Json.JsonElement json) { } - } [System.Flags] public enum DeduplicateMode { @@ -517,7 +503,7 @@ namespace Sentry public SentryEvent(System.Exception? exception) { } public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } public Sentry.Contexts Contexts { get; set; } - public System.Collections.Generic.List? DebugImages { get; set; } + public System.Collections.Generic.List? DebugImages { get; set; } public string? Distribution { get; set; } public string? Environment { get; set; } public Sentry.SentryId EventId { get; } @@ -1502,6 +1488,20 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.Browser FromJson(System.Text.Json.JsonElement json) { } } + public sealed class DebugImage : Sentry.IJsonSerializable + { + public DebugImage() { } + public string? CodeFile { get; set; } + public string? CodeId { get; set; } + public string? DebugChecksum { get; set; } + public string? DebugFile { get; set; } + public string? DebugId { get; set; } + public long? ImageAddress { get; set; } + public long? ImageSize { get; set; } + public string? Type { get; set; } + public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } + public static Sentry.Protocol.DebugImage FromJson(System.Text.Json.JsonElement json) { } + } public sealed class Device : Sentry.IJsonSerializable { public const string Type = "device"; diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt index fe848e4c6c..b74651c7f0 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt @@ -97,20 +97,6 @@ namespace Sentry Managed = 0, ManagedBackgroundThread = 1, } - public sealed class DebugImage : Sentry.IJsonSerializable - { - public DebugImage() { } - public string? CodeFile { get; set; } - public string? CodeId { get; set; } - public string? DebugChecksum { get; set; } - public string? DebugFile { get; set; } - public string? DebugId { get; set; } - public long? ImageAddress { get; set; } - public long? ImageSize { get; set; } - public string? Type { get; set; } - public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } - public static Sentry.DebugImage FromJson(System.Text.Json.JsonElement json) { } - } [System.Flags] public enum DeduplicateMode { @@ -516,7 +502,7 @@ namespace Sentry public SentryEvent(System.Exception? exception) { } public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } public Sentry.Contexts Contexts { get; set; } - public System.Collections.Generic.List? DebugImages { get; set; } + public System.Collections.Generic.List? DebugImages { get; set; } public string? Distribution { get; set; } public string? Environment { get; set; } public Sentry.SentryId EventId { get; } @@ -1500,6 +1486,20 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.Browser FromJson(System.Text.Json.JsonElement json) { } } + public sealed class DebugImage : Sentry.IJsonSerializable + { + public DebugImage() { } + public string? CodeFile { get; set; } + public string? CodeId { get; set; } + public string? DebugChecksum { get; set; } + public string? DebugFile { get; set; } + public string? DebugId { get; set; } + public long? ImageAddress { get; set; } + public long? ImageSize { get; set; } + public string? Type { get; set; } + public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } + public static Sentry.Protocol.DebugImage FromJson(System.Text.Json.JsonElement json) { } + } public sealed class Device : Sentry.IJsonSerializable { public const string Type = "device";