From e213706ea10c70904084596f4c80e1389e9d6e43 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 6 Nov 2023 11:58:27 +1300 Subject: [PATCH 1/7] Added IsAotCompatible for uncomplicated projects --- .../DbConcurrencyExceptionProcessor.cs | 2 +- .../Sentry.EntityFramework.csproj | 14 +++++++++++--- src/Sentry.Log4Net/Sentry.Log4Net.csproj | 6 +++++- src/Sentry.Log4Net/SentryAppender.cs | 2 +- src/Sentry.NLog/Sentry.NLog.csproj | 4 ++++ .../Sentry.OpenTelemetry.csproj | 16 ++++++++++------ src/Sentry.Profiling/Sentry.Profiling.csproj | 4 ++++ src/Sentry.Serilog/Sentry.Serilog.csproj | 4 ++++ 8 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/Sentry.EntityFramework/ErrorProcessors/DbConcurrencyExceptionProcessor.cs b/src/Sentry.EntityFramework/ErrorProcessors/DbConcurrencyExceptionProcessor.cs index 0269d2e989..bdbd0ac2e9 100644 --- a/src/Sentry.EntityFramework/ErrorProcessors/DbConcurrencyExceptionProcessor.cs +++ b/src/Sentry.EntityFramework/ErrorProcessors/DbConcurrencyExceptionProcessor.cs @@ -11,6 +11,6 @@ public class DbConcurrencyExceptionProcessor : SentryEventExceptionProcessor - net462;netstandard2.1 + net6.0;net462;netstandard2.1 Official Entity Framework 6 integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time. $(PackageTags);EntityFramework;EF;EF6 + + true + + @@ -21,8 +25,8 @@ - - + + @@ -32,6 +36,10 @@ + + + + diff --git a/src/Sentry.Log4Net/Sentry.Log4Net.csproj b/src/Sentry.Log4Net/Sentry.Log4Net.csproj index aebe69096e..2d76eef152 100644 --- a/src/Sentry.Log4Net/Sentry.Log4Net.csproj +++ b/src/Sentry.Log4Net/Sentry.Log4Net.csproj @@ -1,12 +1,16 @@  - netstandard2.0;net462 + net6.0;netstandard2.0;net462 $(PackageTags);Logging;log4net Official log4net integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time. true + + true + + diff --git a/src/Sentry.Log4Net/SentryAppender.cs b/src/Sentry.Log4Net/SentryAppender.cs index a8e954dfe8..74b7a94a74 100644 --- a/src/Sentry.Log4Net/SentryAppender.cs +++ b/src/Sentry.Log4Net/SentryAppender.cs @@ -93,7 +93,7 @@ protected override void Append(LoggingEvent loggingEvent) var level = loggingEvent.ToBreadcrumbLevel(); IDictionary data = GetLoggingEventProperties(loggingEvent) .Where(kvp => kvp.Value != null) - .ToDictionary(kvp => kvp.Key, kvp => kvp.Value!.ToString()); + .ToDictionary(kvp => kvp.Key, kvp => kvp.Value!.ToString()!); _hub.AddBreadcrumb(message, category, type: null, data, level ?? default); return; diff --git a/src/Sentry.NLog/Sentry.NLog.csproj b/src/Sentry.NLog/Sentry.NLog.csproj index 2fa5734366..c81d5bd233 100644 --- a/src/Sentry.NLog/Sentry.NLog.csproj +++ b/src/Sentry.NLog/Sentry.NLog.csproj @@ -7,6 +7,10 @@ true + + true + + diff --git a/src/Sentry.OpenTelemetry/Sentry.OpenTelemetry.csproj b/src/Sentry.OpenTelemetry/Sentry.OpenTelemetry.csproj index 9485d10d5e..e8d81f6ed8 100644 --- a/src/Sentry.OpenTelemetry/Sentry.OpenTelemetry.csproj +++ b/src/Sentry.OpenTelemetry/Sentry.OpenTelemetry.csproj @@ -7,17 +7,21 @@ enable + + true + + - + - + - - - - + + + + diff --git a/src/Sentry.Profiling/Sentry.Profiling.csproj b/src/Sentry.Profiling/Sentry.Profiling.csproj index c82782e5cc..3ebc7344d4 100644 --- a/src/Sentry.Profiling/Sentry.Profiling.csproj +++ b/src/Sentry.Profiling/Sentry.Profiling.csproj @@ -9,6 +9,10 @@ Performance profiling support for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time. + + true + + diff --git a/src/Sentry.Serilog/Sentry.Serilog.csproj b/src/Sentry.Serilog/Sentry.Serilog.csproj index 419ec6d496..7abb79e979 100644 --- a/src/Sentry.Serilog/Sentry.Serilog.csproj +++ b/src/Sentry.Serilog/Sentry.Serilog.csproj @@ -7,6 +7,10 @@ true + + true + + From 9fc70970d9ff961845f87ad5402dca5131fb800b Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 6 Nov 2023 13:59:32 +1300 Subject: [PATCH 2/7] Update CHANGELOG.md --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7c8121c29..0397bcfc5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -78,11 +78,12 @@ without native/platform specific bindings and SDKs. See [this ticket for more de - `ISpan` and `ITransaction` have been renamed to `ISpanTracer` and `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)) - Removed obsolete setter from `Sentry.PlatformAbstractions.Runtime.Identifier` ([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)) -- The Sentry core package now supports AOT compilation for .NET 7+. There are some functional differences when compiling AOT: +- AOT compilation support for .NET 7+ has been added to Sentry, Sentry.Serilog, Sentry.Profiling, Sentry.OpenTelemetry, + Sentry.NLog, Sentry.Log4Net and Sentry.EntityFramework. There are some functional differences when compiling AOT: - Enhanced Stack Traces are not available when compiling AOT, as the mechanism to generate these ehanced stack traces currently relies heavily on reflection and isn't compatible with trimming. - Reflection cannot be leveraged for JSON Serialization and you may need to supply a `JsonSerializationContext` for types that you'd like to send to Sentry (e.g. in the Span.Context). You can use `SentryOptions.AddJsonSerializerContext` to supply your own context when initializing Sentry. - When compiling AOT, Sentry isn't able to automatically register an unhandled exception handler in WinUI applications, since that also relies on reflection. If you're using Sentry with a WinUI application and you want to use AOT compilation, you'll need to take care of registering the unhandled event handler yourself. TODO *** Fill in the gaps here when https://github.com/getsentry/sentry-dotnet/issues/2778 has been completed *** - - ([#2732](https://github.com/getsentry/sentry-dotnet/pull/2732)) + - ([#2732](https://github.com/getsentry/sentry-dotnet/pull/2732)), ([#2793](https://github.com/getsentry/sentry-dotnet/pull/2793)) - The TracePropagationTarget class has been removed. Use the SubstringOrRegexPattern class instead. ([#2763](https://github.com/getsentry/sentry-dotnet/pull/2763)) #### Sentry.Google.Cloud.Functions From 8ee6a189c8ae0549e9b0933f0d910f04838f8e42 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Tue, 7 Nov 2023 10:03:10 +1300 Subject: [PATCH 3/7] Update src/Sentry.Log4Net/SentryAppender.cs Co-authored-by: Bruno Garcia --- src/Sentry.Log4Net/SentryAppender.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sentry.Log4Net/SentryAppender.cs b/src/Sentry.Log4Net/SentryAppender.cs index 74b7a94a74..bdc1785ab3 100644 --- a/src/Sentry.Log4Net/SentryAppender.cs +++ b/src/Sentry.Log4Net/SentryAppender.cs @@ -93,7 +93,7 @@ protected override void Append(LoggingEvent loggingEvent) var level = loggingEvent.ToBreadcrumbLevel(); IDictionary data = GetLoggingEventProperties(loggingEvent) .Where(kvp => kvp.Value != null) - .ToDictionary(kvp => kvp.Key, kvp => kvp.Value!.ToString()!); + .ToDictionary(kvp => kvp.Key, kvp => kvp.Value!.ToString() ?? ""); _hub.AddBreadcrumb(message, category, type: null, data, level ?? default); return; From 8552fc5c86525d0098613c542f298f8f622e7960 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Tue, 7 Nov 2023 10:03:22 +1300 Subject: [PATCH 4/7] Update src/Sentry.EntityFramework/ErrorProcessors/DbConcurrencyExceptionProcessor.cs Co-authored-by: Bruno Garcia --- .../ErrorProcessors/DbConcurrencyExceptionProcessor.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Sentry.EntityFramework/ErrorProcessors/DbConcurrencyExceptionProcessor.cs b/src/Sentry.EntityFramework/ErrorProcessors/DbConcurrencyExceptionProcessor.cs index bdbd0ac2e9..4495350bda 100644 --- a/src/Sentry.EntityFramework/ErrorProcessors/DbConcurrencyExceptionProcessor.cs +++ b/src/Sentry.EntityFramework/ErrorProcessors/DbConcurrencyExceptionProcessor.cs @@ -11,6 +11,9 @@ public class DbConcurrencyExceptionProcessor : SentryEventExceptionProcessor Date: Tue, 7 Nov 2023 20:58:46 +1300 Subject: [PATCH 5/7] Removed IsAotCompatible from legacy integrations --- src/Sentry.EntityFramework/Sentry.EntityFramework.csproj | 6 +----- src/Sentry.Log4Net/Sentry.Log4Net.csproj | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/Sentry.EntityFramework/Sentry.EntityFramework.csproj b/src/Sentry.EntityFramework/Sentry.EntityFramework.csproj index d4f5cc8a32..069e011978 100644 --- a/src/Sentry.EntityFramework/Sentry.EntityFramework.csproj +++ b/src/Sentry.EntityFramework/Sentry.EntityFramework.csproj @@ -1,15 +1,11 @@  - net6.0;net462;netstandard2.1 + net462;netstandard2.1 Official Entity Framework 6 integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time. $(PackageTags);EntityFramework;EF;EF6 - - true - - diff --git a/src/Sentry.Log4Net/Sentry.Log4Net.csproj b/src/Sentry.Log4Net/Sentry.Log4Net.csproj index 2d76eef152..aebe69096e 100644 --- a/src/Sentry.Log4Net/Sentry.Log4Net.csproj +++ b/src/Sentry.Log4Net/Sentry.Log4Net.csproj @@ -1,16 +1,12 @@  - net6.0;netstandard2.0;net462 + netstandard2.0;net462 $(PackageTags);Logging;log4net Official log4net integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time. true - - true - - From e1a132f6c3e6e8aae96e9f3d9009414c836ae7c7 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Tue, 7 Nov 2023 23:11:06 +1300 Subject: [PATCH 6/7] Update CHANGELOG.md --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0397bcfc5b..513dd0498d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -78,8 +78,7 @@ without native/platform specific bindings and SDKs. See [this ticket for more de - `ISpan` and `ITransaction` have been renamed to `ISpanTracer` and `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)) - Removed obsolete setter from `Sentry.PlatformAbstractions.Runtime.Identifier` ([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)) -- AOT compilation support for .NET 7+ has been added to Sentry, Sentry.Serilog, Sentry.Profiling, Sentry.OpenTelemetry, - Sentry.NLog, Sentry.Log4Net and Sentry.EntityFramework. There are some functional differences when compiling AOT: +- AOT compilation support for .NET 7+ has been added to Sentry, Sentry.Serilog, Sentry.Profiling, Sentry.OpenTelemetry and Sentry.NLog. There are some functional differences when compiling AOT: - Enhanced Stack Traces are not available when compiling AOT, as the mechanism to generate these ehanced stack traces currently relies heavily on reflection and isn't compatible with trimming. - Reflection cannot be leveraged for JSON Serialization and you may need to supply a `JsonSerializationContext` for types that you'd like to send to Sentry (e.g. in the Span.Context). You can use `SentryOptions.AddJsonSerializerContext` to supply your own context when initializing Sentry. - When compiling AOT, Sentry isn't able to automatically register an unhandled exception handler in WinUI applications, since that also relies on reflection. If you're using Sentry with a WinUI application and you want to use AOT compilation, you'll need to take care of registering the unhandled event handler yourself. TODO *** Fill in the gaps here when https://github.com/getsentry/sentry-dotnet/issues/2778 has been completed *** From 00fd12510bd5a7cec79ebeae695f6eb53a57e09d Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Wed, 8 Nov 2023 14:44:04 +1300 Subject: [PATCH 7/7] Reverting changes to Sentry.EntityFramework.csproj --- src/Sentry.EntityFramework/Sentry.EntityFramework.csproj | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Sentry.EntityFramework/Sentry.EntityFramework.csproj b/src/Sentry.EntityFramework/Sentry.EntityFramework.csproj index 069e011978..db3b8faf4b 100644 --- a/src/Sentry.EntityFramework/Sentry.EntityFramework.csproj +++ b/src/Sentry.EntityFramework/Sentry.EntityFramework.csproj @@ -21,8 +21,8 @@ - - + + @@ -32,10 +32,6 @@ - - - -