-
-
Notifications
You must be signed in to change notification settings - Fork 213
/
Copy pathJsonExtensions.cs
867 lines (771 loc) · 24.9 KB
/
JsonExtensions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
using Sentry.Extensibility;
using Sentry.Internal.JsonConverters;
namespace Sentry.Internal.Extensions;
internal static class JsonExtensions
{
private static readonly JsonConverter[] DefaultConverters =
{
new SentryJsonConverter(),
new IntPtrJsonConverter(),
new IntPtrNullableJsonConverter(),
new UIntPtrJsonConverter(),
new UIntPtrNullableJsonConverter()
};
private static List<JsonConverter> CustomConverters = new List<JsonConverter>();
internal static bool JsonPreserveReferences { get; set; } = true;
static JsonExtensions()
{
ResetSerializerOptions();
}
private static JsonSerializerOptions BuildOptions(bool preserveReferences)
{
var options = new JsonSerializerOptions();
if (preserveReferences)
{
options.ReferenceHandler = ReferenceHandler.Preserve;
}
foreach (var converter in DefaultConverters)
{
options.Converters.Add(converter);
}
foreach (var converter in CustomConverters)
{
options.Converters.Add(converter);
}
return options;
}
#if TRIMMABLE
private static List<JsonSerializerContext> DefaultSerializerContexts = new();
private static List<JsonSerializerContext> ReferencePreservingSerializerContexts = new();
private static List<Func<JsonSerializerOptions, JsonSerializerContext>> JsonSerializerContextBuilders = new()
{
options => new SentryJsonContext(options)
};
internal static void AddJsonSerializerContext<T>(Func<JsonSerializerOptions, T> jsonSerializerContextBuilder)
where T: JsonSerializerContext
{
JsonSerializerContextBuilders.Add(jsonSerializerContextBuilder);
ResetSerializerOptions();
}
internal static void ResetSerializerOptions()
{
DefaultSerializerContexts.Clear();
ReferencePreservingSerializerContexts.Clear();
foreach (var builder in JsonSerializerContextBuilders)
{
DefaultSerializerContexts.Add(builder(BuildOptions(false)));
ReferencePreservingSerializerContexts.Add(builder(BuildOptions(true)));
}
}
#else
private static JsonSerializerOptions SerializerOptions = null!;
private static JsonSerializerOptions AltSerializerOptions = null!;
internal static void ResetSerializerOptions()
{
SerializerOptions = BuildOptions(false);
AltSerializerOptions = BuildOptions(true);
}
#endif
internal static void AddJsonConverter(JsonConverter converter)
{
// only add if we don't have this instance already
if (CustomConverters.Contains(converter))
{
return;
}
try
{
CustomConverters.Add(converter);
ResetSerializerOptions();
}
catch (InvalidOperationException)
{
// If we've already started using the serializer, then it's too late to add more converters.
// The following exception message may occur (depending on STJ version):
// "Serializer options cannot be changed once serialization or deserialization has occurred."
// We'll swallow this, because it's likely to only have occurred in our own unit tests,
// or in a scenario where the Sentry SDK has been initialized multiple times,
// in which case we have the converter from the first initialization already.
// TODO: .NET 8 is getting an IsReadOnly flag we could check instead of catching
// See https://github.com/dotnet/runtime/pull/74431
}
}
public static void Deconstruct(this JsonProperty jsonProperty, out string name, out JsonElement value)
{
name = jsonProperty.Name;
value = jsonProperty.Value;
}
public static Dictionary<string, object?>? GetDictionaryOrNull(this JsonElement json)
{
if (json.ValueKind != JsonValueKind.Object)
{
return null;
}
var result = new Dictionary<string, object?>();
foreach (var (name, value) in json.EnumerateObject())
{
result[name] = value.GetDynamicOrNull();
}
return result;
}
public static Dictionary<string, TValue>? GetDictionaryOrNull<TValue>(
this JsonElement json,
Func<JsonElement, TValue> factory)
where TValue : IJsonSerializable?
{
if (json.ValueKind != JsonValueKind.Object)
{
return null;
}
var result = new Dictionary<string, TValue>();
foreach (var (name, value) in json.EnumerateObject())
{
result[name] = factory(value);
}
return result;
}
public static Dictionary<string, string?>? GetStringDictionaryOrNull(this JsonElement json)
{
if (json.ValueKind != JsonValueKind.Object)
{
return null;
}
var result = new Dictionary<string, string?>(StringComparer.Ordinal);
foreach (var (name, value) in json.EnumerateObject())
{
result[name] = value.GetString();
}
return result;
}
public static JsonElement? GetPropertyOrNull(this JsonElement json, string name)
{
if (json.ValueKind != JsonValueKind.Object)
{
return null;
}
if (json.TryGetProperty(name, out var result) &&
result.ValueKind is not JsonValueKind.Undefined and not JsonValueKind.Null)
{
return result;
}
return null;
}
public static object? GetDynamicOrNull(this JsonElement json) => json.ValueKind switch
{
JsonValueKind.True => true,
JsonValueKind.False => false,
JsonValueKind.Number => json.GetNumber(), // see implementation for why we don't just call GetDouble
JsonValueKind.String => json.GetString(),
JsonValueKind.Array => json.EnumerateArray().Select(GetDynamicOrNull).ToArray(),
JsonValueKind.Object => json.GetDictionaryOrNull(),
_ => null
};
private static object? GetNumber(this JsonElement json)
{
var result = json.GetDouble();
if (result != 0)
{
// We got a value, as expected.
return result;
}
// We might have 0 when there's actually a value there.
// This happens on Unity IL2CPP targets. Let's workaround that.
// See https://github.com/getsentry/sentry-unity/issues/690
// If the number is an integer, we can avoid extra string parsing
if (json.TryGetInt64(out var longResult))
{
return longResult;
}
// Otherwise, let's get the value as a string and parse it ourselves.
// Note that we already know this will succeed due to JsonValueKind.Number
return double.Parse(json.ToString()!, CultureInfo.InvariantCulture);
}
public static long? GetHexAsLong(this JsonElement json)
{
// If the address is in json as a number, we can just use it.
if (json.ValueKind == JsonValueKind.Number)
{
return json.GetInt64();
}
// Otherwise it will be a string, but we need to convert it to a number.
var s = json.GetString();
if (s == null)
{
return null;
}
// It should be in hex format, such as "0x7fff5bf346c0"
var substring = s[2..];
if (s.StartsWith("0x") &&
long.TryParse(substring, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var result))
{
return result;
}
throw new FormatException();
}
public static string GetStringOrThrow(this JsonElement json) =>
json.GetString() ?? throw new InvalidOperationException("JSON string is null.");
public static void WriteDictionaryValue(
this Utf8JsonWriter writer,
IEnumerable<KeyValuePair<string, object?>>? dic,
IDiagnosticLogger? logger,
bool includeNullValues = true)
{
if (dic is not null)
{
writer.WriteStartObject();
if (includeNullValues)
{
foreach (var (key, value) in dic)
{
writer.WriteDynamic(key, value, logger);
}
}
else
{
foreach (var (key, value) in dic)
{
if (value is not null)
{
writer.WriteDynamic(key, value, logger);
}
}
}
writer.WriteEndObject();
}
else
{
writer.WriteNullValue();
}
}
public static void WriteDictionaryValue<TValue>(
this Utf8JsonWriter writer,
IEnumerable<KeyValuePair<string, TValue>>? dic,
IDiagnosticLogger? logger,
bool includeNullValues = true)
where TValue : IJsonSerializable?
{
if (dic is not null)
{
writer.WriteStartObject();
foreach (var (key, value) in dic)
{
if (value is not null)
{
writer.WriteSerializable(key, value, logger);
}
else if (includeNullValues)
{
writer.WriteNull(key);
}
}
writer.WriteEndObject();
}
else
{
writer.WriteNullValue();
}
}
public static void WriteStringDictionaryValue(
this Utf8JsonWriter writer,
IEnumerable<KeyValuePair<string, string?>>? dic)
{
if (dic is not null)
{
writer.WriteStartObject();
foreach (var (key, value) in dic)
{
writer.WriteString(key, value);
}
writer.WriteEndObject();
}
else
{
writer.WriteNullValue();
}
}
public static void WriteDictionary(
this Utf8JsonWriter writer,
string propertyName,
IEnumerable<KeyValuePair<string, object?>>? dic,
IDiagnosticLogger? logger)
{
writer.WritePropertyName(propertyName);
writer.WriteDictionaryValue(dic, logger);
}
public static void WriteDictionary<TValue>(
this Utf8JsonWriter writer,
string propertyName,
IEnumerable<KeyValuePair<string, TValue>>? dic,
IDiagnosticLogger? logger)
where TValue : IJsonSerializable?
{
writer.WritePropertyName(propertyName);
writer.WriteDictionaryValue(dic, logger);
}
public static void WriteStringDictionary(
this Utf8JsonWriter writer,
string propertyName,
IEnumerable<KeyValuePair<string, string?>>? dic)
{
writer.WritePropertyName(propertyName);
writer.WriteStringDictionaryValue(dic);
}
public static void WriteArrayValue<T>(
this Utf8JsonWriter writer,
IEnumerable<T>? arr,
IDiagnosticLogger? logger)
{
if (arr is not null)
{
writer.WriteStartArray();
foreach (var i in arr)
{
writer.WriteDynamicValue(i, logger);
}
writer.WriteEndArray();
}
else
{
writer.WriteNullValue();
}
}
public static void WriteArray<T>(
this Utf8JsonWriter writer,
string propertyName,
IEnumerable<T>? arr,
IDiagnosticLogger? logger)
{
writer.WritePropertyName(propertyName);
writer.WriteArrayValue(arr, logger);
}
public static void WriteStringArrayValue(
this Utf8JsonWriter writer,
IEnumerable<string?>? arr)
{
if (arr is not null)
{
writer.WriteStartArray();
foreach (var i in arr)
{
writer.WriteStringValue(i);
}
writer.WriteEndArray();
}
else
{
writer.WriteNullValue();
}
}
public static void WriteStringArray(
this Utf8JsonWriter writer,
string propertyName,
IEnumerable<string?>? arr)
{
writer.WritePropertyName(propertyName);
writer.WriteStringArrayValue(arr);
}
public static void WriteSerializableValue(
this Utf8JsonWriter writer,
IJsonSerializable value,
IDiagnosticLogger? logger)
{
value.WriteTo(writer, logger);
}
public static void WriteSerializable(
this Utf8JsonWriter writer,
string propertyName,
IJsonSerializable value,
IDiagnosticLogger? logger)
{
writer.WritePropertyName(propertyName);
writer.WriteSerializableValue(value, logger);
}
public static void WriteDynamicValue(
this Utf8JsonWriter writer,
object? value,
IDiagnosticLogger? logger)
{
if (value is null)
{
writer.WriteNullValue();
}
else if (value is IJsonSerializable serializable)
{
writer.WriteSerializableValue(serializable, logger);
}
else if (value is IEnumerable<KeyValuePair<string, string?>> sdic)
{
writer.WriteStringDictionaryValue(sdic);
}
else if (value is IEnumerable<KeyValuePair<string, object?>> dic)
{
writer.WriteDictionaryValue(dic, logger);
}
else if (value is string str)
{
writer.WriteStringValue(str);
}
else if (value is bool b)
{
writer.WriteBooleanValue(b);
}
else if (value is int i)
{
writer.WriteNumberValue(i);
}
else if (value is long l)
{
writer.WriteNumberValue(l);
}
else if (value is double d)
{
writer.WriteNumberValue(d);
}
else if (value is DateTime dt)
{
writer.WriteStringValue(dt);
}
else if (value is DateTimeOffset dto)
{
writer.WriteStringValue(dto);
}
else if (value is TimeSpan timeSpan)
{
writer.WriteStringValue(timeSpan.ToString("g", CultureInfo.InvariantCulture));
}
#if NET6_0_OR_GREATER
else if (value is DateOnly date)
{
writer.WriteStringValue(date.ToString("O", CultureInfo.InvariantCulture));
}
else if (value is TimeOnly time)
{
writer.WriteStringValue(time.ToString("HH:mm:ss.FFFFFFF", CultureInfo.InvariantCulture));
}
#endif
else if (value is IFormattable formattable)
{
writer.WriteStringValue(formattable.ToString(null, CultureInfo.InvariantCulture));
}
else if (value.GetType().ToString() == "System.RuntimeType")
{
writer.WriteStringValue(value.ToString());
}
else
{
if (!JsonPreserveReferences)
{
InternalSerialize(writer, value, preserveReferences: false);
return;
}
try
{
// Use an intermediate byte array, so we can retry if serialization fails.
var bytes = InternalSerializeToUtf8Bytes(value);
writer.WriteRawValue(bytes);
}
catch (JsonException)
{
// Retry, preserving references to avoid cyclical dependency.
InternalSerialize(writer, value, preserveReferences: true);
}
}
}
#if TRIMMABLE
private static JsonSerializerContext GetSerializerContext(Type type, bool preserveReferences = false)
{
var contexts = preserveReferences ? ReferencePreservingSerializerContexts : DefaultSerializerContexts;
return contexts.FirstOrDefault(c => c.GetTypeInfo(type) != null)
?? contexts[0]; // If none of the contexts has type info, this gives us a proper exception message
}
private static byte[] InternalSerializeToUtf8Bytes(object value)
{
var context = GetSerializerContext(value.GetType());
return JsonSerializer.SerializeToUtf8Bytes(value, value.GetType(), context);
}
private static void InternalSerialize(Utf8JsonWriter writer, object value, bool preserveReferences = false)
{
var context = GetSerializerContext(value.GetType(), preserveReferences);
JsonSerializer.Serialize(writer, value, value.GetType(), context);
}
#else
private static byte[] InternalSerializeToUtf8Bytes(object value) =>
JsonSerializer.SerializeToUtf8Bytes(value, SerializerOptions);
private static void InternalSerialize(Utf8JsonWriter writer, object value, bool preserveReferences = false)
{
var options = preserveReferences ? AltSerializerOptions : SerializerOptions;
JsonSerializer.Serialize(writer, value, options);
}
#endif
public static void WriteDynamic(
this Utf8JsonWriter writer,
string propertyName,
object? value,
IDiagnosticLogger? logger)
{
writer.WritePropertyName(propertyName);
var originalPropertyDepth = writer.CurrentDepth;
try
{
writer.WriteDynamicValue(value, logger);
}
catch (Exception e)
{
// In the event of an instance that can't be serialized, we don't want to throw away a whole event
// so we'll suppress issues here.
logger?.LogError(e, "Failed to serialize object for property '{0}'. Original depth: {1}, current depth: {2}",
propertyName, originalPropertyDepth, writer.CurrentDepth);
// The only location in the protocol we allow dynamic objects are Extra and Contexts.
// Render an empty JSON object instead of null. This allows a round trip where this property name is the
// key to a map which would otherwise not be set and result in a different object.
// This affects envelope size which isn't recomputed after a roundtrip.
// If the last token written was ":", then we must write a property value.
// If the last token written was "{", then we can't write a property value.
// Since either could happen, we will *try* to write a "{" and ignore any failure.
try
{
writer.WriteStartObject();
}
catch (InvalidOperationException)
{
}
// Now we can close each open object until we get back to the original depth.
while (originalPropertyDepth < writer.CurrentDepth)
{
writer.WriteEndObject();
}
}
}
public static void WriteBooleanIfNotNull(
this Utf8JsonWriter writer,
string propertyName,
bool? value)
{
if (value is not null)
{
writer.WriteBoolean(propertyName, value.Value);
}
}
public static void WriteBooleanIfTrue(
this Utf8JsonWriter writer,
string propertyName,
bool? value)
{
if (value is true)
{
writer.WriteBoolean(propertyName, value.Value);
}
}
public static void WriteNumberIfNotNull(
this Utf8JsonWriter writer,
string propertyName,
short? value)
{
if (value is not null)
{
writer.WriteNumber(propertyName, value.Value);
}
}
public static void WriteNumberIfNotNull(
this Utf8JsonWriter writer,
string propertyName,
int? value)
{
if (value is not null)
{
writer.WriteNumber(propertyName, value.Value);
}
}
public static void WriteNumberIfNotNull(
this Utf8JsonWriter writer,
string propertyName,
long? value)
{
if (value is not null)
{
writer.WriteNumber(propertyName, value.Value);
}
}
public static void WriteNumberIfNotNull(
this Utf8JsonWriter writer,
string propertyName,
float? value)
{
if (value is not null)
{
writer.WriteNumber(propertyName, value.Value);
}
}
public static void WriteNumberIfNotZero(
this Utf8JsonWriter writer,
string propertyName,
short value)
{
if (value is not 0)
{
writer.WriteNumber(propertyName, value);
}
}
public static void WriteNumberIfNotZero(
this Utf8JsonWriter writer,
string propertyName,
int value)
{
if (value is not 0)
{
writer.WriteNumber(propertyName, value);
}
}
public static void WriteNumberIfNotZero(
this Utf8JsonWriter writer,
string propertyName,
long value)
{
if (value is not 0)
{
writer.WriteNumber(propertyName, value);
}
}
public static void WriteNumberIfNotZero(
this Utf8JsonWriter writer,
string propertyName,
float value)
{
if (value is not 0)
{
writer.WriteNumber(propertyName, value);
}
}
public static void WriteNumberIfNotZero(
this Utf8JsonWriter writer,
string propertyName,
double value)
{
if (value is not 0)
{
writer.WriteNumber(propertyName, value);
}
}
public static void WriteStringIfNotWhiteSpace(
this Utf8JsonWriter writer,
string propertyName,
string? value)
{
if (!string.IsNullOrWhiteSpace(value))
{
writer.WriteString(propertyName, value);
}
}
public static void WriteStringIfNotNull(
this Utf8JsonWriter writer,
string propertyName,
DateTimeOffset? value)
{
if (value is not null)
{
writer.WriteString(propertyName, value.Value);
}
}
public static void WriteSerializableIfNotNull(
this Utf8JsonWriter writer,
string propertyName,
IJsonSerializable? value,
IDiagnosticLogger? logger)
{
if (value is not null)
{
writer.WriteSerializable(propertyName, value, logger);
}
}
public static void WriteDictionaryIfNotEmpty(
this Utf8JsonWriter writer,
string propertyName,
IEnumerable<KeyValuePair<string, object?>>? dic,
IDiagnosticLogger? logger)
{
var dictionary = dic as IReadOnlyDictionary<string, object?> ?? dic?.ToDictionary();
if (dictionary is not null && dictionary.Count > 0)
{
writer.WriteDictionary(propertyName, dictionary, logger);
}
}
public static void WriteDictionaryIfNotEmpty<TValue>(
this Utf8JsonWriter writer,
string propertyName,
IEnumerable<KeyValuePair<string, TValue>>? dic,
IDiagnosticLogger? logger)
where TValue : IJsonSerializable?
{
var dictionary = dic as IReadOnlyDictionary<string, TValue> ?? dic?.ToDictionary();
if (dictionary is not null && dictionary.Count > 0)
{
writer.WriteDictionary(propertyName, dictionary, logger);
}
}
public static void WriteStringDictionaryIfNotEmpty(
this Utf8JsonWriter writer,
string propertyName,
IEnumerable<KeyValuePair<string, string?>>? dic)
{
var dictionary = dic as IReadOnlyDictionary<string, string?> ?? dic?.ToDictionary();
if (dictionary is not null && dictionary.Count > 0)
{
writer.WriteStringDictionary(propertyName, dictionary);
}
}
public static void WriteArrayIfNotEmpty<T>(
this Utf8JsonWriter writer,
string propertyName,
IEnumerable<T>? arr,
IDiagnosticLogger? logger)
{
var list = arr as IReadOnlyList<T> ?? arr?.ToArray();
if (list is not null && list.Count > 0)
{
writer.WriteArray(propertyName, list, logger);
}
}
public static void WriteStringArrayIfNotEmpty(
this Utf8JsonWriter writer,
string propertyName,
IEnumerable<string?>? arr)
{
var list = arr as IReadOnlyList<string?> ?? arr?.ToArray();
if (list is not null && list.Count > 0)
{
writer.WriteStringArray(propertyName, list);
}
}
public static void WriteDynamicIfNotNull(
this Utf8JsonWriter writer,
string propertyName,
object? value,
IDiagnosticLogger? logger)
{
if (value is not null)
{
writer.WriteDynamic(propertyName, value, logger);
}
}
public static void WriteString(
this Utf8JsonWriter writer,
string propertyName,
IEnumeration? value)
{
if (value == null)
{
writer.WriteNull(propertyName);
}
else
{
writer.WriteString(propertyName, value.Value);
}
}
}
#if TRIMMABLE
[JsonSerializable(typeof(GrowableArray<int>))]
[JsonSerializable(typeof(Dictionary<string, bool>))]
internal partial class SentryJsonContext : JsonSerializerContext
{
}
#endif