diff --git a/CHANGELOG.md b/CHANGELOG.md
index f9ea8d394a..e4d113a93e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
# Changelog
+## Unreleased
+
+### Features
+
+- Extended `SentryThread` by `Main` to allow indication whether the thread is considered the current main thread ([#4807](https://github.com/getsentry/sentry-dotnet/pull/4807))
+
## 6.0.0
### BREAKING CHANGES
@@ -45,25 +51,24 @@
- Deliver system breadcrumbs in the main thread on Android ([#4671](https://github.com/getsentry/sentry-dotnet/pull/4671))
- The `Serilog` integration captures _Structured Logs_ (when enabled) independently of captured Events and added Breadcrumbs ([#4691](https://github.com/getsentry/sentry-dotnet/pull/4691))
- Minimum Log-Level for _Structured Logs_, _Breadcrumbs_ and _Events_ in all Logging-Integrations ([#4700](https://github.com/getsentry/sentry-dotnet/pull/4700))
- - for `Sentry.Extensions.Logging`, `Sentry.AspNetCore`, `Sentry.Maui` and `Sentry.Google.Cloud.Functions`
- - the Logger-Provider for _Breadcrumbs_ and _Events_ ignores Logging-Configuration (e.g. via `appsettings.json`)
- - use the intended `SentryLoggingOptions.MinimumBreadcrumbLevel`, `SentryLoggingOptions.MinimumEventLevel`, or add filter functions via `SentryLoggingOptionsExtensions.AddLogEntryFilter`
- - the Logger-Provider for _Structured Logs_ respects Logging-Configuration (e.g. via `appsettings.json`)
- - when enabled by `SentryOptions.EnableLogs`
+ - for `Sentry.Extensions.Logging`, `Sentry.AspNetCore`, `Sentry.Maui` and `Sentry.Google.Cloud.Functions`
+ - the Logger-Provider for _Breadcrumbs_ and _Events_ ignores Logging-Configuration (e.g. via `appsettings.json`)
+ - use the intended `SentryLoggingOptions.MinimumBreadcrumbLevel`, `SentryLoggingOptions.MinimumEventLevel`, or add filter functions via `SentryLoggingOptionsExtensions.AddLogEntryFilter`
+ - the Logger-Provider for _Structured Logs_ respects Logging-Configuration (e.g. via `appsettings.json`)
+ - when enabled by `SentryOptions.EnableLogs`
- Avoid appending `/NODEFAULTLIB:MSVCRT` to NativeAOT linker arguments on Windows when targetting non-Windows platforms (Android, Browser) ([#4760](https://github.com/getsentry/sentry-dotnet/pull/4760))
- The SDK avoids redundant scope sync after transaction finish ([#4623](https://github.com/getsentry/sentry-dotnet/pull/4623))
- sentry-native is now automatically disabled for WASM applications ([#4631](https://github.com/getsentry/sentry-dotnet/pull/4631))
- Remove unnecessary files from SentryCocoaFramework before packing ([#4602](https://github.com/getsentry/sentry-dotnet/pull/4602))
-
### Dependencies
- Bump Java SDK from v8.24.0 to v8.28.0 ([#4728](https://github.com/getsentry/sentry-dotnet/pull/4728), [#4761](https://github.com/getsentry/sentry-dotnet/pull/4761), [#4791](https://github.com/getsentry/sentry-dotnet/pull/4791))
- - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#8280)
- - [diff](https://github.com/getsentry/sentry-java/compare/8.24.0...8.28.0)
+ - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#8280)
+ - [diff](https://github.com/getsentry/sentry-java/compare/8.24.0...8.28.0)
- Bump Native SDK from v0.12.0 to v0.12.2 ([#4690](https://github.com/getsentry/sentry-dotnet/pull/4690), [#4737](https://github.com/getsentry/sentry-dotnet/pull/4737), [#4780](https://github.com/getsentry/sentry-dotnet/pull/4780))
- - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0122)
- - [diff](https://github.com/getsentry/sentry-native/compare/0.12.0...0.12.2)
+ - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0122)
+ - [diff](https://github.com/getsentry/sentry-native/compare/0.12.0...0.12.2)
- Bump Cocoa SDK from v8.57.1 to v8.57.3 ([#4704](https://github.com/getsentry/sentry-dotnet/pull/4704), [#4738](https://github.com/getsentry/sentry-dotnet/pull/4738))
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8573)
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.57.1...8.57.3)
diff --git a/src/Sentry/SentryThread.cs b/src/Sentry/SentryThread.cs
index 6ce62eff7b..d537095e7c 100644
--- a/src/Sentry/SentryThread.cs
+++ b/src/Sentry/SentryThread.cs
@@ -29,6 +29,13 @@ public sealed class SentryThread : ISentryJsonSerializable
///
public bool? Current { get; set; }
+ ///
+ /// An optional flag to indicate whether the thread was responsible for rendering
+ /// the user interface. On mobile and desktop platforms this is oftentimes referred to as the
+ /// "main thread" or "ui thread".
+ ///
+ public bool? Main { get; set; }
+
///
/// Stack trace.
///
@@ -44,6 +51,7 @@ public void WriteTo(Utf8JsonWriter writer, IDiagnosticLogger? logger)
writer.WriteStringIfNotWhiteSpace("name", Name);
writer.WriteBooleanIfNotNull("crashed", Crashed);
writer.WriteBooleanIfNotNull("current", Current);
+ writer.WriteBooleanIfNotNull("main", Main);
writer.WriteSerializableIfNotNull("stacktrace", Stacktrace, logger);
writer.WriteEndObject();
@@ -58,6 +66,7 @@ public static SentryThread FromJson(JsonElement json)
var name = json.GetPropertyOrNull("name")?.GetString();
var crashed = json.GetPropertyOrNull("crashed")?.GetBoolean();
var current = json.GetPropertyOrNull("current")?.GetBoolean();
+ var main = json.GetPropertyOrNull("main")?.GetBoolean();
var stacktrace = json.GetPropertyOrNull("stacktrace")?.Pipe(SentryStackTrace.FromJson);
return new SentryThread
@@ -66,6 +75,7 @@ public static SentryThread FromJson(JsonElement json)
Name = name,
Crashed = crashed,
Current = current,
+ Main = main,
Stacktrace = stacktrace
};
}
diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt
index e32ad6e60c..458d39be99 100644
--- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt
+++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt
@@ -996,6 +996,7 @@ namespace Sentry
public bool? Crashed { get; set; }
public bool? Current { get; set; }
public int? Id { get; set; }
+ public bool? Main { get; set; }
public string? Name { get; set; }
public Sentry.SentryStackTrace? Stacktrace { get; set; }
public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { }
diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt
index e32ad6e60c..458d39be99 100644
--- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt
+++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt
@@ -996,6 +996,7 @@ namespace Sentry
public bool? Crashed { get; set; }
public bool? Current { get; set; }
public int? Id { get; set; }
+ public bool? Main { get; set; }
public string? Name { get; set; }
public Sentry.SentryStackTrace? Stacktrace { get; set; }
public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { }
diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt
index e32ad6e60c..458d39be99 100644
--- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt
+++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt
@@ -996,6 +996,7 @@ namespace Sentry
public bool? Crashed { get; set; }
public bool? Current { get; set; }
public int? Id { get; set; }
+ public bool? Main { get; set; }
public string? Name { get; set; }
public Sentry.SentryStackTrace? Stacktrace { get; set; }
public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { }
diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt
index bd8e747a1b..f2b22fbfdb 100644
--- a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt
+++ b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt
@@ -972,6 +972,7 @@ namespace Sentry
public bool? Crashed { get; set; }
public bool? Current { get; set; }
public int? Id { get; set; }
+ public bool? Main { get; set; }
public string? Name { get; set; }
public Sentry.SentryStackTrace? Stacktrace { get; set; }
public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { }
diff --git a/test/Sentry.Tests/Protocol/SentryThreadTests.cs b/test/Sentry.Tests/Protocol/SentryThreadTests.cs
index a881c64e41..c5f5aa592c 100644
--- a/test/Sentry.Tests/Protocol/SentryThreadTests.cs
+++ b/test/Sentry.Tests/Protocol/SentryThreadTests.cs
@@ -16,6 +16,7 @@ public void SerializeObject_AllPropertiesSetToNonDefault_SerializesValidObject()
{
Crashed = true,
Current = true,
+ Main = true,
Id = 0,
Name = "thread11",
Stacktrace = new SentryStackTrace
@@ -35,6 +36,7 @@ public void SerializeObject_AllPropertiesSetToNonDefault_SerializesValidObject()
"name": "thread11",
"crashed": true,
"current": true,
+ "main": true,
"stacktrace": {
"frames": [
{
@@ -62,6 +64,8 @@ public static IEnumerable