Skip to content

Commit dfed2b2

Browse files
committed
Add Main property to SentryThread
Added an optional flag to indicate whether the thread was responsible for rendering the user interface. On mobile platforms this is oftentimes referred to as the "main thread" or "ui thread".
1 parent 9b89369 commit dfed2b2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Sentry/SentryThread.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ public sealed class SentryThread : ISentryJsonSerializable
2929
/// </summary>
3030
public bool? Current { get; set; }
3131

32+
/// <summary>
33+
/// An optional flag to indicate whether the thread was responsible for rendering
34+
/// the user interface. On mobile platforms this is oftentimes referred to as the
35+
/// "main thread" or "ui thread".
36+
/// </summary>
37+
public bool? Main { get; set; }
38+
3239
/// <summary>
3340
/// Stack trace.
3441
/// </summary>
@@ -44,6 +51,7 @@ public void WriteTo(Utf8JsonWriter writer, IDiagnosticLogger? logger)
4451
writer.WriteStringIfNotWhiteSpace("name", Name);
4552
writer.WriteBooleanIfNotNull("crashed", Crashed);
4653
writer.WriteBooleanIfNotNull("current", Current);
54+
writer.WriteBooleanIfNotNull("main", Main);
4755
writer.WriteSerializableIfNotNull("stacktrace", Stacktrace, logger);
4856

4957
writer.WriteEndObject();
@@ -58,6 +66,7 @@ public static SentryThread FromJson(JsonElement json)
5866
var name = json.GetPropertyOrNull("name")?.GetString();
5967
var crashed = json.GetPropertyOrNull("crashed")?.GetBoolean();
6068
var current = json.GetPropertyOrNull("current")?.GetBoolean();
69+
var main = json.GetPropertyOrNull("main")?.GetBoolean();
6170
var stacktrace = json.GetPropertyOrNull("stacktrace")?.Pipe(SentryStackTrace.FromJson);
6271

6372
return new SentryThread
@@ -66,6 +75,7 @@ public static SentryThread FromJson(JsonElement json)
6675
Name = name,
6776
Crashed = crashed,
6877
Current = current,
78+
Main = main,
6979
Stacktrace = stacktrace
7080
};
7181
}

0 commit comments

Comments
 (0)