diff --git a/CHANGELOG.md b/CHANGELOG.md
index deab977457..9ba4599304 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@
- `BreadcrumbLevel.Critical` has been renamed to `BreadcrumbLevel.Fatal` for consistency with the other Sentry SDKs ([#4605](https://github.com/getsentry/sentry-dotnet/pull/4605))
- 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))
+- CaptureFeedback now returns a `CaptureFeedbackResult` that can be used to determine whether the call succeeded or failed ([#4613](https://github.com/getsentry/sentry-dotnet/pull/4613))
- ScopeExtensions.Populate is now internal ([#4611](https://github.com/getsentry/sentry-dotnet/pull/4611))
### Fixes
diff --git a/src/Sentry/CaptureFeedbackResult.cs b/src/Sentry/CaptureFeedbackResult.cs
new file mode 100644
index 0000000000..1424558104
--- /dev/null
+++ b/src/Sentry/CaptureFeedbackResult.cs
@@ -0,0 +1,95 @@
+namespace Sentry;
+
+///
+/// The result type of the method
+///
+public struct CaptureFeedbackResult
+{
+ ///
+ /// Creates a successful feedback capture result with the specified event Id.
+ ///
+ ///
+ public CaptureFeedbackResult(SentryId eventId)
+ {
+ if (eventId == SentryId.Empty)
+ {
+ throw new ArgumentException("EventId cannot be empty", nameof(eventId));
+ }
+
+ EventId = eventId;
+ }
+
+ ///
+ /// Creates a failed feedback capture result with the specified error reason.
+ ///
+ ///
+ public CaptureFeedbackResult(CaptureFeedbackErrorReason errorReason)
+ {
+ EventId = SentryId.Empty;
+ ErrorReason = errorReason;
+ }
+
+ ///
+ /// The Id of the captured feedback, if successful. if feedback capture fails.
+ ///
+ public SentryId EventId;
+
+ ///
+ public CaptureFeedbackErrorReason? ErrorReason;
+
+ ///
+ /// Implicitly converts a to a
+ ///
+ ///
+ ///
+ public static implicit operator CaptureFeedbackResult(CaptureFeedbackErrorReason errorReason) => new(errorReason);
+
+ ///
+ /// Implicitly converts a non-empty to a
+ ///
+ ///
+ public static implicit operator CaptureFeedbackResult(SentryId eventId) => new(eventId);
+
+ ///
+ /// Returns true if feedback capture was successful, false otherwise.
+ ///
+ public bool Succeededed => ErrorReason == null;
+}
+
+///
+/// Used to specify the reason why feedback capture failed, in the event of a failure
+///
+public enum CaptureFeedbackErrorReason
+{
+ ///
+ ///
+ /// An unknown error occurred (enable debug mode and check the logs for details).
+ ///
+ ///
+ /// Possible causes:
+ ///
+ /// -
+ /// An exception from the configureScope callback
+ ///
+ /// -
+ /// A transmission error when sending the envelope
+ ///
+ /// -
+ /// An attempt to send feedback while the application is shutting down
+ ///
+ /// -
+ /// Something more mysterious...
+ ///
+ ///
+ ///
+ ///
+ UnknownError,
+ ///
+ /// Sentry is disabled (very likely an empty DSN was provided when initialising the SDK).
+ ///
+ DisabledHub,
+ ///
+ /// The message is empty.
+ ///
+ EmptyMessage,
+}
diff --git a/src/Sentry/Extensibility/DisabledHub.cs b/src/Sentry/Extensibility/DisabledHub.cs
index e835a0edfc..8abb8239f2 100644
--- a/src/Sentry/Extensibility/DisabledHub.cs
+++ b/src/Sentry/Extensibility/DisabledHub.cs
@@ -176,15 +176,18 @@ public bool CaptureEnvelope(Envelope envelope)
///
/// No-Op.
///
- public void CaptureFeedback(SentryFeedback feedback, Action configureScope, SentryHint? hint = null)
+ public CaptureFeedbackResult CaptureFeedback(SentryFeedback feedback, Action configureScope,
+ SentryHint? hint = null)
{
+ return CaptureFeedbackErrorReason.DisabledHub;
}
///
/// No-Op.
///
- public void CaptureFeedback(SentryFeedback feedback, Scope? scope = null, SentryHint? hint = null)
+ public CaptureFeedbackResult CaptureFeedback(SentryFeedback feedback, Scope? scope = null, SentryHint? hint = null)
{
+ return CaptureFeedbackErrorReason.DisabledHub;
}
///
diff --git a/src/Sentry/Extensibility/HubAdapter.cs b/src/Sentry/Extensibility/HubAdapter.cs
index e94a6c1914..0a9dd1ebd1 100644
--- a/src/Sentry/Extensibility/HubAdapter.cs
+++ b/src/Sentry/Extensibility/HubAdapter.cs
@@ -260,7 +260,8 @@ public SentryId CaptureEvent(SentryEvent evt, Scope? scope, SentryHint? hint = n
///
[DebuggerStepThrough]
[EditorBrowsable(EditorBrowsableState.Never)]
- public void CaptureFeedback(SentryFeedback feedback, Action configureScope, SentryHint? hint = null)
+ public CaptureFeedbackResult CaptureFeedback(SentryFeedback feedback, Action configureScope,
+ SentryHint? hint = null)
=> SentrySdk.CaptureFeedback(feedback, configureScope, hint);
///
@@ -268,7 +269,7 @@ public void CaptureFeedback(SentryFeedback feedback, Action configureScop
///
[DebuggerStepThrough]
[EditorBrowsable(EditorBrowsableState.Never)]
- public void CaptureFeedback(SentryFeedback feedback, Scope? scope = null, SentryHint? hint = null)
+ public CaptureFeedbackResult CaptureFeedback(SentryFeedback feedback, Scope? scope = null, SentryHint? hint = null)
=> SentrySdk.CaptureFeedback(feedback, scope, hint);
///
diff --git a/src/Sentry/IHub.cs b/src/Sentry/IHub.cs
index 8c3006c149..7f61b61580 100644
--- a/src/Sentry/IHub.cs
+++ b/src/Sentry/IHub.cs
@@ -134,6 +134,13 @@ public TransactionContext ContinueTrace(
///
/// The feedback to send to Sentry.
/// Callback method to configure the scope.
- /// An optional hint providing high level context for the source of the event, including attachments
- public void CaptureFeedback(SentryFeedback feedback, Action configureScope, SentryHint? hint = null);
+ ///
+ /// An optional hint providing high-level context for the source of the event, including attachments
+ ///
+ ///
+ /// A that will contain the Id of the new event (if successful) or an error code
+ /// indicating the reason for failure (if feedback capture fails).
+ ///
+ public CaptureFeedbackResult CaptureFeedback(SentryFeedback feedback, Action configureScope,
+ SentryHint? hint = null);
}
diff --git a/src/Sentry/ISentryClient.cs b/src/Sentry/ISentryClient.cs
index 8229d57780..e96d4fb75c 100644
--- a/src/Sentry/ISentryClient.cs
+++ b/src/Sentry/ISentryClient.cs
@@ -34,7 +34,11 @@ public interface ISentryClient
/// The feedback to send to Sentry.
/// An optional scope to be applied to the event.
/// An optional hint providing high level context for the source of the event
- public void CaptureFeedback(SentryFeedback feedback, Scope? scope = null, SentryHint? hint = null);
+ ///
+ /// A that will contain the Id of the new event (if successful) or an error code
+ /// indicating the reason for failure (if feedback capture fails).
+ ///
+ public CaptureFeedbackResult CaptureFeedback(SentryFeedback feedback, Scope? scope = null, SentryHint? hint = null);
///
/// Captures a user feedback.
diff --git a/src/Sentry/Internal/Hub.cs b/src/Sentry/Internal/Hub.cs
index 2a3b934774..ec6177e9ca 100644
--- a/src/Sentry/Internal/Hub.cs
+++ b/src/Sentry/Internal/Hub.cs
@@ -589,11 +589,12 @@ private SentryId CaptureEvent(SentryEvent evt, SentryHint? hint, Scope scope)
}
}
- public void CaptureFeedback(SentryFeedback feedback, Action configureScope, SentryHint? hint = null)
+ public CaptureFeedbackResult CaptureFeedback(SentryFeedback feedback, Action configureScope,
+ SentryHint? hint = null)
{
if (!IsEnabled)
{
- return;
+ return CaptureFeedbackErrorReason.DisabledHub;
}
try
@@ -601,19 +602,20 @@ public void CaptureFeedback(SentryFeedback feedback, Action configureScop
var clonedScope = CurrentScope.Clone();
configureScope(clonedScope);
- CaptureFeedback(feedback, clonedScope, hint);
+ return CaptureFeedback(feedback, clonedScope, hint);
}
catch (Exception e)
{
_options.LogError(e, "Failure to capture feedback");
+ return CaptureFeedbackErrorReason.UnknownError;
}
}
- public void CaptureFeedback(SentryFeedback feedback, Scope? scope = null, SentryHint? hint = null)
+ public CaptureFeedbackResult CaptureFeedback(SentryFeedback feedback, Scope? scope = null, SentryHint? hint = null)
{
if (!IsEnabled)
{
- return;
+ return CaptureFeedbackErrorReason.DisabledHub;
}
try
@@ -625,11 +627,12 @@ public void CaptureFeedback(SentryFeedback feedback, Scope? scope = null, Sentry
}
scope ??= CurrentScope;
- CurrentClient.CaptureFeedback(feedback, scope, hint);
+ return CurrentClient.CaptureFeedback(feedback, scope, hint);
}
catch (Exception e)
{
_options.LogError(e, "Failure to capture feedback");
+ return CaptureFeedbackErrorReason.UnknownError;
}
}
diff --git a/src/Sentry/SentryClient.cs b/src/Sentry/SentryClient.cs
index 1467ee4364..8b2f130394 100644
--- a/src/Sentry/SentryClient.cs
+++ b/src/Sentry/SentryClient.cs
@@ -20,6 +20,7 @@ public class SentryClient : ISentryClient, IDisposable
private readonly ISessionManager _sessionManager;
private readonly RandomValuesFactory _randomValuesFactory;
private readonly Enricher _enricher;
+ private volatile int _isDisposed = 0;
internal IBackgroundWorker Worker { get; }
@@ -85,12 +86,12 @@ public SentryId CaptureEvent(SentryEvent? @event, Scope? scope = null, SentryHin
}
///
- public void CaptureFeedback(SentryFeedback feedback, Scope? scope = null, SentryHint? hint = null)
+ public CaptureFeedbackResult CaptureFeedback(SentryFeedback feedback, Scope? scope = null, SentryHint? hint = null)
{
if (string.IsNullOrEmpty(feedback.Message))
{
_options.LogWarning("Feedback dropped due to empty message.");
- return;
+ return CaptureFeedbackErrorReason.EmptyMessage;
}
scope ??= new Scope(_options);
@@ -116,7 +117,7 @@ public void CaptureFeedback(SentryFeedback feedback, Scope? scope = null, Sentry
var attachments = hint.Attachments.ToList();
var envelope = Envelope.FromFeedback(evt, _options.DiagnosticLogger, attachments, scope.SessionUpdate);
- CaptureEnvelope(envelope);
+ return CaptureEnvelope(envelope) ? evt.EventId : CaptureFeedbackErrorReason.UnknownError;
}
///
@@ -438,6 +439,12 @@ private SentryId DoSendEvent(SentryEvent @event, SentryHint? hint, Scope? scope)
///
public bool CaptureEnvelope(Envelope envelope)
{
+ if (_isDisposed == 1)
+ {
+ _options.LogWarning("Enqueue envelope failed. Client is disposed.");
+ return false;
+ }
+
if (Worker.EnqueueEnvelope(envelope))
{
_options.LogInfo("Envelope queued up: '{0}'", envelope.TryGetEventId(_options.DiagnosticLogger));
@@ -456,6 +463,11 @@ public bool CaptureEnvelope(Envelope envelope)
///
public void Dispose()
{
+ if (Interlocked.Exchange(ref _isDisposed, 1) == 1)
+ {
+ return;
+ }
+
_options.LogDebug("Flushing SentryClient.");
try
diff --git a/src/Sentry/SentrySdk.cs b/src/Sentry/SentrySdk.cs
index a8588370b6..a5797e9128 100644
--- a/src/Sentry/SentrySdk.cs
+++ b/src/Sentry/SentrySdk.cs
@@ -546,14 +546,14 @@ public static SentryId CaptureMessage(string message, Action configureSco
/// Captures feedback from the user.
///
[DebuggerStepThrough]
- public static void CaptureFeedback(SentryFeedback feedback, Action configureScope, SentryHint? hint = null)
+ public static CaptureFeedbackResult CaptureFeedback(SentryFeedback feedback, Action configureScope, SentryHint? hint = null)
=> CurrentHub.CaptureFeedback(feedback, configureScope, hint);
///
/// Captures feedback from the user.
///
[DebuggerStepThrough]
- public static void CaptureFeedback(SentryFeedback feedback, Scope? scope = null, SentryHint? hint = null)
+ public static CaptureFeedbackResult CaptureFeedback(SentryFeedback feedback, Scope? scope = null, SentryHint? hint = null)
=> CurrentHub.CaptureFeedback(feedback, scope, hint);
///
diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt
index 9a2f11bf6a..5785d9738d 100644
--- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt
+++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt
@@ -45,6 +45,22 @@ namespace Sentry
public ByteAttachmentContent(byte[] bytes) { }
public System.IO.Stream GetStream() { }
}
+ public enum CaptureFeedbackErrorReason
+ {
+ UnknownError = 0,
+ DisabledHub = 1,
+ EmptyMessage = 2,
+ }
+ public struct CaptureFeedbackResult
+ {
+ public Sentry.CaptureFeedbackErrorReason? ErrorReason;
+ public Sentry.SentryId EventId;
+ public CaptureFeedbackResult(Sentry.CaptureFeedbackErrorReason errorReason) { }
+ public CaptureFeedbackResult(Sentry.SentryId eventId) { }
+ public bool Succeededed { get; }
+ public static Sentry.CaptureFeedbackResult op_Implicit(Sentry.CaptureFeedbackErrorReason errorReason) { }
+ public static Sentry.CaptureFeedbackResult op_Implicit(Sentry.SentryId eventId) { }
+ }
public enum CheckInStatus
{
InProgress = 0,
@@ -191,7 +207,7 @@ namespace Sentry
void BindException(System.Exception exception, Sentry.ISpan span);
Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope);
Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope);
- void CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null);
+ Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null);
Sentry.TransactionContext ContinueTrace(Sentry.SentryTraceHeader? traceHeader, Sentry.BaggageHeader? baggageHeader, string? name = null, string? operation = null);
Sentry.TransactionContext ContinueTrace(string? traceHeader, string? baggageHeader, string? name = null, string? operation = null);
void EndSession(Sentry.SessionEndStatus status = 0);
@@ -218,7 +234,7 @@ namespace Sentry
Sentry.SentryId CaptureCheckIn(string monitorSlug, Sentry.CheckInStatus status, Sentry.SentryId? sentryId = default, System.TimeSpan? duration = default, Sentry.Scope? scope = null, System.Action? configureMonitorOptions = null);
bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope);
Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null);
- void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null);
+ Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null);
void CaptureSession(Sentry.SessionUpdate sessionUpdate);
void CaptureTransaction(Sentry.SentryTransaction transaction);
void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint);
@@ -448,7 +464,7 @@ namespace Sentry
public Sentry.SentryId CaptureCheckIn(string monitorSlug, Sentry.CheckInStatus status, Sentry.SentryId? sentryId = default, System.TimeSpan? duration = default, Sentry.Scope? scope = null, System.Action? configureMonitorOptions = null) { }
public bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope) { }
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent? @event, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { }
@@ -844,8 +860,8 @@ namespace Sentry
public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope) { }
public static Sentry.SentryId CaptureException(System.Exception exception) { }
public static Sentry.SentryId CaptureException(System.Exception exception, System.Action configureScope) { }
- public static void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
- public static void CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
+ public static Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
+ public static Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
public static void CaptureFeedback(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(string message, Sentry.SentryLevel level = 1) { }
public static Sentry.SentryId CaptureMessage(string message, System.Action configureScope, Sentry.SentryLevel level = 1) { }
@@ -1388,8 +1404,8 @@ namespace Sentry.Extensibility
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { }
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { }
@@ -1440,8 +1456,8 @@ namespace Sentry.Extensibility
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope, Sentry.SentryHint? hint = null) { }
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope) { }
public Sentry.SentryId CaptureException(System.Exception exception) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { }
diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt
index 9a2f11bf6a..5785d9738d 100644
--- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt
+++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt
@@ -45,6 +45,22 @@ namespace Sentry
public ByteAttachmentContent(byte[] bytes) { }
public System.IO.Stream GetStream() { }
}
+ public enum CaptureFeedbackErrorReason
+ {
+ UnknownError = 0,
+ DisabledHub = 1,
+ EmptyMessage = 2,
+ }
+ public struct CaptureFeedbackResult
+ {
+ public Sentry.CaptureFeedbackErrorReason? ErrorReason;
+ public Sentry.SentryId EventId;
+ public CaptureFeedbackResult(Sentry.CaptureFeedbackErrorReason errorReason) { }
+ public CaptureFeedbackResult(Sentry.SentryId eventId) { }
+ public bool Succeededed { get; }
+ public static Sentry.CaptureFeedbackResult op_Implicit(Sentry.CaptureFeedbackErrorReason errorReason) { }
+ public static Sentry.CaptureFeedbackResult op_Implicit(Sentry.SentryId eventId) { }
+ }
public enum CheckInStatus
{
InProgress = 0,
@@ -191,7 +207,7 @@ namespace Sentry
void BindException(System.Exception exception, Sentry.ISpan span);
Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope);
Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope);
- void CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null);
+ Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null);
Sentry.TransactionContext ContinueTrace(Sentry.SentryTraceHeader? traceHeader, Sentry.BaggageHeader? baggageHeader, string? name = null, string? operation = null);
Sentry.TransactionContext ContinueTrace(string? traceHeader, string? baggageHeader, string? name = null, string? operation = null);
void EndSession(Sentry.SessionEndStatus status = 0);
@@ -218,7 +234,7 @@ namespace Sentry
Sentry.SentryId CaptureCheckIn(string monitorSlug, Sentry.CheckInStatus status, Sentry.SentryId? sentryId = default, System.TimeSpan? duration = default, Sentry.Scope? scope = null, System.Action? configureMonitorOptions = null);
bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope);
Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null);
- void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null);
+ Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null);
void CaptureSession(Sentry.SessionUpdate sessionUpdate);
void CaptureTransaction(Sentry.SentryTransaction transaction);
void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint);
@@ -448,7 +464,7 @@ namespace Sentry
public Sentry.SentryId CaptureCheckIn(string monitorSlug, Sentry.CheckInStatus status, Sentry.SentryId? sentryId = default, System.TimeSpan? duration = default, Sentry.Scope? scope = null, System.Action? configureMonitorOptions = null) { }
public bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope) { }
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent? @event, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { }
@@ -844,8 +860,8 @@ namespace Sentry
public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope) { }
public static Sentry.SentryId CaptureException(System.Exception exception) { }
public static Sentry.SentryId CaptureException(System.Exception exception, System.Action configureScope) { }
- public static void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
- public static void CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
+ public static Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
+ public static Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
public static void CaptureFeedback(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(string message, Sentry.SentryLevel level = 1) { }
public static Sentry.SentryId CaptureMessage(string message, System.Action configureScope, Sentry.SentryLevel level = 1) { }
@@ -1388,8 +1404,8 @@ namespace Sentry.Extensibility
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { }
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { }
@@ -1440,8 +1456,8 @@ namespace Sentry.Extensibility
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope, Sentry.SentryHint? hint = null) { }
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope) { }
public Sentry.SentryId CaptureException(System.Exception exception) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { }
diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt
index 9a2f11bf6a..5785d9738d 100644
--- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt
+++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt
@@ -45,6 +45,22 @@ namespace Sentry
public ByteAttachmentContent(byte[] bytes) { }
public System.IO.Stream GetStream() { }
}
+ public enum CaptureFeedbackErrorReason
+ {
+ UnknownError = 0,
+ DisabledHub = 1,
+ EmptyMessage = 2,
+ }
+ public struct CaptureFeedbackResult
+ {
+ public Sentry.CaptureFeedbackErrorReason? ErrorReason;
+ public Sentry.SentryId EventId;
+ public CaptureFeedbackResult(Sentry.CaptureFeedbackErrorReason errorReason) { }
+ public CaptureFeedbackResult(Sentry.SentryId eventId) { }
+ public bool Succeededed { get; }
+ public static Sentry.CaptureFeedbackResult op_Implicit(Sentry.CaptureFeedbackErrorReason errorReason) { }
+ public static Sentry.CaptureFeedbackResult op_Implicit(Sentry.SentryId eventId) { }
+ }
public enum CheckInStatus
{
InProgress = 0,
@@ -191,7 +207,7 @@ namespace Sentry
void BindException(System.Exception exception, Sentry.ISpan span);
Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope);
Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope);
- void CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null);
+ Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null);
Sentry.TransactionContext ContinueTrace(Sentry.SentryTraceHeader? traceHeader, Sentry.BaggageHeader? baggageHeader, string? name = null, string? operation = null);
Sentry.TransactionContext ContinueTrace(string? traceHeader, string? baggageHeader, string? name = null, string? operation = null);
void EndSession(Sentry.SessionEndStatus status = 0);
@@ -218,7 +234,7 @@ namespace Sentry
Sentry.SentryId CaptureCheckIn(string monitorSlug, Sentry.CheckInStatus status, Sentry.SentryId? sentryId = default, System.TimeSpan? duration = default, Sentry.Scope? scope = null, System.Action? configureMonitorOptions = null);
bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope);
Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null);
- void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null);
+ Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null);
void CaptureSession(Sentry.SessionUpdate sessionUpdate);
void CaptureTransaction(Sentry.SentryTransaction transaction);
void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint);
@@ -448,7 +464,7 @@ namespace Sentry
public Sentry.SentryId CaptureCheckIn(string monitorSlug, Sentry.CheckInStatus status, Sentry.SentryId? sentryId = default, System.TimeSpan? duration = default, Sentry.Scope? scope = null, System.Action? configureMonitorOptions = null) { }
public bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope) { }
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent? @event, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { }
@@ -844,8 +860,8 @@ namespace Sentry
public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope) { }
public static Sentry.SentryId CaptureException(System.Exception exception) { }
public static Sentry.SentryId CaptureException(System.Exception exception, System.Action configureScope) { }
- public static void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
- public static void CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
+ public static Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
+ public static Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
public static void CaptureFeedback(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(string message, Sentry.SentryLevel level = 1) { }
public static Sentry.SentryId CaptureMessage(string message, System.Action configureScope, Sentry.SentryLevel level = 1) { }
@@ -1388,8 +1404,8 @@ namespace Sentry.Extensibility
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { }
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { }
@@ -1440,8 +1456,8 @@ namespace Sentry.Extensibility
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope, Sentry.SentryHint? hint = null) { }
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope) { }
public Sentry.SentryId CaptureException(System.Exception exception) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { }
diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt
index d508934005..cbfa8113e2 100644
--- a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt
+++ b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt
@@ -45,6 +45,22 @@ namespace Sentry
public ByteAttachmentContent(byte[] bytes) { }
public System.IO.Stream GetStream() { }
}
+ public enum CaptureFeedbackErrorReason
+ {
+ UnknownError = 0,
+ DisabledHub = 1,
+ EmptyMessage = 2,
+ }
+ public struct CaptureFeedbackResult
+ {
+ public Sentry.CaptureFeedbackErrorReason? ErrorReason;
+ public Sentry.SentryId EventId;
+ public CaptureFeedbackResult(Sentry.CaptureFeedbackErrorReason errorReason) { }
+ public CaptureFeedbackResult(Sentry.SentryId eventId) { }
+ public bool Succeededed { get; }
+ public static Sentry.CaptureFeedbackResult op_Implicit(Sentry.CaptureFeedbackErrorReason errorReason) { }
+ public static Sentry.CaptureFeedbackResult op_Implicit(Sentry.SentryId eventId) { }
+ }
public enum CheckInStatus
{
InProgress = 0,
@@ -179,7 +195,7 @@ namespace Sentry
void BindException(System.Exception exception, Sentry.ISpan span);
Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope);
Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope);
- void CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null);
+ Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null);
Sentry.TransactionContext ContinueTrace(Sentry.SentryTraceHeader? traceHeader, Sentry.BaggageHeader? baggageHeader, string? name = null, string? operation = null);
Sentry.TransactionContext ContinueTrace(string? traceHeader, string? baggageHeader, string? name = null, string? operation = null);
void EndSession(Sentry.SessionEndStatus status = 0);
@@ -206,7 +222,7 @@ namespace Sentry
Sentry.SentryId CaptureCheckIn(string monitorSlug, Sentry.CheckInStatus status, Sentry.SentryId? sentryId = default, System.TimeSpan? duration = default, Sentry.Scope? scope = null, System.Action? configureMonitorOptions = null);
bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope);
Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null);
- void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null);
+ Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null);
void CaptureSession(Sentry.SessionUpdate sessionUpdate);
void CaptureTransaction(Sentry.SentryTransaction transaction);
void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint);
@@ -436,7 +452,7 @@ namespace Sentry
public Sentry.SentryId CaptureCheckIn(string monitorSlug, Sentry.CheckInStatus status, Sentry.SentryId? sentryId = default, System.TimeSpan? duration = default, Sentry.Scope? scope = null, System.Action? configureMonitorOptions = null) { }
public bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope) { }
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent? @event, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { }
@@ -820,8 +836,8 @@ namespace Sentry
public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope) { }
public static Sentry.SentryId CaptureException(System.Exception exception) { }
public static Sentry.SentryId CaptureException(System.Exception exception, System.Action configureScope) { }
- public static void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
- public static void CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
+ public static Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
+ public static Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
public static void CaptureFeedback(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(string message, Sentry.SentryLevel level = 1) { }
public static Sentry.SentryId CaptureMessage(string message, System.Action configureScope, Sentry.SentryLevel level = 1) { }
@@ -1364,8 +1380,8 @@ namespace Sentry.Extensibility
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { }
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { }
@@ -1416,8 +1432,8 @@ namespace Sentry.Extensibility
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope, Sentry.SentryHint? hint = null) { }
public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope) { }
public Sentry.SentryId CaptureException(System.Exception exception) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
- public void CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { }
+ public Sentry.CaptureFeedbackResult CaptureFeedback(Sentry.SentryFeedback feedback, System.Action configureScope, Sentry.SentryHint? hint = null) { }
public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction) { }
public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { }
diff --git a/test/Sentry.Tests/HubTests.cs b/test/Sentry.Tests/HubTests.cs
index a7a5fcaa8c..8f85dd044c 100644
--- a/test/Sentry.Tests/HubTests.cs
+++ b/test/Sentry.Tests/HubTests.cs
@@ -2034,8 +2034,16 @@ public void CaptureEvent_HubEnabled(bool enabled)
public void CaptureFeedback_HubEnabled(bool enabled)
{
// Arrange
+ var expectedResult = enabled
+ ? new CaptureFeedbackResult(SentryId.Create())
+ : new CaptureFeedbackResult(CaptureFeedbackErrorReason.DisabledHub);
var hub = _fixture.GetSut();
- if (!enabled)
+ if (enabled)
+ {
+ _fixture.Client.CaptureFeedback(Arg.Any(), Arg.Any(), Arg.Any())
+ .Returns(expectedResult);
+ }
+ else
{
hub.Dispose();
}
@@ -2043,9 +2051,10 @@ public void CaptureFeedback_HubEnabled(bool enabled)
var feedback = new SentryFeedback("Test feedback");
// Act
- hub.CaptureFeedback(feedback);
+ var result = hub.CaptureFeedback(feedback);
// Assert
+ result.Should().Be(expectedResult);
_fixture.Client.Received(enabled ? 1 : 0).CaptureFeedback(Arg.Any(), Arg.Any(), Arg.Any());
}
diff --git a/test/Sentry.Tests/SentryClientTests.cs b/test/Sentry.Tests/SentryClientTests.cs
index a2c3782638..d2c363a9af 100644
--- a/test/Sentry.Tests/SentryClientTests.cs
+++ b/test/Sentry.Tests/SentryClientTests.cs
@@ -911,8 +911,13 @@ public void CaptureFeedback_DisposedClient_DoesNotThrow()
var sut = _fixture.GetSut();
sut.Dispose();
- // Act / Assert
- sut.CaptureFeedback(feedback);
+ // Act
+ var result = sut.CaptureFeedback(feedback);
+
+ // Assert
+ result.Succeededed.Should().BeFalse();
+ result.ErrorReason.Should().Be(CaptureFeedbackErrorReason.UnknownError);
+ result.EventId.Should().Be(SentryId.Empty);
}
[Fact]
@@ -923,10 +928,14 @@ public void CaptureFeedback_NoMessage_FeedbackIgnored()
var feedback = new SentryFeedback(string.Empty);
//Act
- sut.CaptureFeedback(feedback);
+ var result = sut.CaptureFeedback(feedback);
//Assert
_ = sut.Worker.DidNotReceive().EnqueueEnvelope(Arg.Any());
+ // Assert
+ result.Succeededed.Should().BeFalse();
+ result.ErrorReason.Should().Be(CaptureFeedbackErrorReason.EmptyMessage);
+ result.EventId.Should().Be(SentryId.Empty);
}
[Fact]
@@ -937,10 +946,11 @@ public void CaptureFeedback_ValidUserFeedback_FeedbackRegistered()
var feedback = new SentryFeedback("Everything is great!");
//Act
- sut.CaptureFeedback(feedback);
+ var result = sut.CaptureFeedback(feedback);
//Assert
_ = sut.Worker.Received(1).EnqueueEnvelope(Arg.Any());
+ result.Should().NotBe(SentryId.Empty);
}
[Fact]
@@ -959,9 +969,10 @@ public void CaptureFeedback_WithScope_ScopeCopiedToEvent()
.Do(callback => envelope = callback.Arg());
//Act
- sut.CaptureFeedback(feedback, scope);
+ var result = sut.CaptureFeedback(feedback, scope);
//Assert
+ result.Should().NotBe(SentryId.Empty);
_ = sut.Worker.Received(1).EnqueueEnvelope(Arg.Any());
envelope.Should().NotBeNull();
envelope.Items.Should().Contain(item => item.TryGetType() == EnvelopeItem.TypeValueFeedback);
@@ -981,9 +992,10 @@ public void CaptureFeedback_WithHint_HasHintAttachment()
hint.Attachments.Add(AttachmentHelper.FakeAttachment("foo.txt"));
//Act
- sut.CaptureFeedback(feedback, null, hint);
+ var result = sut.CaptureFeedback(feedback, null, hint);
//Assert
+ result.Should().NotBe(SentryId.Empty);
_ = sut.Worker.Received(1).EnqueueEnvelope(Arg.Any());
sut.Worker.Received(1).EnqueueEnvelope(Arg.Is(envelope =>
envelope.Items.Count(item => item.TryGetType() == "attachment") == 1));
@@ -1576,12 +1588,12 @@ public void Dispose_Worker_FlushCalled()
}
[Fact]
- public void Dispose_MultipleCalls_WorkerFlushedTwice()
+ public void Dispose_MultipleCalls_WorkerFlushedOnce()
{
var sut = _fixture.GetSut();
sut.Dispose();
sut.Dispose();
- _fixture.BackgroundWorker?.Received(2).FlushAsync(_fixture.SentryOptions.ShutdownTimeout);
+ _fixture.BackgroundWorker?.Received(1).FlushAsync(_fixture.SentryOptions.ShutdownTimeout);
}
[Fact]