diff --git a/CHANGELOG.md b/CHANGELOG.md index f1685d64df..a4fce7184d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,11 @@ ### Fixes - To resolve conflicting types due to the SDK adding itself to the global usings: - - The interface `Sentry.ISession` has been renamed to `Sentry.ISentrySession` + - The interface `Sentry.ISession` has been renamed to `Sentry.ISentrySession` ([#3110](https://github.com/getsentry/sentry-dotnet/pull/3110)) + - The interface `Sentry.IJsonSerializable` has been renamed to `Sentry.ISentryJsonSerializable` ([#3116](https://github.com/getsentry/sentry-dotnet/pull/3116)) - The class `Sentry.Session` has been renamed to `Sentry.SentrySession` ([#3110](https://github.com/getsentry/sentry-dotnet/pull/3110)) +- The class `Sentry.Attachment` has been renamed to `Sentry.SentryAttachment` ([#3116](https://github.com/getsentry/sentry-dotnet/pull/3116)) +- The class `Sentry.Hint` has been renamed to `Sentry.SentryHint` ([#3116](https://github.com/getsentry/sentry-dotnet/pull/3116)) ### Dependencies diff --git a/samples/Sentry.Samples.Console.Customized/Program.cs b/samples/Sentry.Samples.Console.Customized/Program.cs index d4a41f829e..27f0a6bc9e 100644 --- a/samples/Sentry.Samples.Console.Customized/Program.cs +++ b/samples/Sentry.Samples.Console.Customized/Program.cs @@ -110,7 +110,7 @@ await SentrySdk.ConfigureScopeAsync(async scope => SentrySdk.AddBreadcrumb( new Breadcrumb("A breadcrumb that will be replaced by the 'BeforeBreadcrumb callback because of the hint", null), - new Hint("don't trust this breadcrumb", "trust this instead") + new SentryHint("don't trust this breadcrumb", "trust this instead") ); // Data added to the root scope (no PushScope called up to this point) diff --git a/src/Sentry.Maui/Internal/ScreenshotAttachment.cs b/src/Sentry.Maui/Internal/ScreenshotAttachment.cs index e226cf2f14..c867862f85 100644 --- a/src/Sentry.Maui/Internal/ScreenshotAttachment.cs +++ b/src/Sentry.Maui/Internal/ScreenshotAttachment.cs @@ -2,7 +2,7 @@ namespace Sentry.Maui.Internal; -internal class ScreenshotAttachment : Attachment +internal class ScreenshotAttachment : SentryAttachment { public ScreenshotAttachment(SentryMauiOptions options) : this( diff --git a/src/Sentry.Maui/Internal/SentryMauiScreenshotProcessor.cs b/src/Sentry.Maui/Internal/SentryMauiScreenshotProcessor.cs index 833379dba5..3bf6e8e5da 100644 --- a/src/Sentry.Maui/Internal/SentryMauiScreenshotProcessor.cs +++ b/src/Sentry.Maui/Internal/SentryMauiScreenshotProcessor.cs @@ -16,7 +16,7 @@ public SentryMauiScreenshotProcessor(SentryMauiOptions options) return @event; } - public SentryEvent? Process(SentryEvent @event, Hint hint) + public SentryEvent? Process(SentryEvent @event, SentryHint hint) { hint.Attachments.Add(new ScreenshotAttachment(_options)); return @event; diff --git a/src/Sentry/Breadcrumb.cs b/src/Sentry/Breadcrumb.cs index 4985c51160..409354e312 100644 --- a/src/Sentry/Breadcrumb.cs +++ b/src/Sentry/Breadcrumb.cs @@ -8,7 +8,7 @@ namespace Sentry; /// Series of application events. /// [DebuggerDisplay("Message: {" + nameof(Message) + "}, Type: {" + nameof(Type) + "}")] -public sealed class Breadcrumb : IJsonSerializable +public sealed class Breadcrumb : ISentryJsonSerializable { private readonly IReadOnlyDictionary? _data; private readonly string? _message; diff --git a/src/Sentry/Contexts.cs b/src/Sentry/Contexts.cs index 46f69496e7..aca9968fb7 100644 --- a/src/Sentry/Contexts.cs +++ b/src/Sentry/Contexts.cs @@ -11,7 +11,7 @@ namespace Sentry; /// Represents Sentry's structured Context. /// /// -public sealed class Contexts : IDictionary, IJsonSerializable +public sealed class Contexts : IDictionary, ISentryJsonSerializable { private readonly ConcurrentDictionary _innerDictionary = new(StringComparer.Ordinal); diff --git a/src/Sentry/Extensibility/DisabledHub.cs b/src/Sentry/Extensibility/DisabledHub.cs index b9dbfc84fe..1ed0c09cce 100644 --- a/src/Sentry/Extensibility/DisabledHub.cs +++ b/src/Sentry/Extensibility/DisabledHub.cs @@ -147,7 +147,7 @@ public bool CaptureEnvelope(Envelope envelope) /// /// No-Op. /// - public SentryId CaptureEvent(SentryEvent evt, Scope? scope = null, Hint? hint = null) => SentryId.Empty; + public SentryId CaptureEvent(SentryEvent evt, Scope? scope = null, SentryHint? hint = null) => SentryId.Empty; /// /// No-Op. @@ -157,7 +157,7 @@ public bool CaptureEnvelope(Envelope envelope) /// /// No-Op. /// - public SentryId CaptureEvent(SentryEvent evt, Hint? hint, Action configureScope) => SentryId.Empty; + public SentryId CaptureEvent(SentryEvent evt, SentryHint? hint, Action configureScope) => SentryId.Empty; /// /// No-Op. @@ -169,7 +169,7 @@ public void CaptureTransaction(SentryTransaction transaction) /// /// No-Op. /// - public void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint? hint) + public void CaptureTransaction(SentryTransaction transaction, Scope? scope, SentryHint? hint) { } diff --git a/src/Sentry/Extensibility/HubAdapter.cs b/src/Sentry/Extensibility/HubAdapter.cs index 239b072fd5..f48bbbcfc9 100644 --- a/src/Sentry/Extensibility/HubAdapter.cs +++ b/src/Sentry/Extensibility/HubAdapter.cs @@ -219,7 +219,7 @@ public SentryId CaptureEvent(SentryEvent evt, Scope? scope) /// [DebuggerStepThrough] [EditorBrowsable(EditorBrowsableState.Never)] - public SentryId CaptureEvent(SentryEvent evt, Scope? scope, Hint? hint = null) + public SentryId CaptureEvent(SentryEvent evt, Scope? scope, SentryHint? hint = null) => SentrySdk.CaptureEvent(evt, scope, hint); /// @@ -233,7 +233,7 @@ public SentryId CaptureEvent(SentryEvent evt, Action configureScope) /// /// Forwards the call to . /// - public SentryId CaptureEvent(SentryEvent evt, Hint? hint, Action configureScope) + public SentryId CaptureEvent(SentryEvent evt, SentryHint? hint, Action configureScope) => SentrySdk.CaptureEvent(evt, hint, configureScope); /// @@ -256,7 +256,7 @@ public void CaptureTransaction(SentryTransaction transaction) /// [DebuggerStepThrough] [EditorBrowsable(EditorBrowsableState.Never)] - public void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint? hint) + public void CaptureTransaction(SentryTransaction transaction, Scope? scope, SentryHint? hint) => SentrySdk.CaptureTransaction(transaction, scope, hint); /// diff --git a/src/Sentry/Extensibility/ISentryEventProcessor.cs b/src/Sentry/Extensibility/ISentryEventProcessor.cs index 229aa3339a..30e43c2382 100644 --- a/src/Sentry/Extensibility/ISentryEventProcessor.cs +++ b/src/Sentry/Extensibility/ISentryEventProcessor.cs @@ -20,7 +20,7 @@ public interface ISentryEventProcessor internal static class ISentryEventProcessorExtensions { - internal static SentryEvent? DoProcessEvent(this ISentryEventProcessor processor, SentryEvent @event, Hint hint) + internal static SentryEvent? DoProcessEvent(this ISentryEventProcessor processor, SentryEvent @event, SentryHint hint) { return (processor is ISentryEventProcessorWithHint contextualProcessor) ? contextualProcessor.Process(@event, hint) diff --git a/src/Sentry/Extensibility/ISentryEventProcessorWithHint.cs b/src/Sentry/Extensibility/ISentryEventProcessorWithHint.cs index 7eef5c708c..287e710b38 100644 --- a/src/Sentry/Extensibility/ISentryEventProcessorWithHint.cs +++ b/src/Sentry/Extensibility/ISentryEventProcessorWithHint.cs @@ -9,13 +9,13 @@ public interface ISentryEventProcessorWithHint : ISentryEventProcessor /// Process the /// /// The event to process - /// A with context that may be useful prior to sending the event + /// A with context that may be useful prior to sending the event /// The processed event or null if the event was dropped. /// /// The event returned can be the same instance received or a new one. /// Returning null will stop the processing pipeline so that the event will neither be processed by /// additional event processors or sent to Sentry. /// - SentryEvent? Process(SentryEvent @event, Hint hint); + SentryEvent? Process(SentryEvent @event, SentryHint hint); } diff --git a/src/Sentry/Extensibility/ISentryTransactionProcessor.cs b/src/Sentry/Extensibility/ISentryTransactionProcessor.cs index 74f9be1d91..f8fedc524f 100644 --- a/src/Sentry/Extensibility/ISentryTransactionProcessor.cs +++ b/src/Sentry/Extensibility/ISentryTransactionProcessor.cs @@ -19,7 +19,7 @@ public interface ISentryTransactionProcessor internal static class ISentryTransactionProcessorExtensions { - internal static SentryTransaction? DoProcessTransaction(this ISentryTransactionProcessor processor, SentryTransaction transaction, Hint hint) + internal static SentryTransaction? DoProcessTransaction(this ISentryTransactionProcessor processor, SentryTransaction transaction, SentryHint hint) { return (processor is ISentryTransactionProcessorWithHint contextualProcessor) ? contextualProcessor.Process(transaction, hint) diff --git a/src/Sentry/Extensibility/ISentryTransactionProcessorWithHint.cs b/src/Sentry/Extensibility/ISentryTransactionProcessorWithHint.cs index 365aa04c4d..c6e62586de 100644 --- a/src/Sentry/Extensibility/ISentryTransactionProcessorWithHint.cs +++ b/src/Sentry/Extensibility/ISentryTransactionProcessorWithHint.cs @@ -9,11 +9,11 @@ public interface ISentryTransactionProcessorWithHint : ISentryTransactionProcess /// Process the /// /// The Transaction to process - /// A with context that may be useful prior to sending the transaction + /// A with context that may be useful prior to sending the transaction /// /// The transaction returned can be the same instance received or a new one. /// Returning null will stop the processing pipeline. /// Meaning the transaction should no longer be processed nor send. /// - SentryTransaction? Process(SentryTransaction transaction, Hint hint); + SentryTransaction? Process(SentryTransaction transaction, SentryHint hint); } diff --git a/src/Sentry/HubExtensions.cs b/src/Sentry/HubExtensions.cs index 5c43d64792..a4bedfddec 100644 --- a/src/Sentry/HubExtensions.cs +++ b/src/Sentry/HubExtensions.cs @@ -135,7 +135,7 @@ public static void AddBreadcrumb( public static void AddBreadcrumb( this IHub hub, Breadcrumb breadcrumb, - Hint? hint = null + SentryHint? hint = null ) { // Not to throw on code that ignores nullability warnings. @@ -145,7 +145,7 @@ public static void AddBreadcrumb( } hub.ConfigureScope( - s => s.AddBreadcrumb(breadcrumb, hint ?? new Hint()) + s => s.AddBreadcrumb(breadcrumb, hint ?? new SentryHint()) ); } diff --git a/src/Sentry/IHub.cs b/src/Sentry/IHub.cs index 5a55a70a49..3f6e20ac4c 100644 --- a/src/Sentry/IHub.cs +++ b/src/Sentry/IHub.cs @@ -124,5 +124,5 @@ TransactionContext ContinueTrace( /// An optional hint to be provided with the event /// The callback to configure the scope. /// - public SentryId CaptureEvent(SentryEvent evt, Hint? hint, Action configureScope); + public SentryId CaptureEvent(SentryEvent evt, SentryHint? hint, Action configureScope); } diff --git a/src/Sentry/ISentryClient.cs b/src/Sentry/ISentryClient.cs index 56d41b565b..cca262c0d6 100644 --- a/src/Sentry/ISentryClient.cs +++ b/src/Sentry/ISentryClient.cs @@ -27,7 +27,7 @@ public interface ISentryClient /// An optional scope to be applied to the event. /// An optional hint providing high level context for the source of the event /// The Id of the event. - SentryId CaptureEvent(SentryEvent evt, Scope? scope = null, Hint? hint = null); + SentryId CaptureEvent(SentryEvent evt, Scope? scope = null, SentryHint? hint = null); /// /// Captures a user feedback. @@ -60,7 +60,7 @@ public interface ISentryClient /// This will be available in callbacks prior to processing the transaction. /// [EditorBrowsable(EditorBrowsableState.Never)] - void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint? hint); + void CaptureTransaction(SentryTransaction transaction, Scope? scope, SentryHint? hint); /// /// Captures a session update. diff --git a/src/Sentry/IJsonSerializable.cs b/src/Sentry/ISentryJsonSerializable.cs similarity index 80% rename from src/Sentry/IJsonSerializable.cs rename to src/Sentry/ISentryJsonSerializable.cs index beed5d8a3a..da3923b224 100644 --- a/src/Sentry/IJsonSerializable.cs +++ b/src/Sentry/ISentryJsonSerializable.cs @@ -5,7 +5,7 @@ namespace Sentry; /// /// Sentry JsonSerializable. /// -public interface IJsonSerializable +public interface ISentryJsonSerializable { /// /// Writes the object as JSON. @@ -19,7 +19,7 @@ public interface IJsonSerializable internal static class JsonSerializableExtensions { - public static void WriteToFile(this IJsonSerializable serializable, string filePath, IDiagnosticLogger? logger) + public static void WriteToFile(this ISentryJsonSerializable serializable, string filePath, IDiagnosticLogger? logger) { using var file = File.Create(filePath); using var writer = new Utf8JsonWriter(file); diff --git a/src/Sentry/Internal/ClientReport.cs b/src/Sentry/Internal/ClientReport.cs index e6f959ff1e..76d36b6f7d 100644 --- a/src/Sentry/Internal/ClientReport.cs +++ b/src/Sentry/Internal/ClientReport.cs @@ -3,7 +3,7 @@ namespace Sentry.Internal; -internal class ClientReport : IJsonSerializable +internal class ClientReport : ISentryJsonSerializable { public DateTimeOffset Timestamp { get; } public IReadOnlyDictionary DiscardedEvents { get; } diff --git a/src/Sentry/Internal/Extensions/JsonExtensions.cs b/src/Sentry/Internal/Extensions/JsonExtensions.cs index 2d0bc59392..d46898ff3f 100644 --- a/src/Sentry/Internal/Extensions/JsonExtensions.cs +++ b/src/Sentry/Internal/Extensions/JsonExtensions.cs @@ -128,7 +128,7 @@ public static void Deconstruct(this JsonProperty jsonProperty, out string name, public static Dictionary? GetDictionaryOrNull( this JsonElement json, Func factory) - where TValue : IJsonSerializable? + where TValue : ISentryJsonSerializable? { if (json.ValueKind != JsonValueKind.Object) { @@ -283,7 +283,7 @@ public static void WriteDictionaryValue( IEnumerable>? dic, IDiagnosticLogger? logger, bool includeNullValues = true) - where TValue : IJsonSerializable? + where TValue : ISentryJsonSerializable? { if (dic is not null) { @@ -345,7 +345,7 @@ public static void WriteDictionary( string propertyName, IEnumerable>? dic, IDiagnosticLogger? logger) - where TValue : IJsonSerializable? + where TValue : ISentryJsonSerializable? { writer.WritePropertyName(propertyName); writer.WriteDictionaryValue(dic, logger); @@ -424,7 +424,7 @@ public static void WriteStringArray( public static void WriteSerializableValue( this Utf8JsonWriter writer, - IJsonSerializable value, + ISentryJsonSerializable value, IDiagnosticLogger? logger) { value.WriteTo(writer, logger); @@ -433,7 +433,7 @@ public static void WriteSerializableValue( public static void WriteSerializable( this Utf8JsonWriter writer, string propertyName, - IJsonSerializable value, + ISentryJsonSerializable value, IDiagnosticLogger? logger) { writer.WritePropertyName(propertyName); @@ -449,7 +449,7 @@ public static void WriteDynamicValue( { writer.WriteNullValue(); } - else if (value is IJsonSerializable serializable) + else if (value is ISentryJsonSerializable serializable) { writer.WriteSerializableValue(serializable, logger); } @@ -784,7 +784,7 @@ public static void WriteStringIfNotNull( public static void WriteSerializableIfNotNull( this Utf8JsonWriter writer, string propertyName, - IJsonSerializable? value, + ISentryJsonSerializable? value, IDiagnosticLogger? logger) { if (value is not null) @@ -811,7 +811,7 @@ public static void WriteDictionaryIfNotEmpty( string propertyName, IEnumerable>? dic, IDiagnosticLogger? logger) - where TValue : IJsonSerializable? + where TValue : ISentryJsonSerializable? { var dictionary = dic as IReadOnlyDictionary ?? dic?.ToDict(); if (dictionary is not null && dictionary.Count > 0) diff --git a/src/Sentry/Internal/Hub.cs b/src/Sentry/Internal/Hub.cs index fb811bdb31..a9939485aa 100644 --- a/src/Sentry/Internal/Hub.cs +++ b/src/Sentry/Internal/Hub.cs @@ -382,7 +382,7 @@ private void ApplyTraceContextToEvent(SentryEvent evt, SentryPropagationContext public SentryId CaptureEvent(SentryEvent evt, Action configureScope) => CaptureEvent(evt, null, configureScope); - public SentryId CaptureEvent(SentryEvent evt, Hint? hint, Action configureScope) + public SentryId CaptureEvent(SentryEvent evt, SentryHint? hint, Action configureScope) { if (!IsEnabled) { @@ -405,7 +405,7 @@ public SentryId CaptureEvent(SentryEvent evt, Hint? hint, Action configur public bool CaptureEnvelope(Envelope envelope) => _ownedClient.CaptureEnvelope(envelope); - public SentryId CaptureEvent(SentryEvent evt, Scope? scope = null, Hint? hint = null) + public SentryId CaptureEvent(SentryEvent evt, Scope? scope = null, SentryHint? hint = null) { if (!IsEnabled) { @@ -473,7 +473,7 @@ public void CaptureUserFeedback(UserFeedback userFeedback) public void CaptureTransaction(SentryTransaction transaction) => CaptureTransaction(transaction, null, null); - public void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint? hint) + public void CaptureTransaction(SentryTransaction transaction, Scope? scope, SentryHint? hint) { // Note: The hub should capture transactions even if it is disabled. // This allows transactions to be reported as failed when they encountered an unhandled exception, diff --git a/src/Sentry/Internal/MemoryInfo.cs b/src/Sentry/Internal/MemoryInfo.cs index eed39c16d2..99f87c0a2d 100644 --- a/src/Sentry/Internal/MemoryInfo.cs +++ b/src/Sentry/Internal/MemoryInfo.cs @@ -5,7 +5,7 @@ namespace Sentry.Internal; -internal sealed class MemoryInfo : IJsonSerializable +internal sealed class MemoryInfo : ISentryJsonSerializable { public long AllocatedBytes { get; } public long FragmentedBytes { get; } diff --git a/src/Sentry/Internal/ThreadPoolInfo.cs b/src/Sentry/Internal/ThreadPoolInfo.cs index c4da0db98a..b706533452 100644 --- a/src/Sentry/Internal/ThreadPoolInfo.cs +++ b/src/Sentry/Internal/ThreadPoolInfo.cs @@ -2,7 +2,7 @@ namespace Sentry.Internal; -internal sealed class ThreadPoolInfo : IJsonSerializable +internal sealed class ThreadPoolInfo : ISentryJsonSerializable { public ThreadPoolInfo( int minWorkerThreads, diff --git a/src/Sentry/Package.cs b/src/Sentry/Package.cs index 277074fb2c..7d584bec60 100644 --- a/src/Sentry/Package.cs +++ b/src/Sentry/Package.cs @@ -6,7 +6,7 @@ namespace Sentry; /// /// Represents a package used to compose the SDK. /// -public sealed class Package : IJsonSerializable +public sealed class Package : ISentryJsonSerializable { /// /// The name of the package. diff --git a/src/Sentry/PersistedSessionUpdate.cs b/src/Sentry/PersistedSessionUpdate.cs index e86b46cad9..8ca45ab03e 100644 --- a/src/Sentry/PersistedSessionUpdate.cs +++ b/src/Sentry/PersistedSessionUpdate.cs @@ -3,7 +3,7 @@ namespace Sentry; -internal class PersistedSessionUpdate : IJsonSerializable +internal class PersistedSessionUpdate : ISentryJsonSerializable { public SessionUpdate Update { get; } diff --git a/src/Sentry/Platforms/Android/Callbacks/BeforeBreadcrumbCallback.cs b/src/Sentry/Platforms/Android/Callbacks/BeforeBreadcrumbCallback.cs index 17472a06ad..ac2f149902 100644 --- a/src/Sentry/Platforms/Android/Callbacks/BeforeBreadcrumbCallback.cs +++ b/src/Sentry/Platforms/Android/Callbacks/BeforeBreadcrumbCallback.cs @@ -4,9 +4,9 @@ namespace Sentry.Android.Callbacks; internal class BeforeBreadcrumbCallback : JavaObject, JavaSdk.SentryOptions.IBeforeBreadcrumbCallback { - private readonly Func _beforeBreadcrumb; + private readonly Func _beforeBreadcrumb; - public BeforeBreadcrumbCallback(Func beforeBreadcrumb) + public BeforeBreadcrumbCallback(Func beforeBreadcrumb) { _beforeBreadcrumb = beforeBreadcrumb; } diff --git a/src/Sentry/Platforms/Android/Callbacks/BeforeSendCallback.cs b/src/Sentry/Platforms/Android/Callbacks/BeforeSendCallback.cs index 2052925c0c..1fd15c6e1d 100644 --- a/src/Sentry/Platforms/Android/Callbacks/BeforeSendCallback.cs +++ b/src/Sentry/Platforms/Android/Callbacks/BeforeSendCallback.cs @@ -4,12 +4,12 @@ namespace Sentry.Android.Callbacks; internal class BeforeSendCallback : JavaObject, JavaSdk.SentryOptions.IBeforeSendCallback { - private readonly Func _beforeSend; + private readonly Func _beforeSend; private readonly SentryOptions _options; private readonly JavaSdk.SentryOptions _javaOptions; public BeforeSendCallback( - Func beforeSend, + Func beforeSend, SentryOptions options, JavaSdk.SentryOptions javaOptions) { diff --git a/src/Sentry/Platforms/Android/Extensions/AttachmentExtensions.cs b/src/Sentry/Platforms/Android/Extensions/AttachmentExtensions.cs index 43d7b8aa7c..2a9d8b9634 100644 --- a/src/Sentry/Platforms/Android/Extensions/AttachmentExtensions.cs +++ b/src/Sentry/Platforms/Android/Extensions/AttachmentExtensions.cs @@ -2,7 +2,7 @@ namespace Sentry.Android.Extensions; internal static class AttachmentExtensions { - public static Attachment ToAttachment(this JavaSdk.Attachment attachment) + public static SentryAttachment ToAttachment(this JavaSdk.Attachment attachment) { // TODO: Convert JavaSdk.Attachment to Sentry.Attachment. // One way to do this might be to serialise the JavaSdk.Attachment as @@ -14,7 +14,7 @@ public static Attachment ToAttachment(this JavaSdk.Attachment attachment) throw new NotImplementedException(); } - public static JavaSdk.Attachment ToJavaAttachment(this Attachment attachment) + public static JavaSdk.Attachment ToJavaAttachment(this SentryAttachment attachment) { // TODO: Convert Sentry.Attachment to JavaSdk.Attachment. // Same problem as ToAttachment() above but in reverse. diff --git a/src/Sentry/Platforms/Android/Extensions/HintExtensions.cs b/src/Sentry/Platforms/Android/Extensions/HintExtensions.cs index ef3c6dee8d..e09a9d17f9 100644 --- a/src/Sentry/Platforms/Android/Extensions/HintExtensions.cs +++ b/src/Sentry/Platforms/Android/Extensions/HintExtensions.cs @@ -2,14 +2,14 @@ namespace Sentry.Android.Extensions; internal static class HintExtensions { - public static Hint ToHint(this JavaSdk.Hint javaHint) + public static SentryHint ToHint(this JavaSdk.Hint javaHint) { // Note the JavaSDK doesn't expose the internal hint storage in any way that is iterable, // so unless you know the key, you can't get the value. This prevents us from converting // anything in the JavaSdk.Hint except the explicitly named properties: // Attachments, Screenshot and ViewHierarchy - var dotnetHint = new Hint(); + var dotnetHint = new SentryHint(); // TODO: Implement ToAttachment //dotnetHint.Screenshot = (javaHint.Screenshot is { } screenshot) ? screenshot.ToAttachment() : null; //dotnetHint.ViewHierarchy = (javaHint.ViewHierarchy is { } viewhierarchy) ? viewhierarchy.ToAttachment() : null; @@ -18,7 +18,7 @@ public static Hint ToHint(this JavaSdk.Hint javaHint) return dotnetHint; } - public static JavaSdk.Hint ToJavaHint(this Hint dotnetHint) + public static JavaSdk.Hint ToJavaHint(this SentryHint dotnetHint) { var javaHint = new JavaSdk.Hint(); // TODO: Implement ToJavaAttachment diff --git a/src/Sentry/Platforms/Android/LogCatAttachmentEventProcessor.cs b/src/Sentry/Platforms/Android/LogCatAttachmentEventProcessor.cs index d50456d7d0..6730d6fb88 100644 --- a/src/Sentry/Platforms/Android/LogCatAttachmentEventProcessor.cs +++ b/src/Sentry/Platforms/Android/LogCatAttachmentEventProcessor.cs @@ -22,7 +22,7 @@ public LogCatAttachmentEventProcessor(IDiagnosticLogger? diagnosticLogger, LogCa _maxLines = maxLines; } - public SentryEvent Process(SentryEvent @event, Hint hint) + public SentryEvent Process(SentryEvent @event, SentryHint hint) { // If sending has failed once, we have to disable this feature to prevent infinite loops and to allow the SDK to work otherwise if (!SendLogcatLogs) @@ -81,7 +81,7 @@ public SentryEvent Process(SentryEvent @event, Hint hint) output.Seek(0, SeekOrigin.Begin); var bytes = output.ToArray(); - hint.Attachments.Add(new Attachment(AttachmentType.Default, new ByteAttachmentContent(bytes), "logcat.log", "text/logcat")); + hint.Attachments.Add(new SentryAttachment(AttachmentType.Default, new ByteAttachmentContent(bytes), "logcat.log", "text/logcat")); //hint.AddAttachment($"{filesDir.Path}/{fileName}", AttachmentType.Default, "text/logcat"); @@ -100,6 +100,6 @@ public SentryEvent Process(SentryEvent @event, Hint hint) public SentryEvent Process(SentryEvent @event) { - return Process(@event, new Hint()); + return Process(@event, new SentryHint()); } } diff --git a/src/Sentry/Platforms/Cocoa/SentrySdk.cs b/src/Sentry/Platforms/Cocoa/SentrySdk.cs index 518fc66591..bca498ade9 100644 --- a/src/Sentry/Platforms/Cocoa/SentrySdk.cs +++ b/src/Sentry/Platforms/Cocoa/SentrySdk.cs @@ -62,7 +62,7 @@ private static void InitSentryCocoaSdk(SentryOptions options) { // Note: The Cocoa SDK doesn't yet support hints. // See https://github.com/getsentry/sentry-cocoa/issues/2325 - var hint = new Hint(); + var hint = new SentryHint(); var breadcrumb = b.ToBreadcrumb(options.DiagnosticLogger); var result = beforeBreadcrumb(breadcrumb, hint)?.ToCocoaBreadcrumb(); diff --git a/src/Sentry/Protocol/App.cs b/src/Sentry/Protocol/App.cs index 86086578c5..c14703e2d1 100644 --- a/src/Sentry/Protocol/App.cs +++ b/src/Sentry/Protocol/App.cs @@ -12,7 +12,7 @@ namespace Sentry.Protocol; /// was running and carries meta data about the current session. /// /// -public sealed class App : IJsonSerializable, ICloneable, IUpdatable +public sealed class App : ISentryJsonSerializable, ICloneable, IUpdatable { /// /// Tells Sentry which type of context this is. diff --git a/src/Sentry/Protocol/Browser.cs b/src/Sentry/Protocol/Browser.cs index 786226fffa..b1fe911e6e 100644 --- a/src/Sentry/Protocol/Browser.cs +++ b/src/Sentry/Protocol/Browser.cs @@ -10,7 +10,7 @@ namespace Sentry.Protocol; /// web request that triggered the event. /// /// -public sealed class Browser : IJsonSerializable, ICloneable, IUpdatable +public sealed class Browser : ISentryJsonSerializable, ICloneable, IUpdatable { /// /// Tells Sentry which type of context this is. diff --git a/src/Sentry/Protocol/DebugImage.cs b/src/Sentry/Protocol/DebugImage.cs index 6f6a41b9c3..ff8b5f7602 100644 --- a/src/Sentry/Protocol/DebugImage.cs +++ b/src/Sentry/Protocol/DebugImage.cs @@ -7,7 +7,7 @@ namespace Sentry.Protocol; /// The Sentry Debug Meta Images interface. /// /// -public sealed class DebugImage : IJsonSerializable +public sealed class DebugImage : ISentryJsonSerializable { /// /// Type of the debug image. diff --git a/src/Sentry/Protocol/DebugMeta.cs b/src/Sentry/Protocol/DebugMeta.cs index be18118b45..5e957363a8 100644 --- a/src/Sentry/Protocol/DebugMeta.cs +++ b/src/Sentry/Protocol/DebugMeta.cs @@ -7,7 +7,7 @@ namespace Sentry.Protocol; /// The Sentry Debug Meta interface. /// /// -internal sealed class DebugMeta : IJsonSerializable +internal sealed class DebugMeta : ISentryJsonSerializable { public List? Images { get; set; } diff --git a/src/Sentry/Protocol/Device.cs b/src/Sentry/Protocol/Device.cs index 87ad26e806..83ef566ed4 100644 --- a/src/Sentry/Protocol/Device.cs +++ b/src/Sentry/Protocol/Device.cs @@ -8,7 +8,7 @@ namespace Sentry.Protocol; /// Describes the device that caused the event. This is most appropriate for mobile applications. /// /// -public sealed class Device : IJsonSerializable, ICloneable, IUpdatable +public sealed class Device : ISentryJsonSerializable, ICloneable, IUpdatable { /// /// Tells Sentry which type of context this is. diff --git a/src/Sentry/Protocol/Envelopes/AsyncJsonSerializable.cs b/src/Sentry/Protocol/Envelopes/AsyncJsonSerializable.cs index c11643ec2b..c482d0c355 100644 --- a/src/Sentry/Protocol/Envelopes/AsyncJsonSerializable.cs +++ b/src/Sentry/Protocol/Envelopes/AsyncJsonSerializable.cs @@ -10,19 +10,19 @@ internal sealed class AsyncJsonSerializable : ISerializable /// /// Source object. /// - public Task Source { get; } + public Task Source { get; } /// /// Initializes an instance of . /// public static AsyncJsonSerializable CreateFrom(Task source) - where T : IJsonSerializable + where T : ISentryJsonSerializable { - var task = source.ContinueWith(t => t.Result as IJsonSerializable); + var task = source.ContinueWith(t => t.Result as ISentryJsonSerializable); return new AsyncJsonSerializable(task); } - private AsyncJsonSerializable(Task source) => Source = source; + private AsyncJsonSerializable(Task source) => Source = source; /// public async Task SerializeAsync(Stream stream, IDiagnosticLogger? logger, CancellationToken cancellationToken = default) diff --git a/src/Sentry/Protocol/Envelopes/Envelope.cs b/src/Sentry/Protocol/Envelopes/Envelope.cs index d771e67be6..3f7975afcc 100644 --- a/src/Sentry/Protocol/Envelopes/Envelope.cs +++ b/src/Sentry/Protocol/Envelopes/Envelope.cs @@ -226,7 +226,7 @@ internal void Serialize(Stream stream, IDiagnosticLogger? logger, ISystemClock c public static Envelope FromEvent( SentryEvent @event, IDiagnosticLogger? logger = null, - IReadOnlyCollection? attachments = null, + IReadOnlyCollection? attachments = null, SessionUpdate? sessionUpdate = null) { var eventId = @event.EventId; diff --git a/src/Sentry/Protocol/Envelopes/EnvelopeItem.cs b/src/Sentry/Protocol/Envelopes/EnvelopeItem.cs index 9202f0b025..a41d5faea4 100644 --- a/src/Sentry/Protocol/Envelopes/EnvelopeItem.cs +++ b/src/Sentry/Protocol/Envelopes/EnvelopeItem.cs @@ -281,13 +281,13 @@ public static EnvelopeItem FromSession(SessionUpdate sessionUpdate) /// /// Creates an from . /// - public static EnvelopeItem FromAttachment(Attachment attachment) + public static EnvelopeItem FromAttachment(SentryAttachment attachment) { var stream = attachment.Content.GetStream(); return FromAttachment(attachment, stream); } - internal static EnvelopeItem FromAttachment(Attachment attachment, Stream stream) + internal static EnvelopeItem FromAttachment(SentryAttachment attachment, Stream stream) { var attachmentType = attachment.Type switch { diff --git a/src/Sentry/Protocol/Envelopes/JsonSerializable.cs b/src/Sentry/Protocol/Envelopes/JsonSerializable.cs index 855ceb7206..824ffb1be0 100644 --- a/src/Sentry/Protocol/Envelopes/JsonSerializable.cs +++ b/src/Sentry/Protocol/Envelopes/JsonSerializable.cs @@ -10,12 +10,12 @@ internal sealed class JsonSerializable : ISerializable /// /// Source object. /// - public IJsonSerializable Source { get; } + public ISentryJsonSerializable Source { get; } /// /// Initializes an instance of . /// - public JsonSerializable(IJsonSerializable source) => Source = source; + public JsonSerializable(ISentryJsonSerializable source) => Source = source; /// public async Task SerializeAsync(Stream stream, IDiagnosticLogger? logger, CancellationToken cancellationToken = default) diff --git a/src/Sentry/Protocol/Gpu.cs b/src/Sentry/Protocol/Gpu.cs index bb17768125..3a90d71b49 100644 --- a/src/Sentry/Protocol/Gpu.cs +++ b/src/Sentry/Protocol/Gpu.cs @@ -8,7 +8,7 @@ namespace Sentry.Protocol; /// Graphics device unit. /// /// -public sealed class Gpu : IJsonSerializable, ICloneable, IUpdatable +public sealed class Gpu : ISentryJsonSerializable, ICloneable, IUpdatable { /// /// Tells Sentry which type of context this is. diff --git a/src/Sentry/Protocol/Measurement.cs b/src/Sentry/Protocol/Measurement.cs index 58b92aafc1..1b35ebf067 100644 --- a/src/Sentry/Protocol/Measurement.cs +++ b/src/Sentry/Protocol/Measurement.cs @@ -6,7 +6,7 @@ namespace Sentry.Protocol; /// /// A measurement, containing a numeric value and a unit. /// -public sealed class Measurement : IJsonSerializable +public sealed class Measurement : ISentryJsonSerializable { /// /// The numeric value of the measurement. diff --git a/src/Sentry/Protocol/Mechanism.cs b/src/Sentry/Protocol/Mechanism.cs index 1d1e7d26ec..ff0eb014fd 100644 --- a/src/Sentry/Protocol/Mechanism.cs +++ b/src/Sentry/Protocol/Mechanism.cs @@ -12,7 +12,7 @@ namespace Sentry.Protocol; /// This includes general exception values obtained from operating system or runtime APIs, as well as mechanism-specific values. /// /// -public sealed class Mechanism : IJsonSerializable +public sealed class Mechanism : ISentryJsonSerializable { /// /// Key found inside of Exception.Data to inform if the exception was handled. diff --git a/src/Sentry/Protocol/Metrics/CodeLocations.cs b/src/Sentry/Protocol/Metrics/CodeLocations.cs index da4835d85b..2b468f9e22 100644 --- a/src/Sentry/Protocol/Metrics/CodeLocations.cs +++ b/src/Sentry/Protocol/Metrics/CodeLocations.cs @@ -7,7 +7,7 @@ namespace Sentry.Protocol.Metrics; /// Represents a collection of code locations. /// internal class CodeLocations(long timestamp, IReadOnlyDictionary locations) - : IJsonSerializable + : ISentryJsonSerializable { /// /// Uniquely identifies a code location using the number of seconds since the UnixEpoch, as measured at the start @@ -15,7 +15,7 @@ internal class CodeLocations(long timestamp, IReadOnlyDictionary public long Timestamp => timestamp; - /// + /// public void WriteTo(Utf8JsonWriter writer, IDiagnosticLogger? logger) { writer.WriteStartObject(); diff --git a/src/Sentry/Protocol/Metrics/Metric.cs b/src/Sentry/Protocol/Metrics/Metric.cs index 5973265677..3899da616d 100644 --- a/src/Sentry/Protocol/Metrics/Metric.cs +++ b/src/Sentry/Protocol/Metrics/Metric.cs @@ -7,7 +7,7 @@ namespace Sentry.Protocol.Metrics; /// /// Base class for metric instruments /// -internal abstract class Metric : IJsonSerializable, ISentrySerializable +internal abstract class Metric : ISentryJsonSerializable, ISentrySerializable { /// /// Creates a new instance of . @@ -75,7 +75,7 @@ public IDictionary Tags /// protected abstract void WriteValues(Utf8JsonWriter writer, IDiagnosticLogger? logger); - /// + /// public void WriteTo(Utf8JsonWriter writer, IDiagnosticLogger? logger) { writer.WriteStartObject(); diff --git a/src/Sentry/Protocol/OperatingSystem.cs b/src/Sentry/Protocol/OperatingSystem.cs index 2a61805798..34c3d4fe6e 100644 --- a/src/Sentry/Protocol/OperatingSystem.cs +++ b/src/Sentry/Protocol/OperatingSystem.cs @@ -11,7 +11,7 @@ namespace Sentry.Protocol; /// Defines the operating system that caused the event. In web contexts, this is the operating system of the browser (normally pulled from the User-Agent string). /// /// -public sealed class OperatingSystem : IJsonSerializable, ICloneable, IUpdatable +public sealed class OperatingSystem : ISentryJsonSerializable, ICloneable, IUpdatable { /// /// Tells Sentry which type of context this is. diff --git a/src/Sentry/Protocol/ProfileInfo.cs b/src/Sentry/Protocol/ProfileInfo.cs index 4a0cad6e69..ebca7ec299 100644 --- a/src/Sentry/Protocol/ProfileInfo.cs +++ b/src/Sentry/Protocol/ProfileInfo.cs @@ -6,7 +6,7 @@ namespace Sentry.Protocol; /// /// Profiling context information. /// -internal sealed class ProfileInfo : IJsonSerializable +internal sealed class ProfileInfo : ISentryJsonSerializable { /// /// Profile's event ID. diff --git a/src/Sentry/Protocol/Response.cs b/src/Sentry/Protocol/Response.cs index f6976eac8c..2ed1032285 100644 --- a/src/Sentry/Protocol/Response.cs +++ b/src/Sentry/Protocol/Response.cs @@ -23,7 +23,7 @@ namespace Sentry.Protocol; ///} /// /// -public sealed class Response : IJsonSerializable, ICloneable, IUpdatable +public sealed class Response : ISentryJsonSerializable, ICloneable, IUpdatable { /// /// Tells Sentry which type of context this is. diff --git a/src/Sentry/Protocol/Runtime.cs b/src/Sentry/Protocol/Runtime.cs index 572c3d9047..45709272a8 100644 --- a/src/Sentry/Protocol/Runtime.cs +++ b/src/Sentry/Protocol/Runtime.cs @@ -11,7 +11,7 @@ namespace Sentry.Protocol; /// Typically this context is used multiple times if multiple runtimes are involved (for instance if you have a JavaScript application running on top of JVM) /// /// -public sealed class Runtime : IJsonSerializable, ICloneable, IUpdatable +public sealed class Runtime : ISentryJsonSerializable, ICloneable, IUpdatable { /// /// Tells Sentry which type of context this is. diff --git a/src/Sentry/Protocol/SampleProfile.cs b/src/Sentry/Protocol/SampleProfile.cs index 264d0492ee..55241bf5a7 100644 --- a/src/Sentry/Protocol/SampleProfile.cs +++ b/src/Sentry/Protocol/SampleProfile.cs @@ -10,7 +10,7 @@ namespace Sentry.Protocol; /// /// Sentry sampling profiler output profile /// -internal sealed class SampleProfile : IJsonSerializable +internal sealed class SampleProfile : ISentryJsonSerializable { // Note: changing these to properties would break because GrowableArray is a struct. internal Internal.GrowableArray Samples = new(10000); @@ -52,7 +52,7 @@ public void WriteTo(Utf8JsonWriter writer, IDiagnosticLogger? logger) writer.WriteEndObject(); } - public class Sample : IJsonSerializable + public class Sample : ISentryJsonSerializable { /// /// Timestamp in nanoseconds relative to the profile start. diff --git a/src/Sentry/Protocol/SentryException.cs b/src/Sentry/Protocol/SentryException.cs index c04b95bf2f..4717d1cbb7 100644 --- a/src/Sentry/Protocol/SentryException.cs +++ b/src/Sentry/Protocol/SentryException.cs @@ -7,7 +7,7 @@ namespace Sentry.Protocol; /// Sentry Exception interface. /// /// -public sealed class SentryException : IJsonSerializable +public sealed class SentryException : ISentryJsonSerializable { /// /// Exception Type. diff --git a/src/Sentry/Protocol/Trace.cs b/src/Sentry/Protocol/Trace.cs index ae8d27da5f..d6102b0e32 100644 --- a/src/Sentry/Protocol/Trace.cs +++ b/src/Sentry/Protocol/Trace.cs @@ -7,7 +7,7 @@ namespace Sentry.Protocol; /// /// Trace context data. /// -public class Trace : ITraceContext, IJsonSerializable, ICloneable, IUpdatable +public class Trace : ITraceContext, ISentryJsonSerializable, ICloneable, IUpdatable { /// /// Tells Sentry which type of context this is. diff --git a/src/Sentry/Request.cs b/src/Sentry/Request.cs index 5a9a6ea0a0..9141ff1b48 100644 --- a/src/Sentry/Request.cs +++ b/src/Sentry/Request.cs @@ -25,7 +25,7 @@ namespace Sentry; /// } /// /// -public sealed class Request : IJsonSerializable +public sealed class Request : ISentryJsonSerializable { internal Dictionary? InternalEnv { get; private set; } diff --git a/src/Sentry/Scope.cs b/src/Sentry/Scope.cs index e0c4ede588..9e32e14cf3 100644 --- a/src/Sentry/Scope.cs +++ b/src/Sentry/Scope.cs @@ -220,15 +220,15 @@ public ITransactionTracer? Transaction public IReadOnlyDictionary Tags => _tags; #if NETSTANDARD2_0 || NETFRAMEWORK - private ConcurrentBag _attachments = new(); + private ConcurrentBag _attachments = new(); #else - private readonly ConcurrentBag _attachments = new(); + private readonly ConcurrentBag _attachments = new(); #endif /// /// Attachments. /// - public IReadOnlyCollection Attachments => _attachments; + public IReadOnlyCollection Attachments => _attachments; /// /// Creates a scope with the specified options. @@ -251,14 +251,14 @@ internal Scope() } /// - public void AddBreadcrumb(Breadcrumb breadcrumb) => AddBreadcrumb(breadcrumb, new Hint()); + public void AddBreadcrumb(Breadcrumb breadcrumb) => AddBreadcrumb(breadcrumb, new SentryHint()); /// /// Adds a breadcrumb with a hint. /// /// The breadcrumb /// A hint for use in the BeforeBreadcrumb callback - public void AddBreadcrumb(Breadcrumb breadcrumb, Hint hint) + public void AddBreadcrumb(Breadcrumb breadcrumb, SentryHint hint) { if (Options.BeforeBreadcrumbInternal is { } beforeBreadcrumb) { @@ -331,7 +331,7 @@ public void UnsetTag(string key) /// /// Adds an attachment. /// - public void AddAttachment(Attachment attachment) => _attachments.Add(attachment); + public void AddAttachment(SentryAttachment attachment) => _attachments.Add(attachment); /// /// Resets all the properties and collections within the scope to their default values. diff --git a/src/Sentry/ScopeExtensions.cs b/src/Sentry/ScopeExtensions.cs index 454aeb4610..8e1b8d5d82 100644 --- a/src/Sentry/ScopeExtensions.cs +++ b/src/Sentry/ScopeExtensions.cs @@ -166,7 +166,7 @@ public static void AddAttachment( // TODO: Envelope spec allows the last item to not have a length. // So if we make sure there's only 1 item without length, we can support it. scope.AddAttachment( - new Attachment( + new SentryAttachment( type, new StreamAttachmentContent(stream), fileName, @@ -183,7 +183,7 @@ public static void AddAttachment( AttachmentType type = AttachmentType.Default, string? contentType = null) => scope.AddAttachment( - new Attachment( + new SentryAttachment( type, new ByteAttachmentContent(data), fileName, @@ -198,7 +198,7 @@ public static void AddAttachment( AttachmentType type = AttachmentType.Default, string? contentType = null) => scope.AddAttachment( - new Attachment( + new SentryAttachment( type, new FileAttachmentContent(filePath, scope.Options.UseAsyncFileIO), Path.GetFileName(filePath), diff --git a/src/Sentry/SdkVersion.cs b/src/Sentry/SdkVersion.cs index 472d800c3f..8c4e63ce26 100644 --- a/src/Sentry/SdkVersion.cs +++ b/src/Sentry/SdkVersion.cs @@ -8,7 +8,7 @@ namespace Sentry; /// Information about the SDK to be sent with the SentryEvent. /// /// Requires Sentry version 8.4 or higher. -public sealed class SdkVersion : IJsonSerializable +public sealed class SdkVersion : ISentryJsonSerializable { private static readonly Lazy InstanceLazy = new( () => new SdkVersion diff --git a/src/Sentry/Attachment.cs b/src/Sentry/SentryAttachment.cs similarity index 93% rename from src/Sentry/Attachment.cs rename to src/Sentry/SentryAttachment.cs index 143f4a81a4..0249fc589f 100644 --- a/src/Sentry/Attachment.cs +++ b/src/Sentry/SentryAttachment.cs @@ -43,7 +43,7 @@ public enum AttachmentType /// Sentry attachment. /// [DebuggerDisplay("{" + nameof(FileName) + "}")] -public class Attachment +public class SentryAttachment { /// /// Attachment type. @@ -66,9 +66,9 @@ public class Attachment public string? ContentType { get; } /// - /// Initializes an instance of . + /// Initializes an instance of . /// - public Attachment( + public SentryAttachment( AttachmentType type, IAttachmentContent content, string fileName, diff --git a/src/Sentry/SentryClient.cs b/src/Sentry/SentryClient.cs index 12e5a6dee1..4058b1e363 100644 --- a/src/Sentry/SentryClient.cs +++ b/src/Sentry/SentryClient.cs @@ -77,7 +77,7 @@ internal SentryClient( } /// - public SentryId CaptureEvent(SentryEvent? @event, Scope? scope = null, Hint? hint = null) + public SentryId CaptureEvent(SentryEvent? @event, Scope? scope = null, SentryHint? hint = null) { if (@event == null) { @@ -112,7 +112,7 @@ public void CaptureUserFeedback(UserFeedback userFeedback) public void CaptureTransaction(SentryTransaction transaction) => CaptureTransaction(transaction, null, null); /// - public void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint? hint) + public void CaptureTransaction(SentryTransaction transaction, Scope? scope, SentryHint? hint) { if (transaction.SpanId.Equals(SpanId.Empty)) { @@ -148,7 +148,7 @@ public void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint } scope ??= new Scope(_options); - hint ??= new Hint(); + hint ??= new SentryHint(); hint.AddAttachmentsFromScope(scope); _options.LogInfo("Capturing transaction."); @@ -186,7 +186,7 @@ public void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint CaptureEnvelope(Envelope.FromTransaction(processedTransaction)); } - private SentryTransaction? BeforeSendTransaction(SentryTransaction transaction, Hint hint) + private SentryTransaction? BeforeSendTransaction(SentryTransaction transaction, SentryHint hint) { if (_options.BeforeSendTransactionInternal is null) { @@ -243,7 +243,7 @@ public void CaptureSession(SessionUpdate sessionUpdate) public Task FlushAsync(TimeSpan timeout) => Worker.FlushAsync(timeout); // TODO: this method needs to be refactored, it's really hard to analyze nullability - private SentryId DoSendEvent(SentryEvent @event, Hint? hint, Scope? scope) + private SentryId DoSendEvent(SentryEvent @event, SentryHint? hint, Scope? scope) { var filteredExceptions = ApplyExceptionFilters(@event.Exception); if (filteredExceptions?.Count > 0) @@ -255,7 +255,7 @@ private SentryId DoSendEvent(SentryEvent @event, Hint? hint, Scope? scope) } scope ??= new Scope(_options); - hint ??= new Hint(); + hint ??= new SentryHint(); hint.AddAttachmentsFromScope(scope); _options.LogInfo("Capturing event."); @@ -389,7 +389,7 @@ public bool CaptureEnvelope(Envelope envelope) return false; } - private SentryEvent? BeforeSend(SentryEvent? @event, Hint hint) + private SentryEvent? BeforeSend(SentryEvent? @event, SentryHint hint) { if (_options.BeforeSendInternal == null) { diff --git a/src/Sentry/SentryEvent.cs b/src/Sentry/SentryEvent.cs index fbddc28b9f..c69bb7dd05 100644 --- a/src/Sentry/SentryEvent.cs +++ b/src/Sentry/SentryEvent.cs @@ -10,7 +10,7 @@ namespace Sentry; /// /// [DebuggerDisplay("{GetType().Name,nq}: {" + nameof(EventId) + ",nq}")] -public sealed class SentryEvent : IEventLike, IJsonSerializable +public sealed class SentryEvent : IEventLike, ISentryJsonSerializable { private IDictionary? _modules; diff --git a/src/Sentry/SentryGraphQLHttpFailedRequestHandler.cs b/src/Sentry/SentryGraphQLHttpFailedRequestHandler.cs index e370010031..22a5bb516d 100644 --- a/src/Sentry/SentryGraphQLHttpFailedRequestHandler.cs +++ b/src/Sentry/SentryGraphQLHttpFailedRequestHandler.cs @@ -42,7 +42,7 @@ protected internal override void DoEnsureSuccessfulResponse([NotNull] HttpReques exception.SetSentryMechanism(MechanismType, "GraphQL Failed Request Handler", false); var @event = new SentryEvent(exception); - var hint = new Hint(HintTypes.HttpResponseMessage, response); + var hint = new SentryHint(HintTypes.HttpResponseMessage, response); var sentryRequest = new Request { diff --git a/src/Sentry/Hint.cs b/src/Sentry/SentryHint.cs similarity index 81% rename from src/Sentry/Hint.cs rename to src/Sentry/SentryHint.cs index b38657c3b9..8a8d01108b 100644 --- a/src/Sentry/Hint.cs +++ b/src/Sentry/SentryHint.cs @@ -4,20 +4,20 @@ namespace Sentry; /// A hint that can be provided when capturing a or when adding a . /// Hints can be used to filter or modify events, transactions, or breadcrumbs before they are sent to Sentry. /// -public class Hint +public class SentryHint { private readonly SentryOptions? _options; - private readonly List _attachments = new(); + private readonly List _attachments = new(); private Dictionary? _items; /// - /// Creates a new instance of . + /// Creates a new instance of . /// - public Hint() : this(SentrySdk.CurrentHub.GetSentryOptions()) + public SentryHint() : this(SentrySdk.CurrentHub.GetSentryOptions()) { } - internal Hint(SentryOptions? options) + internal SentryHint(SentryOptions? options) { _options = options; } @@ -27,7 +27,7 @@ internal Hint(SentryOptions? options) /// /// The key of the hint item. /// The value of the hint item. - public Hint(string key, object? value) + public SentryHint(string key, object? value) : this() { Items[key] = value; @@ -40,7 +40,7 @@ public Hint(string key, object? value) /// This collection represents all of the attachments that will be sent to Sentry with the corresponding event. /// You can add or remove attachments from this collection as needed. /// - public ICollection Attachments => _attachments; + public ICollection Attachments => _attachments; /// /// A dictionary of arbitrary items provided with the Hint. @@ -72,7 +72,7 @@ public void AddAttachment( if (_options is not null) { _attachments.Add( - new Attachment( + new SentryAttachment( type, new FileAttachmentContent(filePath, _options.UseAsyncFileIO), Path.GetFileName(filePath), @@ -85,16 +85,16 @@ public void AddAttachment( /// /// The attachment(s) to add. /// A Hint having the attachment(s). - public static Hint WithAttachments(params Attachment[] attachments) => WithAttachments(attachments.AsEnumerable()); + public static SentryHint WithAttachments(params SentryAttachment[] attachments) => WithAttachments(attachments.AsEnumerable()); /// /// Creates a new Hint with attachments. /// /// The attachments to add. /// A Hint having the attachments. - public static Hint WithAttachments(IEnumerable attachments) + public static SentryHint WithAttachments(IEnumerable attachments) { - var hint = new Hint(); + var hint = new SentryHint(); hint._attachments.AddRange(attachments); return hint; } diff --git a/src/Sentry/SentryHttpFailedRequestHandler.cs b/src/Sentry/SentryHttpFailedRequestHandler.cs index 2d298f3c88..41e835ed61 100644 --- a/src/Sentry/SentryHttpFailedRequestHandler.cs +++ b/src/Sentry/SentryHttpFailedRequestHandler.cs @@ -42,7 +42,7 @@ protected internal override void DoEnsureSuccessfulResponse([NotNull] HttpReques exception.SetSentryMechanism(MechanismType); var @event = new SentryEvent(exception); - var hint = new Hint(HintTypes.HttpResponseMessage, response); + var hint = new SentryHint(HintTypes.HttpResponseMessage, response); var uri = response.RequestMessage?.RequestUri; var sentryRequest = new Request diff --git a/src/Sentry/SentryId.cs b/src/Sentry/SentryId.cs index 955702e07f..265b988d5f 100644 --- a/src/Sentry/SentryId.cs +++ b/src/Sentry/SentryId.cs @@ -5,7 +5,7 @@ namespace Sentry; /// /// The identifier of an event in Sentry. /// -public readonly struct SentryId : IEquatable, IJsonSerializable +public readonly struct SentryId : IEquatable, ISentryJsonSerializable { private readonly Guid _guid; diff --git a/src/Sentry/SentryMessage.cs b/src/Sentry/SentryMessage.cs index 473f8b3865..9b30e4e0d5 100644 --- a/src/Sentry/SentryMessage.cs +++ b/src/Sentry/SentryMessage.cs @@ -16,7 +16,7 @@ namespace Sentry; /// } /// /// -public sealed class SentryMessage : IJsonSerializable +public sealed class SentryMessage : ISentryJsonSerializable { /// /// The raw message string (un-interpolated). diff --git a/src/Sentry/SentryOptions.cs b/src/Sentry/SentryOptions.cs index d6e7ed8a84..330d49ad1e 100644 --- a/src/Sentry/SentryOptions.cs +++ b/src/Sentry/SentryOptions.cs @@ -423,9 +423,9 @@ internal bool IsSentryRequest(Uri? requestUri) return string.Equals(requestBaseUrl, _sentryBaseUrl.Value, StringComparison.OrdinalIgnoreCase); } - private Func? _beforeSend; + private Func? _beforeSend; - internal Func? BeforeSendInternal => _beforeSend; + internal Func? BeforeSendInternal => _beforeSend; /// /// Configures a callback function to be invoked before sending an event to Sentry @@ -435,7 +435,7 @@ internal bool IsSentryRequest(Uri? requestUri) /// application a chance to inspect and/or modify the event before it's sent. If the /// event should not be sent at all, return null from the callback. /// - public void SetBeforeSend(Func beforeSend) + public void SetBeforeSend(Func beforeSend) { _beforeSend = beforeSend; } @@ -453,15 +453,15 @@ public void SetBeforeSend(Func beforeSend) _beforeSend = (@event, _) => beforeSend(@event); } - private Func? _beforeSendTransaction; + private Func? _beforeSendTransaction; - internal Func? BeforeSendTransactionInternal => _beforeSendTransaction; + internal Func? BeforeSendTransactionInternal => _beforeSendTransaction; /// /// Configures a callback to invoke before sending a transaction to Sentry /// /// The callback - public void SetBeforeSendTransaction(Func beforeSendTransaction) + public void SetBeforeSendTransaction(Func beforeSendTransaction) { _beforeSendTransaction = beforeSendTransaction; } @@ -475,9 +475,9 @@ public void SetBeforeSendTransaction(Func _beforeSendTransaction = (transaction, _) => beforeSendTransaction(transaction); } - private Func? _beforeBreadcrumb; + private Func? _beforeBreadcrumb; - internal Func? BeforeBreadcrumbInternal => _beforeBreadcrumb; + internal Func? BeforeBreadcrumbInternal => _beforeBreadcrumb; /// /// Sets a callback function to be invoked when a breadcrumb is about to be stored. @@ -486,7 +486,7 @@ public void SetBeforeSendTransaction(Func /// Gives a chance to inspect and modify the breadcrumb. If null is returned, the /// breadcrumb will be discarded. Otherwise the result of the callback will be stored. /// - public void SetBeforeBreadcrumb(Func beforeBreadcrumb) + public void SetBeforeBreadcrumb(Func beforeBreadcrumb) { _beforeBreadcrumb = beforeBreadcrumb; } @@ -1093,7 +1093,7 @@ public void AddJsonSerializerContext(Func contextBu /// /// /// This option applies only to complex objects being added to Sentry events as contexts or extras, which do not - /// implement . + /// implement . /// public bool JsonPreserveReferences { diff --git a/src/Sentry/SentrySdk.cs b/src/Sentry/SentrySdk.cs index ce29f57473..3a6872d724 100644 --- a/src/Sentry/SentrySdk.cs +++ b/src/Sentry/SentrySdk.cs @@ -357,7 +357,7 @@ public static void AddBreadcrumb( /// A hint providing additional context that can be used in the BeforeBreadcrumb callback /// [DebuggerStepThrough] - public static void AddBreadcrumb(Breadcrumb breadcrumb, Hint? hint = null) + public static void AddBreadcrumb(Breadcrumb breadcrumb, SentryHint? hint = null) => CurrentHub.AddBreadcrumb(breadcrumb, hint); /// @@ -392,7 +392,7 @@ public static bool CaptureEnvelope(Envelope envelope) /// The Id of the event. [DebuggerStepThrough] [EditorBrowsable(EditorBrowsableState.Never)] - public static SentryId CaptureEvent(SentryEvent evt, Scope? scope = null, Hint? hint = null) + public static SentryId CaptureEvent(SentryEvent evt, Scope? scope = null, SentryHint? hint = null) => CurrentHub.CaptureEvent(evt, scope, hint); /// @@ -421,7 +421,7 @@ public static SentryId CaptureEvent(SentryEvent evt, Action configureScop /// The Id of the event. [DebuggerStepThrough] [EditorBrowsable(EditorBrowsableState.Never)] - public static SentryId CaptureEvent(SentryEvent evt, Hint? hint, Action configureScope) + public static SentryId CaptureEvent(SentryEvent evt, SentryHint? hint, Action configureScope) => CurrentHub.CaptureEvent(evt, hint, configureScope); /// @@ -510,7 +510,7 @@ public static void CaptureTransaction(SentryTransaction transaction) /// [DebuggerStepThrough] [EditorBrowsable(EditorBrowsableState.Never)] - public static void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint? hint) + public static void CaptureTransaction(SentryTransaction transaction, Scope? scope, SentryHint? hint) => CurrentHub.CaptureTransaction(transaction, scope, hint); /// diff --git a/src/Sentry/SentrySpan.cs b/src/Sentry/SentrySpan.cs index cff5f927d3..9262bd85d1 100644 --- a/src/Sentry/SentrySpan.cs +++ b/src/Sentry/SentrySpan.cs @@ -9,7 +9,7 @@ namespace Sentry; /// /// Transaction span. /// -public class SentrySpan : ISpanData, IJsonSerializable +public class SentrySpan : ISpanData, ISentryJsonSerializable { /// public SpanId SpanId { get; private set; } diff --git a/src/Sentry/SentryStackFrame.cs b/src/Sentry/SentryStackFrame.cs index 5cc26814a2..ad3696e1fd 100644 --- a/src/Sentry/SentryStackFrame.cs +++ b/src/Sentry/SentryStackFrame.cs @@ -7,7 +7,7 @@ namespace Sentry; /// A frame of a stacktrace. /// /// -public sealed class SentryStackFrame : IJsonSerializable +public sealed class SentryStackFrame : ISentryJsonSerializable { internal List? InternalPreContext { get; private set; } diff --git a/src/Sentry/SentryStackTrace.cs b/src/Sentry/SentryStackTrace.cs index e1b14af6d0..5c32dc73e6 100644 --- a/src/Sentry/SentryStackTrace.cs +++ b/src/Sentry/SentryStackTrace.cs @@ -40,7 +40,7 @@ public enum InstructionAddressAdjustment /// Frames should be sorted from oldest to newest. /// /// -public class SentryStackTrace : IJsonSerializable +public class SentryStackTrace : ISentryJsonSerializable { internal IList? InternalFrames { get; private set; } diff --git a/src/Sentry/SentryThread.cs b/src/Sentry/SentryThread.cs index d5c2508920..6ce62eff7b 100644 --- a/src/Sentry/SentryThread.cs +++ b/src/Sentry/SentryThread.cs @@ -7,7 +7,7 @@ namespace Sentry; /// A thread running at the time of an event. /// /// -public sealed class SentryThread : IJsonSerializable +public sealed class SentryThread : ISentryJsonSerializable { /// /// The Id of the thread. diff --git a/src/Sentry/SentryTransaction.cs b/src/Sentry/SentryTransaction.cs index 7b5502a1a9..7e6d7e31f5 100644 --- a/src/Sentry/SentryTransaction.cs +++ b/src/Sentry/SentryTransaction.cs @@ -9,7 +9,7 @@ namespace Sentry; /// /// Sentry performance transaction. /// -public class SentryTransaction : ITransactionData, IJsonSerializable +public class SentryTransaction : ITransactionData, ISentryJsonSerializable { /// /// Transaction's event ID. diff --git a/src/Sentry/SentryUser.cs b/src/Sentry/SentryUser.cs index 953c319e3b..0959c5baee 100644 --- a/src/Sentry/SentryUser.cs +++ b/src/Sentry/SentryUser.cs @@ -7,7 +7,7 @@ namespace Sentry; /// An interface which describes the authenticated User for a request. /// /// -public sealed class SentryUser : IJsonSerializable +public sealed class SentryUser : ISentryJsonSerializable { internal Action? PropertyChanged { get; set; } diff --git a/src/Sentry/SentryValues.cs b/src/Sentry/SentryValues.cs index b2193df876..5e20bfe170 100644 --- a/src/Sentry/SentryValues.cs +++ b/src/Sentry/SentryValues.cs @@ -6,7 +6,7 @@ namespace Sentry; /// /// Helps serialization of Sentry protocol types which include a values property. /// -internal sealed class SentryValues : IJsonSerializable +internal sealed class SentryValues : ISentryJsonSerializable { /// /// The values. diff --git a/src/Sentry/SessionUpdate.cs b/src/Sentry/SessionUpdate.cs index 88a09af846..91c4a75cfb 100644 --- a/src/Sentry/SessionUpdate.cs +++ b/src/Sentry/SessionUpdate.cs @@ -7,7 +7,7 @@ namespace Sentry; /// Session update. /// // https://develop.sentry.dev/sdk/sessions/#session-update-payload -public class SessionUpdate : ISentrySession, IJsonSerializable +public class SessionUpdate : ISentrySession, ISentryJsonSerializable { /// public SentryId Id { get; } diff --git a/src/Sentry/SpanId.cs b/src/Sentry/SpanId.cs index f4546cc5bc..a4e1062a40 100644 --- a/src/Sentry/SpanId.cs +++ b/src/Sentry/SpanId.cs @@ -6,7 +6,7 @@ namespace Sentry; /// /// Sentry span ID. /// -public readonly struct SpanId : IEquatable, IJsonSerializable +public readonly struct SpanId : IEquatable, ISentryJsonSerializable { private static readonly char[] HexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; private static readonly RandomValuesFactory Random = new SynchronizedRandomValuesFactory(); diff --git a/src/Sentry/UserFeedback.cs b/src/Sentry/UserFeedback.cs index c10bd87827..3de5773d69 100644 --- a/src/Sentry/UserFeedback.cs +++ b/src/Sentry/UserFeedback.cs @@ -6,7 +6,7 @@ namespace Sentry; /// /// Sentry User Feedback. /// -public sealed class UserFeedback : IJsonSerializable +public sealed class UserFeedback : ISentryJsonSerializable { /// /// The eventId of the event to which the user feedback is associated. diff --git a/src/Sentry/ViewHierarchy.cs b/src/Sentry/ViewHierarchy.cs index 3b27109e06..1776872e89 100644 --- a/src/Sentry/ViewHierarchy.cs +++ b/src/Sentry/ViewHierarchy.cs @@ -6,7 +6,7 @@ namespace Sentry /// /// Sentry View Hierarchy. /// - public sealed class ViewHierarchy : IJsonSerializable + public sealed class ViewHierarchy : ISentryJsonSerializable { /// /// The rendering system this view hierarchy is capturing. diff --git a/src/Sentry/ViewHierarchyAttachment.cs b/src/Sentry/ViewHierarchyAttachment.cs index de7fffc736..d71e9e8db5 100644 --- a/src/Sentry/ViewHierarchyAttachment.cs +++ b/src/Sentry/ViewHierarchyAttachment.cs @@ -3,7 +3,7 @@ namespace Sentry; /// /// Sentry View Hierarchy attachment. /// -public class ViewHierarchyAttachment : Attachment +public class ViewHierarchyAttachment : SentryAttachment { /// /// Initializes an instance of . diff --git a/src/Sentry/ViewHierarchyNode.cs b/src/Sentry/ViewHierarchyNode.cs index 871dc21491..99df806121 100644 --- a/src/Sentry/ViewHierarchyNode.cs +++ b/src/Sentry/ViewHierarchyNode.cs @@ -5,7 +5,7 @@ namespace Sentry; /// /// Sentry View Hierarchy Node /// -public abstract class ViewHierarchyNode : IJsonSerializable +public abstract class ViewHierarchyNode : ISentryJsonSerializable { private List? _children; diff --git a/test/Sentry.AspNetCore.Tests/MiddlewareLoggerIntegration.cs b/test/Sentry.AspNetCore.Tests/MiddlewareLoggerIntegration.cs index b1ee841e41..d3567c6164 100644 --- a/test/Sentry.AspNetCore.Tests/MiddlewareLoggerIntegration.cs +++ b/test/Sentry.AspNetCore.Tests/MiddlewareLoggerIntegration.cs @@ -41,7 +41,7 @@ public Fixture() }; loggingOptions.InitializeSdk = false; - Client.When(client => client.CaptureEvent(Arg.Any(), Arg.Any(), Arg.Any())) + Client.When(client => client.CaptureEvent(Arg.Any(), Arg.Any(), Arg.Any())) .Do(callback => callback.Arg().Evaluate()); var hub = new Hub(new SentryOptions { Dsn = ValidDsn }); @@ -83,7 +83,7 @@ public async Task InvokeAsync_LoggerMessage_AsBreadcrumb() _ = _fixture.Client.Received(1).CaptureEvent( Arg.Any(), - Arg.Is(e => e.Breadcrumbs.Any(b => b.Message == expectedCrumb)), Arg.Any()); + Arg.Is(e => e.Breadcrumbs.Any(b => b.Message == expectedCrumb)), Arg.Any()); } [Fact] @@ -104,7 +104,7 @@ public async Task InvokeAsync_LoggerPushesScope_LoggerMessage_AsBreadcrumb() _ = _fixture.Client.Received(1).CaptureEvent( Arg.Any(), - Arg.Is(e => e.Breadcrumbs.Any(b => b.Message == expectedCrumb)), Arg.Any()); + Arg.Is(e => e.Breadcrumbs.Any(b => b.Message == expectedCrumb)), Arg.Any()); } [Fact] @@ -119,7 +119,7 @@ public async Task InvokeAsync_OptionsConfigureScope_AffectsAllRequests() _ = _fixture.Client.Received(1).CaptureEvent( Arg.Any(), - Arg.Is(e => e.Level == expected), Arg.Any()); + Arg.Is(e => e.Level == expected), Arg.Any()); } public void Dispose() => _fixture.Dispose(); diff --git a/test/Sentry.AspNetCore.Tests/SentryTracingMiddlewareTests.cs b/test/Sentry.AspNetCore.Tests/SentryTracingMiddlewareTests.cs index f54e7cadd7..66fb35b914 100644 --- a/test/Sentry.AspNetCore.Tests/SentryTracingMiddlewareTests.cs +++ b/test/Sentry.AspNetCore.Tests/SentryTracingMiddlewareTests.cs @@ -57,7 +57,7 @@ public async Task Transactions_are_grouped_by_route() transaction.Name == "GET /person/{id}" && transaction.NameSource == TransactionNameSource.Route), Arg.Any(), - Arg.Any() + Arg.Any() ); } @@ -153,7 +153,7 @@ public async Task Transaction_is_started_automatically_from_incoming_trace_heade t.IsSampled == false ), Arg.Any(), - Arg.Any() + Arg.Any() ); } @@ -187,7 +187,7 @@ public async Task Transaction_name_includes_slash_prefix() sentryClient.CaptureTransaction( Arg.Do(t => transaction = t), Arg.Any(), - Arg.Any() + Arg.Any() ); // Act @@ -599,7 +599,7 @@ public async Task Transaction_TransactionNameProviderSetSet_TransactionNameSet() var expectedName = "My custom name"; var sentryClient = Substitute.For(); - sentryClient.When(x => x.CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any())) + sentryClient.When(x => x.CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any())) .Do(callback => transaction = callback.Arg()); var options = new SentryAspNetCoreOptions { @@ -641,7 +641,7 @@ public async Task Transaction_TransactionNameProviderSetUnset_TransactionNameSet SentryTransaction transaction = null; var sentryClient = Substitute.For(); - sentryClient.When(x => x.CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any())) + sentryClient.When(x => x.CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any())) .Do(callback => transaction = callback.Arg()); var options = new SentryAspNetCoreOptions { diff --git a/test/Sentry.Azure.Functions.Worker.Tests/SentryFunctionsWorkerMiddlewareTests.cs b/test/Sentry.Azure.Functions.Worker.Tests/SentryFunctionsWorkerMiddlewareTests.cs index e08387f99e..4dc844488f 100644 --- a/test/Sentry.Azure.Functions.Worker.Tests/SentryFunctionsWorkerMiddlewareTests.cs +++ b/test/Sentry.Azure.Functions.Worker.Tests/SentryFunctionsWorkerMiddlewareTests.cs @@ -22,7 +22,7 @@ public Fixture() var client = Substitute.For(); var sessionManager = Substitute.For(); - client.When(x => x.CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any())) + client.When(x => x.CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any())) .Do(callback => Transaction = callback.Arg()); ScopeManager = new SentryScopeManager(options, client); diff --git a/test/Sentry.Testing/JsonSerializableExtensions.cs b/test/Sentry.Testing/JsonSerializableExtensions.cs index 632de335c9..a8e92c735d 100644 --- a/test/Sentry.Testing/JsonSerializableExtensions.cs +++ b/test/Sentry.Testing/JsonSerializableExtensions.cs @@ -4,7 +4,7 @@ internal static class JsonSerializableExtensions { private static readonly bool IsWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); - public static string ToJsonString(this IJsonSerializable serializable, IDiagnosticLogger logger = null, bool indented = false) => + public static string ToJsonString(this ISentryJsonSerializable serializable, IDiagnosticLogger logger = null, bool indented = false) => WriteToJsonString(writer => writer.WriteSerializableValue(serializable, logger), indented); public static string ToJsonString(this object @object, IDiagnosticLogger logger = null, bool indented = false) => diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt index 7f4549ae4e..9b4bda93f1 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt @@ -1,15 +1,6 @@ [assembly: System.CLSCompliant(true)] namespace Sentry { - [System.Diagnostics.DebuggerDisplay("{FileName}")] - public class Attachment - { - public Attachment(Sentry.AttachmentType type, Sentry.IAttachmentContent content, string fileName, string? contentType) { } - public Sentry.IAttachmentContent Content { get; } - public string? ContentType { get; } - public string FileName { get; } - public Sentry.AttachmentType Type { get; } - } public enum AttachmentType { Default = 0, @@ -24,7 +15,7 @@ namespace Sentry public override string ToString() { } } [System.Diagnostics.DebuggerDisplay("Message: {Message}, Type: {Type}")] - public sealed class Breadcrumb : Sentry.IJsonSerializable + public sealed class Breadcrumb : Sentry.ISentryJsonSerializable { public Breadcrumb(string message, string type, System.Collections.Generic.IReadOnlyDictionary? data = null, string? category = null, Sentry.BreadcrumbLevel level = 0) { } public string? Category { get; } @@ -76,7 +67,7 @@ namespace Sentry public const string Platform = "csharp"; public const int ProtocolVersion = 7; } - public sealed class Contexts : Sentry.IJsonSerializable, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable + public sealed class Contexts : Sentry.ISentryJsonSerializable, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable { public Contexts() { } public Sentry.Protocol.App App { get; } @@ -162,16 +153,6 @@ namespace Sentry { public static void SetTags(this Sentry.IHasTags hasTags, System.Collections.Generic.IEnumerable> tags) { } } - public class Hint - { - public Hint() { } - public Hint(string key, object? value) { } - public System.Collections.Generic.ICollection Attachments { get; } - public System.Collections.Generic.IDictionary Items { get; } - public void AddAttachment(string filePath, Sentry.AttachmentType type = 0, string? contentType = null) { } - public static Sentry.Hint WithAttachments(params Sentry.Attachment[] attachments) { } - public static Sentry.Hint WithAttachments(System.Collections.Generic.IEnumerable attachments) { } - } public static class HintTypes { public const string HttpResponseMessage = "http-response-message"; @@ -195,7 +176,7 @@ namespace Sentry } public static class HubExtensions { - public static void AddBreadcrumb(this Sentry.IHub hub, Sentry.Breadcrumb breadcrumb, Sentry.Hint? hint = null) { } + public static void AddBreadcrumb(this Sentry.IHub hub, Sentry.Breadcrumb breadcrumb, Sentry.SentryHint? hint = null) { } public static void AddBreadcrumb(this Sentry.IHub hub, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void AddBreadcrumb(this Sentry.IHub hub, Sentry.Infrastructure.ISystemClock? clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static Sentry.SentryId CaptureException(this Sentry.IHub hub, System.Exception ex, System.Action configureScope) { } @@ -244,7 +225,7 @@ namespace Sentry Sentry.IMetricAggregator Metrics { get; } void BindException(System.Exception exception, Sentry.ISpan span); Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope); - Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope); + Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope); 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); @@ -256,10 +237,6 @@ namespace Sentry void StartSession(); Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext); } - public interface IJsonSerializable - { - void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger); - } public interface IMetricAggregator : System.IDisposable { void Distribution(string key, double value = 1, Sentry.MeasurementUnit? unit = default, System.Collections.Generic.IDictionary? tags = null, System.DateTimeOffset? timestamp = default, int stackLevel = 1); @@ -283,13 +260,17 @@ namespace Sentry { bool IsEnabled { get; } bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope); - Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null); + Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, 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.Hint? hint); + void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint); void CaptureUserFeedback(Sentry.UserFeedback userFeedback); System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout); } + public interface ISentryJsonSerializable + { + void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger); + } public interface ISentryScopeManager { void BindClient(Sentry.ISentryClient client); @@ -413,7 +394,7 @@ namespace Sentry Exbibyte = 13, } } - public sealed class Package : Sentry.IJsonSerializable + public sealed class Package : Sentry.ISentryJsonSerializable { public Package(string name, string version) { } public string Name { get; } @@ -429,7 +410,7 @@ namespace Sentry Version = 1, InformationalVersion = 2, } - public sealed class Request : Sentry.IJsonSerializable + public sealed class Request : Sentry.ISentryJsonSerializable { public Request() { } public string? ApiTarget { get; set; } @@ -448,7 +429,7 @@ namespace Sentry public class Scope : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags { public Scope(Sentry.SentryOptions? options) { } - public System.Collections.Generic.IReadOnlyCollection Attachments { get; } + public System.Collections.Generic.IReadOnlyCollection Attachments { get; } public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } public Sentry.Contexts Contexts { get; set; } public string? Distribution { get; set; } @@ -464,9 +445,9 @@ namespace Sentry public Sentry.ITransactionTracer? Transaction { get; set; } public string? TransactionName { get; set; } public Sentry.SentryUser User { get; set; } - public void AddAttachment(Sentry.Attachment attachment) { } + public void AddAttachment(Sentry.SentryAttachment attachment) { } public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb) { } - public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.Hint hint) { } + public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.SentryHint hint) { } public void Apply(Sentry.IEventLike other) { } public void Apply(Sentry.Scope other) { } public void Apply(object state) { } @@ -495,7 +476,7 @@ namespace Sentry public static System.Collections.Generic.IEnumerable GetAllExceptionProcessors(this Sentry.Scope scope) { } public static System.Collections.Generic.IEnumerable GetAllTransactionProcessors(this Sentry.Scope scope) { } } - public sealed class SdkVersion : Sentry.IJsonSerializable + public sealed class SdkVersion : Sentry.ISentryJsonSerializable { public SdkVersion() { } public string? Name { get; set; } @@ -506,15 +487,24 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SdkVersion FromJson(System.Text.Json.JsonElement json) { } } + [System.Diagnostics.DebuggerDisplay("{FileName}")] + public class SentryAttachment + { + public SentryAttachment(Sentry.AttachmentType type, Sentry.IAttachmentContent content, string fileName, string? contentType) { } + public Sentry.IAttachmentContent Content { get; } + public string? ContentType { get; } + public string FileName { get; } + public Sentry.AttachmentType Type { get; } + } public class SentryClient : Sentry.ISentryClient, System.IDisposable { public SentryClient(Sentry.SentryOptions options) { } public bool IsEnabled { get; } public bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent? @event, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } + public Sentry.SentryId CaptureEvent(Sentry.SentryEvent? @event, 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.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void Dispose() { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } @@ -529,7 +519,7 @@ namespace Sentry public static System.Threading.Tasks.Task FlushAsync(this Sentry.ISentryClient client) { } } [System.Diagnostics.DebuggerDisplay("{GetType().Name,nq}: {EventId,nq}")] - public sealed class SentryEvent : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable + public sealed class SentryEvent : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISentryJsonSerializable { public SentryEvent() { } public SentryEvent(System.Exception? exception) { } @@ -570,6 +560,16 @@ namespace Sentry protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url) { } protected override Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } } + public class SentryHint + { + public SentryHint() { } + public SentryHint(string key, object? value) { } + public System.Collections.Generic.ICollection Attachments { get; } + public System.Collections.Generic.IDictionary Items { get; } + public void AddAttachment(string filePath, Sentry.AttachmentType type = 0, string? contentType = null) { } + public static Sentry.SentryHint WithAttachments(params Sentry.SentryAttachment[] attachments) { } + public static Sentry.SentryHint WithAttachments(System.Collections.Generic.IEnumerable attachments) { } + } public class SentryHttpMessageHandler : Sentry.SentryMessageHandler { public SentryHttpMessageHandler() { } @@ -579,7 +579,7 @@ namespace Sentry protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url) { } protected override Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } } - public readonly struct SentryId : Sentry.IJsonSerializable, System.IEquatable + public readonly struct SentryId : Sentry.ISentryJsonSerializable, System.IEquatable { public static readonly Sentry.SentryId Empty; public SentryId(System.Guid guid) { } @@ -609,7 +609,7 @@ namespace Sentry [System.Runtime.Serialization.EnumMember(Value="fatal")] Fatal = 4, } - public sealed class SentryMessage : Sentry.IJsonSerializable + public sealed class SentryMessage : Sentry.ISentryJsonSerializable { public SentryMessage() { } public string? Formatted { get; set; } @@ -695,11 +695,11 @@ namespace Sentry public void AddJsonSerializerContext(System.Func contextBuilder) where T : System.Text.Json.Serialization.JsonSerializerContext { } public void SetBeforeBreadcrumb(System.Func beforeBreadcrumb) { } - public void SetBeforeBreadcrumb(System.Func beforeBreadcrumb) { } + public void SetBeforeBreadcrumb(System.Func beforeBreadcrumb) { } public void SetBeforeSend(System.Func beforeSend) { } - public void SetBeforeSend(System.Func beforeSend) { } + public void SetBeforeSend(System.Func beforeSend) { } public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } - public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } + public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } } public static class SentryOptionsExtensions { @@ -743,22 +743,22 @@ namespace Sentry public static bool IsEnabled { get; } public static Sentry.SentryId LastEventId { get; } public static Sentry.IMetricAggregator Metrics { get; } - public static void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.Hint? hint = null) { } + public static void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.SentryHint? hint = null) { } public static void AddBreadcrumb(string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void AddBreadcrumb(Sentry.Infrastructure.ISystemClock? clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void BindClient(Sentry.ISentryClient client) { } public static void BindException(System.Exception exception, Sentry.ISpan span) { } public static bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } - public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } - public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } + public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { } + 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 Sentry.SentryId CaptureMessage(string message, Sentry.SentryLevel level = 1) { } public static Sentry.SentryId CaptureMessage(string message, System.Action configureScope, Sentry.SentryLevel level = 1) { } 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.Hint? hint) { } + public static void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } public static void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } 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" + @@ -805,7 +805,7 @@ namespace Sentry public string? UserAgent { get; } public void ReportError() { } } - public class SentrySpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext + public class SentrySpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISentryJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext { public SentrySpan(Sentry.ISpan tracer) { } public SentrySpan(Sentry.SpanId? parentSpanId, string operation) { } @@ -830,7 +830,7 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SentrySpan FromJson(System.Text.Json.JsonElement json) { } } - public sealed class SentryStackFrame : Sentry.IJsonSerializable + public sealed class SentryStackFrame : Sentry.ISentryJsonSerializable { public SentryStackFrame() { } public string? AbsolutePath { get; set; } @@ -856,7 +856,7 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SentryStackFrame FromJson(System.Text.Json.JsonElement json) { } } - public class SentryStackTrace : Sentry.IJsonSerializable + public class SentryStackTrace : Sentry.ISentryJsonSerializable { public SentryStackTrace() { } public Sentry.InstructionAddressAdjustment? AddressAdjustment { get; set; } @@ -864,7 +864,7 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SentryStackTrace FromJson(System.Text.Json.JsonElement json) { } } - public sealed class SentryThread : Sentry.IJsonSerializable + public sealed class SentryThread : Sentry.ISentryJsonSerializable { public SentryThread() { } public bool? Crashed { get; set; } @@ -884,7 +884,7 @@ namespace Sentry public override string ToString() { } public static Sentry.SentryTraceHeader Parse(string value) { } } - public class SentryTransaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + public class SentryTransaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISentryJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext { public SentryTransaction(Sentry.ITransactionTracer tracer) { } public SentryTransaction(string name, string operation) { } @@ -928,7 +928,7 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SentryTransaction FromJson(System.Text.Json.JsonElement json) { } } - public sealed class SentryUser : Sentry.IJsonSerializable + public sealed class SentryUser : Sentry.ISentryJsonSerializable { public SentryUser() { } public string? Email { get; set; } @@ -947,7 +947,7 @@ namespace Sentry Crashed = 1, Abnormal = 2, } - public class SessionUpdate : Sentry.IJsonSerializable, Sentry.ISentrySession + public class SessionUpdate : Sentry.ISentryJsonSerializable, Sentry.ISentrySession { public SessionUpdate(Sentry.SessionUpdate sessionUpdate, bool isInitial) { } public SessionUpdate(Sentry.SessionUpdate sessionUpdate, bool isInitial, Sentry.SessionEndStatus? endStatus) { } @@ -994,7 +994,7 @@ namespace Sentry public static Sentry.ITransactionTracer GetTransaction(this Sentry.ISpan span) { } public static Sentry.ISpan StartChild(this Sentry.ISpan span, string operation, string? description) { } } - public readonly struct SpanId : Sentry.IJsonSerializable, System.IEquatable + public readonly struct SpanId : Sentry.ISentryJsonSerializable, System.IEquatable { public static readonly Sentry.SpanId Empty; public SpanId(long value) { } @@ -1152,7 +1152,7 @@ namespace Sentry public Sentry.ISpan StartChild(string operation) { } public void UnsetTag(string key) { } } - public sealed class UserFeedback : Sentry.IJsonSerializable + public sealed class UserFeedback : Sentry.ISentryJsonSerializable { public UserFeedback(Sentry.SentryId eventId, string? name, string? email, string? comments) { } public string? Comments { get; } @@ -1162,18 +1162,18 @@ namespace Sentry 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.IJsonSerializable + public sealed class ViewHierarchy : Sentry.ISentryJsonSerializable { public ViewHierarchy(string renderingSystem) { } public string RenderingSystem { get; set; } public System.Collections.Generic.List Windows { get; } public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } } - public class ViewHierarchyAttachment : Sentry.Attachment + public class ViewHierarchyAttachment : Sentry.SentryAttachment { public ViewHierarchyAttachment(Sentry.IAttachmentContent content) { } } - public abstract class ViewHierarchyNode : Sentry.IJsonSerializable + public abstract class ViewHierarchyNode : Sentry.ISentryJsonSerializable { protected ViewHierarchyNode(string type) { } public System.Collections.Generic.List Children { get; set; } @@ -1229,11 +1229,11 @@ namespace Sentry.Extensibility public void BindException(System.Exception exception, Sentry.ISpan span) { } public bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } + 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 CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } - public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void ConfigureScope(System.Action configureScope) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1272,12 +1272,12 @@ namespace Sentry.Extensibility public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope, Sentry.Hint? hint = null) { } + 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 CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } - public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } public void ConfigureScope(System.Action configureScope) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1336,7 +1336,7 @@ namespace Sentry.Extensibility } public interface ISentryEventProcessorWithHint : Sentry.Extensibility.ISentryEventProcessor { - Sentry.SentryEvent? Process(Sentry.SentryEvent @event, Sentry.Hint hint); + Sentry.SentryEvent? Process(Sentry.SentryEvent @event, Sentry.SentryHint hint); } public interface ISentryStackTraceFactory { @@ -1348,7 +1348,7 @@ namespace Sentry.Extensibility } public interface ISentryTransactionProcessorWithHint : Sentry.Extensibility.ISentryTransactionProcessor { - Sentry.SentryTransaction? Process(Sentry.SentryTransaction transaction, Sentry.Hint hint); + Sentry.SentryTransaction? Process(Sentry.SentryTransaction transaction, Sentry.SentryHint hint); } public interface ITransport { @@ -1482,7 +1482,7 @@ namespace Sentry.PlatformAbstractions } namespace Sentry.Protocol { - public sealed class App : Sentry.IJsonSerializable + public sealed class App : Sentry.ISentryJsonSerializable { public const string Type = "app"; public App() { } @@ -1497,7 +1497,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.App FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Browser : Sentry.IJsonSerializable + public sealed class Browser : Sentry.ISentryJsonSerializable { public const string Type = "browser"; public Browser() { } @@ -1506,7 +1506,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.Browser FromJson(System.Text.Json.JsonElement json) { } } - public sealed class DebugImage : Sentry.IJsonSerializable + public sealed class DebugImage : Sentry.ISentryJsonSerializable { public DebugImage() { } public string? CodeFile { get; set; } @@ -1520,7 +1520,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.DebugImage FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Device : Sentry.IJsonSerializable + public sealed class Device : Sentry.ISentryJsonSerializable { public const string Type = "device"; public Device() { } @@ -1570,7 +1570,7 @@ namespace Sentry.Protocol [System.Runtime.Serialization.EnumMember(Value="landscape")] Landscape = 1, } - public sealed class Gpu : Sentry.IJsonSerializable + public sealed class Gpu : Sentry.ISentryJsonSerializable { public const string Type = "gpu"; public Gpu() { } @@ -1602,14 +1602,14 @@ namespace Sentry.Protocol Sentry.SpanStatus? Status { get; } Sentry.SentryId TraceId { get; } } - public sealed class Measurement : Sentry.IJsonSerializable + public sealed class Measurement : Sentry.ISentryJsonSerializable { public Sentry.MeasurementUnit Unit { get; } public object Value { get; } public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.Measurement FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Mechanism : Sentry.IJsonSerializable + public sealed class Mechanism : Sentry.ISentryJsonSerializable { public static readonly string DescriptionKey; public static readonly string HandledKey; @@ -1629,7 +1629,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.Mechanism FromJson(System.Text.Json.JsonElement json) { } } - public sealed class OperatingSystem : Sentry.IJsonSerializable + public sealed class OperatingSystem : Sentry.ISentryJsonSerializable { public const string Type = "os"; public OperatingSystem() { } @@ -1642,7 +1642,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.OperatingSystem FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Response : Sentry.IJsonSerializable + public sealed class Response : Sentry.ISentryJsonSerializable { public const string Type = "response"; public Response() { } @@ -1657,7 +1657,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.Response FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Runtime : Sentry.IJsonSerializable + public sealed class Runtime : Sentry.ISentryJsonSerializable { public const string Type = "runtime"; public Runtime() { } @@ -1669,7 +1669,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.Runtime FromJson(System.Text.Json.JsonElement json) { } } - public sealed class SentryException : Sentry.IJsonSerializable + public sealed class SentryException : Sentry.ISentryJsonSerializable { public SentryException() { } public Sentry.Protocol.Mechanism? Mechanism { get; set; } @@ -1681,7 +1681,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.SentryException FromJson(System.Text.Json.JsonElement json) { } } - public class Trace : Sentry.IJsonSerializable, Sentry.Protocol.ITraceContext + public class Trace : Sentry.ISentryJsonSerializable, Sentry.Protocol.ITraceContext { public const string Type = "trace"; public Trace() { } @@ -1708,7 +1708,7 @@ namespace Sentry.Protocol.Envelopes public System.Threading.Tasks.Task SerializeAsync(System.IO.Stream stream, Sentry.Extensibility.IDiagnosticLogger? logger, System.Threading.CancellationToken cancellationToken = default) { } public Sentry.SentryId? TryGetEventId() { } public static System.Threading.Tasks.Task DeserializeAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default) { } - public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } + public static Sentry.Protocol.Envelopes.Envelope FromEvent(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) { } public static Sentry.Protocol.Envelopes.Envelope FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } @@ -1725,7 +1725,7 @@ namespace Sentry.Protocol.Envelopes public long? TryGetLength() { } public string? TryGetType() { } public static System.Threading.Tasks.Task DeserializeAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default) { } - public static Sentry.Protocol.Envelopes.EnvelopeItem FromAttachment(Sentry.Attachment attachment) { } + public static Sentry.Protocol.Envelopes.EnvelopeItem FromAttachment(Sentry.SentryAttachment attachment) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromEvent(Sentry.SentryEvent @event) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromSession(Sentry.SessionUpdate sessionUpdate) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromTransaction(Sentry.SentryTransaction transaction) { } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt index 7f4549ae4e..9b4bda93f1 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt @@ -1,15 +1,6 @@ [assembly: System.CLSCompliant(true)] namespace Sentry { - [System.Diagnostics.DebuggerDisplay("{FileName}")] - public class Attachment - { - public Attachment(Sentry.AttachmentType type, Sentry.IAttachmentContent content, string fileName, string? contentType) { } - public Sentry.IAttachmentContent Content { get; } - public string? ContentType { get; } - public string FileName { get; } - public Sentry.AttachmentType Type { get; } - } public enum AttachmentType { Default = 0, @@ -24,7 +15,7 @@ namespace Sentry public override string ToString() { } } [System.Diagnostics.DebuggerDisplay("Message: {Message}, Type: {Type}")] - public sealed class Breadcrumb : Sentry.IJsonSerializable + public sealed class Breadcrumb : Sentry.ISentryJsonSerializable { public Breadcrumb(string message, string type, System.Collections.Generic.IReadOnlyDictionary? data = null, string? category = null, Sentry.BreadcrumbLevel level = 0) { } public string? Category { get; } @@ -76,7 +67,7 @@ namespace Sentry public const string Platform = "csharp"; public const int ProtocolVersion = 7; } - public sealed class Contexts : Sentry.IJsonSerializable, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable + public sealed class Contexts : Sentry.ISentryJsonSerializable, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable { public Contexts() { } public Sentry.Protocol.App App { get; } @@ -162,16 +153,6 @@ namespace Sentry { public static void SetTags(this Sentry.IHasTags hasTags, System.Collections.Generic.IEnumerable> tags) { } } - public class Hint - { - public Hint() { } - public Hint(string key, object? value) { } - public System.Collections.Generic.ICollection Attachments { get; } - public System.Collections.Generic.IDictionary Items { get; } - public void AddAttachment(string filePath, Sentry.AttachmentType type = 0, string? contentType = null) { } - public static Sentry.Hint WithAttachments(params Sentry.Attachment[] attachments) { } - public static Sentry.Hint WithAttachments(System.Collections.Generic.IEnumerable attachments) { } - } public static class HintTypes { public const string HttpResponseMessage = "http-response-message"; @@ -195,7 +176,7 @@ namespace Sentry } public static class HubExtensions { - public static void AddBreadcrumb(this Sentry.IHub hub, Sentry.Breadcrumb breadcrumb, Sentry.Hint? hint = null) { } + public static void AddBreadcrumb(this Sentry.IHub hub, Sentry.Breadcrumb breadcrumb, Sentry.SentryHint? hint = null) { } public static void AddBreadcrumb(this Sentry.IHub hub, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void AddBreadcrumb(this Sentry.IHub hub, Sentry.Infrastructure.ISystemClock? clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static Sentry.SentryId CaptureException(this Sentry.IHub hub, System.Exception ex, System.Action configureScope) { } @@ -244,7 +225,7 @@ namespace Sentry Sentry.IMetricAggregator Metrics { get; } void BindException(System.Exception exception, Sentry.ISpan span); Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope); - Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope); + Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope); 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); @@ -256,10 +237,6 @@ namespace Sentry void StartSession(); Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext); } - public interface IJsonSerializable - { - void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger); - } public interface IMetricAggregator : System.IDisposable { void Distribution(string key, double value = 1, Sentry.MeasurementUnit? unit = default, System.Collections.Generic.IDictionary? tags = null, System.DateTimeOffset? timestamp = default, int stackLevel = 1); @@ -283,13 +260,17 @@ namespace Sentry { bool IsEnabled { get; } bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope); - Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null); + Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, 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.Hint? hint); + void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint); void CaptureUserFeedback(Sentry.UserFeedback userFeedback); System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout); } + public interface ISentryJsonSerializable + { + void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger); + } public interface ISentryScopeManager { void BindClient(Sentry.ISentryClient client); @@ -413,7 +394,7 @@ namespace Sentry Exbibyte = 13, } } - public sealed class Package : Sentry.IJsonSerializable + public sealed class Package : Sentry.ISentryJsonSerializable { public Package(string name, string version) { } public string Name { get; } @@ -429,7 +410,7 @@ namespace Sentry Version = 1, InformationalVersion = 2, } - public sealed class Request : Sentry.IJsonSerializable + public sealed class Request : Sentry.ISentryJsonSerializable { public Request() { } public string? ApiTarget { get; set; } @@ -448,7 +429,7 @@ namespace Sentry public class Scope : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags { public Scope(Sentry.SentryOptions? options) { } - public System.Collections.Generic.IReadOnlyCollection Attachments { get; } + public System.Collections.Generic.IReadOnlyCollection Attachments { get; } public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } public Sentry.Contexts Contexts { get; set; } public string? Distribution { get; set; } @@ -464,9 +445,9 @@ namespace Sentry public Sentry.ITransactionTracer? Transaction { get; set; } public string? TransactionName { get; set; } public Sentry.SentryUser User { get; set; } - public void AddAttachment(Sentry.Attachment attachment) { } + public void AddAttachment(Sentry.SentryAttachment attachment) { } public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb) { } - public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.Hint hint) { } + public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.SentryHint hint) { } public void Apply(Sentry.IEventLike other) { } public void Apply(Sentry.Scope other) { } public void Apply(object state) { } @@ -495,7 +476,7 @@ namespace Sentry public static System.Collections.Generic.IEnumerable GetAllExceptionProcessors(this Sentry.Scope scope) { } public static System.Collections.Generic.IEnumerable GetAllTransactionProcessors(this Sentry.Scope scope) { } } - public sealed class SdkVersion : Sentry.IJsonSerializable + public sealed class SdkVersion : Sentry.ISentryJsonSerializable { public SdkVersion() { } public string? Name { get; set; } @@ -506,15 +487,24 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SdkVersion FromJson(System.Text.Json.JsonElement json) { } } + [System.Diagnostics.DebuggerDisplay("{FileName}")] + public class SentryAttachment + { + public SentryAttachment(Sentry.AttachmentType type, Sentry.IAttachmentContent content, string fileName, string? contentType) { } + public Sentry.IAttachmentContent Content { get; } + public string? ContentType { get; } + public string FileName { get; } + public Sentry.AttachmentType Type { get; } + } public class SentryClient : Sentry.ISentryClient, System.IDisposable { public SentryClient(Sentry.SentryOptions options) { } public bool IsEnabled { get; } public bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent? @event, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } + public Sentry.SentryId CaptureEvent(Sentry.SentryEvent? @event, 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.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void Dispose() { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } @@ -529,7 +519,7 @@ namespace Sentry public static System.Threading.Tasks.Task FlushAsync(this Sentry.ISentryClient client) { } } [System.Diagnostics.DebuggerDisplay("{GetType().Name,nq}: {EventId,nq}")] - public sealed class SentryEvent : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable + public sealed class SentryEvent : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISentryJsonSerializable { public SentryEvent() { } public SentryEvent(System.Exception? exception) { } @@ -570,6 +560,16 @@ namespace Sentry protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url) { } protected override Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } } + public class SentryHint + { + public SentryHint() { } + public SentryHint(string key, object? value) { } + public System.Collections.Generic.ICollection Attachments { get; } + public System.Collections.Generic.IDictionary Items { get; } + public void AddAttachment(string filePath, Sentry.AttachmentType type = 0, string? contentType = null) { } + public static Sentry.SentryHint WithAttachments(params Sentry.SentryAttachment[] attachments) { } + public static Sentry.SentryHint WithAttachments(System.Collections.Generic.IEnumerable attachments) { } + } public class SentryHttpMessageHandler : Sentry.SentryMessageHandler { public SentryHttpMessageHandler() { } @@ -579,7 +579,7 @@ namespace Sentry protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url) { } protected override Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } } - public readonly struct SentryId : Sentry.IJsonSerializable, System.IEquatable + public readonly struct SentryId : Sentry.ISentryJsonSerializable, System.IEquatable { public static readonly Sentry.SentryId Empty; public SentryId(System.Guid guid) { } @@ -609,7 +609,7 @@ namespace Sentry [System.Runtime.Serialization.EnumMember(Value="fatal")] Fatal = 4, } - public sealed class SentryMessage : Sentry.IJsonSerializable + public sealed class SentryMessage : Sentry.ISentryJsonSerializable { public SentryMessage() { } public string? Formatted { get; set; } @@ -695,11 +695,11 @@ namespace Sentry public void AddJsonSerializerContext(System.Func contextBuilder) where T : System.Text.Json.Serialization.JsonSerializerContext { } public void SetBeforeBreadcrumb(System.Func beforeBreadcrumb) { } - public void SetBeforeBreadcrumb(System.Func beforeBreadcrumb) { } + public void SetBeforeBreadcrumb(System.Func beforeBreadcrumb) { } public void SetBeforeSend(System.Func beforeSend) { } - public void SetBeforeSend(System.Func beforeSend) { } + public void SetBeforeSend(System.Func beforeSend) { } public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } - public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } + public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } } public static class SentryOptionsExtensions { @@ -743,22 +743,22 @@ namespace Sentry public static bool IsEnabled { get; } public static Sentry.SentryId LastEventId { get; } public static Sentry.IMetricAggregator Metrics { get; } - public static void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.Hint? hint = null) { } + public static void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.SentryHint? hint = null) { } public static void AddBreadcrumb(string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void AddBreadcrumb(Sentry.Infrastructure.ISystemClock? clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void BindClient(Sentry.ISentryClient client) { } public static void BindException(System.Exception exception, Sentry.ISpan span) { } public static bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } - public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } - public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } + public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { } + 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 Sentry.SentryId CaptureMessage(string message, Sentry.SentryLevel level = 1) { } public static Sentry.SentryId CaptureMessage(string message, System.Action configureScope, Sentry.SentryLevel level = 1) { } 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.Hint? hint) { } + public static void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } public static void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } 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" + @@ -805,7 +805,7 @@ namespace Sentry public string? UserAgent { get; } public void ReportError() { } } - public class SentrySpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext + public class SentrySpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISentryJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext { public SentrySpan(Sentry.ISpan tracer) { } public SentrySpan(Sentry.SpanId? parentSpanId, string operation) { } @@ -830,7 +830,7 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SentrySpan FromJson(System.Text.Json.JsonElement json) { } } - public sealed class SentryStackFrame : Sentry.IJsonSerializable + public sealed class SentryStackFrame : Sentry.ISentryJsonSerializable { public SentryStackFrame() { } public string? AbsolutePath { get; set; } @@ -856,7 +856,7 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SentryStackFrame FromJson(System.Text.Json.JsonElement json) { } } - public class SentryStackTrace : Sentry.IJsonSerializable + public class SentryStackTrace : Sentry.ISentryJsonSerializable { public SentryStackTrace() { } public Sentry.InstructionAddressAdjustment? AddressAdjustment { get; set; } @@ -864,7 +864,7 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SentryStackTrace FromJson(System.Text.Json.JsonElement json) { } } - public sealed class SentryThread : Sentry.IJsonSerializable + public sealed class SentryThread : Sentry.ISentryJsonSerializable { public SentryThread() { } public bool? Crashed { get; set; } @@ -884,7 +884,7 @@ namespace Sentry public override string ToString() { } public static Sentry.SentryTraceHeader Parse(string value) { } } - public class SentryTransaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + public class SentryTransaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISentryJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext { public SentryTransaction(Sentry.ITransactionTracer tracer) { } public SentryTransaction(string name, string operation) { } @@ -928,7 +928,7 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SentryTransaction FromJson(System.Text.Json.JsonElement json) { } } - public sealed class SentryUser : Sentry.IJsonSerializable + public sealed class SentryUser : Sentry.ISentryJsonSerializable { public SentryUser() { } public string? Email { get; set; } @@ -947,7 +947,7 @@ namespace Sentry Crashed = 1, Abnormal = 2, } - public class SessionUpdate : Sentry.IJsonSerializable, Sentry.ISentrySession + public class SessionUpdate : Sentry.ISentryJsonSerializable, Sentry.ISentrySession { public SessionUpdate(Sentry.SessionUpdate sessionUpdate, bool isInitial) { } public SessionUpdate(Sentry.SessionUpdate sessionUpdate, bool isInitial, Sentry.SessionEndStatus? endStatus) { } @@ -994,7 +994,7 @@ namespace Sentry public static Sentry.ITransactionTracer GetTransaction(this Sentry.ISpan span) { } public static Sentry.ISpan StartChild(this Sentry.ISpan span, string operation, string? description) { } } - public readonly struct SpanId : Sentry.IJsonSerializable, System.IEquatable + public readonly struct SpanId : Sentry.ISentryJsonSerializable, System.IEquatable { public static readonly Sentry.SpanId Empty; public SpanId(long value) { } @@ -1152,7 +1152,7 @@ namespace Sentry public Sentry.ISpan StartChild(string operation) { } public void UnsetTag(string key) { } } - public sealed class UserFeedback : Sentry.IJsonSerializable + public sealed class UserFeedback : Sentry.ISentryJsonSerializable { public UserFeedback(Sentry.SentryId eventId, string? name, string? email, string? comments) { } public string? Comments { get; } @@ -1162,18 +1162,18 @@ namespace Sentry 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.IJsonSerializable + public sealed class ViewHierarchy : Sentry.ISentryJsonSerializable { public ViewHierarchy(string renderingSystem) { } public string RenderingSystem { get; set; } public System.Collections.Generic.List Windows { get; } public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } } - public class ViewHierarchyAttachment : Sentry.Attachment + public class ViewHierarchyAttachment : Sentry.SentryAttachment { public ViewHierarchyAttachment(Sentry.IAttachmentContent content) { } } - public abstract class ViewHierarchyNode : Sentry.IJsonSerializable + public abstract class ViewHierarchyNode : Sentry.ISentryJsonSerializable { protected ViewHierarchyNode(string type) { } public System.Collections.Generic.List Children { get; set; } @@ -1229,11 +1229,11 @@ namespace Sentry.Extensibility public void BindException(System.Exception exception, Sentry.ISpan span) { } public bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } + 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 CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } - public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void ConfigureScope(System.Action configureScope) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1272,12 +1272,12 @@ namespace Sentry.Extensibility public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope, Sentry.Hint? hint = null) { } + 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 CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } - public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } public void ConfigureScope(System.Action configureScope) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1336,7 +1336,7 @@ namespace Sentry.Extensibility } public interface ISentryEventProcessorWithHint : Sentry.Extensibility.ISentryEventProcessor { - Sentry.SentryEvent? Process(Sentry.SentryEvent @event, Sentry.Hint hint); + Sentry.SentryEvent? Process(Sentry.SentryEvent @event, Sentry.SentryHint hint); } public interface ISentryStackTraceFactory { @@ -1348,7 +1348,7 @@ namespace Sentry.Extensibility } public interface ISentryTransactionProcessorWithHint : Sentry.Extensibility.ISentryTransactionProcessor { - Sentry.SentryTransaction? Process(Sentry.SentryTransaction transaction, Sentry.Hint hint); + Sentry.SentryTransaction? Process(Sentry.SentryTransaction transaction, Sentry.SentryHint hint); } public interface ITransport { @@ -1482,7 +1482,7 @@ namespace Sentry.PlatformAbstractions } namespace Sentry.Protocol { - public sealed class App : Sentry.IJsonSerializable + public sealed class App : Sentry.ISentryJsonSerializable { public const string Type = "app"; public App() { } @@ -1497,7 +1497,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.App FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Browser : Sentry.IJsonSerializable + public sealed class Browser : Sentry.ISentryJsonSerializable { public const string Type = "browser"; public Browser() { } @@ -1506,7 +1506,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.Browser FromJson(System.Text.Json.JsonElement json) { } } - public sealed class DebugImage : Sentry.IJsonSerializable + public sealed class DebugImage : Sentry.ISentryJsonSerializable { public DebugImage() { } public string? CodeFile { get; set; } @@ -1520,7 +1520,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.DebugImage FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Device : Sentry.IJsonSerializable + public sealed class Device : Sentry.ISentryJsonSerializable { public const string Type = "device"; public Device() { } @@ -1570,7 +1570,7 @@ namespace Sentry.Protocol [System.Runtime.Serialization.EnumMember(Value="landscape")] Landscape = 1, } - public sealed class Gpu : Sentry.IJsonSerializable + public sealed class Gpu : Sentry.ISentryJsonSerializable { public const string Type = "gpu"; public Gpu() { } @@ -1602,14 +1602,14 @@ namespace Sentry.Protocol Sentry.SpanStatus? Status { get; } Sentry.SentryId TraceId { get; } } - public sealed class Measurement : Sentry.IJsonSerializable + public sealed class Measurement : Sentry.ISentryJsonSerializable { public Sentry.MeasurementUnit Unit { get; } public object Value { get; } public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.Measurement FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Mechanism : Sentry.IJsonSerializable + public sealed class Mechanism : Sentry.ISentryJsonSerializable { public static readonly string DescriptionKey; public static readonly string HandledKey; @@ -1629,7 +1629,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.Mechanism FromJson(System.Text.Json.JsonElement json) { } } - public sealed class OperatingSystem : Sentry.IJsonSerializable + public sealed class OperatingSystem : Sentry.ISentryJsonSerializable { public const string Type = "os"; public OperatingSystem() { } @@ -1642,7 +1642,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.OperatingSystem FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Response : Sentry.IJsonSerializable + public sealed class Response : Sentry.ISentryJsonSerializable { public const string Type = "response"; public Response() { } @@ -1657,7 +1657,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.Response FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Runtime : Sentry.IJsonSerializable + public sealed class Runtime : Sentry.ISentryJsonSerializable { public const string Type = "runtime"; public Runtime() { } @@ -1669,7 +1669,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.Runtime FromJson(System.Text.Json.JsonElement json) { } } - public sealed class SentryException : Sentry.IJsonSerializable + public sealed class SentryException : Sentry.ISentryJsonSerializable { public SentryException() { } public Sentry.Protocol.Mechanism? Mechanism { get; set; } @@ -1681,7 +1681,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.SentryException FromJson(System.Text.Json.JsonElement json) { } } - public class Trace : Sentry.IJsonSerializable, Sentry.Protocol.ITraceContext + public class Trace : Sentry.ISentryJsonSerializable, Sentry.Protocol.ITraceContext { public const string Type = "trace"; public Trace() { } @@ -1708,7 +1708,7 @@ namespace Sentry.Protocol.Envelopes public System.Threading.Tasks.Task SerializeAsync(System.IO.Stream stream, Sentry.Extensibility.IDiagnosticLogger? logger, System.Threading.CancellationToken cancellationToken = default) { } public Sentry.SentryId? TryGetEventId() { } public static System.Threading.Tasks.Task DeserializeAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default) { } - public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } + public static Sentry.Protocol.Envelopes.Envelope FromEvent(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) { } public static Sentry.Protocol.Envelopes.Envelope FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } @@ -1725,7 +1725,7 @@ namespace Sentry.Protocol.Envelopes public long? TryGetLength() { } public string? TryGetType() { } public static System.Threading.Tasks.Task DeserializeAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default) { } - public static Sentry.Protocol.Envelopes.EnvelopeItem FromAttachment(Sentry.Attachment attachment) { } + public static Sentry.Protocol.Envelopes.EnvelopeItem FromAttachment(Sentry.SentryAttachment attachment) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromEvent(Sentry.SentryEvent @event) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromSession(Sentry.SessionUpdate sessionUpdate) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromTransaction(Sentry.SentryTransaction transaction) { } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt index fef68b67c6..8f6c5c0b1c 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt @@ -1,15 +1,6 @@ [assembly: System.CLSCompliant(true)] namespace Sentry { - [System.Diagnostics.DebuggerDisplay("{FileName}")] - public class Attachment - { - public Attachment(Sentry.AttachmentType type, Sentry.IAttachmentContent content, string fileName, string? contentType) { } - public Sentry.IAttachmentContent Content { get; } - public string? ContentType { get; } - public string FileName { get; } - public Sentry.AttachmentType Type { get; } - } public enum AttachmentType { Default = 0, @@ -24,7 +15,7 @@ namespace Sentry public override string ToString() { } } [System.Diagnostics.DebuggerDisplay("Message: {Message}, Type: {Type}")] - public sealed class Breadcrumb : Sentry.IJsonSerializable + public sealed class Breadcrumb : Sentry.ISentryJsonSerializable { public Breadcrumb(string message, string type, System.Collections.Generic.IReadOnlyDictionary? data = null, string? category = null, Sentry.BreadcrumbLevel level = 0) { } public string? Category { get; } @@ -76,7 +67,7 @@ namespace Sentry public const string Platform = "csharp"; public const int ProtocolVersion = 7; } - public sealed class Contexts : Sentry.IJsonSerializable, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable + public sealed class Contexts : Sentry.ISentryJsonSerializable, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable { public Contexts() { } public Sentry.Protocol.App App { get; } @@ -163,16 +154,6 @@ namespace Sentry { public static void SetTags(this Sentry.IHasTags hasTags, System.Collections.Generic.IEnumerable> tags) { } } - public class Hint - { - public Hint() { } - public Hint(string key, object? value) { } - public System.Collections.Generic.ICollection Attachments { get; } - public System.Collections.Generic.IDictionary Items { get; } - public void AddAttachment(string filePath, Sentry.AttachmentType type = 0, string? contentType = null) { } - public static Sentry.Hint WithAttachments(params Sentry.Attachment[] attachments) { } - public static Sentry.Hint WithAttachments(System.Collections.Generic.IEnumerable attachments) { } - } public static class HintTypes { public const string HttpResponseMessage = "http-response-message"; @@ -196,7 +177,7 @@ namespace Sentry } public static class HubExtensions { - public static void AddBreadcrumb(this Sentry.IHub hub, Sentry.Breadcrumb breadcrumb, Sentry.Hint? hint = null) { } + public static void AddBreadcrumb(this Sentry.IHub hub, Sentry.Breadcrumb breadcrumb, Sentry.SentryHint? hint = null) { } public static void AddBreadcrumb(this Sentry.IHub hub, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void AddBreadcrumb(this Sentry.IHub hub, Sentry.Infrastructure.ISystemClock? clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static Sentry.SentryId CaptureException(this Sentry.IHub hub, System.Exception ex, System.Action configureScope) { } @@ -245,7 +226,7 @@ namespace Sentry Sentry.IMetricAggregator Metrics { get; } void BindException(System.Exception exception, Sentry.ISpan span); Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope); - Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope); + Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope); 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); @@ -257,10 +238,6 @@ namespace Sentry void StartSession(); Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext); } - public interface IJsonSerializable - { - void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger); - } public interface IMetricAggregator : System.IDisposable { void Distribution(string key, double value = 1, Sentry.MeasurementUnit? unit = default, System.Collections.Generic.IDictionary? tags = null, System.DateTimeOffset? timestamp = default, int stackLevel = 1); @@ -284,13 +261,17 @@ namespace Sentry { bool IsEnabled { get; } bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope); - Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null); + Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, 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.Hint? hint); + void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint); void CaptureUserFeedback(Sentry.UserFeedback userFeedback); System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout); } + public interface ISentryJsonSerializable + { + void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger); + } public interface ISentryScopeManager { void BindClient(Sentry.ISentryClient client); @@ -414,7 +395,7 @@ namespace Sentry Exbibyte = 13, } } - public sealed class Package : Sentry.IJsonSerializable + public sealed class Package : Sentry.ISentryJsonSerializable { public Package(string name, string version) { } public string Name { get; } @@ -430,7 +411,7 @@ namespace Sentry Version = 1, InformationalVersion = 2, } - public sealed class Request : Sentry.IJsonSerializable + public sealed class Request : Sentry.ISentryJsonSerializable { public Request() { } public string? ApiTarget { get; set; } @@ -449,7 +430,7 @@ namespace Sentry public class Scope : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags { public Scope(Sentry.SentryOptions? options) { } - public System.Collections.Generic.IReadOnlyCollection Attachments { get; } + public System.Collections.Generic.IReadOnlyCollection Attachments { get; } public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } public Sentry.Contexts Contexts { get; set; } public string? Distribution { get; set; } @@ -465,9 +446,9 @@ namespace Sentry public Sentry.ITransactionTracer? Transaction { get; set; } public string? TransactionName { get; set; } public Sentry.SentryUser User { get; set; } - public void AddAttachment(Sentry.Attachment attachment) { } + public void AddAttachment(Sentry.SentryAttachment attachment) { } public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb) { } - public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.Hint hint) { } + public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.SentryHint hint) { } public void Apply(Sentry.IEventLike other) { } public void Apply(Sentry.Scope other) { } public void Apply(object state) { } @@ -496,7 +477,7 @@ namespace Sentry public static System.Collections.Generic.IEnumerable GetAllExceptionProcessors(this Sentry.Scope scope) { } public static System.Collections.Generic.IEnumerable GetAllTransactionProcessors(this Sentry.Scope scope) { } } - public sealed class SdkVersion : Sentry.IJsonSerializable + public sealed class SdkVersion : Sentry.ISentryJsonSerializable { public SdkVersion() { } public string? Name { get; set; } @@ -507,15 +488,24 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SdkVersion FromJson(System.Text.Json.JsonElement json) { } } + [System.Diagnostics.DebuggerDisplay("{FileName}")] + public class SentryAttachment + { + public SentryAttachment(Sentry.AttachmentType type, Sentry.IAttachmentContent content, string fileName, string? contentType) { } + public Sentry.IAttachmentContent Content { get; } + public string? ContentType { get; } + public string FileName { get; } + public Sentry.AttachmentType Type { get; } + } public class SentryClient : Sentry.ISentryClient, System.IDisposable { public SentryClient(Sentry.SentryOptions options) { } public bool IsEnabled { get; } public bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent? @event, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } + public Sentry.SentryId CaptureEvent(Sentry.SentryEvent? @event, 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.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void Dispose() { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } @@ -530,7 +520,7 @@ namespace Sentry public static System.Threading.Tasks.Task FlushAsync(this Sentry.ISentryClient client) { } } [System.Diagnostics.DebuggerDisplay("{GetType().Name,nq}: {EventId,nq}")] - public sealed class SentryEvent : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable + public sealed class SentryEvent : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISentryJsonSerializable { public SentryEvent() { } public SentryEvent(System.Exception? exception) { } @@ -571,6 +561,16 @@ namespace Sentry protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url) { } protected override Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } } + public class SentryHint + { + public SentryHint() { } + public SentryHint(string key, object? value) { } + public System.Collections.Generic.ICollection Attachments { get; } + public System.Collections.Generic.IDictionary Items { get; } + public void AddAttachment(string filePath, Sentry.AttachmentType type = 0, string? contentType = null) { } + public static Sentry.SentryHint WithAttachments(params Sentry.SentryAttachment[] attachments) { } + public static Sentry.SentryHint WithAttachments(System.Collections.Generic.IEnumerable attachments) { } + } public class SentryHttpMessageHandler : Sentry.SentryMessageHandler { public SentryHttpMessageHandler() { } @@ -580,7 +580,7 @@ namespace Sentry protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url) { } protected override Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } } - public readonly struct SentryId : Sentry.IJsonSerializable, System.IEquatable + public readonly struct SentryId : Sentry.ISentryJsonSerializable, System.IEquatable { public static readonly Sentry.SentryId Empty; public SentryId(System.Guid guid) { } @@ -610,7 +610,7 @@ namespace Sentry [System.Runtime.Serialization.EnumMember(Value="fatal")] Fatal = 4, } - public sealed class SentryMessage : Sentry.IJsonSerializable + public sealed class SentryMessage : Sentry.ISentryJsonSerializable { public SentryMessage() { } public string? Formatted { get; set; } @@ -696,11 +696,11 @@ namespace Sentry public void AddJsonSerializerContext(System.Func contextBuilder) where T : System.Text.Json.Serialization.JsonSerializerContext { } public void SetBeforeBreadcrumb(System.Func beforeBreadcrumb) { } - public void SetBeforeBreadcrumb(System.Func beforeBreadcrumb) { } + public void SetBeforeBreadcrumb(System.Func beforeBreadcrumb) { } public void SetBeforeSend(System.Func beforeSend) { } - public void SetBeforeSend(System.Func beforeSend) { } + public void SetBeforeSend(System.Func beforeSend) { } public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } - public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } + public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } } public static class SentryOptionsExtensions { @@ -745,22 +745,22 @@ namespace Sentry public static bool IsEnabled { get; } public static Sentry.SentryId LastEventId { get; } public static Sentry.IMetricAggregator Metrics { get; } - public static void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.Hint? hint = null) { } + public static void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.SentryHint? hint = null) { } public static void AddBreadcrumb(string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void AddBreadcrumb(Sentry.Infrastructure.ISystemClock? clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void BindClient(Sentry.ISentryClient client) { } public static void BindException(System.Exception exception, Sentry.ISpan span) { } public static bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } - public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } - public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } + public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { } + 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 Sentry.SentryId CaptureMessage(string message, Sentry.SentryLevel level = 1) { } public static Sentry.SentryId CaptureMessage(string message, System.Action configureScope, Sentry.SentryLevel level = 1) { } 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.Hint? hint) { } + public static void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } public static void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } 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" + @@ -807,7 +807,7 @@ namespace Sentry public string? UserAgent { get; } public void ReportError() { } } - public class SentrySpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext + public class SentrySpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISentryJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext { public SentrySpan(Sentry.ISpan tracer) { } public SentrySpan(Sentry.SpanId? parentSpanId, string operation) { } @@ -832,7 +832,7 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SentrySpan FromJson(System.Text.Json.JsonElement json) { } } - public sealed class SentryStackFrame : Sentry.IJsonSerializable + public sealed class SentryStackFrame : Sentry.ISentryJsonSerializable { public SentryStackFrame() { } public string? AbsolutePath { get; set; } @@ -858,7 +858,7 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SentryStackFrame FromJson(System.Text.Json.JsonElement json) { } } - public class SentryStackTrace : Sentry.IJsonSerializable + public class SentryStackTrace : Sentry.ISentryJsonSerializable { public SentryStackTrace() { } public Sentry.InstructionAddressAdjustment? AddressAdjustment { get; set; } @@ -866,7 +866,7 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SentryStackTrace FromJson(System.Text.Json.JsonElement json) { } } - public sealed class SentryThread : Sentry.IJsonSerializable + public sealed class SentryThread : Sentry.ISentryJsonSerializable { public SentryThread() { } public bool? Crashed { get; set; } @@ -886,7 +886,7 @@ namespace Sentry public override string ToString() { } public static Sentry.SentryTraceHeader Parse(string value) { } } - public class SentryTransaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + public class SentryTransaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISentryJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext { public SentryTransaction(Sentry.ITransactionTracer tracer) { } public SentryTransaction(string name, string operation) { } @@ -930,7 +930,7 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SentryTransaction FromJson(System.Text.Json.JsonElement json) { } } - public sealed class SentryUser : Sentry.IJsonSerializable + public sealed class SentryUser : Sentry.ISentryJsonSerializable { public SentryUser() { } public string? Email { get; set; } @@ -949,7 +949,7 @@ namespace Sentry Crashed = 1, Abnormal = 2, } - public class SessionUpdate : Sentry.IJsonSerializable, Sentry.ISentrySession + public class SessionUpdate : Sentry.ISentryJsonSerializable, Sentry.ISentrySession { public SessionUpdate(Sentry.SessionUpdate sessionUpdate, bool isInitial) { } public SessionUpdate(Sentry.SessionUpdate sessionUpdate, bool isInitial, Sentry.SessionEndStatus? endStatus) { } @@ -996,7 +996,7 @@ namespace Sentry public static Sentry.ITransactionTracer GetTransaction(this Sentry.ISpan span) { } public static Sentry.ISpan StartChild(this Sentry.ISpan span, string operation, string? description) { } } - public readonly struct SpanId : Sentry.IJsonSerializable, System.IEquatable + public readonly struct SpanId : Sentry.ISentryJsonSerializable, System.IEquatable { public static readonly Sentry.SpanId Empty; public SpanId(long value) { } @@ -1154,7 +1154,7 @@ namespace Sentry public Sentry.ISpan StartChild(string operation) { } public void UnsetTag(string key) { } } - public sealed class UserFeedback : Sentry.IJsonSerializable + public sealed class UserFeedback : Sentry.ISentryJsonSerializable { public UserFeedback(Sentry.SentryId eventId, string? name, string? email, string? comments) { } public string? Comments { get; } @@ -1164,18 +1164,18 @@ namespace Sentry 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.IJsonSerializable + public sealed class ViewHierarchy : Sentry.ISentryJsonSerializable { public ViewHierarchy(string renderingSystem) { } public string RenderingSystem { get; set; } public System.Collections.Generic.List Windows { get; } public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } } - public class ViewHierarchyAttachment : Sentry.Attachment + public class ViewHierarchyAttachment : Sentry.SentryAttachment { public ViewHierarchyAttachment(Sentry.IAttachmentContent content) { } } - public abstract class ViewHierarchyNode : Sentry.IJsonSerializable + public abstract class ViewHierarchyNode : Sentry.ISentryJsonSerializable { protected ViewHierarchyNode(string type) { } public System.Collections.Generic.List Children { get; set; } @@ -1231,11 +1231,11 @@ namespace Sentry.Extensibility public void BindException(System.Exception exception, Sentry.ISpan span) { } public bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } + 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 CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } - public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void ConfigureScope(System.Action configureScope) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1274,12 +1274,12 @@ namespace Sentry.Extensibility public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope, Sentry.Hint? hint = null) { } + 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 CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } - public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } public void ConfigureScope(System.Action configureScope) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1338,7 +1338,7 @@ namespace Sentry.Extensibility } public interface ISentryEventProcessorWithHint : Sentry.Extensibility.ISentryEventProcessor { - Sentry.SentryEvent? Process(Sentry.SentryEvent @event, Sentry.Hint hint); + Sentry.SentryEvent? Process(Sentry.SentryEvent @event, Sentry.SentryHint hint); } public interface ISentryStackTraceFactory { @@ -1350,7 +1350,7 @@ namespace Sentry.Extensibility } public interface ISentryTransactionProcessorWithHint : Sentry.Extensibility.ISentryTransactionProcessor { - Sentry.SentryTransaction? Process(Sentry.SentryTransaction transaction, Sentry.Hint hint); + Sentry.SentryTransaction? Process(Sentry.SentryTransaction transaction, Sentry.SentryHint hint); } public interface ITransport { @@ -1484,7 +1484,7 @@ namespace Sentry.PlatformAbstractions } namespace Sentry.Protocol { - public sealed class App : Sentry.IJsonSerializable + public sealed class App : Sentry.ISentryJsonSerializable { public const string Type = "app"; public App() { } @@ -1499,7 +1499,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.App FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Browser : Sentry.IJsonSerializable + public sealed class Browser : Sentry.ISentryJsonSerializable { public const string Type = "browser"; public Browser() { } @@ -1508,7 +1508,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.Browser FromJson(System.Text.Json.JsonElement json) { } } - public sealed class DebugImage : Sentry.IJsonSerializable + public sealed class DebugImage : Sentry.ISentryJsonSerializable { public DebugImage() { } public string? CodeFile { get; set; } @@ -1522,7 +1522,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.DebugImage FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Device : Sentry.IJsonSerializable + public sealed class Device : Sentry.ISentryJsonSerializable { public const string Type = "device"; public Device() { } @@ -1572,7 +1572,7 @@ namespace Sentry.Protocol [System.Runtime.Serialization.EnumMember(Value="landscape")] Landscape = 1, } - public sealed class Gpu : Sentry.IJsonSerializable + public sealed class Gpu : Sentry.ISentryJsonSerializable { public const string Type = "gpu"; public Gpu() { } @@ -1604,14 +1604,14 @@ namespace Sentry.Protocol Sentry.SpanStatus? Status { get; } Sentry.SentryId TraceId { get; } } - public sealed class Measurement : Sentry.IJsonSerializable + public sealed class Measurement : Sentry.ISentryJsonSerializable { public Sentry.MeasurementUnit Unit { get; } public object Value { get; } public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.Measurement FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Mechanism : Sentry.IJsonSerializable + public sealed class Mechanism : Sentry.ISentryJsonSerializable { public static readonly string DescriptionKey; public static readonly string HandledKey; @@ -1631,7 +1631,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.Mechanism FromJson(System.Text.Json.JsonElement json) { } } - public sealed class OperatingSystem : Sentry.IJsonSerializable + public sealed class OperatingSystem : Sentry.ISentryJsonSerializable { public const string Type = "os"; public OperatingSystem() { } @@ -1644,7 +1644,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.OperatingSystem FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Response : Sentry.IJsonSerializable + public sealed class Response : Sentry.ISentryJsonSerializable { public const string Type = "response"; public Response() { } @@ -1659,7 +1659,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.Response FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Runtime : Sentry.IJsonSerializable + public sealed class Runtime : Sentry.ISentryJsonSerializable { public const string Type = "runtime"; public Runtime() { } @@ -1671,7 +1671,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.Runtime FromJson(System.Text.Json.JsonElement json) { } } - public sealed class SentryException : Sentry.IJsonSerializable + public sealed class SentryException : Sentry.ISentryJsonSerializable { public SentryException() { } public Sentry.Protocol.Mechanism? Mechanism { get; set; } @@ -1683,7 +1683,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.SentryException FromJson(System.Text.Json.JsonElement json) { } } - public class Trace : Sentry.IJsonSerializable, Sentry.Protocol.ITraceContext + public class Trace : Sentry.ISentryJsonSerializable, Sentry.Protocol.ITraceContext { public const string Type = "trace"; public Trace() { } @@ -1710,7 +1710,7 @@ namespace Sentry.Protocol.Envelopes public System.Threading.Tasks.Task SerializeAsync(System.IO.Stream stream, Sentry.Extensibility.IDiagnosticLogger? logger, System.Threading.CancellationToken cancellationToken = default) { } public Sentry.SentryId? TryGetEventId() { } public static System.Threading.Tasks.Task DeserializeAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default) { } - public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } + public static Sentry.Protocol.Envelopes.Envelope FromEvent(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) { } public static Sentry.Protocol.Envelopes.Envelope FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } @@ -1727,7 +1727,7 @@ namespace Sentry.Protocol.Envelopes public long? TryGetLength() { } public string? TryGetType() { } public static System.Threading.Tasks.Task DeserializeAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default) { } - public static Sentry.Protocol.Envelopes.EnvelopeItem FromAttachment(Sentry.Attachment attachment) { } + public static Sentry.Protocol.Envelopes.EnvelopeItem FromAttachment(Sentry.SentryAttachment attachment) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromEvent(Sentry.SentryEvent @event) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromSession(Sentry.SessionUpdate sessionUpdate) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromTransaction(Sentry.SentryTransaction transaction) { } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt index 53a42cb31a..84452724cb 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt @@ -1,15 +1,6 @@ [assembly: System.CLSCompliant(true)] namespace Sentry { - [System.Diagnostics.DebuggerDisplay("{FileName}")] - public class Attachment - { - public Attachment(Sentry.AttachmentType type, Sentry.IAttachmentContent content, string fileName, string? contentType) { } - public Sentry.IAttachmentContent Content { get; } - public string? ContentType { get; } - public string FileName { get; } - public Sentry.AttachmentType Type { get; } - } public enum AttachmentType { Default = 0, @@ -24,7 +15,7 @@ namespace Sentry public override string ToString() { } } [System.Diagnostics.DebuggerDisplay("Message: {Message}, Type: {Type}")] - public sealed class Breadcrumb : Sentry.IJsonSerializable + public sealed class Breadcrumb : Sentry.ISentryJsonSerializable { public Breadcrumb(string message, string type, System.Collections.Generic.IReadOnlyDictionary? data = null, string? category = null, Sentry.BreadcrumbLevel level = 0) { } public string? Category { get; } @@ -76,7 +67,7 @@ namespace Sentry public const string Platform = "csharp"; public const int ProtocolVersion = 7; } - public sealed class Contexts : Sentry.IJsonSerializable, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable + public sealed class Contexts : Sentry.ISentryJsonSerializable, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable { public Contexts() { } public Sentry.Protocol.App App { get; } @@ -161,16 +152,6 @@ namespace Sentry { public static void SetTags(this Sentry.IHasTags hasTags, System.Collections.Generic.IEnumerable> tags) { } } - public class Hint - { - public Hint() { } - public Hint(string key, object? value) { } - public System.Collections.Generic.ICollection Attachments { get; } - public System.Collections.Generic.IDictionary Items { get; } - public void AddAttachment(string filePath, Sentry.AttachmentType type = 0, string? contentType = null) { } - public static Sentry.Hint WithAttachments(params Sentry.Attachment[] attachments) { } - public static Sentry.Hint WithAttachments(System.Collections.Generic.IEnumerable attachments) { } - } public static class HintTypes { public const string HttpResponseMessage = "http-response-message"; @@ -194,7 +175,7 @@ namespace Sentry } public static class HubExtensions { - public static void AddBreadcrumb(this Sentry.IHub hub, Sentry.Breadcrumb breadcrumb, Sentry.Hint? hint = null) { } + public static void AddBreadcrumb(this Sentry.IHub hub, Sentry.Breadcrumb breadcrumb, Sentry.SentryHint? hint = null) { } public static void AddBreadcrumb(this Sentry.IHub hub, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void AddBreadcrumb(this Sentry.IHub hub, Sentry.Infrastructure.ISystemClock? clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static Sentry.SentryId CaptureException(this Sentry.IHub hub, System.Exception ex, System.Action configureScope) { } @@ -243,7 +224,7 @@ namespace Sentry Sentry.IMetricAggregator Metrics { get; } void BindException(System.Exception exception, Sentry.ISpan span); Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope); - Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope); + Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.SentryHint? hint, System.Action configureScope); 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); @@ -255,10 +236,6 @@ namespace Sentry void StartSession(); Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext); } - public interface IJsonSerializable - { - void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger); - } public interface IMetricAggregator : System.IDisposable { void Distribution(string key, double value = 1, Sentry.MeasurementUnit? unit = default, System.Collections.Generic.IDictionary? tags = null, System.DateTimeOffset? timestamp = default, int stackLevel = 1); @@ -282,13 +259,17 @@ namespace Sentry { bool IsEnabled { get; } bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope); - Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null); + Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, 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.Hint? hint); + void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint); void CaptureUserFeedback(Sentry.UserFeedback userFeedback); System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout); } + public interface ISentryJsonSerializable + { + void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger); + } public interface ISentryScopeManager { void BindClient(Sentry.ISentryClient client); @@ -412,7 +393,7 @@ namespace Sentry Exbibyte = 13, } } - public sealed class Package : Sentry.IJsonSerializable + public sealed class Package : Sentry.ISentryJsonSerializable { public Package(string name, string version) { } public string Name { get; } @@ -428,7 +409,7 @@ namespace Sentry Version = 1, InformationalVersion = 2, } - public sealed class Request : Sentry.IJsonSerializable + public sealed class Request : Sentry.ISentryJsonSerializable { public Request() { } public string? ApiTarget { get; set; } @@ -447,7 +428,7 @@ namespace Sentry public class Scope : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags { public Scope(Sentry.SentryOptions? options) { } - public System.Collections.Generic.IReadOnlyCollection Attachments { get; } + public System.Collections.Generic.IReadOnlyCollection Attachments { get; } public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } public Sentry.Contexts Contexts { get; set; } public string? Distribution { get; set; } @@ -463,9 +444,9 @@ namespace Sentry public Sentry.ITransactionTracer? Transaction { get; set; } public string? TransactionName { get; set; } public Sentry.SentryUser User { get; set; } - public void AddAttachment(Sentry.Attachment attachment) { } + public void AddAttachment(Sentry.SentryAttachment attachment) { } public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb) { } - public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.Hint hint) { } + public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.SentryHint hint) { } public void Apply(Sentry.IEventLike other) { } public void Apply(Sentry.Scope other) { } public void Apply(object state) { } @@ -494,7 +475,7 @@ namespace Sentry public static System.Collections.Generic.IEnumerable GetAllExceptionProcessors(this Sentry.Scope scope) { } public static System.Collections.Generic.IEnumerable GetAllTransactionProcessors(this Sentry.Scope scope) { } } - public sealed class SdkVersion : Sentry.IJsonSerializable + public sealed class SdkVersion : Sentry.ISentryJsonSerializable { public SdkVersion() { } public string? Name { get; set; } @@ -505,15 +486,24 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SdkVersion FromJson(System.Text.Json.JsonElement json) { } } + [System.Diagnostics.DebuggerDisplay("{FileName}")] + public class SentryAttachment + { + public SentryAttachment(Sentry.AttachmentType type, Sentry.IAttachmentContent content, string fileName, string? contentType) { } + public Sentry.IAttachmentContent Content { get; } + public string? ContentType { get; } + public string FileName { get; } + public Sentry.AttachmentType Type { get; } + } public class SentryClient : Sentry.ISentryClient, System.IDisposable { public SentryClient(Sentry.SentryOptions options) { } public bool IsEnabled { get; } public bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent? @event, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } + public Sentry.SentryId CaptureEvent(Sentry.SentryEvent? @event, 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.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void Dispose() { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } @@ -528,7 +518,7 @@ namespace Sentry public static System.Threading.Tasks.Task FlushAsync(this Sentry.ISentryClient client) { } } [System.Diagnostics.DebuggerDisplay("{GetType().Name,nq}: {EventId,nq}")] - public sealed class SentryEvent : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable + public sealed class SentryEvent : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISentryJsonSerializable { public SentryEvent() { } public SentryEvent(System.Exception? exception) { } @@ -569,6 +559,16 @@ namespace Sentry protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url) { } protected override Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } } + public class SentryHint + { + public SentryHint() { } + public SentryHint(string key, object? value) { } + public System.Collections.Generic.ICollection Attachments { get; } + public System.Collections.Generic.IDictionary Items { get; } + public void AddAttachment(string filePath, Sentry.AttachmentType type = 0, string? contentType = null) { } + public static Sentry.SentryHint WithAttachments(params Sentry.SentryAttachment[] attachments) { } + public static Sentry.SentryHint WithAttachments(System.Collections.Generic.IEnumerable attachments) { } + } public class SentryHttpMessageHandler : Sentry.SentryMessageHandler { public SentryHttpMessageHandler() { } @@ -578,7 +578,7 @@ namespace Sentry protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url) { } protected override Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } } - public readonly struct SentryId : Sentry.IJsonSerializable, System.IEquatable + public readonly struct SentryId : Sentry.ISentryJsonSerializable, System.IEquatable { public static readonly Sentry.SentryId Empty; public SentryId(System.Guid guid) { } @@ -608,7 +608,7 @@ namespace Sentry [System.Runtime.Serialization.EnumMember(Value="fatal")] Fatal = 4, } - public sealed class SentryMessage : Sentry.IJsonSerializable + public sealed class SentryMessage : Sentry.ISentryJsonSerializable { public SentryMessage() { } public string? Formatted { get; set; } @@ -693,11 +693,11 @@ namespace Sentry public void AddJsonSerializerContext(System.Func contextBuilder) where T : System.Text.Json.Serialization.JsonSerializerContext { } public void SetBeforeBreadcrumb(System.Func beforeBreadcrumb) { } - public void SetBeforeBreadcrumb(System.Func beforeBreadcrumb) { } + public void SetBeforeBreadcrumb(System.Func beforeBreadcrumb) { } public void SetBeforeSend(System.Func beforeSend) { } - public void SetBeforeSend(System.Func beforeSend) { } + public void SetBeforeSend(System.Func beforeSend) { } public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } - public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } + public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } } public static class SentryOptionsExtensions { @@ -740,22 +740,22 @@ namespace Sentry public static bool IsEnabled { get; } public static Sentry.SentryId LastEventId { get; } public static Sentry.IMetricAggregator Metrics { get; } - public static void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.Hint? hint = null) { } + public static void AddBreadcrumb(Sentry.Breadcrumb breadcrumb, Sentry.SentryHint? hint = null) { } public static void AddBreadcrumb(string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void AddBreadcrumb(Sentry.Infrastructure.ISystemClock? clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void BindClient(Sentry.ISentryClient client) { } public static void BindException(System.Exception exception, Sentry.ISpan span) { } public static bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } - public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } - public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } + public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.SentryHint? hint = null) { } + 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 Sentry.SentryId CaptureMessage(string message, Sentry.SentryLevel level = 1) { } public static Sentry.SentryId CaptureMessage(string message, System.Action configureScope, Sentry.SentryLevel level = 1) { } 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.Hint? hint) { } + public static void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } public static void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } 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" + @@ -802,7 +802,7 @@ namespace Sentry public string? UserAgent { get; } public void ReportError() { } } - public class SentrySpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext + public class SentrySpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISentryJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext { public SentrySpan(Sentry.ISpan tracer) { } public SentrySpan(Sentry.SpanId? parentSpanId, string operation) { } @@ -827,7 +827,7 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SentrySpan FromJson(System.Text.Json.JsonElement json) { } } - public sealed class SentryStackFrame : Sentry.IJsonSerializable + public sealed class SentryStackFrame : Sentry.ISentryJsonSerializable { public SentryStackFrame() { } public string? AbsolutePath { get; set; } @@ -853,7 +853,7 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SentryStackFrame FromJson(System.Text.Json.JsonElement json) { } } - public class SentryStackTrace : Sentry.IJsonSerializable + public class SentryStackTrace : Sentry.ISentryJsonSerializable { public SentryStackTrace() { } public Sentry.InstructionAddressAdjustment? AddressAdjustment { get; set; } @@ -861,7 +861,7 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SentryStackTrace FromJson(System.Text.Json.JsonElement json) { } } - public sealed class SentryThread : Sentry.IJsonSerializable + public sealed class SentryThread : Sentry.ISentryJsonSerializable { public SentryThread() { } public bool? Crashed { get; set; } @@ -881,7 +881,7 @@ namespace Sentry public override string ToString() { } public static Sentry.SentryTraceHeader Parse(string value) { } } - public class SentryTransaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + public class SentryTransaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISentryJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext { public SentryTransaction(Sentry.ITransactionTracer tracer) { } public SentryTransaction(string name, string operation) { } @@ -925,7 +925,7 @@ namespace Sentry public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.SentryTransaction FromJson(System.Text.Json.JsonElement json) { } } - public sealed class SentryUser : Sentry.IJsonSerializable + public sealed class SentryUser : Sentry.ISentryJsonSerializable { public SentryUser() { } public string? Email { get; set; } @@ -944,7 +944,7 @@ namespace Sentry Crashed = 1, Abnormal = 2, } - public class SessionUpdate : Sentry.IJsonSerializable, Sentry.ISentrySession + public class SessionUpdate : Sentry.ISentryJsonSerializable, Sentry.ISentrySession { public SessionUpdate(Sentry.SessionUpdate sessionUpdate, bool isInitial) { } public SessionUpdate(Sentry.SessionUpdate sessionUpdate, bool isInitial, Sentry.SessionEndStatus? endStatus) { } @@ -991,7 +991,7 @@ namespace Sentry public static Sentry.ITransactionTracer GetTransaction(this Sentry.ISpan span) { } public static Sentry.ISpan StartChild(this Sentry.ISpan span, string operation, string? description) { } } - public readonly struct SpanId : Sentry.IJsonSerializable, System.IEquatable + public readonly struct SpanId : Sentry.ISentryJsonSerializable, System.IEquatable { public static readonly Sentry.SpanId Empty; public SpanId(long value) { } @@ -1149,7 +1149,7 @@ namespace Sentry public Sentry.ISpan StartChild(string operation) { } public void UnsetTag(string key) { } } - public sealed class UserFeedback : Sentry.IJsonSerializable + public sealed class UserFeedback : Sentry.ISentryJsonSerializable { public UserFeedback(Sentry.SentryId eventId, string? name, string? email, string? comments) { } public string? Comments { get; } @@ -1159,18 +1159,18 @@ namespace Sentry 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.IJsonSerializable + public sealed class ViewHierarchy : Sentry.ISentryJsonSerializable { public ViewHierarchy(string renderingSystem) { } public string RenderingSystem { get; set; } public System.Collections.Generic.List Windows { get; } public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } } - public class ViewHierarchyAttachment : Sentry.Attachment + public class ViewHierarchyAttachment : Sentry.SentryAttachment { public ViewHierarchyAttachment(Sentry.IAttachmentContent content) { } } - public abstract class ViewHierarchyNode : Sentry.IJsonSerializable + public abstract class ViewHierarchyNode : Sentry.ISentryJsonSerializable { protected ViewHierarchyNode(string type) { } public System.Collections.Generic.List Children { get; set; } @@ -1226,11 +1226,11 @@ namespace Sentry.Extensibility public void BindException(System.Exception exception, Sentry.ISpan span) { } public bool CaptureEnvelope(Sentry.Protocol.Envelopes.Envelope envelope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } + 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 CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } - public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void ConfigureScope(System.Action configureScope) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1269,12 +1269,12 @@ namespace Sentry.Extensibility public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } - public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope, Sentry.Hint? hint = null) { } + 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 CaptureSession(Sentry.SessionUpdate sessionUpdate) { } public void CaptureTransaction(Sentry.SentryTransaction transaction) { } - public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.SentryHint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } public void ConfigureScope(System.Action configureScope) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1333,7 +1333,7 @@ namespace Sentry.Extensibility } public interface ISentryEventProcessorWithHint : Sentry.Extensibility.ISentryEventProcessor { - Sentry.SentryEvent? Process(Sentry.SentryEvent @event, Sentry.Hint hint); + Sentry.SentryEvent? Process(Sentry.SentryEvent @event, Sentry.SentryHint hint); } public interface ISentryStackTraceFactory { @@ -1345,7 +1345,7 @@ namespace Sentry.Extensibility } public interface ISentryTransactionProcessorWithHint : Sentry.Extensibility.ISentryTransactionProcessor { - Sentry.SentryTransaction? Process(Sentry.SentryTransaction transaction, Sentry.Hint hint); + Sentry.SentryTransaction? Process(Sentry.SentryTransaction transaction, Sentry.SentryHint hint); } public interface ITransport { @@ -1480,7 +1480,7 @@ namespace Sentry.PlatformAbstractions } namespace Sentry.Protocol { - public sealed class App : Sentry.IJsonSerializable + public sealed class App : Sentry.ISentryJsonSerializable { public const string Type = "app"; public App() { } @@ -1495,7 +1495,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.App FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Browser : Sentry.IJsonSerializable + public sealed class Browser : Sentry.ISentryJsonSerializable { public const string Type = "browser"; public Browser() { } @@ -1504,7 +1504,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.Browser FromJson(System.Text.Json.JsonElement json) { } } - public sealed class DebugImage : Sentry.IJsonSerializable + public sealed class DebugImage : Sentry.ISentryJsonSerializable { public DebugImage() { } public string? CodeFile { get; set; } @@ -1518,7 +1518,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.DebugImage FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Device : Sentry.IJsonSerializable + public sealed class Device : Sentry.ISentryJsonSerializable { public const string Type = "device"; public Device() { } @@ -1568,7 +1568,7 @@ namespace Sentry.Protocol [System.Runtime.Serialization.EnumMember(Value="landscape")] Landscape = 1, } - public sealed class Gpu : Sentry.IJsonSerializable + public sealed class Gpu : Sentry.ISentryJsonSerializable { public const string Type = "gpu"; public Gpu() { } @@ -1600,14 +1600,14 @@ namespace Sentry.Protocol Sentry.SpanStatus? Status { get; } Sentry.SentryId TraceId { get; } } - public sealed class Measurement : Sentry.IJsonSerializable + public sealed class Measurement : Sentry.ISentryJsonSerializable { public Sentry.MeasurementUnit Unit { get; } public object Value { get; } public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.Measurement FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Mechanism : Sentry.IJsonSerializable + public sealed class Mechanism : Sentry.ISentryJsonSerializable { public static readonly string DescriptionKey; public static readonly string HandledKey; @@ -1627,7 +1627,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.Mechanism FromJson(System.Text.Json.JsonElement json) { } } - public sealed class OperatingSystem : Sentry.IJsonSerializable + public sealed class OperatingSystem : Sentry.ISentryJsonSerializable { public const string Type = "os"; public OperatingSystem() { } @@ -1640,7 +1640,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.OperatingSystem FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Response : Sentry.IJsonSerializable + public sealed class Response : Sentry.ISentryJsonSerializable { public const string Type = "response"; public Response() { } @@ -1655,7 +1655,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.Response FromJson(System.Text.Json.JsonElement json) { } } - public sealed class Runtime : Sentry.IJsonSerializable + public sealed class Runtime : Sentry.ISentryJsonSerializable { public const string Type = "runtime"; public Runtime() { } @@ -1667,7 +1667,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { } public static Sentry.Protocol.Runtime FromJson(System.Text.Json.JsonElement json) { } } - public sealed class SentryException : Sentry.IJsonSerializable + public sealed class SentryException : Sentry.ISentryJsonSerializable { public SentryException() { } public Sentry.Protocol.Mechanism? Mechanism { get; set; } @@ -1679,7 +1679,7 @@ namespace Sentry.Protocol public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } public static Sentry.Protocol.SentryException FromJson(System.Text.Json.JsonElement json) { } } - public class Trace : Sentry.IJsonSerializable, Sentry.Protocol.ITraceContext + public class Trace : Sentry.ISentryJsonSerializable, Sentry.Protocol.ITraceContext { public const string Type = "trace"; public Trace() { } @@ -1706,7 +1706,7 @@ namespace Sentry.Protocol.Envelopes public System.Threading.Tasks.Task SerializeAsync(System.IO.Stream stream, Sentry.Extensibility.IDiagnosticLogger? logger, System.Threading.CancellationToken cancellationToken = default) { } public Sentry.SentryId? TryGetEventId() { } public static System.Threading.Tasks.Task DeserializeAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default) { } - public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } + public static Sentry.Protocol.Envelopes.Envelope FromEvent(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) { } public static Sentry.Protocol.Envelopes.Envelope FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } @@ -1723,7 +1723,7 @@ namespace Sentry.Protocol.Envelopes public long? TryGetLength() { } public string? TryGetType() { } public static System.Threading.Tasks.Task DeserializeAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default) { } - public static Sentry.Protocol.Envelopes.EnvelopeItem FromAttachment(Sentry.Attachment attachment) { } + public static Sentry.Protocol.Envelopes.EnvelopeItem FromAttachment(Sentry.SentryAttachment attachment) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromEvent(Sentry.SentryEvent @event) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromSession(Sentry.SessionUpdate sessionUpdate) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromTransaction(Sentry.SentryTransaction transaction) { } diff --git a/test/Sentry.Tests/AttachmentHelper.cs b/test/Sentry.Tests/AttachmentHelper.cs index 53c27b7cf2..562313fb2a 100644 --- a/test/Sentry.Tests/AttachmentHelper.cs +++ b/test/Sentry.Tests/AttachmentHelper.cs @@ -2,7 +2,7 @@ namespace Sentry.Tests { internal static class AttachmentHelper { - internal static Attachment FakeAttachment(string name = "test.txt") + internal static SentryAttachment FakeAttachment(string name = "test.txt") => new( AttachmentType.Default, new StreamAttachmentContent(new MemoryStream(new byte[] { 1 })), diff --git a/test/Sentry.Tests/HintTests.cs b/test/Sentry.Tests/HintTests.cs index b578e7e14e..0c5dc24b11 100644 --- a/test/Sentry.Tests/HintTests.cs +++ b/test/Sentry.Tests/HintTests.cs @@ -19,7 +19,7 @@ public void AddAttachment_AddsToHint() File.Create(attachmentPath1); File.Create(attachmentPath2); - var hint = new Hint(new SentryOptions()); + var hint = new SentryHint(new SentryOptions()); // Act hint.AddAttachment(attachmentPath1); @@ -33,7 +33,7 @@ public void AddAttachment_AddsToHint() public void Clear_WithEntries_ClearsHintEntries() { // Arrange - var hint = new Hint("key", "value"); + var hint = new SentryHint("key", "value"); // Act hint.Items.Clear(); @@ -46,7 +46,7 @@ public void Clear_WithEntries_ClearsHintEntries() public void ClearAttachments_WithAttachments_ClearsHintAttachments() { // Arrange - var hint = new Hint(); + var hint = new SentryHint(); var attachment1 = Path.Combine(_testDirectory, Path.GetTempFileName()); hint.AddAttachment(attachment1); @@ -61,7 +61,7 @@ public void ClearAttachments_WithAttachments_ClearsHintAttachments() public void ContainsKey_ExistingKey_ReturnsTrue() { // Arrange - var hint = new Hint("key", "value"); + var hint = new SentryHint("key", "value"); // Act var containsKey = hint.Items.ContainsKey("key"); @@ -74,7 +74,7 @@ public void ContainsKey_ExistingKey_ReturnsTrue() public void ContainsKey_NonExistingKey_ReturnsFalse() { // Arrange - var hint = new Hint("key", "value"); + var hint = new SentryHint("key", "value"); // Act var containsKey = hint.Items.ContainsKey("nonExistingKey"); @@ -87,7 +87,7 @@ public void ContainsKey_NonExistingKey_ReturnsFalse() public void Count_ReturnsZero_WhenHintIsEmpty() { // Arrange - var hint = new Hint(); + var hint = new SentryHint(); // Act var count = hint.Items.Count; @@ -100,7 +100,7 @@ public void Count_ReturnsZero_WhenHintIsEmpty() public void Count_ReturnsCorrectValue_WhenHintHasItems() { // Arrange - var hint = new Hint(); + var hint = new SentryHint(); hint.Items["key1"] = "value1"; hint.Items["key2"] = "value2"; @@ -115,7 +115,7 @@ public void Count_ReturnsCorrectValue_WhenHintHasItems() public void Remove_WithExistingKey_RemovesEntry() { // Arrange - var hint = new Hint("key", "value"); + var hint = new SentryHint("key", "value"); // Act hint.Items.Remove("key"); @@ -132,7 +132,7 @@ public void WithAttachments_ReturnsHintWithAttachments() var attachment2 = AttachmentHelper.FakeAttachment("attachment2"); // Act - var hint = Hint.WithAttachments(attachment1, attachment2); + var hint = SentryHint.WithAttachments(attachment1, attachment2); // Assert hint.Attachments.Count.Should().Be(2); @@ -146,10 +146,10 @@ public void WithAttachments_WithICollection_ReturnsHintWithAttachments() // Arrange var attachment1 = AttachmentHelper.FakeAttachment("attachment1"); var attachment2 = AttachmentHelper.FakeAttachment("attachment2"); - var attachments = new List { attachment1, attachment2 }; + var attachments = new List { attachment1, attachment2 }; // Act - var hint = Hint.WithAttachments(attachments); + var hint = SentryHint.WithAttachments(attachments); // Assert hint.Attachments.Count.Should().Be(2); diff --git a/test/Sentry.Tests/HubTests.cs b/test/Sentry.Tests/HubTests.cs index 2c053e5bb3..417876d7b5 100644 --- a/test/Sentry.Tests/HubTests.cs +++ b/test/Sentry.Tests/HubTests.cs @@ -127,7 +127,7 @@ public void CaptureException_FinishedSpanBoundToSameExceptionExists_EventIsLinke Arg.Is(evt => evt.Contexts.Trace.TraceId == transaction.TraceId && evt.Contexts.Trace.SpanId == transaction.SpanId), - Arg.Any(), Arg.Any()); + Arg.Any(), Arg.Any()); } [Fact] @@ -149,7 +149,7 @@ public void CaptureException_ActiveSpanExistsOnScope_EventIsLinkedToSpan() Arg.Is(evt => evt.Contexts.Trace.TraceId == transaction.TraceId && evt.Contexts.Trace.SpanId == transaction.SpanId), - Arg.Any(), Arg.Any()); + Arg.Any(), Arg.Any()); } [Fact] @@ -188,7 +188,7 @@ public void CaptureException_TransactionFinished_Gets_DSC_From_LinkedSpan() _fixture.Client.Received(1).CaptureEvent( Arg.Is(evt => evt.DynamicSamplingContext == dsc), - Arg.Any(), Arg.Any()); + Arg.Any(), Arg.Any()); } [Fact] @@ -210,7 +210,7 @@ public void CaptureException_ActiveSpanExistsOnScopeButIsSampledOut_EventIsNotLi Arg.Is(evt => evt.Contexts.Trace.TraceId == default && evt.Contexts.Trace.SpanId == default), - Arg.Any(), Arg.Any()); + Arg.Any(), Arg.Any()); } [Fact] @@ -229,7 +229,7 @@ public void CaptureException_NoActiveSpanAndNoSpanBoundToSameException_EventCont Arg.Is(evt => evt.Contexts.Trace.TraceId == scope.PropagationContext.TraceId && evt.Contexts.Trace.SpanId == scope.PropagationContext.SpanId), - Arg.Any(), Arg.Any()); + Arg.Any(), Arg.Any()); } [Fact] @@ -435,7 +435,7 @@ public void CaptureEvent_Client_GetsHint() { // Arrange var @event = new SentryEvent(); - var hint = new Hint(); + var hint = new SentryHint(); var hub = _fixture.GetSut(); // Act @@ -444,7 +444,7 @@ public void CaptureEvent_Client_GetsHint() // Assert _fixture.Client.Received(1).CaptureEvent( Arg.Any(), - Arg.Any(), Arg.Is(h => h == hint)); + Arg.Any(), Arg.Is(h => h == hint)); } [Fact] @@ -1391,7 +1391,7 @@ public void CaptureEvent_HubEnabled(bool enabled) hub.CaptureEvent(evt); // Assert - _fixture.Client.Received(enabled ? 1 : 0).CaptureEvent(Arg.Any(), Arg.Any(), Arg.Any()); + _fixture.Client.Received(enabled ? 1 : 0).CaptureEvent(Arg.Any(), Arg.Any(), Arg.Any()); } [Theory] @@ -1452,7 +1452,7 @@ public void CaptureTransaction_HubEnabled(bool enabled) transaction.Finish(); // Assert - _fixture.Client.Received().CaptureTransaction(Arg.Is(t => t.IsSampled == enabled), Arg.Any(), Arg.Any()); + _fixture.Client.Received().CaptureTransaction(Arg.Is(t => t.IsSampled == enabled), Arg.Any(), Arg.Any()); } [Fact] @@ -1466,7 +1466,7 @@ public void CaptureTransaction_Client_Gets_Hint() transaction.Finish(); // Assert - _fixture.Client.Received().CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any()); + _fixture.Client.Received().CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any()); } [Theory] diff --git a/test/Sentry.Tests/Internals/Http/CachingTransportTests.cs b/test/Sentry.Tests/Internals/Http/CachingTransportTests.cs index 777f01af5c..f092692c61 100644 --- a/test/Sentry.Tests/Internals/Http/CachingTransportTests.cs +++ b/test/Sentry.Tests/Internals/Http/CachingTransportTests.cs @@ -53,7 +53,7 @@ public async Task WithAttachment() try { - var attachment = new Attachment(AttachmentType.Default, new FileAttachmentContent(tempFile), "Attachment.txt", null); + var attachment = new SentryAttachment(AttachmentType.Default, new FileAttachmentContent(tempFile), "Attachment.txt", null); using var envelope = Envelope.FromEvent(new SentryEvent(), attachments: new[] { attachment }); // Act diff --git a/test/Sentry.Tests/Internals/Http/HttpTransportTests.cs b/test/Sentry.Tests/Internals/Http/HttpTransportTests.cs index 06099e54c2..c19e16a585 100644 --- a/test/Sentry.Tests/Internals/Http/HttpTransportTests.cs +++ b/test/Sentry.Tests/Internals/Http/HttpTransportTests.cs @@ -520,7 +520,7 @@ public async Task SendEnvelopeAsync_AttachmentFail_DropsItem() }, new HttpClient(httpHandler)); - var attachment = new Attachment( + var attachment = new SentryAttachment( AttachmentType.Default, new FileAttachmentContent("test1.txt"), "test1.txt", @@ -566,13 +566,13 @@ public async Task SendEnvelopeAsync_AttachmentTooLarge_DropsItem() }, new HttpClient(httpHandler)); - var attachmentNormal = new Attachment( + var attachmentNormal = new SentryAttachment( AttachmentType.Default, new StreamAttachmentContent(new MemoryStream(new byte[] { 1 })), "test1.txt", null); - var attachmentTooBig = new Attachment( + var attachmentTooBig = new SentryAttachment( AttachmentType.Default, new StreamAttachmentContent(new MemoryStream(new byte[] { 1, 2, 3, 4, 5 })), "test2.txt", diff --git a/test/Sentry.Tests/Protocol/Envelopes/EnvelopeTests.cs b/test/Sentry.Tests/Protocol/Envelopes/EnvelopeTests.cs index cdc489628c..4e67821400 100644 --- a/test/Sentry.Tests/Protocol/Envelopes/EnvelopeTests.cs +++ b/test/Sentry.Tests/Protocol/Envelopes/EnvelopeTests.cs @@ -535,7 +535,7 @@ public void Serialization_EnvelopeWithItemWithoutLength_Success_Synchronous() """); } - private class ThrowingSerializable : IJsonSerializable + private class ThrowingSerializable : ISentryJsonSerializable { public void WriteTo(Utf8JsonWriter writer, IDiagnosticLogger logger) { @@ -726,7 +726,7 @@ public async Task Roundtrip_WithEvent_WithAttachment_Success() using var attachmentStream = new MemoryStream(new byte[] { 1, 2, 3 }); - var attachment = new Attachment( + var attachment = new SentryAttachment( AttachmentType.Default, new StreamAttachmentContent(attachmentStream), "file.txt", @@ -763,7 +763,7 @@ public async Task Roundtrip_WithEvent_WithSession_Success() using var attachmentStream = new MemoryStream(new byte[] { 1, 2, 3 }); - var attachment = new Attachment( + var attachment = new SentryAttachment( AttachmentType.Default, new StreamAttachmentContent(attachmentStream), "file.txt", @@ -893,14 +893,14 @@ value is IReadOnlyDictionary nested && public void FromEvent_EmptyAttachmentStream_DoesNotIncludeAttachment() { // Arrange - var attachment = new Attachment( + var attachment = new SentryAttachment( default, new StreamAttachmentContent(Stream.Null), "Screenshot.jpg", "image/jpg"); // Act - var envelope = Envelope.FromEvent(new SentryEvent(), attachments: new List { attachment }); + var envelope = Envelope.FromEvent(new SentryEvent(), attachments: new List { attachment }); // Assert envelope.Items.Should().HaveCount(1); @@ -912,14 +912,14 @@ public void FromEvent_EmptyAttachmentStream_DisposesStream() // Arrange var path = Path.GetTempFileName(); using var stream = File.OpenRead(path); - var attachment = new Attachment( + var attachment = new SentryAttachment( default, new StreamAttachmentContent(stream), "Screenshot.jpg", "image/jpg"); // Act - _ = Envelope.FromEvent(new SentryEvent(), attachments: new List { attachment }); + _ = Envelope.FromEvent(new SentryEvent(), attachments: new List { attachment }); // Assert Assert.Throws(() => stream.ReadByte()); diff --git a/test/Sentry.Tests/Protocol/MeasurementTests.cs b/test/Sentry.Tests/Protocol/MeasurementTests.cs index b84f3f2768..73c7ded2f2 100644 --- a/test/Sentry.Tests/Protocol/MeasurementTests.cs +++ b/test/Sentry.Tests/Protocol/MeasurementTests.cs @@ -188,7 +188,7 @@ public void Transaction_SetMeasurement_IntValue() t.Measurements["foo"].Value.As() == int.MaxValue && t.Measurements["foo"].Unit == EmptyUnit), Arg.Any(), - Arg.Any() + Arg.Any() ); } @@ -216,7 +216,7 @@ public void Transaction_SetMeasurement_LongValue() t.Measurements["foo"].Value.As() == long.MaxValue && t.Measurements["foo"].Unit == EmptyUnit), Arg.Any(), - Arg.Any() + Arg.Any() ); } @@ -244,7 +244,7 @@ public void Transaction_SetMeasurement_ULongValue() t.Measurements["foo"].Value.As() == ulong.MaxValue && t.Measurements["foo"].Unit == EmptyUnit), Arg.Any(), - Arg.Any() + Arg.Any() ); } @@ -272,7 +272,7 @@ public void Transaction_SetMeasurement_DoubleValue() Math.Abs(t.Measurements["foo"].Value.As() - double.MaxValue) < double.Epsilon && t.Measurements["foo"].Unit == EmptyUnit), Arg.Any(), - Arg.Any() + Arg.Any() ); } @@ -300,7 +300,7 @@ public void Transaction_SetMeasurement_IntValue_WithUnit() t.Measurements["foo"].Value.As() == int.MaxValue && t.Measurements["foo"].Unit == MeasurementUnit.Duration.Nanosecond), Arg.Any(), - Arg.Any() + Arg.Any() ); } @@ -328,7 +328,7 @@ public void Transaction_SetMeasurement_LongValue_WithUnit() t.Measurements["foo"].Value.As() == long.MaxValue && t.Measurements["foo"].Unit == MeasurementUnit.Duration.Nanosecond), Arg.Any(), - Arg.Any() + Arg.Any() ); } @@ -356,7 +356,7 @@ public void Transaction_SetMeasurement_ULongValue_WithUnit() t.Measurements["foo"].Value.As() == ulong.MaxValue && t.Measurements["foo"].Unit == MeasurementUnit.Duration.Nanosecond), Arg.Any(), - Arg.Any() + Arg.Any() ); } @@ -384,7 +384,7 @@ public void Transaction_SetMeasurement_DoubleValue_WithUnit() Math.Abs(t.Measurements["foo"].Value.As() - double.MaxValue) < double.Epsilon && t.Measurements["foo"].Unit == MeasurementUnit.Duration.Nanosecond), Arg.Any(), - Arg.Any() + Arg.Any() ); } } diff --git a/test/Sentry.Tests/Protocol/SentryTransactionTests.cs b/test/Sentry.Tests/Protocol/SentryTransactionTests.cs index 43b0e2e8ad..ca22086f57 100644 --- a/test/Sentry.Tests/Protocol/SentryTransactionTests.cs +++ b/test/Sentry.Tests/Protocol/SentryTransactionTests.cs @@ -449,7 +449,7 @@ public void Finish_CapturesTransaction() transaction.Finish(); // Assert - client.Received(1).CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any()); + client.Received(1).CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any()); } [Fact] @@ -478,7 +478,7 @@ public void Finish_LinksExceptionToEvent() e.Contexts.Trace.SpanId == transaction.SpanId && e.Contexts.Trace.ParentSpanId == transaction.ParentSpanId ), - Arg.Any(), Arg.Any()); + Arg.Any(), Arg.Any()); } [Fact] diff --git a/test/Sentry.Tests/ScopeTests.cs b/test/Sentry.Tests/ScopeTests.cs index 45e0bbb293..6277367ca4 100644 --- a/test/Sentry.Tests/ScopeTests.cs +++ b/test/Sentry.Tests/ScopeTests.cs @@ -295,8 +295,8 @@ public void AddAttachment_AddAttachments() { // Arrange var scope = new Scope(); - var attachment = new Attachment(default, default, default, default); - var attachment2 = new Attachment(default, default, default, default); + var attachment = new SentryAttachment(default, default, default, default); + var attachment2 = new SentryAttachment(default, default, default, default); // Act scope.AddAttachment(attachment); @@ -400,7 +400,7 @@ public void AddBreadcrumb_BeforeAddBreadcrumb_ReceivesHint() { // Arrange var options = new SentryOptions(); - Hint receivedHint = null; + SentryHint receivedHint = null; options.SetBeforeBreadcrumb((breadcrumb, hint) => { receivedHint = hint; @@ -409,7 +409,7 @@ public void AddBreadcrumb_BeforeAddBreadcrumb_ReceivesHint() var scope = new Scope(options); // Act - var expectedHint = new Hint(); + var expectedHint = new SentryHint(); scope.AddBreadcrumb(new Breadcrumb(), expectedHint); // Assert @@ -421,7 +421,7 @@ public void AddBreadcrumb_ScopeAttachments_Copied_To_Hint() { // Arrange var options = new SentryOptions(); - Hint hint = null; + SentryHint hint = null; options.SetBeforeBreadcrumb((b, h) => { hint = h; @@ -633,7 +633,7 @@ public static void ApplyFakeValues(this Scope scope, string salt = "fake") scope.AddBreadcrumb(new(message: $"{salt} breadcrumb")); scope.SetExtra("extra", $"{salt} extra"); scope.SetTag("tag", $"{salt} tag"); - scope.AddAttachment(new Attachment(default, default, default, $"{salt} attachment")); + scope.AddAttachment(new SentryAttachment(default, default, default, $"{salt} attachment")); } public static void ShouldBeEquivalentTo(this Scope source, Scope target) diff --git a/test/Sentry.Tests/SentryClientTests.cs b/test/Sentry.Tests/SentryClientTests.cs index 51d4eb799d..a416661754 100644 --- a/test/Sentry.Tests/SentryClientTests.cs +++ b/test/Sentry.Tests/SentryClientTests.cs @@ -326,7 +326,7 @@ public void CaptureEvent_ExceptionFilter_RecordsDiscard() [Fact] public void CaptureEvent_BeforeSend_GetsHint() { - Hint received = null; + SentryHint received = null; _fixture.SentryOptions.SetBeforeSend((e, h) => { received = h; @@ -334,7 +334,7 @@ public void CaptureEvent_BeforeSend_GetsHint() }); var @event = new SentryEvent(); - var hint = new Hint(); + var hint = new SentryHint(); var sut = _fixture.GetSut(); _ = sut.CaptureEvent(@event, hint: hint); @@ -346,7 +346,7 @@ public void CaptureEvent_BeforeSend_GetsHint() public void CaptureEvent_BeforeSend_Gets_ScopeAttachments() { // Arrange - Hint hint = null; + SentryHint hint = null; _fixture.SentryOptions.SetBeforeSend((e, h) => { hint = h; @@ -395,7 +395,7 @@ public void CaptureEvent_EventProcessor_Gets_Hint() { // Arrange var processor = Substitute.For(); - processor.Process(Arg.Any(), Arg.Any()).Returns(new SentryEvent()); + processor.Process(Arg.Any(), Arg.Any()).Returns(new SentryEvent()); _fixture.SentryOptions.AddEventProcessor(processor); // Act @@ -403,7 +403,7 @@ public void CaptureEvent_EventProcessor_Gets_Hint() _ = sut.CaptureEvent(new SentryEvent()); // Assert - processor.Received(1).Process(Arg.Any(), Arg.Any()); + processor.Received(1).Process(Arg.Any(), Arg.Any()); } [Fact] @@ -411,8 +411,8 @@ public void CaptureEvent_EventProcessor_Gets_ScopeAttachments() { // Arrange var processor = Substitute.For(); - Hint hint = null; - processor.Process(Arg.Any(), Arg.Do(h => hint = h)).Returns(new SentryEvent()); + SentryHint hint = null; + processor.Process(Arg.Any(), Arg.Do(h => hint = h)).Returns(new SentryEvent()); _fixture.SentryOptions.AddEventProcessor(processor); var scope = new Scope(_fixture.SentryOptions); @@ -1038,7 +1038,7 @@ public void CaptureTransaction_ScopeContainsAttachments_GetAppliedToHint() IsSampled = true, EndTimestamp = DateTimeOffset.Now // finished }; - var attachments = new List { + var attachments = new List { AttachmentHelper.FakeAttachment("foo"), AttachmentHelper.FakeAttachment("bar") }; @@ -1046,7 +1046,7 @@ public void CaptureTransaction_ScopeContainsAttachments_GetAppliedToHint() scope.AddAttachment(attachments[0]); scope.AddAttachment(attachments[1]); - Hint hint = null; + SentryHint hint = null; _fixture.SentryOptions.SetBeforeSendTransaction((e, h) => { hint = h; @@ -1066,7 +1066,7 @@ public void CaptureTransaction_AddedTransactionProcessor_ReceivesHint() { // Arrange var processor = Substitute.For(); - processor.Process(Arg.Any(), Arg.Any()).Returns(new SentryTransaction("name", "operation")); + processor.Process(Arg.Any(), Arg.Any()).Returns(new SentryTransaction("name", "operation")); _fixture.SentryOptions.AddTransactionProcessor(processor); var transaction = new SentryTransaction("name", "operation") @@ -1079,7 +1079,7 @@ public void CaptureTransaction_AddedTransactionProcessor_ReceivesHint() _fixture.GetSut().CaptureTransaction(transaction); // Assert - processor.Received(1).Process(Arg.Any(), Arg.Any()); + processor.Received(1).Process(Arg.Any(), Arg.Any()); } [Fact] @@ -1093,14 +1093,14 @@ public void CaptureTransaction_TransactionProcessor_ReceivesScopeAttachments() }; var processor = Substitute.For(); - Hint hint = null; + SentryHint hint = null; processor.Process( Arg.Any(), - Arg.Do(h => hint = h)) + Arg.Do(h => hint = h)) .Returns(new SentryTransaction("name", "operation")); _fixture.SentryOptions.AddTransactionProcessor(processor); - var attachments = new List { AttachmentHelper.FakeAttachment("foo.txt") }; + var attachments = new List { AttachmentHelper.FakeAttachment("foo.txt") }; var scope = new Scope(_fixture.SentryOptions); scope.AddAttachment(attachments[0]); @@ -1116,7 +1116,7 @@ public void CaptureTransaction_TransactionProcessor_ReceivesScopeAttachments() [Fact] public void CaptureTransaction_BeforeSendTransaction_GetsHint() { - Hint received = null; + SentryHint received = null; _fixture.SentryOptions.SetBeforeSendTransaction((tx, h) => { received = h; @@ -1130,7 +1130,7 @@ public void CaptureTransaction_BeforeSendTransaction_GetsHint() }; var sut = _fixture.GetSut(); - var hint = new Hint(); + var hint = new SentryHint(); sut.CaptureTransaction(transaction, null, hint); Assert.Same(hint, received); diff --git a/test/Sentry.Tests/SentryGraphQlHttpFailedRequestHandlerTests.cs b/test/Sentry.Tests/SentryGraphQlHttpFailedRequestHandlerTests.cs index c620d79f25..63aba9e397 100644 --- a/test/Sentry.Tests/SentryGraphQlHttpFailedRequestHandlerTests.cs +++ b/test/Sentry.Tests/SentryGraphQlHttpFailedRequestHandlerTests.cs @@ -100,7 +100,7 @@ public void HandleResponse_NoError_BaseCapturesFailedRequests() // Assert hub.Received(1).CaptureEvent( Arg.Any(), - Arg.Any(), Arg.Any()); + Arg.Any(), Arg.Any()); } [Fact] @@ -123,7 +123,7 @@ public void HandleResponse_Error_Capture() // Assert hub.Received(1).CaptureEvent( Arg.Any(), - Arg.Any(), Arg.Any()); + Arg.Any(), Arg.Any()); } [Fact] @@ -143,7 +143,7 @@ public void HandleResponse_Error_DontSendPii() // Act SentryEvent @event = null; - hub.CaptureEvent(Arg.Do(e => @event = e), hint: Arg.Any()); + hub.CaptureEvent(Arg.Do(e => @event = e), hint: Arg.Any()); sut.HandleResponse(response); // Assert @@ -177,7 +177,7 @@ public void HandleResponse_Error_CaptureRequestAndResponse() SentryEvent @event = null; hub.CaptureEvent( Arg.Do(e => @event = e), - hint: Arg.Any() + hint: Arg.Any() ); // Act @@ -233,10 +233,10 @@ public void HandleResponse_Error_ResponseAsHint() response.RequestMessage = SentryGraphQlTestHelpers.GetRequestQuery(ValidQuery); // Act - Hint hint = null; + SentryHint hint = null; hub.CaptureEvent( Arg.Any(), - hint: Arg.Do(h => hint = h) + hint: Arg.Do(h => hint = h) ); sut.HandleResponse(response); diff --git a/test/Sentry.Tests/SentryHttpFailedRequestHandlerTests.cs b/test/Sentry.Tests/SentryHttpFailedRequestHandlerTests.cs index 4980929596..1d336e19a8 100644 --- a/test/Sentry.Tests/SentryHttpFailedRequestHandlerTests.cs +++ b/test/Sentry.Tests/SentryHttpFailedRequestHandlerTests.cs @@ -119,7 +119,7 @@ public void HandleResponse_Capture_FailedRequest() // Assert _hub.Received(1).CaptureEvent( Arg.Any(), - Arg.Any(), Arg.Any()); + Arg.Any(), Arg.Any()); } [Fact] @@ -138,7 +138,7 @@ public void HandleResponse_Capture_FailedRequest_No_Pii() // Act SentryEvent @event = null; - ((ISentryClient)_hub).CaptureEvent(Arg.Do(e => @event = e), hint: Arg.Any()); + ((ISentryClient)_hub).CaptureEvent(Arg.Do(e => @event = e), hint: Arg.Any()); sut.HandleResponse(response); // Assert @@ -170,7 +170,7 @@ public void HandleResponse_Capture_RequestAndResponse() SentryEvent @event = null; ((ISentryClient)_hub).CaptureEvent( Arg.Do(e => @event = e), - hint: Arg.Any() + hint: Arg.Any() ); sut.HandleResponse(response); @@ -220,7 +220,7 @@ public void HandleResponse_Capture_Default_SkipCookiesAndHeaders() SentryEvent @event = null; ((ISentryClient)_hub).CaptureEvent( Arg.Do(e => @event = e), - hint: Arg.Any() + hint: Arg.Any() ); sut.HandleResponse(response); @@ -249,10 +249,10 @@ public void HandleResponse_Hint_Response() response.RequestMessage = new HttpRequestMessage(HttpMethod.Post, "http://foo/bar"); // Act - Hint hint = null; + SentryHint hint = null; ((ISentryClient)_hub).CaptureEvent( Arg.Any(), - hint: Arg.Do(h => hint = h) + hint: Arg.Do(h => hint = h) ); sut.HandleResponse(response);