Skip to content

Commit

Permalink
chore: Bump .NET SDK 4.1.2 (#1488)
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsandfoxes authored Feb 21, 2024
1 parent 764a732 commit 8ed9dbd
Show file tree
Hide file tree
Showing 27 changed files with 198 additions and 57 deletions.
104 changes: 104 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,112 @@

## Unreleased

This major release is based on the .NET 4.0 release and includes features like [Metrics](https://docs.sentry.io/platforms/dotnet/metrics/)(preview) and [Spotlight](https://spotlightjs.com/).

### Significant change in behavior

- Transactions' spans are no longer automatically finished with the status `deadline_exceeded` by the transaction. This is now handled by the [Relay](https://github.com/getsentry/relay).
- Customers self hosting Sentry must use verion 22.12.0 or later ([#3013](https://github.com/getsentry/sentry-dotnet/pull/3013))
- The `User.IpAddress` is now set to `{{auto}}` by default, even when sendDefaultPII is disabled ([#2981](https://github.com/getsentry/sentry-dotnet/pull/2981))
- The "Prevent Storing of IP Addresses" option in the "Security & Privacy" project settings on sentry.io can be used to control this instead
- The `DiagnosticLogger` signature for `LogWarning` changed to take the `exception` as the first parameter. That way it no longer gets mixed up with the TArgs. ([#2987](https://github.com/getsentry/sentry-dotnet/pull/2987))

### API breaking Changes

If you have compilation errors you can find the affected types or overloads missing in the changelog entries below.

#### Changed APIs

- Class renamed from `Sentry.Attachment` to `Sentry.SentryAttachment` ([#3116](https://github.com/getsentry/sentry-dotnet/pull/3116))
- Class renamed from `Sentry.Constants` to `Sentry.SentryConstants` ([#3125](https://github.com/getsentry/sentry-dotnet/pull/3125))
- Class renamed from `Sentry.Context` to `Sentry.SentryContext` ([#3121](https://github.com/getsentry/sentry-dotnet/pull/3121))
- Class renamed from `Sentry.Hint` to `Sentry.SentryHint` ([#3116](https://github.com/getsentry/sentry-dotnet/pull/3116))
- Class renamed from `Sentry.Package` to `Sentry.SentryPackage` ([#3121](https://github.com/getsentry/sentry-dotnet/pull/3121))
- Class renamed from `Sentry.Request` to `Sentry.SentryRequest` ([#3121](https://github.com/getsentry/sentry-dotnet/pull/3121))
- Class renamed from `Sentry.Runtime` to `Sentry.SentryRuntime` ([#3016](https://github.com/getsentry/sentry-dotnet/pull/3016))
- Class renamed from `Sentry.Session` to `Sentry.SentrySession` ([#3110](https://github.com/getsentry/sentry-dotnet/pull/3110))
- Class renamed from `Sentry.Span` to `Sentry.SentrySpan` ([#3021](https://github.com/getsentry/sentry-dotnet/pull/3021))
- Class renamed from `Sentry.Transaction` to `Sentry.SentryTransaction` ([#3023](https://github.com/getsentry/sentry-dotnet/pull/3023))
- Class renamed from `Sentry.User` to `Sentry.SentryUser` ([#3015](https://github.com/getsentry/sentry-dotnet/pull/3015))
- Interface renamed from `Sentry.IJsonSerializable` to `Sentry.ISentryJsonSerializable` ([#3116](https://github.com/getsentry/sentry-dotnet/pull/3116))
- Interface renamed from `Sentry.ISession` to `Sentry.ISentrySession` ([#3110](https://github.com/getsentry/sentry-dotnet/pull/3110))
- `SentryClient.Dispose` is no longer obsolete ([#2842](https://github.com/getsentry/sentry-dotnet/pull/2842))
- `ISentryClient.CaptureEvent` overloads have been replaced by a single method accepting optional `Hint` and `Scope` parameters. You will need to pass `hint` as a named parameter from code that calls `CaptureEvent` without passing a `scope` argument. ([#2749](https://github.com/getsentry/sentry-dotnet/pull/2749))
- `ITransaction` has been renamed to `ITransactionTracer`. You will need to update any references to these interfaces in your code to use the new interface names ([#2731](https://github.com/getsentry/sentry-dotnet/pull/2731), [#2870](https://github.com/getsentry/sentry-dotnet/pull/2870))
- `TransactionContext` and `SpanContext` constructors were updated. If you're constructing instances of these classes, you will need to adjust the order in which you pass parameters to these. ([#2694](https://github.com/getsentry/sentry-dotnet/pull/2694), [#2696](https://github.com/getsentry/sentry-dotnet/pull/2696))
- The `DiagnosticLogger` signature for `LogError` and `LogFatal` changed to take the `exception` as the first parameter. That way it no longer gets mixed up with the TArgs. The `DiagnosticLogger` now also receives an overload for `LogError` and `LogFatal` that accepts a message only. ([#2715](https://github.com/getsentry/sentry-dotnet/pull/2715))
- `Distribution` added to `IEventLike`. ([#2660](https://github.com/getsentry/sentry-dotnet/pull/2660))
- `StackFrame`'s `ImageAddress`, `InstructionAddress`, and `FunctionId` changed to `long?`. ([#2691](https://github.com/getsentry/sentry-dotnet/pull/2691))
- `DebugImage` and `DebugMeta` moved to `Sentry.Protocol` namespace. ([#2815](https://github.com/getsentry/sentry-dotnet/pull/2815))
- `DebugImage.ImageAddress` changed to `long?`. ([#2725](https://github.com/getsentry/sentry-dotnet/pull/2725))
- Contexts now inherit from `IDictionary` rather than `ConcurrentDictionary`. The specific dictionary being used is an implementation detail. ([#2729](https://github.com/getsentry/sentry-dotnet/pull/2729))

#### Removed APIs

- SentrySinkExtensions.ConfigureSentrySerilogOptions is now internal. If you were using this method, please use one of the `SentrySinkExtensions.Sentry` extension methods instead. ([#2902](https://github.com/getsentry/sentry-dotnet/pull/2902))
- 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.
- `DisableTaskUnobservedTaskExceptionCapture` method has been renamed to `DisableUnobservedTaskExceptionCapture`.
- `DebugDiagnosticLogger` - use `TraceDiagnosticLogger` instead.
- `KeepAggregateException` - this property is no longer used and has no replacement.
- `ReportAssemblies` - use `ReportAssembliesMode` 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), [#2840](https://github.com/getsentry/sentry-dotnet/pull/2840))
- `IHasMeasurements` has been removed, use `ISpanData` instead. ([#2659](https://github.com/getsentry/sentry-dotnet/pull/2659))
- `IHasBreadcrumbs` has been removed, use `IEventLike` instead. ([#2670](https://github.com/getsentry/sentry-dotnet/pull/2670))
- `ISpanContext` has been removed, use `ITraceContext` instead. ([#2668](https://github.com/getsentry/sentry-dotnet/pull/2668))
- `IHasTransactionNameSource` has been removed, use `ITransactionContext` instead. ([#2654](https://github.com/getsentry/sentry-dotnet/pull/2654))
- ([#2694](https://github.com/getsentry/sentry-dotnet/pull/2694))
- The unused `StackFrame.InstructionOffset` has been removed. ([#2691](https://github.com/getsentry/sentry-dotnet/pull/2691))
- The unused `Scope.Platform` property has been removed. ([#2695](https://github.com/getsentry/sentry-dotnet/pull/2695))
- The obsolete setter `Sentry.PlatformAbstractions.Runtime.Identifier` has been removed ([2764](https://github.com/getsentry/sentry-dotnet/pull/2764))
- `Sentry.Values<T>` is now internal as it is never exposed in the public API ([#2771](https://github.com/getsentry/sentry-dotnet/pull/2771))
- The `TracePropagationTarget` class has been removed, use the `SubstringOrRegexPattern` class instead. ([#2763](https://github.com/getsentry/sentry-dotnet/pull/2763))
- The `WithScope` and `WithScopeAsync` methods have been removed. We have discovered that these methods didn't work correctly in certain desktop contexts, especially when using a global scope. ([#2717](https://github.com/getsentry/sentry-dotnet/pull/2717))
Replace your usage of `WithScope` with overloads of `Capture*` methods:

- `SentrySdk.CaptureEvent(SentryEvent @event, Action<Scope> scopeCallback)`
- `SentrySdk.CaptureMessage(string message, Action<Scope> scopeCallback)`
- `SentrySdk.CaptureException(Exception exception, Action<Scope> scopeCallback)`

```c#
// Before
SentrySdk.WithScope(scope =>
{
scope.SetTag("key", "value");
SentrySdk.CaptureEvent(new SentryEvent());
});

// After
SentrySdk.CaptureEvent(new SentryEvent(), scope =>
{
// Configure your scope here
scope.SetTag("key", "value");
});
```

### Features

- Experimental pre-release availability of Metrics. We're exploring the use of Metrics in Sentry. The API will very likely change and we don't yet have any documentation. ([#2949](https://github.com/getsentry/sentry-dotnet/pull/2949))
- `SentrySdk.Metrics.Set` now additionally accepts `string` as value ([#3092](https://github.com/getsentry/sentry-dotnet/pull/3092))
- Timing metrics can now be captured with `SentrySdk.Metrics.StartTimer` ([#3075](https://github.com/getsentry/sentry-dotnet/pull/3075))
- Support for [Spotlight](https://spotlightjs.com/), a debug tool for local development. ([#2961](https://github.com/getsentry/sentry-dotnet/pull/2961))
- Enable it with the option `EnableSpotlight`
- Optionally configure the URL to connect via `SpotlightUrl`. Defaults to `http://localhost:8969/stream`.

### Dependencies

- Bump .NET SDK from v3.41.3 to v4.0.0 [#1505](https://github.com/getsentry/sentry-unity/pull/1488)
- [changelog](https://github.com/getsentry/sentry-dotnet/blob/main/CHANGELOG.md#400)
- [diff](https://github.com/getsentry/sentry-dotnet/compare/3.41.3...4.0.0)
- Bump CLI from v2.24.1 to v2.28.6 ([#1534](https://github.com/getsentry/sentry-unity/pull/1534), [#1539](https://github.com/getsentry/sentry-unity/pull/1539), [#1540](https://github.com/getsentry/sentry-unity/pull/1540), [#1542](https://github.com/getsentry/sentry-unity/pull/1542), [#1547](https://github.com/getsentry/sentry-unity/pull/1547), [#1560](https://github.com/getsentry/sentry-unity/pull/1560), [#1562](https://github.com/getsentry/sentry-unity/pull/1562))
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2286)
- [diff](https://github.com/getsentry/sentry-cli/compare/2.24.1...2.28.6)
Expand Down
2 changes: 1 addition & 1 deletion samples/unity-of-bugs/Assets/Scripts/AdditionalButtons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public void SetUser()
{
SentrySdk.ConfigureScope(s =>
{
s.User = new User
s.User = new SentryUser
{
Email = "[email protected]",
Username = "ant",
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry.Unity.Android/AndroidJavaScopeObserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public override void UnsetTagImpl(string key)
sentry.CallStatic("removeTag", key);
}

public override void SetUserImpl(User user)
public override void SetUserImpl(SentryUser user)
{
AndroidJNI.AttachCurrentThread();

Expand Down
2 changes: 1 addition & 1 deletion src/Sentry.Unity.Android/SentryNativeAndroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static void Configure(SentryUnityOptions options, ISentryUnityInfo sentry
catch (Exception e)
{
options.DiagnosticLogger?.LogError(
"Failed to reinstall backend. Captured native crashes will miss scope data and tag.", e);
e, "Failed to reinstall backend. Captured native crashes will miss scope data and tag.");
}

options.NativeSupportCloseCallback = () => Close(options.DiagnosticLogger);
Expand Down
4 changes: 2 additions & 2 deletions src/Sentry.Unity.Editor.iOS/BuildPostProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ internal static void SetupNoOpBridge(IDiagnosticLogger logger, string pathToProj
}
catch (Exception e)
{
logger.LogError("Failed to add the Sentry NoOp bridge to the output project.", e);
logger.LogError(e, "Failed to add the Sentry NoOp bridge to the output project.");
}
}

Expand Down Expand Up @@ -133,7 +133,7 @@ internal static void SetupSentry(SentryUnityOptions options,
}
catch (Exception e)
{
logger.LogError("Failed to add the Sentry framework to the generated Xcode project", e);
logger.LogError(e, "Failed to add the Sentry framework to the generated Xcode project");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ internal void AddAndroidSdkDependencies(string gradleProjectPath)
}
catch (Exception e)
{
_logger.LogError($"Failed to {(nativeSupportEnabled ? "add" : "remove")} Android Dependencies in the gradle project", e);
_logger.LogError(e, $"Failed to {(nativeSupportEnabled ? "add" : "remove")} Android Dependencies in the gradle project");
}
}

Expand Down Expand Up @@ -277,7 +277,7 @@ internal void SetupSymbolsUpload(string unityProjectPath, string gradleProjectPa
}
catch (Exception e)
{
_logger.LogError("Failed to add the automatic symbols upload to the gradle project", e);
_logger.LogError(e, "Failed to add the automatic symbols upload to the gradle project");
}
}

Expand All @@ -299,7 +299,7 @@ private void SetupProguard(string gradleProjectPath)
}
catch (Exception e)
{
_logger.LogError($"Failed to {(nativeSupportEnabled ? "add" : "remove")} Proguard rules in the gradle project", e);
_logger.LogError(e, $"Failed to {(nativeSupportEnabled ? "add" : "remove")} Proguard rules in the gradle project");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public void OnPostBuildPlayerScriptDLLs(BuildReport report)
}
catch (Exception e)
{
logger.LogError("Failed to add the performance auto instrumentation. " +
"The assembly has not been modified.", e);
logger.LogError(e, "Failed to add the performance auto instrumentation. " +
"The assembly has not been modified.");
}

stopwatch.Stop();
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry.Unity.Editor/Native/BuildPostProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static void OnPostProcessBuild(BuildTarget target, string executablePath)
}
catch (Exception e)
{
logger.LogError("Failed to add the Sentry native integration to the built application", e);
logger.LogError(e, "Failed to add the Sentry native integration to the built application");
throw new BuildFailedException("Sentry Native BuildPostProcess failed");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry.Unity.Native/NativeScopeObserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public override void SetExtraImpl(string key, string? value) =>

public override void UnsetTagImpl(string key) => C.sentry_remove_tag(key);

public override void SetUserImpl(User user)
public override void SetUserImpl(SentryUser user)
{
// see https://develop.sentry.dev/sdk/event-payloads/user/
var cUser = C.sentry_value_new_object();
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry.Unity.Native/SentryNative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static void Configure(SentryUnityOptions options, ISentryUnityInfo sentry
options.DefaultUserId = AnalyticsSessionInfo.userId;
if (options.DefaultUserId is not null)
{
options.ScopeObserver.SetUser(new User { Id = options.DefaultUserId });
options.ScopeObserver.SetUser(new SentryUser { Id = options.DefaultUserId });
}

// Note: we must actually call the function now and on every other call use the value we get here.
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry.Unity.Native/SentryNativeBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private static void nativeLogImpl(int cLevel, IntPtr format, IntPtr args, IntPtr
}
catch (Exception err)
{
logger.LogError("Exception in native log forwarder.", err);
logger.LogError(err, "Exception in native log forwarder.");
}

if (message == null)
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry.Unity.iOS/NativeScopeObserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public override void SetExtraImpl(string key, string? value) =>

public override void UnsetTagImpl(string key) => SentryCocoaBridgeProxy.SentryNativeBridgeUnsetTag(key);

public override void SetUserImpl(User user) =>
public override void SetUserImpl(SentryUser user) =>
SentryCocoaBridgeProxy.SentryNativeBridgeSetUser(user.Email, user.Id, user.IpAddress, user.Username);

public override void UnsetUserImpl() => SentryCocoaBridgeProxy.SentryNativeBridgeUnsetUser();
Expand Down
7 changes: 6 additions & 1 deletion src/Sentry.Unity/ContextWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ internal abstract class ContextWriter
{
public void Write(Scope scope)
{
var unityContext = (Protocol.Unity)scope.Contexts.GetOrAdd(Protocol.Unity.Type, _ => new Protocol.Unity());
if (!scope.Contexts.TryGetValue(Protocol.Unity.Type, out var getThatUnityContext))
{
getThatUnityContext = new Protocol.Unity();
}
var unityContext = (Protocol.Unity)getThatUnityContext;

WriteScope(
scope.Contexts.App.StartTime?.ToString("o"),
scope.Contexts.App.BuildType,
Expand Down
Loading

0 comments on commit 8ed9dbd

Please sign in to comment.