Skip to content

Commit

Permalink
chore: remove obsolete APIs (#2856)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Nov 17, 2023
1 parent 128e372 commit 12e23cb
Show file tree
Hide file tree
Showing 26 changed files with 24 additions and 366 deletions.
20 changes: 19 additions & 1 deletion CHANGELOG.md
Expand Up @@ -16,8 +16,26 @@
- `BeforeBreadcrumb` - use `SetBeforeBreadcrumb` instead.
- `CreateHttpClientHandler` - use `CreateHttpMessageHandler` instead.
- `ReportAssemblies` - use `ReportAssembliesMode` instead.
- `KeepAggregateException` - This property is no longer used and has no replacement.
- `KeepAggregateException` - this property is no longer used and has no replacement.
- `DisableTaskUnobservedTaskExceptionCapture` method has been renamed to `DisableUnobservedTaskExceptionCapture`.
- `DebugDiagnosticLogger` - use `TraceDiagnosticLogger` instead.
- A number of iOS/Android-specific `[Obsolete]` options have been removed ([#2856](https://github.com/getsentry/sentry-dotnet/pull/2856))
- `Distribution` - use `SentryOptions.Distribution` instead.
- `EnableAutoPerformanceTracking` - use `SetBeforeSendTransaction` instead.
- `EnableCoreDataTracking` - use `EnableCoreDataTracing` instead.
- `EnableFileIOTracking` - use `EnableFileIOTracing` instead.
- `EnableOutOfMemoryTracking` - use `EnableWatchdogTerminationTracking` instead.
- `EnableUIViewControllerTracking` - use `EnableUIViewControllerTracing` instead.
- `StitchAsyncCode` - no longer available.
- `ProfilingTracesInterval` - no longer available.
- `ProfilingEnabled` - use `ProfilesSampleRate` instead.
- Obsolete `SystemClock` constructor removed, use `SystemClock.Clock` instead. ([#2856](https://github.com/getsentry/sentry-dotnet/pull/2856))
- Obsolete `Runtime.Clone()` removed, this shouldn't have been public in the past and has no replacement. ([#2856](https://github.com/getsentry/sentry-dotnet/pull/2856))
- Obsolete `SentryException.Data` removed, use `SentryException.Mechanism.Data` instead. ([#2856](https://github.com/getsentry/sentry-dotnet/pull/2856))
- Obsolete `AssemblyExtensions` removed, this shouldn't have been public in the past and has no replacement. ([#2856](https://github.com/getsentry/sentry-dotnet/pull/2856))
- Obsolete `SentryDatabaseLogging.UseBreadcrumbs()` removed, it is called automatically and has no replacement. ([#2856](https://github.com/getsentry/sentry-dotnet/pull/2856))
- Obsolete `Scope.GetSpan()` removed, use `Span` property instead. ([#2856](https://github.com/getsentry/sentry-dotnet/pull/2856))
- Obsolete `IUserFactory` removed, use `ISentryUserFactory` instead. ([#2856](https://github.com/getsentry/sentry-dotnet/pull/2856))

#### Changed APIs

Expand Down
2 changes: 0 additions & 2 deletions src/Sentry.AspNetCore/DefaultUserFactory.cs
Expand Up @@ -2,9 +2,7 @@

namespace Sentry.AspNetCore;

#pragma warning disable CS0618
internal class DefaultUserFactory : IUserFactory, ISentryUserFactory
#pragma warning restore CS0618
{
private readonly IHttpContextAccessor? _httpContextAccessor;

Expand Down
Expand Up @@ -23,9 +23,7 @@ public static ISentryBuilder AddSentry(this IServiceCollection services)
services.AddSingleton<ISentryEventExceptionProcessor, AspNetCoreExceptionProcessor>();

services.AddHttpContextAccessor();
#pragma warning disable CS0618
services.TryAddSingleton<IUserFactory, DefaultUserFactory>();
#pragma warning restore CS0618
services.TryAddSingleton<ISentryUserFactory, DefaultUserFactory>();

services
Expand Down
3 changes: 1 addition & 2 deletions src/Sentry.AspNetCore/IUserFactory.cs
Expand Up @@ -5,8 +5,7 @@ namespace Sentry.AspNetCore;
/// <summary>
/// Sentry User Factory
/// </summary>
[Obsolete("This interface is tightly coupled to AspNetCore and will be removed in version 4.0.0. Please consider using ISentryUserFactory with IHttpContextAccessor instead.")]
public interface IUserFactory
internal interface IUserFactory
{
/// <summary>
/// Creates a <see cref="User"/> from the <see cref="HttpContext"/>
Expand Down
2 changes: 0 additions & 2 deletions src/Sentry.AspNetCore/ScopeExtensions.cs
Expand Up @@ -38,10 +38,8 @@ public static void Populate(this Scope scope, HttpContext context, SentryAspNetC

if (options.SendDefaultPii && !scope.HasUser())
{
#pragma warning disable CS0618
var userFactory = context.RequestServices.GetService<IUserFactory>();
var user = userFactory?.Create(context);
#pragma warning restore CS0618

if (user != null)
{
Expand Down
11 changes: 1 addition & 10 deletions src/Sentry.EntityFramework/SentryDatabaseLogging.cs
Expand Up @@ -3,19 +3,10 @@ namespace Sentry.EntityFramework;
/// <summary>
/// Sentry Database Logger
/// </summary>
public static class SentryDatabaseLogging
internal static class SentryDatabaseLogging
{
private static int Init;

/// <summary>
/// Adds an instance of <see cref="SentryCommandInterceptor"/> to <see cref="DbInterception"/>
/// This is a static setup call, so make sure you only call it once for each <see cref="IQueryLogger"/> instance you want to register globally
/// </summary>
/// <param name="logger">Query Logger.</param>
[Obsolete("This method is called automatically by options.AddEntityFramework. This method will be removed in future versions.")]
public static SentryCommandInterceptor? UseBreadcrumbs(IQueryLogger? logger = null)
=> UseBreadcrumbs(logger, true);

internal static SentryCommandInterceptor? UseBreadcrumbs(
IQueryLogger? queryLogger = null,
bool initOnce = true,
Expand Down
21 changes: 0 additions & 21 deletions src/Sentry/Infrastructure/DebugDiagnosticLogger.cs

This file was deleted.

7 changes: 1 addition & 6 deletions src/Sentry/Infrastructure/SystemClock.cs
Expand Up @@ -12,17 +12,12 @@ public sealed class SystemClock : ISystemClock
/// <remarks>
/// This constructor should have been private originally. It will be removed in a future major version.
/// </remarks>
[Obsolete("This constructor will become private in a future major version. Use the `SystemClock.Clock` singleton instead.")]
public SystemClock()
{
}
private SystemClock() {}

/// <summary>
/// System clock singleton.
/// </summary>
#pragma warning disable CS0618
public static readonly SystemClock Clock = new();
#pragma warning restore CS0618

/// <summary>
/// Gets the current time in UTC.
Expand Down
28 changes: 0 additions & 28 deletions src/Sentry/Platforms/Android/SentryOptions.cs
Expand Up @@ -143,13 +143,6 @@ internal AndroidOptions(SentryOptions options)
/// </remarks>
public bool EnableUserInteractionTracing { get; set; } = false;

/// <summary>
/// Deprecated.
/// </summary>
[Obsolete("This property is deprecated and ignored.")]
public TimeSpan ProfilingTracesInterval { get; set; }


// ---------- From SentryOptions.java ----------

/// <summary>
Expand All @@ -164,16 +157,6 @@ internal AndroidOptions(SentryOptions options)
/// </summary>
public TimeSpan ConnectionTimeout { get; set; } = TimeSpan.FromSeconds(5);

/// <summary>
/// The distribution of the application, associated with the release set in <see cref="Release"/>.
/// </summary>
[Obsolete("Use SentryOptions.Distribution instead. This property will be removed in a future version.")]
public string? Distribution
{
get => _options.Distribution;
set => _options.Distribution = value;
}

/// <summary>
/// Gets or sets a value that indicates if the NDK (Android Native Development Kit) is enabled.
/// The default value is <c>true</c> (enabled).
Expand Down Expand Up @@ -201,17 +184,6 @@ internal AndroidOptions(SentryOptions options)
/// </summary>
public bool PrintUncaughtStackTrace { get; set; } = false;

/// <summary>
/// Gets or sets if profiling is enabled for transactions.
/// The default value is <c>false</c> (disabled).
/// </summary>
[Obsolete("Use ProfilesSampleRate instead")]
public bool ProfilingEnabled
{
get => (ProfilesSampleRate ?? 0.0) > 0.0;
set => ProfilesSampleRate = value ? 1.0 : null;
}

/// <summary>
/// Gets or sets the profiling sample rate, between 0.0 and 1.0.
/// The default value is <c>null</c> (disabled).
Expand Down
119 changes: 0 additions & 119 deletions src/Sentry/Platforms/iOS/SentryOptions.cs
Expand Up @@ -56,16 +56,6 @@ internal IosOptions(SentryOptions options)
/// </remarks>
public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(3);

/// <summary>
/// The distribution of the application, associated with the release set in <see cref="Release"/>.
/// </summary>
[Obsolete("Use SentryOptions.Distribution instead. This property will be removed in a future version.")]
public string? Distribution
{
get => _options.Distribution;
set => _options.Distribution = value;
}

/// <summary>
/// When enabled, the SDK tracks when the application stops responding for a specific amount of
/// time defined by the <see cref="AppHangTimeoutInterval"/> option.
Expand Down Expand Up @@ -97,23 +87,6 @@ internal IosOptions(SentryOptions options)
/// </remarks>
public bool EnableAutoPerformanceTracing { get; set; } = true;

/// <summary>
/// When enabled, the SDK tracks performance for <see cref="UIViewController"/> subclasses and HTTP requests
/// automatically. It also measures the app start and slow and frozen frames.
/// The default value is <c>true</c> (enabled).
/// </summary>
/// <remarks>
/// Performance Monitoring must be enabled for this option to take effect.
/// See: https://docs.sentry.io/platforms/apple/performance/
/// And: https://docs.sentry.io/platforms/apple/performance/instrumentation/automatic-instrumentation/#opt-out
/// </remarks>
[Obsolete("Use EnableAutoPerformanceTracing instead. This property will be removed in a future version.")]
public bool EnableAutoPerformanceTracking
{
get => EnableAutoPerformanceTracing;
set => EnableAutoPerformanceTracing = value;
}

/// <summary>
/// When enabled, the SDK tracks the performance of Core Data operations.
/// It requires enabling performance monitoring.
Expand All @@ -125,22 +98,6 @@ public bool EnableAutoPerformanceTracking
/// </remarks>
public bool EnableCoreDataTracing { get; set; } = true;

/// <summary>
/// When enabled, the SDK tracks the performance of Core Data operations.
/// It requires enabling performance monitoring.
/// The default value is <c>true</c> (enabled).
/// </summary>
/// <remarks>
/// Performance Monitoring must be enabled for this option to take effect.
/// See https://docs.sentry.io/platforms/apple/performance/instrumentation/automatic-instrumentation/#core-data-instrumentation
/// </remarks>
[Obsolete("Use EnableCoreDataTracing instead. This property will be removed in a future version.")]
public bool EnableCoreDataTracking
{
get => EnableCoreDataTracing;
set => EnableCoreDataTracing = value;
}

/// <summary>
/// When enabled, the SDK tracks performance for file IO reads and writes with <see cref="NSData"/>
/// if auto performance tracking and <see cref="EnableSwizzling"/> are enabled.
Expand All @@ -151,21 +108,6 @@ public bool EnableCoreDataTracking
/// </remarks>
public bool EnableFileIOTracing { get; set; } = true;

/// <summary>
/// When enabled, the SDK tracks performance for file IO reads and writes with <see cref="NSData"/>
/// if auto performance tracking and <see cref="EnableSwizzling"/> are enabled.
/// The default value is <c>true</c> (enabled).
/// </summary>
/// <remarks>
/// See https://docs.sentry.io/platforms/apple/performance/instrumentation/automatic-instrumentation/#file-io-instrumentation
/// </remarks>
[Obsolete("Use EnableFileIOTracing instead. This property will be removed in a future version.")]
public bool EnableFileIOTracking
{
get => EnableFileIOTracing;
set => EnableFileIOTracing = value;
}

/// <summary>
/// When enabled, the SDK adds breadcrumbs for each network request
/// if auto performance tracking and <see cref="EnableSwizzling"/> are enabled.
Expand All @@ -192,20 +134,6 @@ public bool EnableFileIOTracking
/// </remarks>
public bool EnableWatchdogTerminationTracking { get; set; } = true;

/// <summary>
/// Whether to enable out of memory tracking or not.
/// The default value is <c>true</c> (enabled).
/// </summary>
/// <remarks>
/// https://docs.sentry.io/platforms/apple/configuration/out-of-memory/
/// </remarks>
[Obsolete("Use EnableWatchdogTerminationTracking instead. This property will be removed in a future version.")]
public bool EnableOutOfMemoryTracking
{
get => EnableWatchdogTerminationTracking;
set => EnableWatchdogTerminationTracking = value;
}

/// <summary>
/// Whether the SDK should use swizzling or not.
/// The default value is <c>true</c> (enabled).
Expand All @@ -228,20 +156,6 @@ public bool EnableOutOfMemoryTracking
/// </remarks>
public bool EnableUIViewControllerTracing { get; set; } = true;

/// <summary>
/// When enabled, the SDK tracks performance for <see cref="UIViewController"/> subclasses.
/// The default value is <c>true</c> (enabled).
/// </summary>
/// <remarks>
/// See https://docs.sentry.io/platforms/apple/performance/instrumentation/automatic-instrumentation/#uiviewcontroller-instrumentation
/// </remarks>
[Obsolete("Use EnableUIViewControllerTracing instead.")]
public bool EnableUIViewControllerTracking
{
get => EnableUIViewControllerTracing;
set => EnableUIViewControllerTracing = value;
}

/// <summary>
/// When enabled, the SDK creates transactions for UI events like buttons clicks, switch toggles,
/// and other UI elements that uses <see cref="UIControl.SendAction(Selector, NSObject?, UIEvent?)"/>.
Expand All @@ -252,28 +166,6 @@ public bool EnableUIViewControllerTracking
/// </remarks>
public bool EnableUserInteractionTracing { get; set; } = false;

/// <summary>
/// This feature is no longer available. This option does nothing and will be removed in a future release.
/// </summary>
/// <remarks>
/// This was removed from the Cocoa SDK in 8.6.0 with https://github.com/getsentry/sentry-cocoa/pull/2973
/// </remarks>
[Obsolete("This feature is no longer available. This option does nothing and will be removed in a future release.")]
public bool StitchAsyncCode { get; set; } = false;

// /// <summary>
// /// This gets called shortly after the initialization of the SDK when the last program execution
// /// terminated with a crash. It is not guaranteed that this is called on the main thread.
// /// </summary>
// /// <remarks>
// /// This callback is only executed once during the entire run of the program to avoid
// /// multiple callbacks if there are multiple crash events to send. This can happen when the program
// /// terminates with a crash before the SDK can send the crash event.
// /// You can use <see cref="BeforeSend"/> if you prefer a callback for every event.
// /// See also https://docs.sentry.io/platforms/apple/enriching-events/user-feedback/
// /// </remarks>
// public Action<SentryEvent>? OnCrashedLastRun { get; set; } = null;

/// <summary>
/// When provided, this will be set as delegate on the <see cref="NSUrlSession"/> used for network
/// data-transfer tasks performed by the native Sentry Cocoa SDK.
Expand All @@ -292,17 +184,6 @@ public bool EnableUIViewControllerTracking
/// </summary>
public bool EnableCocoaSdkTracing { get; set; } = false;

// /// <summary>
// /// Gets or sets a value that indicates if the <see cref="BeforeSend"/> callback will be invoked for
// /// events that originate from the embedded Cocoa SDK. The default value is <c>false</c> (disabled).
// /// </summary>
// /// <remarks>
// /// This is an experimental feature and is imperfect, as the .NET SDK and the embedded Cocoa SDK don't
// /// implement all of the same features that may be present in the event graph. Some optional elements may
// /// be stripped away during the round-tripping between the two SDKs. Use with caution.
// /// </remarks>
// public bool EnableCocoaSdkBeforeSend { get; set; }

internal List<string>? InAppExcludes { get; private set; }
internal List<string>? InAppIncludes { get; private set; }

Expand Down
4 changes: 1 addition & 3 deletions src/Sentry/Protocol/Runtime.cs
Expand Up @@ -51,9 +51,7 @@ public sealed class Runtime : IJsonSerializable, ICloneable<Runtime>, IUpdatable
/// <summary>
/// Clones this instance
/// </summary>
// NOTE: This appears to have been public by mistake
[Obsolete("This method will be made internal in a future version.")]
public Runtime Clone() => ((ICloneable<Runtime>)this).Clone();
internal Runtime Clone() => ((ICloneable<Runtime>)this).Clone();

Runtime ICloneable<Runtime>.Clone()
=> new()
Expand Down
10 changes: 0 additions & 10 deletions src/Sentry/Protocol/SentryException.cs
Expand Up @@ -43,16 +43,6 @@ public sealed class SentryException : IJsonSerializable
/// <see href="https://develop.sentry.dev/sdk/event-payloads/exception/#exception-mechanism"/>
public Mechanism? Mechanism { get; set; }

/// <summary>
/// Arbitrary extra data that is related to this error.
/// </summary>
/// <remarks>
/// This property is obsolete and should no longer be used.
/// Anything added here will be ignored and not sent to Sentry.
/// </remarks>
[Obsolete("Use SentryException.Mechanism.Data instead. This property will be removed in a future version.")]
public IDictionary<string, object?> Data { get; } = new Dictionary<string, object?>(StringComparer.Ordinal);

/// <inheritdoc />
public void WriteTo(Utf8JsonWriter writer, IDiagnosticLogger? logger)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Sentry/Reflection/AssemblyExtensions.cs
Expand Up @@ -4,8 +4,7 @@ namespace Sentry.Reflection;
/// Extension methods to <see cref="Assembly"/>.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Should not be public. This method will be removed in version 4.")]
public static class AssemblyExtensions
internal static class AssemblyExtensions
{
/// <summary>
/// Get the assemblies Name and Version.
Expand Down

0 comments on commit 12e23cb

Please sign in to comment.