Skip to content

Commit fb13b03

Browse files
committed
Merge branch 'main' into feat/ios-native-profiling
2 parents ba4982a + a2fa21f commit fb13b03

File tree

74 files changed

+1389
-893
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1389
-893
lines changed

CHANGELOG.md

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,48 @@
22

33
## Unreleased
44

5+
### API breaking Changes
6+
7+
#### Changed APIs
8+
9+
- Rename iOS and MacCatalyst platform specific options from `Cocoa` to `Native` ([#2940](https://github.com/getsentry/sentry-dotnet/pull/2940))
10+
- Rename iOS platform specific options `EnableCocoaSdkTracing` to `EnableTracing` ([#2940](https://github.com/getsentry/sentry-dotnet/pull/2940))
11+
- Rename Android platform specific options from `Android` to `Native` ([#2940](https://github.com/getsentry/sentry-dotnet/pull/2940))
12+
- Rename Android platform specific options `EnableAndroidSdkTracing` and `EnableAndroidSdkBeforeSend` to `EnableTracing` and `EnableBeforeSend` respectively ([#2940](https://github.com/getsentry/sentry-dotnet/pull/2940))
13+
14+
### Dependencies
15+
16+
- Bump Cocoa SDK from v8.17.0 to v8.17.1 ([#2936](https://github.com/getsentry/sentry-dotnet/pull/2936))
17+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8171)
18+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.17.0...8.17.1)
19+
20+
## 4.0.0-beta.3
21+
22+
### Fixes
23+
24+
- Reworked automatic breadcrumb creation for MAUI. ([#2900](https://github.com/getsentry/sentry-dotnet/pull/2900))
25+
- The SDK no longer uses on reflection to bind to all public element events. This also fixes issues where the SDK would consume third-party events.
26+
- Added `CreateElementEventsBreadcrumbs` to the SentryMauiOptions to allow users to opt-in automatic breadcrumb creation for `BindingContextChanged`, `ChildAdded`, `ChildRemoved` and `ParentChanged` on `Element`.
27+
- Reduced amount of automatic breadcrumbs by limiting the amount of bindings created in `VisualElement`, `Window`, `Shell`, `Page` and `Button`.
28+
- Fixed Sentry SDK has not been initialised when using ASP.NET Core, Serilog and OpenTelemetry ([#2911](https://github.com/getsentry/sentry-dotnet/pull/2911))
29+
530
### Features
631

732
- Native crash reporting on NativeAOT published apps (Windows, Linux, macOS). ([#2887](https://github.com/getsentry/sentry-dotnet/pull/2887))
33+
- Android: By default attaches LogCat logs to unhandled exceptions. Configurable via `SentryOptions.Android.LogCatIntegration` and `SentryOptions.Android.LogCatMaxLines`. Available when targeting `net7.0-android` or later, on API level 23 or later. ([#2926](https://github.com/getsentry/sentry-dotnet/pull/2926))
834

935
### API breaking Changes
1036

37+
- The method used to configure a Sentry Sink for Serilog now has an additional overload. Calling `WriteTo.Sentry()` with no arguments will no longer attempt to initialize the SDK (it has optional arguments to configure the behaviour of the Sink only). If you want to initialize Sentry at the same time you configure the Sentry Sink then you will need to use the overload of this method that accepts a DSN as the first parameter (e.g. `WriteTo.Sentry("https://[email protected]:65535/2147483647")`). ([#2928](https://github.com/getsentry/sentry-dotnet/pull/2928))
38+
1139
#### Removed APIs
1240

13-
- 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))
41+
- 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))
1442

15-
### Fixes
43+
#### Changed APIs
1644

17-
- Fixed Sentry SDK has not been initialised when using ASP.NET Core, Serilog and OpenTelemetry ([#2911](https://github.com/getsentry/sentry-dotnet/pull/2911))
45+
- `AssemblyExtensions` have been made public again. ([#2917](https://github.com/getsentry/sentry-dotnet/pull/2917))
46+
- Rename iOS and MacCatalyst platform specific options from `iOS` to `Cocoa` ([#2929](https://github.com/getsentry/sentry-dotnet/pull/2929))
1847

1948
### Dependencies
2049

@@ -27,6 +56,9 @@
2756
- Bump Native SDK from v0.6.5 to v0.6.7 ([#2914](https://github.com/getsentry/sentry-dotnet/pull/2914))
2857
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#067)
2958
- [diff](https://github.com/getsentry/sentry-native/compare/0.6.5...0.6.7)
59+
- Bump Java SDK from v6.34.0 to v7.0.0 ([#2932](https://github.com/getsentry/sentry-dotnet/pull/2932))
60+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#700)
61+
- [diff](https://github.com/getsentry/sentry-java/compare/6.34.0...7.0.0)
3062

3163
## 4.0.0-beta.2
3264

@@ -189,6 +221,7 @@ There are some functional differences when publishing Native AOT:
189221
- `StackTraceMode.Enhanced` is ignored because it's not available when publishing Native AOT. The mechanism to generate these enhanced stack traces relies heavily on reflection which isn't compatible with trimming.
190222
- Reflection cannot be leveraged for JSON Serialization and you may need to use `SentryOptions.AddJsonSerializerContext` to supply a serialization context for types that you'd like to send to Sentry (e.g. in the `Span.Context`). ([#2732](https://github.com/getsentry/sentry-dotnet/pull/2732), [#2793](https://github.com/getsentry/sentry-dotnet/pull/2793))
191223
- WinUI applications: when publishing Native AOT, Sentry isn't able to automatically register an unhandled exception handler because that relies on reflection. You'll need to [register the unhandled event handler manually](https://github.com/getsentry/sentry-dotnet/issues/2778) instead.
224+
- For Azure Functions Workers, when AOT/Trimming is enabled we can't use reflection to read route data from the HttpTrigger so the route name will always be `/api/<FUNCTION_NAME>` ([#2920](https://github.com/getsentry/sentry-dotnet/pull/2920))
192225

193226
### Dependencies
194227

@@ -199,6 +232,11 @@ There are some functional differences when publishing Native AOT:
199232
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2222)
200233
- [diff](https://github.com/getsentry/sentry-cli/compare/2.21.5...2.22.2)
201234

235+
## 3.41.3
236+
237+
### Fixes
238+
239+
- Fixed Sentry SDK has not been initialised when using ASP.NET Core, Serilog and OpenTelemetry ([#2918](https://github.com/getsentry/sentry-dotnet/pull/2918))
202240

203241
## 3.41.2
204242

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Although the files in `/src/Sentry/Platforms/` are part of the `Sentry` project,
4848
```xml
4949
<!-- Platform-specific props included here -->
5050
<Import Project="Platforms\Android\Sentry.Android.props" Condition="'$(TargetPlatformIdentifier)' == 'android'" />
51-
<Import Project="Platforms\iOS\Sentry.iOS.props" Condition="'$(TargetPlatformIdentifier)' == 'ios' Or '$(TargetPlatformIdentifier)' == 'maccatalyst'" />
51+
<Import Project="Platforms\Cocoa\Sentry.Cocoa.props" Condition="'$(TargetPlatformIdentifier)' == 'ios' Or '$(TargetPlatformIdentifier)' == 'maccatalyst'" />
5252
```
5353

5454
These `*.props` files are used to add platform-specific files, such as references to the binding projects for each native SDK (which provide .NET wrappers around native Android or Cocoa functions).

Directory.Build.props

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22

33
<PropertyGroup>
4-
<Version>4.0.0-beta.2</Version>
4+
<Version>4.0.0-beta.3</Version>
55
<LangVersion>12</LangVersion>
66
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
77
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory).assets\Sentry.snk</AssemblyOriginatorKeyFile>
@@ -10,9 +10,6 @@
1010
<Features>strict</Features>
1111
<ImplicitUsings>true</ImplicitUsings>
1212

13-
<!-- Ignore EOL warnings... we need to support old stuff -->
14-
<CheckEolWorkloads>false</CheckEolWorkloads>
15-
1613
<!-- Allow references to unsigned assemblies (like MAUI) from signed projects -->
1714
<NoWarn>$(NoWarn);CS8002</NoWarn>
1815
</PropertyGroup>
@@ -68,12 +65,6 @@
6865
<DefineConstants Condition="'$(TargetPlatformIdentifier)' == ''">$(DefineConstants);PLATFORM_NEUTRAL</DefineConstants>
6966
</PropertyGroup>
7067

71-
<!-- We're aware it's out of support but this is a library and it doesn't require nca3.1. -->
72-
<!-- there's no reason to cause friction to a consumer that for some reason is stuck on an unsupported version. -->
73-
<PropertyGroup>
74-
<CheckEolTargetFramework>false</CheckEolTargetFramework>
75-
</PropertyGroup>
76-
7768
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
7869
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
7970
<DefineConstants>$(DefineConstants);CI_BUILD</DefineConstants>

Directory.Build.targets

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
</ItemGroup>
2020

2121
<ItemGroup Condition="'$(TargetPlatformIdentifier)' != 'ios' And '$(TargetPlatformIdentifier)' != 'maccatalyst'">
22+
<!-- Exclude our platform-specific code: -->
23+
<Compile Remove="**\*.Cocoa.cs" />
24+
<Compile Remove="**\Cocoa\**\*.cs" />
25+
<!-- Maui device test projects have these too: -->
2226
<Compile Remove="**\*.iOS.cs" />
2327
<Compile Remove="**\iOS\**\*.cs" />
2428
</ItemGroup>

modules/sentry-cocoa

Submodule sentry-cocoa updated 137 files

samples/Sentry.Samples.Android/MainActivity.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using Sentry.Android;
2+
13
namespace Sentry.Samples.Android;
24

35
[Activity(Label = "@string/app_name", MainLauncher = true)]
@@ -9,6 +11,8 @@ protected override void OnCreate(Bundle? savedInstanceState)
911
{
1012
o.Dsn = "https://[email protected]/5428537";
1113
o.SendDefaultPii = true; // adds the user's IP address automatically
14+
o.Native.LogCatIntegration = LogCatIntegrationType.Errors; // Get logcat logs for both handled and unhandled errors; default is unhandled only
15+
o.Native.LogCatMaxLines = 1000; // Defaults to 1000
1216
});
1317

1418
// Here's an example of adding custom scope information.

samples/Sentry.Samples.Maui/MainPage.xaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,3 @@ private void OnNativeCrashClicked(object sender, EventArgs e)
8888
#endif
8989
}
9090
}
91-
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Sentry.Extensions.Logging;
2+
3+
namespace Sentry.Azure.Functions.Worker;
4+
5+
/// <inheritdoc cref="BindableSentryOptions"/>
6+
internal class BindableSentryAzureFunctionsOptions : BindableSentryLoggingOptions
7+
{
8+
public void ApplyTo(SentryAzureFunctionsOptions options)
9+
{
10+
base.ApplyTo(options);
11+
}
12+
}

src/Sentry.Azure.Functions.Worker/Sentry.Azure.Functions.Worker.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
<Description>Official Azure Functions Worker SDK integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time.</Description>
77
</PropertyGroup>
88

9+
<PropertyGroup Condition="'$(FrameworkSupportsAot)' == 'true'">
10+
<IsAotCompatible>true</IsAotCompatible>
11+
<EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator>
12+
</PropertyGroup>
13+
914
<ItemGroup>
1015
<ProjectReference Include="..\Sentry.Extensions.Logging\Sentry.Extensions.Logging.csproj" />
1116
</ItemGroup>

src/Sentry.Azure.Functions.Worker/SentryAzureFunctionsOptionsSetup.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,30 @@
33

44
namespace Sentry.Azure.Functions.Worker;
55

6+
#if NET8_0_OR_GREATER
7+
internal class SentryAzureFunctionsOptionsSetup : IConfigureOptions<SentryAzureFunctionsOptions>
8+
{
9+
private readonly IConfiguration _config;
10+
11+
public SentryAzureFunctionsOptionsSetup(IConfiguration config)
12+
{
13+
ArgumentNullException.ThrowIfNull(config);
14+
_config = config;
15+
}
16+
17+
public void Configure(SentryAzureFunctionsOptions options)
18+
{
19+
ArgumentNullException.ThrowIfNull(options);
20+
21+
var bindable = new BindableSentryAzureFunctionsOptions();
22+
_config.Bind(bindable);
23+
bindable.ApplyTo(options);
24+
25+
// These can't be changed by the user
26+
options.TagFilters.Add("AzureFunctions_");
27+
}
28+
}
29+
#else
630
internal class SentryAzureFunctionsOptionsSetup : ConfigureFromConfigurationOptions<SentryAzureFunctionsOptions>
731
{
832
public SentryAzureFunctionsOptionsSetup(IConfiguration config) : base(config)
@@ -20,3 +44,4 @@ public override void Configure(SentryAzureFunctionsOptions options)
2044
options.TagFilters.Add("AzureFunctions_");
2145
}
2246
}
47+
#endif

src/Sentry.Azure.Functions.Worker/SentryFunctionsWorkerApplicationBuilderExtensions.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,15 @@ public static IFunctionsWorkerApplicationBuilder UseSentry(
3737
builder.UseMiddleware<SentryFunctionsWorkerMiddleware>();
3838

3939
var services = builder.Services;
40+
var section = context.Configuration.GetSection("Sentry");
41+
#if NET8_0_OR_GREATER
42+
services.AddSingleton<IConfigureOptions<SentryAzureFunctionsOptions>>(_ =>
43+
new SentryAzureFunctionsOptionsSetup(section)
44+
);
45+
#else
4046
services.Configure<SentryAzureFunctionsOptions>(options =>
41-
context.Configuration.GetSection("Sentry").Bind(options));
47+
section.Bind(options));
48+
#endif
4249

4350
if (optionsConfiguration != null)
4451
{

src/Sentry.Azure.Functions.Worker/SentryFunctionsWorkerMiddleware.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Microsoft.Azure.Functions.Worker.Http;
33
using Microsoft.Azure.Functions.Worker.Middleware;
44
using Sentry.Extensibility;
5+
using Sentry.Internal;
56

67
namespace Sentry.Azure.Functions.Worker;
78

@@ -79,6 +80,7 @@ public async Task Invoke(FunctionContext context, FunctionExecutionDelegate next
7980
}
8081
}
8182

83+
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = AotHelper.SuppressionJustification)]
8284
private async Task<TransactionContext> StartOrContinueTraceAsync(FunctionContext context)
8385
{
8486
var transactionName = context.FunctionDefinition.Name;
@@ -94,7 +96,11 @@ private async Task<TransactionContext> StartOrContinueTraceAsync(FunctionContext
9496
var httpMethod = requestData.Method.ToUpperInvariant();
9597
var transactionNameKey = $"{context.FunctionDefinition.EntryPoint}-{httpMethod}";
9698

97-
if (!TransactionNameCache.TryGetValue(transactionNameKey, out transactionName))
99+
// Note that, when Trimming is enabled, we can't use reflection to read route data from the HttpTrigger
100+
// attribute. In that case the route name will always be /api/<FUNCTION_NAME>
101+
// If this is ever a problem for customers, we can potentially see if there are alternate ways to get this info
102+
// from route tables or something. We're not even sure if anyone will use this functionality for now though.
103+
if (!AotHelper.IsNativeAot && !TransactionNameCache.TryGetValue(transactionNameKey, out transactionName))
98104
{
99105
// Find the HTTP Trigger attribute via reflection
100106
var assembly = Assembly.LoadFrom(context.FunctionDefinition.PathToAssembly);

src/Sentry.Bindings.Android/Sentry.Bindings.Android.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<TargetFramework>net7.0-android</TargetFramework>
44
<!-- BG8605 and BG8606 happen because there's a missing androidx.lifecycle dependency, but we don't need it here. (The native Android Sentry SDK will use it if it exists.) -->
55
<NoWarn>$(NoWarn);BG8605;BG8606</NoWarn>
6-
<SentryAndroidSdkVersion>6.34.0</SentryAndroidSdkVersion>
6+
<SentryAndroidSdkVersion>7.0.0</SentryAndroidSdkVersion>
77
<SentryAndroidSdkDirectory>$(BaseIntermediateOutputPath)sdks\Sentry\Android\$(SentryAndroidSdkVersion)\</SentryAndroidSdkDirectory>
88
<Description>.NET Bindings for the Sentry Android SDK</Description>
99
</PropertyGroup>

src/Sentry.Bindings.Cocoa/PrivateApiDefinitions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Sentry.CocoaSdk;
66

7-
// SentryScope.ApplyToEvent was made private in 8.x, but we use it in our IosEventProcessor class.
7+
// SentryScope.ApplyToEvent was made private in 8.x, but we use it in our CocoaEventProcessor class.
88
// TODO: Find a better way than using the private API.
99
partial interface SentryScope
1010
{

src/Sentry.Maui/BindableSentryMauiOptions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ internal class BindableSentryMauiOptions : BindableSentryLoggingOptions
88
public bool? IncludeTextInBreadcrumbs { get; set; }
99
public bool? IncludeTitleInBreadcrumbs { get; set; }
1010
public bool? IncludeBackgroundingStateInBreadcrumbs { get; set; }
11+
public bool? CreateElementEventsBreadcrumbs { get; set; } = false;
1112

1213
public void ApplyTo(SentryMauiOptions options)
1314
{
1415
base.ApplyTo(options);
1516
options.IncludeTextInBreadcrumbs = IncludeTextInBreadcrumbs ?? options.IncludeTextInBreadcrumbs;
1617
options.IncludeTitleInBreadcrumbs = IncludeTitleInBreadcrumbs ?? options.IncludeTitleInBreadcrumbs;
1718
options.IncludeBackgroundingStateInBreadcrumbs = IncludeBackgroundingStateInBreadcrumbs?? options.IncludeBackgroundingStateInBreadcrumbs;
19+
options.CreateElementEventsBreadcrumbs = CreateElementEventsBreadcrumbs ?? options.CreateElementEventsBreadcrumbs;
1820
}
1921
}

src/Sentry.Maui/Internal/IMauiEventsBinder.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)