diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a6cbf410b..47b98eaff6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ - SentryOptions.IsEnvironmentUser now defaults to false on MAUI. The means the User.Name will no longer be set, by default, to the name of the device ([#4606](https://github.com/getsentry/sentry-dotnet/pull/4606)) - Remove unnecessary files from SentryCocoaFramework before packing ([#4602](https://github.com/getsentry/sentry-dotnet/pull/4602)) +- Removed obsolete v6 APIs ([#4619](https://github.com/getsentry/sentry-dotnet/pull/4619)) + - Removed the unusual constructor from `Sentry.Maui.BreadcrumbEvent` that had been marked as obsolete. That constructor expected a `IEnumerable<(string Key, string Value)>[]` argument (i.e. an array of IEnumerable of tuples). If you were using this constructor, you should instead use the alternate constructor that expects just an IEnumerable of tuples: `IEnumerable<(string Key, string Value)>`. + - Removed `SentrySdk.CaptureUserFeedback` and all associated members. Use the newer `SentrySdk.CaptureFeedback` instead. ## 6.0.0-preview.1 diff --git a/src/Sentry.Maui/BreadcrumbEvent.cs b/src/Sentry.Maui/BreadcrumbEvent.cs index 48a9252901..3c3797d255 100644 --- a/src/Sentry.Maui/BreadcrumbEvent.cs +++ b/src/Sentry.Maui/BreadcrumbEvent.cs @@ -52,20 +52,4 @@ public BreadcrumbEvent( e => new KeyValuePair(e.key, e.value))) { } - - /// - /// This constructor remains for backward compatibility. - /// - /// - /// - /// - [Obsolete("Use one of the other simpler constructors instead.")] - public BreadcrumbEvent( - object? sender, - string eventName, - IEnumerable<(string Key, string Value)>[] extraData) : this(sender, eventName, extraData.SelectMany( - x => x.Select(pair => new KeyValuePair(pair.Key, pair.Value))) - ) - { - } } diff --git a/src/Sentry/Extensibility/DisabledHub.cs b/src/Sentry/Extensibility/DisabledHub.cs index e835a0edfc..30d2eefffa 100644 --- a/src/Sentry/Extensibility/DisabledHub.cs +++ b/src/Sentry/Extensibility/DisabledHub.cs @@ -242,14 +242,6 @@ public void Dispose() { } - /// - /// No-Op. - /// - [Obsolete("Use CaptureFeedback instead.")] - public void CaptureUserFeedback(UserFeedback userFeedback) - { - } - /// /// No-Op. /// diff --git a/src/Sentry/Extensibility/HubAdapter.cs b/src/Sentry/Extensibility/HubAdapter.cs index e94a6c1914..25eb86800c 100644 --- a/src/Sentry/Extensibility/HubAdapter.cs +++ b/src/Sentry/Extensibility/HubAdapter.cs @@ -335,13 +335,4 @@ public SentryId CaptureCheckIn( [EditorBrowsable(EditorBrowsableState.Never)] public Task FlushAsync(TimeSpan timeout) => SentrySdk.FlushAsync(timeout); - - /// - /// Forwards the call to - /// - [DebuggerStepThrough] - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CaptureFeedback instead.")] - public void CaptureUserFeedback(UserFeedback sentryUserFeedback) - => SentrySdk.CaptureUserFeedback(sentryUserFeedback); } diff --git a/src/Sentry/ISentryClient.cs b/src/Sentry/ISentryClient.cs index 8229d57780..ae8f93dc0c 100644 --- a/src/Sentry/ISentryClient.cs +++ b/src/Sentry/ISentryClient.cs @@ -36,13 +36,6 @@ public interface ISentryClient /// An optional hint providing high level context for the source of the event public void CaptureFeedback(SentryFeedback feedback, Scope? scope = null, SentryHint? hint = null); - /// - /// Captures a user feedback. - /// - /// The user feedback to send to Sentry. - [Obsolete("Use CaptureFeedback instead.")] - public void CaptureUserFeedback(UserFeedback userFeedback); - /// /// Captures a transaction. /// diff --git a/src/Sentry/Internal/Hub.cs b/src/Sentry/Internal/Hub.cs index 5170a64233..df0fa3d3f4 100644 --- a/src/Sentry/Internal/Hub.cs +++ b/src/Sentry/Internal/Hub.cs @@ -661,34 +661,6 @@ internal void CaptureHeapDump(string dumpFile) } #endif - [Obsolete("Use CaptureFeedback instead.")] - public void CaptureUserFeedback(UserFeedback userFeedback) - { - if (!IsEnabled) - { - return; - } - - try - { - if (!string.IsNullOrWhiteSpace(userFeedback.Email) && !EmailValidator.IsValidEmail(userFeedback.Email)) - { - _options.LogWarning("Feedback email scrubbed due to invalid email format: '{0}'", userFeedback.Email); - userFeedback = new UserFeedback( - userFeedback.EventId, - userFeedback.Name, - null, // Scrubbed email - userFeedback.Comments); - } - - CurrentClient.CaptureUserFeedback(userFeedback); - } - catch (Exception e) - { - _options.LogError(e, "Failure to capture user feedback: {0}", userFeedback.EventId); - } - } - public void CaptureTransaction(SentryTransaction transaction) => CaptureTransaction(transaction, null, null); public void CaptureTransaction(SentryTransaction transaction, Scope? scope, SentryHint? hint) diff --git a/src/Sentry/Protocol/Envelopes/Envelope.cs b/src/Sentry/Protocol/Envelopes/Envelope.cs index 45193ea097..e9b06cff00 100644 --- a/src/Sentry/Protocol/Envelopes/Envelope.cs +++ b/src/Sentry/Protocol/Envelopes/Envelope.cs @@ -330,23 +330,6 @@ public static Envelope FromFeedback( return new Envelope(eventId, header, items); } - /// - /// Creates an envelope that contains a single user feedback. - /// - [Obsolete("Use FromFeedback instead.")] - public static Envelope FromUserFeedback(UserFeedback sentryUserFeedback) - { - var eventId = sentryUserFeedback.EventId; - var header = CreateHeader(eventId); - - var items = new[] - { - EnvelopeItem.FromUserFeedback(sentryUserFeedback) - }; - - return new Envelope(eventId, header, items); - } - /// /// Creates an envelope that contains a single transaction. /// diff --git a/src/Sentry/Protocol/Envelopes/EnvelopeItem.cs b/src/Sentry/Protocol/Envelopes/EnvelopeItem.cs index 5409ebc0a6..976c9a1305 100644 --- a/src/Sentry/Protocol/Envelopes/EnvelopeItem.cs +++ b/src/Sentry/Protocol/Envelopes/EnvelopeItem.cs @@ -231,20 +231,6 @@ public static EnvelopeItem FromFeedback(SentryEvent @event) return new EnvelopeItem(header, new JsonSerializable(@event)); } - /// - /// Creates an from . - /// - [Obsolete("Use FromFeedback instead.")] - public static EnvelopeItem FromUserFeedback(UserFeedback sentryUserFeedback) - { - var header = new Dictionary(1, StringComparer.Ordinal) - { - [TypeKey] = TypeValueUserReport - }; - - return new EnvelopeItem(header, new JsonSerializable(sentryUserFeedback)); - } - /// /// Creates an from . /// @@ -417,18 +403,6 @@ private static async Task DeserializePayloadAsync( return new JsonSerializable(sentryEvent); } - // User report - if (string.Equals(payloadType, TypeValueUserReport, StringComparison.OrdinalIgnoreCase)) - { -#pragma warning disable CS0618 // Type or member is obsolete - var bufferLength = (int)(payloadLength ?? stream.Length); - var buffer = await stream.ReadByteChunkAsync(bufferLength, cancellationToken).ConfigureAwait(false); - var userFeedback = Json.Parse(buffer, UserFeedback.FromJson); -#pragma warning restore CS0618 // Type or member is obsolete - - return new JsonSerializable(userFeedback); - } - // Transaction if (string.Equals(payloadType, TypeValueTransaction, StringComparison.OrdinalIgnoreCase)) { diff --git a/src/Sentry/SentryClient.cs b/src/Sentry/SentryClient.cs index 80ede995dd..7fc8b70a02 100644 --- a/src/Sentry/SentryClient.cs +++ b/src/Sentry/SentryClient.cs @@ -119,20 +119,6 @@ public void CaptureFeedback(SentryFeedback feedback, Scope? scope = null, Sentry CaptureEnvelope(envelope); } - /// - [Obsolete("Use CaptureFeedback instead.")] - public void CaptureUserFeedback(UserFeedback userFeedback) - { - if (userFeedback.EventId.Equals(SentryId.Empty)) - { - // Ignore the user feedback if EventId is empty - _options.LogWarning("User feedback dropped due to empty id."); - return; - } - - CaptureEnvelope(Envelope.FromUserFeedback(userFeedback)); - } - /// public void CaptureTransaction(SentryTransaction transaction) => CaptureTransaction(transaction, null, null); diff --git a/src/Sentry/SentryClientExtensions.cs b/src/Sentry/SentryClientExtensions.cs index 73d394f205..fc0b120b8e 100644 --- a/src/Sentry/SentryClientExtensions.cs +++ b/src/Sentry/SentryClientExtensions.cs @@ -49,26 +49,6 @@ public static void CaptureFeedback(this ISentryClient client, string message, st => client.CaptureFeedback(new SentryFeedback(message, contactEmail, name, replayId, url, associatedEventId), scope, hint); - /// - /// Captures a user feedback. - /// - /// - /// The event Id. - /// The user email. - /// The user comments. - /// The optional username. - [Obsolete("Use CaptureFeedback instead.")] - public static void CaptureUserFeedback(this ISentryClient client, SentryId eventId, string email, string comments, - string? name = null) - { - if (!client.IsEnabled) - { - return; - } - - client.CaptureUserFeedback(new UserFeedback(eventId, name, email, comments)); - } - /// /// Flushes the queue of captured events until the timeout set in /// is reached. @@ -125,7 +105,8 @@ public static Task FlushAsync(this ISentryClient client) /// /// /// - [Obsolete("This method is meant for external usage only")] + [Obsolete("WARNING: This method is meant for internal usage only")] + [EditorBrowsable(EditorBrowsableState.Never)] public static SentryOptions? GetInternalSentryOptions(this ISentryClient clientOrHub) => clientOrHub.GetSentryOptions(); } diff --git a/src/Sentry/SentrySdk.cs b/src/Sentry/SentrySdk.cs index a8588370b6..982dbb6c3a 100644 --- a/src/Sentry/SentrySdk.cs +++ b/src/Sentry/SentrySdk.cs @@ -566,27 +566,6 @@ public static void CaptureFeedback(string message, string? contactEmail = null, => CurrentHub.CaptureFeedback(new SentryFeedback(message, contactEmail, name, replayId, url, associatedEventId), scope, hint); - /// - /// Captures a user feedback. - /// - /// The user feedback to send to Sentry. - [DebuggerStepThrough] - [Obsolete("Use CaptureFeedback instead.")] - public static void CaptureUserFeedback(UserFeedback userFeedback) - => CurrentHub.CaptureUserFeedback(userFeedback); - - /// - /// Captures a user feedback. - /// - /// The event Id. - /// The user email. - /// The user comments. - /// The optional username. - [DebuggerStepThrough] - [Obsolete("Use CaptureFeedback instead.")] - public static void CaptureUserFeedback(SentryId eventId, string email, string comments, string? name = null) - => CurrentHub.CaptureUserFeedback(new UserFeedback(eventId, name, email, comments)); - /// /// Captures a transaction. /// diff --git a/src/Sentry/UserFeedback.cs b/src/Sentry/UserFeedback.cs deleted file mode 100644 index 0094a6ade4..0000000000 --- a/src/Sentry/UserFeedback.cs +++ /dev/null @@ -1,68 +0,0 @@ -using Sentry.Extensibility; -using Sentry.Internal.Extensions; - -namespace Sentry; - -/// -/// Sentry User Feedback. -/// -[Obsolete("Use SentryFeedback instead.")] -public sealed class UserFeedback : ISentryJsonSerializable -{ - /// - /// The eventId of the event to which the user feedback is associated. - /// - public SentryId EventId { get; } - - /// - /// The name of the user. - /// - public string? Name { get; } - - /// - /// The name of the user. - /// - public string? Email { get; } - - /// - /// Comments of the user about what happened. - /// - public string? Comments { get; } - - /// - /// Initializes an instance of . - /// - public UserFeedback(SentryId eventId, string? name, string? email, string? comments) - { - EventId = eventId; - Name = name; - Email = email; - Comments = comments; - } - - /// - public void WriteTo(Utf8JsonWriter writer, IDiagnosticLogger? logger) - { - writer.WriteStartObject(); - - writer.WriteSerializable("event_id", EventId, logger); - writer.WriteStringIfNotWhiteSpace("name", Name); - writer.WriteStringIfNotWhiteSpace("email", Email); - writer.WriteStringIfNotWhiteSpace("comments", Comments); - - writer.WriteEndObject(); - } - - /// - /// Parses from JSON. - /// - public static UserFeedback FromJson(JsonElement json) - { - var eventId = json.GetPropertyOrNull("event_id")?.Pipe(SentryId.FromJson) ?? SentryId.Empty; - var name = json.GetPropertyOrNull("name")?.GetString(); - var email = json.GetPropertyOrNull("email")?.GetString(); - var comments = json.GetPropertyOrNull("comments")?.GetString(); - - return new UserFeedback(eventId, name, email, comments); - } -} diff --git a/test/Sentry.Maui.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt b/test/Sentry.Maui.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt index 244d13725f..db0645d89c 100644 --- a/test/Sentry.Maui.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt +++ b/test/Sentry.Maui.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt @@ -25,10 +25,6 @@ namespace Sentry.Maui public BreadcrumbEvent(object? sender, string eventName, [System.Runtime.CompilerServices.ParamCollection] [System.Runtime.CompilerServices.TupleElementNames(new string[] { "key", "value"})] System.Collections.Generic.IEnumerable> extraData) { } - [System.Obsolete("Use one of the other simpler constructors instead.")] - public BreadcrumbEvent(object? sender, string eventName, [System.Runtime.CompilerServices.TupleElementNames(new string[] { - "Key", - "Value"})] System.Collections.Generic.IEnumerable>[] extraData) { } public string EventName { get; } public System.Collections.Generic.IEnumerable> ExtraData { get; } public object? Sender { get; } diff --git a/test/Sentry.Maui.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt b/test/Sentry.Maui.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt index 12ae9dcc31..f2790100c2 100644 --- a/test/Sentry.Maui.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt +++ b/test/Sentry.Maui.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt @@ -18,10 +18,6 @@ namespace Sentry.Maui public BreadcrumbEvent(object? sender, string eventName, [System.Runtime.CompilerServices.ParamCollection] [System.Runtime.CompilerServices.TupleElementNames(new string[] { "key", "value"})] System.Collections.Generic.IEnumerable> extraData) { } - [System.Obsolete("Use one of the other simpler constructors instead.")] - public BreadcrumbEvent(object? sender, string eventName, [System.Runtime.CompilerServices.TupleElementNames(new string[] { - "Key", - "Value"})] System.Collections.Generic.IEnumerable>[] extraData) { } public string EventName { get; } public System.Collections.Generic.IEnumerable> ExtraData { get; } public object? Sender { get; } diff --git a/test/Sentry.Maui.Tests/BreadcrumbEventTests.cs b/test/Sentry.Maui.Tests/BreadcrumbEventTests.cs index c92938adde..073aeebe22 100644 --- a/test/Sentry.Maui.Tests/BreadcrumbEventTests.cs +++ b/test/Sentry.Maui.Tests/BreadcrumbEventTests.cs @@ -14,10 +14,8 @@ public void BreadcrumbEvent_OldConstructor_EquivalentToNewConstructor() var eventName = "TestEvent"; // Act - IEnumerable<(string Key, string Value)>[] extraData = [[("key1", "value1")], [("key2", "value2")]]; -#pragma warning disable CS0618 // Type or member is obsolete + IEnumerable<(string Key, string Value)> extraData = [("key1", "value1"), ("key2", "value2")]; var oldEvent = new BreadcrumbEvent(sender, eventName, extraData); -#pragma warning restore CS0618 // Type or member is obsolete var newEvent = new BreadcrumbEvent(sender, eventName, ("key1", "value1"), ("key2", "value2")); // Assert diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt index 406a853181..652c97c761 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt @@ -222,8 +222,6 @@ namespace Sentry void CaptureSession(Sentry.SessionUpdate sessionUpdate); void CaptureTransaction(Sentry.SentryTransaction transaction); void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint); - [System.Obsolete("Use CaptureFeedback instead.")] - void CaptureUserFeedback(Sentry.UserFeedback userFeedback); System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout); } public interface ISentryJsonSerializable @@ -452,8 +450,6 @@ namespace Sentry public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void Dispose() { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } } @@ -462,12 +458,10 @@ namespace Sentry public static Sentry.SentryId CaptureException(this Sentry.ISentryClient client, System.Exception ex) { } public static void CaptureFeedback(this Sentry.ISentryClient client, string message, string? contactEmail = null, string? name = null, string? replayId = null, string? url = null, Sentry.SentryId? associatedEventId = default, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { } public static Sentry.SentryId CaptureMessage(this Sentry.ISentryClient client, string message, Sentry.SentryLevel level = 1) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public static void CaptureUserFeedback(this Sentry.ISentryClient client, Sentry.SentryId eventId, string email, string comments, string? name = null) { } public static void Flush(this Sentry.ISentryClient client) { } public static void Flush(this Sentry.ISentryClient client, System.TimeSpan timeout) { } public static System.Threading.Tasks.Task FlushAsync(this Sentry.ISentryClient client) { } - [System.Obsolete("This method is meant for external usage only")] + [System.Obsolete("WARNING: This method is meant for internal usage only")] public static Sentry.SentryOptions? GetInternalSentryOptions(this Sentry.ISentryClient clientOrHub) { } } public static class SentryConstants @@ -852,10 +846,6 @@ namespace Sentry public static void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public static void CaptureTransaction(Sentry.SentryTransaction transaction) { } public static void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public static void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public static void CaptureUserFeedback(Sentry.SentryId eventId, string email, string comments, string? name = null) { } [System.Obsolete("WARNING: This method deliberately causes a crash, and should not be used in a rea" + "l application.")] public static void CauseCrash(Sentry.CrashType crashType) { } @@ -1289,17 +1279,6 @@ namespace Sentry public Sentry.ISpan StartChild(string operation) { } public void UnsetTag(string key) { } } - [System.Obsolete("Use SentryFeedback instead.")] - public sealed class UserFeedback : Sentry.ISentryJsonSerializable - { - public UserFeedback(Sentry.SentryId eventId, string? name, string? email, string? comments) { } - public string? Comments { get; } - public string? Email { get; } - public Sentry.SentryId EventId { get; } - public string? Name { get; } - public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } - public static Sentry.UserFeedback FromJson(System.Text.Json.JsonElement json) { } - } public sealed class ViewHierarchy : Sentry.ISentryJsonSerializable { public ViewHierarchy(string renderingSystem) { } @@ -1393,8 +1372,6 @@ namespace Sentry.Extensibility public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void ConfigureScope(System.Action configureScope) { } public void ConfigureScope(System.Action configureScope, TArg arg) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1445,8 +1422,6 @@ namespace Sentry.Extensibility public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public void CaptureUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } public void ConfigureScope(System.Action configureScope) { } public void ConfigureScope(System.Action configureScope, TArg arg) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1900,8 +1875,6 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.Envelope FromFeedback(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } - [System.Obsolete("Use FromFeedback instead.")] - public static Sentry.Protocol.Envelopes.Envelope FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable { @@ -1921,8 +1894,6 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.EnvelopeItem FromFeedback(Sentry.SentryEvent @event) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromSession(Sentry.SessionUpdate sessionUpdate) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromTransaction(Sentry.SentryTransaction transaction) { } - [System.Obsolete("Use FromFeedback instead.")] - public static Sentry.Protocol.Envelopes.EnvelopeItem FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } } public interface ISerializable { diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt index 406a853181..652c97c761 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt @@ -222,8 +222,6 @@ namespace Sentry void CaptureSession(Sentry.SessionUpdate sessionUpdate); void CaptureTransaction(Sentry.SentryTransaction transaction); void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint); - [System.Obsolete("Use CaptureFeedback instead.")] - void CaptureUserFeedback(Sentry.UserFeedback userFeedback); System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout); } public interface ISentryJsonSerializable @@ -452,8 +450,6 @@ namespace Sentry public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void Dispose() { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } } @@ -462,12 +458,10 @@ namespace Sentry public static Sentry.SentryId CaptureException(this Sentry.ISentryClient client, System.Exception ex) { } public static void CaptureFeedback(this Sentry.ISentryClient client, string message, string? contactEmail = null, string? name = null, string? replayId = null, string? url = null, Sentry.SentryId? associatedEventId = default, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { } public static Sentry.SentryId CaptureMessage(this Sentry.ISentryClient client, string message, Sentry.SentryLevel level = 1) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public static void CaptureUserFeedback(this Sentry.ISentryClient client, Sentry.SentryId eventId, string email, string comments, string? name = null) { } public static void Flush(this Sentry.ISentryClient client) { } public static void Flush(this Sentry.ISentryClient client, System.TimeSpan timeout) { } public static System.Threading.Tasks.Task FlushAsync(this Sentry.ISentryClient client) { } - [System.Obsolete("This method is meant for external usage only")] + [System.Obsolete("WARNING: This method is meant for internal usage only")] public static Sentry.SentryOptions? GetInternalSentryOptions(this Sentry.ISentryClient clientOrHub) { } } public static class SentryConstants @@ -852,10 +846,6 @@ namespace Sentry public static void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public static void CaptureTransaction(Sentry.SentryTransaction transaction) { } public static void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public static void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public static void CaptureUserFeedback(Sentry.SentryId eventId, string email, string comments, string? name = null) { } [System.Obsolete("WARNING: This method deliberately causes a crash, and should not be used in a rea" + "l application.")] public static void CauseCrash(Sentry.CrashType crashType) { } @@ -1289,17 +1279,6 @@ namespace Sentry public Sentry.ISpan StartChild(string operation) { } public void UnsetTag(string key) { } } - [System.Obsolete("Use SentryFeedback instead.")] - public sealed class UserFeedback : Sentry.ISentryJsonSerializable - { - public UserFeedback(Sentry.SentryId eventId, string? name, string? email, string? comments) { } - public string? Comments { get; } - public string? Email { get; } - public Sentry.SentryId EventId { get; } - public string? Name { get; } - public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } - public static Sentry.UserFeedback FromJson(System.Text.Json.JsonElement json) { } - } public sealed class ViewHierarchy : Sentry.ISentryJsonSerializable { public ViewHierarchy(string renderingSystem) { } @@ -1393,8 +1372,6 @@ namespace Sentry.Extensibility public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void ConfigureScope(System.Action configureScope) { } public void ConfigureScope(System.Action configureScope, TArg arg) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1445,8 +1422,6 @@ namespace Sentry.Extensibility public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public void CaptureUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } public void ConfigureScope(System.Action configureScope) { } public void ConfigureScope(System.Action configureScope, TArg arg) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1900,8 +1875,6 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.Envelope FromFeedback(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } - [System.Obsolete("Use FromFeedback instead.")] - public static Sentry.Protocol.Envelopes.Envelope FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable { @@ -1921,8 +1894,6 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.EnvelopeItem FromFeedback(Sentry.SentryEvent @event) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromSession(Sentry.SessionUpdate sessionUpdate) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromTransaction(Sentry.SentryTransaction transaction) { } - [System.Obsolete("Use FromFeedback instead.")] - public static Sentry.Protocol.Envelopes.EnvelopeItem FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } } public interface ISerializable { diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt index 406a853181..652c97c761 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt @@ -222,8 +222,6 @@ namespace Sentry void CaptureSession(Sentry.SessionUpdate sessionUpdate); void CaptureTransaction(Sentry.SentryTransaction transaction); void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint); - [System.Obsolete("Use CaptureFeedback instead.")] - void CaptureUserFeedback(Sentry.UserFeedback userFeedback); System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout); } public interface ISentryJsonSerializable @@ -452,8 +450,6 @@ namespace Sentry public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void Dispose() { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } } @@ -462,12 +458,10 @@ namespace Sentry public static Sentry.SentryId CaptureException(this Sentry.ISentryClient client, System.Exception ex) { } public static void CaptureFeedback(this Sentry.ISentryClient client, string message, string? contactEmail = null, string? name = null, string? replayId = null, string? url = null, Sentry.SentryId? associatedEventId = default, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { } public static Sentry.SentryId CaptureMessage(this Sentry.ISentryClient client, string message, Sentry.SentryLevel level = 1) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public static void CaptureUserFeedback(this Sentry.ISentryClient client, Sentry.SentryId eventId, string email, string comments, string? name = null) { } public static void Flush(this Sentry.ISentryClient client) { } public static void Flush(this Sentry.ISentryClient client, System.TimeSpan timeout) { } public static System.Threading.Tasks.Task FlushAsync(this Sentry.ISentryClient client) { } - [System.Obsolete("This method is meant for external usage only")] + [System.Obsolete("WARNING: This method is meant for internal usage only")] public static Sentry.SentryOptions? GetInternalSentryOptions(this Sentry.ISentryClient clientOrHub) { } } public static class SentryConstants @@ -852,10 +846,6 @@ namespace Sentry public static void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public static void CaptureTransaction(Sentry.SentryTransaction transaction) { } public static void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public static void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public static void CaptureUserFeedback(Sentry.SentryId eventId, string email, string comments, string? name = null) { } [System.Obsolete("WARNING: This method deliberately causes a crash, and should not be used in a rea" + "l application.")] public static void CauseCrash(Sentry.CrashType crashType) { } @@ -1289,17 +1279,6 @@ namespace Sentry public Sentry.ISpan StartChild(string operation) { } public void UnsetTag(string key) { } } - [System.Obsolete("Use SentryFeedback instead.")] - public sealed class UserFeedback : Sentry.ISentryJsonSerializable - { - public UserFeedback(Sentry.SentryId eventId, string? name, string? email, string? comments) { } - public string? Comments { get; } - public string? Email { get; } - public Sentry.SentryId EventId { get; } - public string? Name { get; } - public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } - public static Sentry.UserFeedback FromJson(System.Text.Json.JsonElement json) { } - } public sealed class ViewHierarchy : Sentry.ISentryJsonSerializable { public ViewHierarchy(string renderingSystem) { } @@ -1393,8 +1372,6 @@ namespace Sentry.Extensibility public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void ConfigureScope(System.Action configureScope) { } public void ConfigureScope(System.Action configureScope, TArg arg) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1445,8 +1422,6 @@ namespace Sentry.Extensibility public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public void CaptureUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } public void ConfigureScope(System.Action configureScope) { } public void ConfigureScope(System.Action configureScope, TArg arg) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1900,8 +1875,6 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.Envelope FromFeedback(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } - [System.Obsolete("Use FromFeedback instead.")] - public static Sentry.Protocol.Envelopes.Envelope FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable { @@ -1921,8 +1894,6 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.EnvelopeItem FromFeedback(Sentry.SentryEvent @event) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromSession(Sentry.SessionUpdate sessionUpdate) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromTransaction(Sentry.SentryTransaction transaction) { } - [System.Obsolete("Use FromFeedback instead.")] - public static Sentry.Protocol.Envelopes.EnvelopeItem FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } } public interface ISerializable { diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt index e2a02fc89a..1bb5a16fc9 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt @@ -210,8 +210,6 @@ namespace Sentry void CaptureSession(Sentry.SessionUpdate sessionUpdate); void CaptureTransaction(Sentry.SentryTransaction transaction); void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint); - [System.Obsolete("Use CaptureFeedback instead.")] - void CaptureUserFeedback(Sentry.UserFeedback userFeedback); System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout); } public interface ISentryJsonSerializable @@ -440,8 +438,6 @@ namespace Sentry public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void Dispose() { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } } @@ -450,12 +446,10 @@ namespace Sentry public static Sentry.SentryId CaptureException(this Sentry.ISentryClient client, System.Exception ex) { } public static void CaptureFeedback(this Sentry.ISentryClient client, string message, string? contactEmail = null, string? name = null, string? replayId = null, string? url = null, Sentry.SentryId? associatedEventId = default, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { } public static Sentry.SentryId CaptureMessage(this Sentry.ISentryClient client, string message, Sentry.SentryLevel level = 1) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public static void CaptureUserFeedback(this Sentry.ISentryClient client, Sentry.SentryId eventId, string email, string comments, string? name = null) { } public static void Flush(this Sentry.ISentryClient client) { } public static void Flush(this Sentry.ISentryClient client, System.TimeSpan timeout) { } public static System.Threading.Tasks.Task FlushAsync(this Sentry.ISentryClient client) { } - [System.Obsolete("This method is meant for external usage only")] + [System.Obsolete("WARNING: This method is meant for internal usage only")] public static Sentry.SentryOptions? GetInternalSentryOptions(this Sentry.ISentryClient clientOrHub) { } } public static class SentryConstants @@ -828,10 +822,6 @@ namespace Sentry public static void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public static void CaptureTransaction(Sentry.SentryTransaction transaction) { } public static void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public static void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public static void CaptureUserFeedback(Sentry.SentryId eventId, string email, string comments, string? name = null) { } [System.Obsolete("WARNING: This method deliberately causes a crash, and should not be used in a rea" + "l application.")] public static void CauseCrash(Sentry.CrashType crashType) { } @@ -1265,17 +1255,6 @@ namespace Sentry public Sentry.ISpan StartChild(string operation) { } public void UnsetTag(string key) { } } - [System.Obsolete("Use SentryFeedback instead.")] - public sealed class UserFeedback : Sentry.ISentryJsonSerializable - { - public UserFeedback(Sentry.SentryId eventId, string? name, string? email, string? comments) { } - public string? Comments { get; } - public string? Email { get; } - public Sentry.SentryId EventId { get; } - public string? Name { get; } - public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } - public static Sentry.UserFeedback FromJson(System.Text.Json.JsonElement json) { } - } public sealed class ViewHierarchy : Sentry.ISentryJsonSerializable { public ViewHierarchy(string renderingSystem) { } @@ -1369,8 +1348,6 @@ namespace Sentry.Extensibility public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void ConfigureScope(System.Action configureScope) { } public void ConfigureScope(System.Action configureScope, TArg arg) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1421,8 +1398,6 @@ namespace Sentry.Extensibility public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } - [System.Obsolete("Use CaptureFeedback instead.")] - public void CaptureUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } public void ConfigureScope(System.Action configureScope) { } public void ConfigureScope(System.Action configureScope, TArg arg) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1871,8 +1846,6 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.Envelope FromFeedback(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } - [System.Obsolete("Use FromFeedback instead.")] - public static Sentry.Protocol.Envelopes.Envelope FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable { @@ -1892,8 +1865,6 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.EnvelopeItem FromFeedback(Sentry.SentryEvent @event) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromSession(Sentry.SessionUpdate sessionUpdate) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromTransaction(Sentry.SentryTransaction transaction) { } - [System.Obsolete("Use FromFeedback instead.")] - public static Sentry.Protocol.Envelopes.EnvelopeItem FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } } public interface ISerializable { diff --git a/test/Sentry.Tests/HubTests.cs b/test/Sentry.Tests/HubTests.cs index 342d38f84d..4da1500071 100644 --- a/test/Sentry.Tests/HubTests.cs +++ b/test/Sentry.Tests/HubTests.cs @@ -2131,29 +2131,6 @@ public void CaptureAttachment_AttachmentNull_ReturnsFalse() _fixture.Client.DidNotReceive().CaptureEnvelope(Arg.Any()); } - [Theory] - [InlineData(true)] - [InlineData(false)] - public void CaptureUserFeedback_HubEnabled(bool enabled) - { -#pragma warning disable CS0618 // Type or member is obsolete - // Arrange - var hub = _fixture.GetSut(); - if (!enabled) - { - hub.Dispose(); - } - - var feedback = new UserFeedback(SentryId.Create(), "foo", "bar@example.com", "baz"); - - // Act - hub.CaptureUserFeedback(feedback); - - // Assert - _fixture.Client.Received(enabled ? 1 : 0).CaptureUserFeedback(Arg.Any()); -#pragma warning restore CS0618 // Type or member is obsolete - } - [Theory] [InlineData(true)] [InlineData(false)] @@ -2340,56 +2317,6 @@ public void CaptureFeedback_InvalidEmail_FeedbackDropped(string email) Arg.Any(), Arg.Any()); } - [Theory] - [InlineData(null)] - [InlineData("")] - [InlineData(" ")] - [InlineData("test@example.com")] - [InlineData("user.name@domain.com")] - [InlineData("user+tag@example.com")] - public void CaptureUserFeedback_ValidEmail_FeedbackRegistered(string email) - { -#pragma warning disable CS0618 // Type or member is obsolete - // Arrange - var hub = _fixture.GetSut(); - var feedback = new UserFeedback(SentryId.Create(), "Test name", email, "Test comment"); - - // Act - hub.CaptureUserFeedback(feedback); - - // Assert - _fixture.Client.Received(1).CaptureUserFeedback(Arg.Any()); -#pragma warning restore CS0618 // Type or member is obsolete - } - - [Theory] - [InlineData("invalid-email")] - [InlineData("missing@domain")] - [InlineData("@missing-local.com")] - [InlineData("spaces in@email.com")] - public void CaptureUserFeedback_InvalidEmail_FeedbackDropped(string email) - { -#pragma warning disable CS0618 // Type or member is obsolete - // Arrange - _fixture.Options.Debug = true; - _fixture.Options.DiagnosticLogger = Substitute.For(); - _fixture.Options.DiagnosticLogger!.IsEnabled(Arg.Any()).Returns(true); - var hub = _fixture.GetSut(); - var feedback = new UserFeedback(SentryId.Create(), "Test name", email, "Test comment"); - - // Act - hub.CaptureUserFeedback(feedback); - - // Assert - _fixture.Options.DiagnosticLogger.Received(1).Log( - SentryLevel.Warning, - Arg.Is(s => s.Contains("invalid email format")), - null, - Arg.Any()); - _fixture.Client.Received(1).CaptureUserFeedback(Arg.Is(f => f.Email.IsNull())); -#pragma warning restore CS0618 // Type or member is obsolete - } - private class TestDisposableIntegration : ISdkIntegration, IDisposable { public int Registered { get; private set; } diff --git a/test/Sentry.Tests/Protocol/Envelopes/EnvelopeTests.cs b/test/Sentry.Tests/Protocol/Envelopes/EnvelopeTests.cs index 60f2fb98a4..8db1187afe 100644 --- a/test/Sentry.Tests/Protocol/Envelopes/EnvelopeTests.cs +++ b/test/Sentry.Tests/Protocol/Envelopes/EnvelopeTests.cs @@ -795,32 +795,6 @@ public async Task Roundtrip_WithEvent_WithSession_Success() .Which.Source.Should().BeEquivalentTo(sessionUpdate); } - [Fact] - public async Task Roundtrip_WithUserFeedback_Success() - { -#pragma warning disable CS0618 // Type or member is obsolete - // Arrange - var feedback = new UserFeedback( - SentryId.Create(), - "Someone Nice", - "foo@bar.com", - "Everything is great!"); - - using var envelope = Envelope.FromUserFeedback(feedback); - - using var stream = new MemoryStream(); - - // Act - await envelope.SerializeAsync(stream, _testOutputLogger); - stream.Seek(0, SeekOrigin.Begin); - - using var envelopeRoundtrip = await Envelope.DeserializeAsync(stream); - - // Assert - envelopeRoundtrip.Should().BeEquivalentTo(envelope); -#pragma warning restore CS0618 // Type or member is obsolete - } - [Fact] public async Task Roundtrip_WithFeedback_Success() { diff --git a/test/Sentry.Tests/Protocol/UserFeedbackTests.cs b/test/Sentry.Tests/Protocol/UserFeedbackTests.cs deleted file mode 100644 index 5358773067..0000000000 --- a/test/Sentry.Tests/Protocol/UserFeedbackTests.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace Sentry.Tests.Protocol; - -public class UserFeedbackTests -{ - private readonly IDiagnosticLogger _testOutputLogger; - - public UserFeedbackTests(ITestOutputHelper output) - { - _testOutputLogger = new TestOutputDiagnosticLogger(output); - } - - [Fact] - public void Serialization_SentryUserFeedbacks_Success() - { -#pragma warning disable CS0618 // Type or member is obsolete - // Arrange - var eventId = new SentryId(Guid.Parse("acbe351c61494e7b807fd7e82a435ffc")); - var userFeedback = new UserFeedback(eventId, "myName", "myEmail@service.com", "my comment"); - using var stream = new MemoryStream(); - - // Act - var actual = userFeedback.ToJsonString(_testOutputLogger, indented: true); - - // Assert - Assert.Equal(""" - { - "event_id": "acbe351c61494e7b807fd7e82a435ffc", - "name": "myName", - "email": "myEmail@service.com", - "comments": "my comment" - } - """, - actual); -#pragma warning restore CS0618 // Type or member is obsolete - } -} diff --git a/test/Sentry.Tests/SentryClientExtensionsTests.cs b/test/Sentry.Tests/SentryClientExtensionsTests.cs index cb73d048ba..637e05078f 100644 --- a/test/Sentry.Tests/SentryClientExtensionsTests.cs +++ b/test/Sentry.Tests/SentryClientExtensionsTests.cs @@ -78,27 +78,6 @@ public void CaptureMessage_NullMessage_DoesNotCapturesEventWithMessage() Assert.Equal(default, id); } - [Fact] - public void CaptureUserFeedback_EnabledClient_CapturesUserFeedback() - { -#pragma warning disable CS0618 // Type or member is obsolete - _ = _sut.IsEnabled.Returns(true); - _sut.CaptureUserFeedback(Guid.Parse("1ec19311a7c048818de80b18dcc43eaa"), "email@email.com", "comments"); - _sut.Received(1).CaptureUserFeedback(Arg.Any()); -#pragma warning restore CS0618 // Type or member is obsolete - } - - [Fact] - public void CaptureUserFeedback_DisabledClient_DoesNotCaptureUserFeedback() - { -#pragma warning disable CS0618 // Type or member is obsolete - _ = _sut.IsEnabled.Returns(false); - _sut.CaptureUserFeedback(Guid.Parse("1ec19311a7c048818de80b18dcc43eea"), "email@email.com", "comments"); - - _sut.DidNotReceive().CaptureUserFeedback(Arg.Any()); -#pragma warning restore CS0618 // Type or member is obsolete - } - [Fact] public async Task FlushAsync_NoTimeoutSpecified_UsesFlushTimeoutFromOptions() { diff --git a/test/Sentry.Tests/SentryClientTests.cs b/test/Sentry.Tests/SentryClientTests.cs index a2c3782638..2a2987b9ef 100644 --- a/test/Sentry.Tests/SentryClientTests.cs +++ b/test/Sentry.Tests/SentryClientTests.cs @@ -842,53 +842,6 @@ public void CaptureEvent_DisposedClient_DoesNotThrow() sut.CaptureEvent(@event); } - [Fact] - public void CaptureUserFeedback_EventIdEmpty_IgnoreUserFeedback() - { -#pragma warning disable CS0618 // Type or member is obsolete - //Arrange - var sut = _fixture.GetSut(); - - //Act - sut.CaptureUserFeedback( - new UserFeedback(SentryId.Empty, "name", "email", "comment")); - - //Assert - _ = sut.Worker.DidNotReceive().EnqueueEnvelope(Arg.Any()); -#pragma warning restore CS0618 // Type or member is obsolete - } - - [Fact] - public void CaptureUserFeedback_ValidUserFeedback_FeedbackRegistered() - { -#pragma warning disable CS0618 // Type or member is obsolete - //Arrange - var sut = _fixture.GetSut(); - - //Act - sut.CaptureUserFeedback( - new UserFeedback(SentryId.Parse("4eb98e5f861a41019f270a7a27e84f02"), "name", "email", "comment")); - - //Assert - _ = sut.Worker.Received(1).EnqueueEnvelope(Arg.Any()); -#pragma warning restore CS0618 // Type or member is obsolete - } - - [Fact] - public void CaptureUserFeedback_EventIdEmpty_FeedbackIgnored() - { -#pragma warning disable CS0618 // Type or member is obsolete - //Arrange - var sut = _fixture.GetSut(); - - //Act - sut.CaptureUserFeedback(new UserFeedback(SentryId.Empty, "name", "email", "comment")); - - //Assert - _ = sut.Worker.DidNotReceive().EnqueueEnvelope(Arg.Any()); -#pragma warning restore CS0618 // Type or member is obsolete - } - [Fact] public void Dispose_should_only_flush() { @@ -989,16 +942,6 @@ public void CaptureFeedback_WithHint_HasHintAttachment() envelope.Items.Count(item => item.TryGetType() == "attachment") == 1)); } - [Fact] - public void CaptureUserFeedback_DisposedClient_DoesNotThrow() - { -#pragma warning disable CS0618 // Type or member is obsolete - var sut = _fixture.GetSut(); - sut.Dispose(); - sut.CaptureUserFeedback(new UserFeedback(SentryId.Empty, "name", "email", "comment")); -#pragma warning restore CS0618 // Type or member is obsolete - } - [Fact] public void CaptureTransaction_SampledOut_Dropped() {