From 62d57b4fe15c04a9cb8d8f8680fb5ec1aa50cc4c Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 15 Nov 2023 13:47:09 +0100 Subject: [PATCH 1/3] removed obsolete options --- .../SentryAspNetCoreOptionsSetup.cs | 11 --- src/Sentry.Serilog/SentrySinkExtensions.cs | 18 ++--- src/Sentry/Platforms/Android/SentryOptions.cs | 2 +- src/Sentry/SentryOptions.cs | 79 ------------------- src/Sentry/SentryOptionsExtensions.cs | 8 -- ...piApprovalTests.Run.DotNet6_0.verified.txt | 2 - ...piApprovalTests.Run.DotNet7_0.verified.txt | 2 - ...piApprovalTests.Run.DotNet8_0.verified.txt | 2 - .../ApiApprovalTests.Run.Net4_8.verified.txt | 2 - ...piApprovalTests.Run.DotNet6_0.verified.txt | 4 +- ...piApprovalTests.Run.DotNet7_0.verified.txt | 4 +- ...piApprovalTests.Run.DotNet8_0.verified.txt | 4 +- .../ApiApprovalTests.Run.Net4_8.verified.txt | 4 +- .../SentrySerilogSinkExtensionsTests.cs | 14 ++-- ...piApprovalTests.Run.DotNet6_0.verified.txt | 17 ---- ...piApprovalTests.Run.DotNet7_0.verified.txt | 17 ---- ...piApprovalTests.Run.DotNet8_0.verified.txt | 17 ---- .../ApiApprovalTests.Run.Net4_8.verified.txt | 17 ---- .../MainSentryEventProcessorTests.cs | 5 +- 19 files changed, 23 insertions(+), 206 deletions(-) diff --git a/src/Sentry.AspNetCore/SentryAspNetCoreOptionsSetup.cs b/src/Sentry.AspNetCore/SentryAspNetCoreOptionsSetup.cs index f235b7540e..900953a495 100644 --- a/src/Sentry.AspNetCore/SentryAspNetCoreOptionsSetup.cs +++ b/src/Sentry.AspNetCore/SentryAspNetCoreOptionsSetup.cs @@ -24,17 +24,6 @@ public SentryAspNetCoreOptionsSetup( { } - /// - /// Creates a new instance of . - /// - [Obsolete("Use constructor with no IHostingEnvironment")] - public SentryAspNetCoreOptionsSetup( - ILoggerProviderConfiguration providerConfiguration, - IHostingEnvironment hostingEnvironment) - : base(providerConfiguration.Configuration) - { - } - /// /// Configures the . /// diff --git a/src/Sentry.Serilog/SentrySinkExtensions.cs b/src/Sentry.Serilog/SentrySinkExtensions.cs index ac400cba01..0286175d8a 100644 --- a/src/Sentry.Serilog/SentrySinkExtensions.cs +++ b/src/Sentry.Serilog/SentrySinkExtensions.cs @@ -31,7 +31,7 @@ public static class SentrySinkExtensions /// Whether the body compression is buffered and the request 'Content-Length' known in advance. /// Whether to log diagnostics messages. /// The diagnostics level to be used. - /// Whether or not to include referenced assemblies in each event sent to sentry. Defaults to . + /// What mode to use for reporting referenced assemblies in each event sent to sentry. Defaults to /// What modes to use for event automatic de-duplication. /// Whether to initialize this SDK through this integration. /// Defaults tags to add to all events. @@ -66,7 +66,7 @@ public static class SentrySinkExtensions /// "requestBodyCompressionBuffered": false, /// "debug": false, /// "diagnosticLevel": "Debug", - /// "reportAssemblies": false, + /// "reportAssembliesMode": ReportAssembliesMode.None, /// "deduplicateMode": "All", /// "initializeSdk": true, /// "defaultTags": { @@ -102,7 +102,7 @@ public static LoggerConfiguration Sentry( bool? requestBodyCompressionBuffered = null, bool? debug = null, SentryLevel? diagnosticLevel = null, - bool? reportAssemblies = null, + ReportAssembliesMode? reportAssembliesMode = null, DeduplicateMode? deduplicateMode = null, bool? initializeSdk = null, Dictionary? defaultTags = null) @@ -128,7 +128,7 @@ public static LoggerConfiguration Sentry( requestBodyCompressionBuffered, debug, diagnosticLevel, - reportAssemblies, + reportAssembliesMode, deduplicateMode, initializeSdk, defaultTags)); @@ -158,7 +158,7 @@ public static LoggerConfiguration Sentry( /// Whether the body compression is buffered and the request 'Content-Length' known in advance. /// Whether to log diagnostics messages. /// The diagnostics level to be used. - /// Whether or not to include referenced assemblies in each event sent to sentry. Defaults to . + /// What mode to use for reporting referenced assemblies in each event sent to sentry. Defaults to /// What modes to use for event automatic de-duplication. /// Whether to initialize this SDK through this integration. /// Defaults tags to add to all events. @@ -184,7 +184,7 @@ public static void ConfigureSentrySerilogOptions( bool? requestBodyCompressionBuffered = null, bool? debug = null, SentryLevel? diagnosticLevel = null, - bool? reportAssemblies = null, + ReportAssembliesMode? reportAssembliesMode = null, DeduplicateMode? deduplicateMode = null, bool? initializeSdk = null, Dictionary? defaultTags = null) @@ -289,11 +289,9 @@ public static void ConfigureSentrySerilogOptions( sentrySerilogOptions.DiagnosticLevel = diagnosticLevel.Value; } - if (reportAssemblies.HasValue) + if (reportAssembliesMode.HasValue) { -#pragma warning disable CS0618 // Type or member is obsolete - sentrySerilogOptions.ReportAssemblies = reportAssemblies.Value; -#pragma warning restore CS0618 // Type or member is obsolete + sentrySerilogOptions.ReportAssembliesMode = reportAssembliesMode.Value; } if (deduplicateMode.HasValue) diff --git a/src/Sentry/Platforms/Android/SentryOptions.cs b/src/Sentry/Platforms/Android/SentryOptions.cs index 2c352c729c..8807738b85 100644 --- a/src/Sentry/Platforms/Android/SentryOptions.cs +++ b/src/Sentry/Platforms/Android/SentryOptions.cs @@ -270,7 +270,7 @@ public void AddInAppInclude(string prefix){ public bool EnableAndroidSdkTracing { get; set; } = false; /// - /// Gets or sets a value that indicates if the callback will be invoked for + /// Gets or sets a value that indicates if the callback will be invoked for /// events that originate from the embedded Android SDK. The default value is false (disabled). /// /// diff --git a/src/Sentry/SentryOptions.cs b/src/Sentry/SentryOptions.cs index b4124017d2..ab48a28437 100644 --- a/src/Sentry/SentryOptions.cs +++ b/src/Sentry/SentryOptions.cs @@ -409,17 +409,6 @@ internal bool IsSentryRequest(Uri? requestUri) internal Func? BeforeSendInternal => _beforeSend; - /// - /// Configures a callback to invoke before sending an event to Sentry - /// - /// - [Obsolete("This property will be removed in a future version. Use SetBeforeSend instead.")] - public Func? BeforeSend - { - get => null; - set => _beforeSend = value is null ? null : (e, _) => value(e); - } - /// /// Configures a callback function to be invoked before sending an event to Sentry /// @@ -450,21 +439,6 @@ public void SetBeforeSend(Func beforeSend) internal Func? BeforeSendTransactionInternal => _beforeSendTransaction; - /// - /// A callback to invoke before sending a transaction to Sentry - /// - /// - /// The return of this transaction will be sent to Sentry. This allows the application - /// a chance to inspect and/or modify the transaction before it's sent. If the transaction - /// should not be sent at all, return null from the callback. - /// - [Obsolete("This property will be removed in a future version. Use SetBeforeSendTransaction instead.")] - public Func? BeforeSendTransaction - { - get => null; - set => _beforeSendTransaction = value is null ? null : (e, _) => value(e); - } - /// /// Configures a callback to invoke before sending a transaction to Sentry /// @@ -487,17 +461,6 @@ public void SetBeforeSendTransaction(Func beforeSendT internal Func? BeforeBreadcrumbInternal => _beforeBreadcrumb; - /// - /// Sets a callback function to be invoked when a breadcrumb is about to be stored. - /// - /// - [Obsolete("This property will be removed in a future version. Use SetBeforeBreadcrumb instead.")] - public Func? BeforeBreadcrumb - { - get => null; - set => _beforeBreadcrumb = value is null ? null : (e, _) => value(e); - } - /// /// Sets a callback function to be invoked when a breadcrumb is about to be stored. /// @@ -622,26 +585,6 @@ public int MaxCacheItems /// public IWebProxy? HttpProxy { get; set; } - /// - /// private field to hold the , since a typecheck or cast won't work here. - /// - private Func? _createClientHandler = null; - - /// - /// Creates the inner most . - /// Deprecated in favor of . - /// - [Obsolete("Use CreateHttpMessageHandler instead")] - public Func? CreateHttpClientHandler - { - get => _createClientHandler; - set - { - CreateHttpMessageHandler = value; - _createClientHandler = value; - } - } - /// /// Creates the inner most . /// @@ -702,17 +645,6 @@ public IDiagnosticLogger? DiagnosticLogger } } - /// - /// Whether or not to include referenced assemblies in each event sent to sentry. Defaults to . - /// - [Obsolete("Use ReportAssembliesMode instead", error: false)] - public bool ReportAssemblies - { - // Note: note marking this as error to prevent breaking changes, but this is now a wrapper around ReportAssembliesMode - get => ReportAssembliesMode != ReportAssembliesMode.None; - set => ReportAssembliesMode = value ? ReportAssembliesMode.Version : ReportAssembliesMode.None; - } - /// /// What mode to use for reporting referenced assemblies in each event sent to sentry. Defaults to . /// @@ -1029,17 +961,6 @@ public StackTraceMode StackTraceMode /// internal Instrumenter Instrumenter { get; set; } = Instrumenter.Sentry; - /// - /// This property is no longer used. It will be removed in a future version. - /// - /// - /// All exceptions are now sent to Sentry, including s. - /// The issue grouping rules in Sentry have been updated to accomodate "exception groups", - /// such as in .NET. - /// - [Obsolete("This property is no longer used. It will be removed in a future version.")] - public bool KeepAggregateException { get; set; } - /// /// Adds a to be used when serializing or deserializing /// objects to JSON with this SDK. For example, when custom context data might use diff --git a/src/Sentry/SentryOptionsExtensions.cs b/src/Sentry/SentryOptionsExtensions.cs index 5481047545..586aaacd2c 100644 --- a/src/Sentry/SentryOptionsExtensions.cs +++ b/src/Sentry/SentryOptionsExtensions.cs @@ -48,14 +48,6 @@ public static void DisableDiagnosticSourceIntegration(this SentryOptions options => options.RemoveDefaultIntegration(SentryOptions.DefaultIntegrations.SentryDiagnosticListenerIntegration); #endif - /// - /// Disables the capture of errors through . - /// - /// The SentryOptions to remove the integration from. - [Obsolete("Method has been renamed to DisableUnobservedTaskExceptionCapture. Please update usage.")] - public static void DisableTaskUnobservedTaskExceptionCapture(this SentryOptions options) => - options.DisableUnobservedTaskExceptionCapture(); - /// /// Disables the capture of errors through . /// diff --git a/test/Sentry.AspNetCore.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt b/test/Sentry.AspNetCore.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt index b9ab302f97..53a38b9bee 100644 --- a/test/Sentry.AspNetCore.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt +++ b/test/Sentry.AspNetCore.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt @@ -68,8 +68,6 @@ namespace Sentry.AspNetCore public class SentryAspNetCoreOptionsSetup : Microsoft.Extensions.Options.ConfigureFromConfigurationOptions { public SentryAspNetCoreOptionsSetup(Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfiguration providerConfiguration) { } - [System.Obsolete("Use constructor with no IHostingEnvironment")] - public SentryAspNetCoreOptionsSetup(Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfiguration providerConfiguration, Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment) { } public override void Configure(Sentry.AspNetCore.SentryAspNetCoreOptions options) { } } public static class SentryBuilderExtensions diff --git a/test/Sentry.AspNetCore.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt b/test/Sentry.AspNetCore.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt index b9ab302f97..53a38b9bee 100644 --- a/test/Sentry.AspNetCore.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt +++ b/test/Sentry.AspNetCore.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt @@ -68,8 +68,6 @@ namespace Sentry.AspNetCore public class SentryAspNetCoreOptionsSetup : Microsoft.Extensions.Options.ConfigureFromConfigurationOptions { public SentryAspNetCoreOptionsSetup(Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfiguration providerConfiguration) { } - [System.Obsolete("Use constructor with no IHostingEnvironment")] - public SentryAspNetCoreOptionsSetup(Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfiguration providerConfiguration, Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment) { } public override void Configure(Sentry.AspNetCore.SentryAspNetCoreOptions options) { } } public static class SentryBuilderExtensions diff --git a/test/Sentry.AspNetCore.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt b/test/Sentry.AspNetCore.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt index b9ab302f97..53a38b9bee 100644 --- a/test/Sentry.AspNetCore.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt +++ b/test/Sentry.AspNetCore.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt @@ -68,8 +68,6 @@ namespace Sentry.AspNetCore public class SentryAspNetCoreOptionsSetup : Microsoft.Extensions.Options.ConfigureFromConfigurationOptions { public SentryAspNetCoreOptionsSetup(Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfiguration providerConfiguration) { } - [System.Obsolete("Use constructor with no IHostingEnvironment")] - public SentryAspNetCoreOptionsSetup(Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfiguration providerConfiguration, Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment) { } public override void Configure(Sentry.AspNetCore.SentryAspNetCoreOptions options) { } } public static class SentryBuilderExtensions diff --git a/test/Sentry.AspNetCore.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.AspNetCore.Tests/ApiApprovalTests.Run.Net4_8.verified.txt index e5a886e55f..53a38b9bee 100644 --- a/test/Sentry.AspNetCore.Tests/ApiApprovalTests.Run.Net4_8.verified.txt +++ b/test/Sentry.AspNetCore.Tests/ApiApprovalTests.Run.Net4_8.verified.txt @@ -68,8 +68,6 @@ namespace Sentry.AspNetCore public class SentryAspNetCoreOptionsSetup : Microsoft.Extensions.Options.ConfigureFromConfigurationOptions { public SentryAspNetCoreOptionsSetup(Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfiguration providerConfiguration) { } - [System.Obsolete("Use constructor with no IHostingEnvironment")] - public SentryAspNetCoreOptionsSetup(Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfiguration providerConfiguration, Microsoft.AspNetCore.Hosting.IHostingEnvironment hostingEnvironment) { } public override void Configure(Sentry.AspNetCore.SentryAspNetCoreOptions options) { } } public static class SentryBuilderExtensions diff --git a/test/Sentry.Serilog.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt b/test/Sentry.Serilog.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt index 42ac3d8c67..a518be36cc 100644 --- a/test/Sentry.Serilog.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt +++ b/test/Sentry.Serilog.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt @@ -37,7 +37,7 @@ namespace Serilog bool? requestBodyCompressionBuffered = default, bool? debug = default, Sentry.SentryLevel? diagnosticLevel = default, - bool? reportAssemblies = default, + Sentry.ReportAssembliesMode? reportAssembliesMode = default, Sentry.DeduplicateMode? deduplicateMode = default, bool? initializeSdk = default, System.Collections.Generic.Dictionary? defaultTags = null) { } @@ -64,7 +64,7 @@ namespace Serilog bool? requestBodyCompressionBuffered = default, bool? debug = default, Sentry.SentryLevel? diagnosticLevel = default, - bool? reportAssemblies = default, + Sentry.ReportAssembliesMode? reportAssembliesMode = default, Sentry.DeduplicateMode? deduplicateMode = default, bool? initializeSdk = default, System.Collections.Generic.Dictionary? defaultTags = null) { } diff --git a/test/Sentry.Serilog.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt b/test/Sentry.Serilog.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt index 42ac3d8c67..a518be36cc 100644 --- a/test/Sentry.Serilog.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt +++ b/test/Sentry.Serilog.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt @@ -37,7 +37,7 @@ namespace Serilog bool? requestBodyCompressionBuffered = default, bool? debug = default, Sentry.SentryLevel? diagnosticLevel = default, - bool? reportAssemblies = default, + Sentry.ReportAssembliesMode? reportAssembliesMode = default, Sentry.DeduplicateMode? deduplicateMode = default, bool? initializeSdk = default, System.Collections.Generic.Dictionary? defaultTags = null) { } @@ -64,7 +64,7 @@ namespace Serilog bool? requestBodyCompressionBuffered = default, bool? debug = default, Sentry.SentryLevel? diagnosticLevel = default, - bool? reportAssemblies = default, + Sentry.ReportAssembliesMode? reportAssembliesMode = default, Sentry.DeduplicateMode? deduplicateMode = default, bool? initializeSdk = default, System.Collections.Generic.Dictionary? defaultTags = null) { } diff --git a/test/Sentry.Serilog.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt b/test/Sentry.Serilog.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt index 42ac3d8c67..a518be36cc 100644 --- a/test/Sentry.Serilog.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt +++ b/test/Sentry.Serilog.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt @@ -37,7 +37,7 @@ namespace Serilog bool? requestBodyCompressionBuffered = default, bool? debug = default, Sentry.SentryLevel? diagnosticLevel = default, - bool? reportAssemblies = default, + Sentry.ReportAssembliesMode? reportAssembliesMode = default, Sentry.DeduplicateMode? deduplicateMode = default, bool? initializeSdk = default, System.Collections.Generic.Dictionary? defaultTags = null) { } @@ -64,7 +64,7 @@ namespace Serilog bool? requestBodyCompressionBuffered = default, bool? debug = default, Sentry.SentryLevel? diagnosticLevel = default, - bool? reportAssemblies = default, + Sentry.ReportAssembliesMode? reportAssembliesMode = default, Sentry.DeduplicateMode? deduplicateMode = default, bool? initializeSdk = default, System.Collections.Generic.Dictionary? defaultTags = null) { } diff --git a/test/Sentry.Serilog.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.Serilog.Tests/ApiApprovalTests.Run.Net4_8.verified.txt index 42ac3d8c67..a518be36cc 100644 --- a/test/Sentry.Serilog.Tests/ApiApprovalTests.Run.Net4_8.verified.txt +++ b/test/Sentry.Serilog.Tests/ApiApprovalTests.Run.Net4_8.verified.txt @@ -37,7 +37,7 @@ namespace Serilog bool? requestBodyCompressionBuffered = default, bool? debug = default, Sentry.SentryLevel? diagnosticLevel = default, - bool? reportAssemblies = default, + Sentry.ReportAssembliesMode? reportAssembliesMode = default, Sentry.DeduplicateMode? deduplicateMode = default, bool? initializeSdk = default, System.Collections.Generic.Dictionary? defaultTags = null) { } @@ -64,7 +64,7 @@ namespace Serilog bool? requestBodyCompressionBuffered = default, bool? debug = default, Sentry.SentryLevel? diagnosticLevel = default, - bool? reportAssemblies = default, + Sentry.ReportAssembliesMode? reportAssembliesMode = default, Sentry.DeduplicateMode? deduplicateMode = default, bool? initializeSdk = default, System.Collections.Generic.Dictionary? defaultTags = null) { } diff --git a/test/Sentry.Serilog.Tests/SentrySerilogSinkExtensionsTests.cs b/test/Sentry.Serilog.Tests/SentrySerilogSinkExtensionsTests.cs index 006c17b748..6e68a4ee64 100644 --- a/test/Sentry.Serilog.Tests/SentrySerilogSinkExtensionsTests.cs +++ b/test/Sentry.Serilog.Tests/SentrySerilogSinkExtensionsTests.cs @@ -23,7 +23,7 @@ private class Fixture public bool RequestBodyCompressionBuffered { get; } = false; public bool Debug { get; } = true; public SentryLevel DiagnosticLevel { get; } = SentryLevel.Warning; - public bool ReportAssemblies { get; } = false; + public ReportAssembliesMode ReportAssembliesMode { get; } = ReportAssembliesMode.None; public DeduplicateMode DeduplicateMode { get; } = DeduplicateMode.SameExceptionInstance; public bool InitializeSdk { get; } = false; public LogEventLevel MinimumEventLevel { get; } = LogEventLevel.Verbose; @@ -71,7 +71,7 @@ public void ConfigureSentrySerilogOptions_WithMultipleParameters_MakesAppropriat var sut = Fixture.GetSut(); SentrySinkExtensions.ConfigureSentrySerilogOptions(sut, sendDefaultPii: _fixture.SendDefaultPii, - decompressionMethods: _fixture.DecompressionMethods, reportAssemblies: _fixture.ReportAssemblies, sampleRate: _fixture.SampleRate); + decompressionMethods: _fixture.DecompressionMethods, reportAssembliesMode: _fixture.ReportAssembliesMode, sampleRate: _fixture.SampleRate); // Fail early AssertNotEqualDeep(_fixture.Options, sut); @@ -79,9 +79,7 @@ public void ConfigureSentrySerilogOptions_WithMultipleParameters_MakesAppropriat // Compare individual properties Assert.Equal(_fixture.SendDefaultPii, sut.SendDefaultPii); Assert.Equal(_fixture.DecompressionMethods, sut.DecompressionMethods); -#pragma warning disable CS0618 // Type or member is obsolete - Assert.Equal(_fixture.ReportAssemblies, sut.ReportAssemblies); -#pragma warning restore CS0618 // Type or member is obsolete + Assert.Equal(_fixture.ReportAssembliesMode, sut.ReportAssembliesMode); Assert.Equal(_fixture.SampleRate, sut.SampleRate); } @@ -96,7 +94,7 @@ public void ConfigureSentrySerilogOptions_WithAllParameters_MakesAppropriateChan _fixture.SampleRate, _fixture.Release, _fixture.Environment, _fixture.MaxQueueItems, _fixture.ShutdownTimeout, _fixture.DecompressionMethods, _fixture.RequestBodyCompressionLevel, _fixture.RequestBodyCompressionBuffered, _fixture.Debug, _fixture.DiagnosticLevel, - _fixture.ReportAssemblies, _fixture.DeduplicateMode, _fixture.InitializeSdk); + _fixture.ReportAssembliesMode, _fixture.DeduplicateMode, _fixture.InitializeSdk); // Fail early AssertNotEqualDeep(_fixture.Options, sut); @@ -118,9 +116,7 @@ public void ConfigureSentrySerilogOptions_WithAllParameters_MakesAppropriateChan Assert.Equal(_fixture.RequestBodyCompressionBuffered, sut.RequestBodyCompressionBuffered); Assert.Equal(_fixture.Debug, sut.Debug); Assert.Equal(_fixture.DiagnosticLevel, sut.DiagnosticLevel); -#pragma warning disable CS0618 // Type or member is obsolete - Assert.Equal(_fixture.ReportAssemblies, sut.ReportAssemblies); -#pragma warning restore CS0618 // Type or member is obsolete + Assert.Equal(_fixture.ReportAssembliesMode, sut.ReportAssembliesMode); Assert.Equal(_fixture.DeduplicateMode, sut.DeduplicateMode); Assert.Equal(_fixture.InitializeSdk, sut.InitializeSdk); Assert.Equal(_fixture.MinimumEventLevel, sut.MinimumEventLevel); diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt index 39648308f6..237db27cab 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt @@ -607,20 +607,10 @@ namespace Sentry public bool AutoSessionTracking { get; set; } public System.TimeSpan AutoSessionTrackingInterval { get; set; } public Sentry.Extensibility.IBackgroundWorker? BackgroundWorker { get; set; } - [System.Obsolete("This property will be removed in a future version. Use SetBeforeBreadcrumb instea" + - "d.")] - public System.Func? BeforeBreadcrumb { get; set; } - [System.Obsolete("This property will be removed in a future version. Use SetBeforeSend instead.")] - public System.Func? BeforeSend { get; set; } - [System.Obsolete("This property will be removed in a future version. Use SetBeforeSendTransaction i" + - "nstead.")] - public System.Func? BeforeSendTransaction { get; set; } public string? CacheDirectoryPath { get; set; } public bool CaptureFailedRequests { get; set; } public System.Action? ConfigureClient { get; set; } public System.Func? CrashedLastRun { get; set; } - [System.Obsolete("Use CreateHttpMessageHandler instead")] - public System.Func? CreateHttpClientHandler { get; set; } public System.Func? CreateHttpMessageHandler { get; set; } public bool Debug { get; set; } public System.Net.DecompressionMethods DecompressionMethods { get; set; } @@ -642,16 +632,12 @@ namespace Sentry public bool IsEnvironmentUser { get; set; } public bool IsGlobalModeEnabled { get; set; } public bool JsonPreserveReferences { get; set; } - [System.Obsolete("This property is no longer used. It will be removed in a future version.")] - public bool KeepAggregateException { get; set; } public long MaxAttachmentSize { get; set; } public int MaxBreadcrumbs { get; set; } public int MaxCacheItems { get; set; } public int MaxQueueItems { get; set; } public Sentry.Extensibility.INetworkStatusListener? NetworkStatusListener { get; set; } public string? Release { get; set; } - [System.Obsolete("Use ReportAssembliesMode instead", false)] - public bool ReportAssemblies { get; set; } public Sentry.ReportAssembliesMode ReportAssembliesMode { get; set; } public bool RequestBodyCompressionBuffered { get; set; } public System.IO.Compression.CompressionLevel RequestBodyCompressionLevel { get; set; } @@ -701,9 +687,6 @@ namespace Sentry public static void DisableAppDomainUnhandledExceptionCapture(this Sentry.SentryOptions options) { } public static void DisableDiagnosticSourceIntegration(this Sentry.SentryOptions options) { } public static void DisableDuplicateEventDetection(this Sentry.SentryOptions options) { } - [System.Obsolete("Method has been renamed to DisableUnobservedTaskExceptionCapture. Please update " + - "usage.")] - public static void DisableTaskUnobservedTaskExceptionCapture(this Sentry.SentryOptions options) { } public static void DisableUnobservedTaskExceptionCapture(this Sentry.SentryOptions options) { } public static void DisableWinUiUnhandledExceptionIntegration(this Sentry.SentryOptions options) { } public static System.Collections.Generic.IEnumerable GetAllEventProcessors(this Sentry.SentryOptions options) { } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt index 39648308f6..237db27cab 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt @@ -607,20 +607,10 @@ namespace Sentry public bool AutoSessionTracking { get; set; } public System.TimeSpan AutoSessionTrackingInterval { get; set; } public Sentry.Extensibility.IBackgroundWorker? BackgroundWorker { get; set; } - [System.Obsolete("This property will be removed in a future version. Use SetBeforeBreadcrumb instea" + - "d.")] - public System.Func? BeforeBreadcrumb { get; set; } - [System.Obsolete("This property will be removed in a future version. Use SetBeforeSend instead.")] - public System.Func? BeforeSend { get; set; } - [System.Obsolete("This property will be removed in a future version. Use SetBeforeSendTransaction i" + - "nstead.")] - public System.Func? BeforeSendTransaction { get; set; } public string? CacheDirectoryPath { get; set; } public bool CaptureFailedRequests { get; set; } public System.Action? ConfigureClient { get; set; } public System.Func? CrashedLastRun { get; set; } - [System.Obsolete("Use CreateHttpMessageHandler instead")] - public System.Func? CreateHttpClientHandler { get; set; } public System.Func? CreateHttpMessageHandler { get; set; } public bool Debug { get; set; } public System.Net.DecompressionMethods DecompressionMethods { get; set; } @@ -642,16 +632,12 @@ namespace Sentry public bool IsEnvironmentUser { get; set; } public bool IsGlobalModeEnabled { get; set; } public bool JsonPreserveReferences { get; set; } - [System.Obsolete("This property is no longer used. It will be removed in a future version.")] - public bool KeepAggregateException { get; set; } public long MaxAttachmentSize { get; set; } public int MaxBreadcrumbs { get; set; } public int MaxCacheItems { get; set; } public int MaxQueueItems { get; set; } public Sentry.Extensibility.INetworkStatusListener? NetworkStatusListener { get; set; } public string? Release { get; set; } - [System.Obsolete("Use ReportAssembliesMode instead", false)] - public bool ReportAssemblies { get; set; } public Sentry.ReportAssembliesMode ReportAssembliesMode { get; set; } public bool RequestBodyCompressionBuffered { get; set; } public System.IO.Compression.CompressionLevel RequestBodyCompressionLevel { get; set; } @@ -701,9 +687,6 @@ namespace Sentry public static void DisableAppDomainUnhandledExceptionCapture(this Sentry.SentryOptions options) { } public static void DisableDiagnosticSourceIntegration(this Sentry.SentryOptions options) { } public static void DisableDuplicateEventDetection(this Sentry.SentryOptions options) { } - [System.Obsolete("Method has been renamed to DisableUnobservedTaskExceptionCapture. Please update " + - "usage.")] - public static void DisableTaskUnobservedTaskExceptionCapture(this Sentry.SentryOptions options) { } public static void DisableUnobservedTaskExceptionCapture(this Sentry.SentryOptions options) { } public static void DisableWinUiUnhandledExceptionIntegration(this Sentry.SentryOptions options) { } public static System.Collections.Generic.IEnumerable GetAllEventProcessors(this Sentry.SentryOptions options) { } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt index 39648308f6..237db27cab 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt @@ -607,20 +607,10 @@ namespace Sentry public bool AutoSessionTracking { get; set; } public System.TimeSpan AutoSessionTrackingInterval { get; set; } public Sentry.Extensibility.IBackgroundWorker? BackgroundWorker { get; set; } - [System.Obsolete("This property will be removed in a future version. Use SetBeforeBreadcrumb instea" + - "d.")] - public System.Func? BeforeBreadcrumb { get; set; } - [System.Obsolete("This property will be removed in a future version. Use SetBeforeSend instead.")] - public System.Func? BeforeSend { get; set; } - [System.Obsolete("This property will be removed in a future version. Use SetBeforeSendTransaction i" + - "nstead.")] - public System.Func? BeforeSendTransaction { get; set; } public string? CacheDirectoryPath { get; set; } public bool CaptureFailedRequests { get; set; } public System.Action? ConfigureClient { get; set; } public System.Func? CrashedLastRun { get; set; } - [System.Obsolete("Use CreateHttpMessageHandler instead")] - public System.Func? CreateHttpClientHandler { get; set; } public System.Func? CreateHttpMessageHandler { get; set; } public bool Debug { get; set; } public System.Net.DecompressionMethods DecompressionMethods { get; set; } @@ -642,16 +632,12 @@ namespace Sentry public bool IsEnvironmentUser { get; set; } public bool IsGlobalModeEnabled { get; set; } public bool JsonPreserveReferences { get; set; } - [System.Obsolete("This property is no longer used. It will be removed in a future version.")] - public bool KeepAggregateException { get; set; } public long MaxAttachmentSize { get; set; } public int MaxBreadcrumbs { get; set; } public int MaxCacheItems { get; set; } public int MaxQueueItems { get; set; } public Sentry.Extensibility.INetworkStatusListener? NetworkStatusListener { get; set; } public string? Release { get; set; } - [System.Obsolete("Use ReportAssembliesMode instead", false)] - public bool ReportAssemblies { get; set; } public Sentry.ReportAssembliesMode ReportAssembliesMode { get; set; } public bool RequestBodyCompressionBuffered { get; set; } public System.IO.Compression.CompressionLevel RequestBodyCompressionLevel { get; set; } @@ -701,9 +687,6 @@ namespace Sentry public static void DisableAppDomainUnhandledExceptionCapture(this Sentry.SentryOptions options) { } public static void DisableDiagnosticSourceIntegration(this Sentry.SentryOptions options) { } public static void DisableDuplicateEventDetection(this Sentry.SentryOptions options) { } - [System.Obsolete("Method has been renamed to DisableUnobservedTaskExceptionCapture. Please update " + - "usage.")] - public static void DisableTaskUnobservedTaskExceptionCapture(this Sentry.SentryOptions options) { } public static void DisableUnobservedTaskExceptionCapture(this Sentry.SentryOptions options) { } public static void DisableWinUiUnhandledExceptionIntegration(this Sentry.SentryOptions options) { } public static System.Collections.Generic.IEnumerable GetAllEventProcessors(this Sentry.SentryOptions options) { } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt index b74651c7f0..cd39043dd6 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt @@ -605,20 +605,10 @@ namespace Sentry public bool AutoSessionTracking { get; set; } public System.TimeSpan AutoSessionTrackingInterval { get; set; } public Sentry.Extensibility.IBackgroundWorker? BackgroundWorker { get; set; } - [System.Obsolete("This property will be removed in a future version. Use SetBeforeBreadcrumb instea" + - "d.")] - public System.Func? BeforeBreadcrumb { get; set; } - [System.Obsolete("This property will be removed in a future version. Use SetBeforeSend instead.")] - public System.Func? BeforeSend { get; set; } - [System.Obsolete("This property will be removed in a future version. Use SetBeforeSendTransaction i" + - "nstead.")] - public System.Func? BeforeSendTransaction { get; set; } public string? CacheDirectoryPath { get; set; } public bool CaptureFailedRequests { get; set; } public System.Action? ConfigureClient { get; set; } public System.Func? CrashedLastRun { get; set; } - [System.Obsolete("Use CreateHttpMessageHandler instead")] - public System.Func? CreateHttpClientHandler { get; set; } public System.Func? CreateHttpMessageHandler { get; set; } public bool Debug { get; set; } public System.Net.DecompressionMethods DecompressionMethods { get; set; } @@ -640,16 +630,12 @@ namespace Sentry public bool IsEnvironmentUser { get; set; } public bool IsGlobalModeEnabled { get; set; } public bool JsonPreserveReferences { get; set; } - [System.Obsolete("This property is no longer used. It will be removed in a future version.")] - public bool KeepAggregateException { get; set; } public long MaxAttachmentSize { get; set; } public int MaxBreadcrumbs { get; set; } public int MaxCacheItems { get; set; } public int MaxQueueItems { get; set; } public Sentry.Extensibility.INetworkStatusListener? NetworkStatusListener { get; set; } public string? Release { get; set; } - [System.Obsolete("Use ReportAssembliesMode instead", false)] - public bool ReportAssemblies { get; set; } public Sentry.ReportAssembliesMode ReportAssembliesMode { get; set; } public bool RequestBodyCompressionBuffered { get; set; } public System.IO.Compression.CompressionLevel RequestBodyCompressionLevel { get; set; } @@ -699,9 +685,6 @@ namespace Sentry public static void DisableAppDomainUnhandledExceptionCapture(this Sentry.SentryOptions options) { } public static void DisableDuplicateEventDetection(this Sentry.SentryOptions options) { } public static void DisableNetFxInstallationsIntegration(this Sentry.SentryOptions options) { } - [System.Obsolete("Method has been renamed to DisableUnobservedTaskExceptionCapture. Please update " + - "usage.")] - public static void DisableTaskUnobservedTaskExceptionCapture(this Sentry.SentryOptions options) { } public static void DisableUnobservedTaskExceptionCapture(this Sentry.SentryOptions options) { } public static System.Collections.Generic.IEnumerable GetAllEventProcessors(this Sentry.SentryOptions options) { } public static System.Collections.Generic.IEnumerable GetAllExceptionProcessors(this Sentry.SentryOptions options) { } diff --git a/test/Sentry.Tests/Internals/MainSentryEventProcessorTests.cs b/test/Sentry.Tests/Internals/MainSentryEventProcessorTests.cs index bc52a9d6d4..201c041e19 100644 --- a/test/Sentry.Tests/Internals/MainSentryEventProcessorTests.cs +++ b/test/Sentry.Tests/Internals/MainSentryEventProcessorTests.cs @@ -373,10 +373,7 @@ public void Process_Modules_NotEmpty() [Fact] public void Process_Modules_IsEmpty_WhenSpecified() { - // Note: this property is obsolete, test is kept for backwards compatibility check -#pragma warning disable CS0618 // Type or member is obsolete - _fixture.SentryOptions.ReportAssemblies = false; -#pragma warning restore CS0618 // Type or member is obsolete + _fixture.SentryOptions.ReportAssembliesMode = ReportAssembliesMode.None; var sut = _fixture.GetSut(); var evt = new SentryEvent(); From 67d0b9600704265a80abf592b3ba316d472b6f51 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Wed, 15 Nov 2023 13:56:17 +0100 Subject: [PATCH 2/3] Updated CHANGELOG.md --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c751b837d5..de88f48511 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,14 @@ Additionally, we're dropping support for some of the old target frameworks, plea - Obsolete setter `Sentry.PlatformAbstractions.Runtime.Identifier` has been removed ([2764](https://github.com/getsentry/sentry-dotnet/pull/2764)) - `Sentry.Values` is now internal as it is never exposed in the public API ([#2771](https://github.com/getsentry/sentry-dotnet/pull/2771)) - `TracePropagationTarget` class has been removed, use the `SubstringOrRegexPattern` class instead. ([#2763](https://github.com/getsentry/sentry-dotnet/pull/2763)) +- A number of `[Obsolete]` options have been removed ([#2841](https://github.com/getsentry/sentry-dotnet/pull/2841)) + - `BeforeSend` - use `SetBeforeSend` instead. + - `BeforeSendTransaction` - use `SetBeforeSendTransaction` instead. + - `BeforeBreadcrumb` - use `SetBeforeBreadcrumb` instead. + - `CreateHttpClientHandler` - use `CreateHttpMessageHandler` instead. + - `ReportAssemblies` - use `ReportAssembliesMode` instead. + - `KeepAggregateException` - This property is no longer used and has no replacement. + - `DisableTaskUnobservedTaskExceptionCapture` method has been renamed to `DisableUnobservedTaskExceptionCapture`. #### Changed APIs From 7accb2874d378d30dd2dfc04742a84c3a121cf0f Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 16 Nov 2023 10:40:57 +0100 Subject: [PATCH 3/3] comment --- src/Sentry/Platforms/Android/SentryOptions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Sentry/Platforms/Android/SentryOptions.cs b/src/Sentry/Platforms/Android/SentryOptions.cs index 8807738b85..5a90c892e3 100644 --- a/src/Sentry/Platforms/Android/SentryOptions.cs +++ b/src/Sentry/Platforms/Android/SentryOptions.cs @@ -270,8 +270,8 @@ public void AddInAppInclude(string prefix){ public bool EnableAndroidSdkTracing { get; set; } = false; /// - /// Gets or sets a value that indicates if the callback will be invoked for - /// events that originate from the embedded Android SDK. The default value is false (disabled). + /// Gets or sets a value that indicates if the BeforeSend callback set in + /// will be invoked for events that originate from the embedded Android SDK. The default value is false (disabled). /// /// /// This is an experimental feature and is imperfect, as the .NET SDK and the embedded Android SDK don't