Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IsAotCompatible for uncomplicated projects #2793

Merged
merged 7 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ 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<T>` 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 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 ***
- ([#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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ public class DbConcurrencyExceptionProcessor : SentryEventExceptionProcessor<DBC
protected internal override void ProcessException(DBConcurrencyException exception, SentryEvent sentryEvent)
{
sentryEvent.SetExtra("Row Count", exception.RowCount);
sentryEvent.SetExtra("Row Error", exception.Row.RowError);
if (exception.Row is { } row)
{
sentryEvent.SetExtra("Row Error", row.RowError);
}
}
}
2 changes: 1 addition & 1 deletion src/Sentry.Log4Net/SentryAppender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected override void Append(LoggingEvent loggingEvent)
var level = loggingEvent.ToBreadcrumbLevel();
IDictionary<string, string> 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;
Expand Down
4 changes: 4 additions & 0 deletions src/Sentry.NLog/Sentry.NLog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<CLSCompliant>true</CLSCompliant>
</PropertyGroup>

<PropertyGroup Condition="'$(FrameworkSupportsAot)' == 'true'">
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NLog" Version="5.0.5" />
</ItemGroup>
Expand Down
16 changes: 10 additions & 6 deletions src/Sentry.OpenTelemetry/Sentry.OpenTelemetry.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,21 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<PropertyGroup Condition="'$(FrameworkSupportsAot)' == 'true'">
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="OpenTelemetry" Version="1.5.0" />
<ProjectReference Include="..\Sentry\Sentry.csproj" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Sentry\Sentry.csproj" />
<PackageReference Include="OpenTelemetry" Version="1.5.0" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="Sentry.OpenTelemetry.AspNetCore" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.OpenTelemetry.Tests" PublicKey="$(SentryPublicKey)" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Sentry.OpenTelemetry.AspNetCore" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.OpenTelemetry.Tests" PublicKey="$(SentryPublicKey)" />
</ItemGroup>

</Project>
4 changes: 4 additions & 0 deletions src/Sentry.Profiling/Sentry.Profiling.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
<Description>Performance profiling support for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time.</Description>
</PropertyGroup>

<PropertyGroup Condition="'$(FrameworkSupportsAot)' == 'true'">
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Sentry\Sentry.csproj" />
<PackageReference Include="Microsoft.Diagnostics.NETCore.Client" Version="0.2.421201" />
Expand Down
4 changes: 4 additions & 0 deletions src/Sentry.Serilog/Sentry.Serilog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<CLSCompliant>true</CLSCompliant>
</PropertyGroup>

<PropertyGroup Condition="'$(FrameworkSupportsAot)' == 'true'">
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Sentry\Sentry.csproj" />
</ItemGroup>
Expand Down
Loading