feat: Add network details for session replay on iOS #4891
2 issues
find-bugs: Found 2 issues (2 high)
High
NSDictionary indexer assignment will throw runtime exception - `src/Sentry/Platforms/Cocoa/Extensions/CocoaExtensions.cs:207-221`
The new ToCocoaBreadcrumbData method creates an NSDictionary<NSString, NSObject>() and attempts to add entries using indexer assignment (dict[key] = value). However, NSDictionary in iOS/macOS is immutable and does not support setting values via indexer - this will throw a NotSupportedException at runtime. The existing methods in this file (e.g., ToNSDictionary at lines 153-170) correctly use a mutable .NET Dictionary<NSString, NSObject> to build the data and then convert it using NSDictionary.FromObjectsAndKeys() at the end.
Duplicate test method definitions will cause compilation error on Android - `test/Sentry.Tests/SentryHttpMessageHandlerTests.cs:617-692`
When the ANDROID preprocessor symbol is defined, both the #if ANDROID || IOS || MACCATALYST block (lines 616-694) and the #if ANDROID block (lines 696-765) will be compiled. This results in duplicate definitions of HandleResponse_SpanExists_AddsReplayBreadcrumbData and HandleResponse_NoSpanExists_NoReplayBreadcrumbData methods, which will cause a C# compilation error (CS0111: Type already defines a member with the same parameter types).
Duration: 3m 13s · Tokens: 1.9M in / 10.2k out · Cost: $1.95 (+merge: $0.00)
Annotations
Check failure on line 221 in src/Sentry/Platforms/Cocoa/Extensions/CocoaExtensions.cs
sentry-warden / warden: find-bugs
NSDictionary indexer assignment will throw runtime exception
The new `ToCocoaBreadcrumbData` method creates an `NSDictionary<NSString, NSObject>()` and attempts to add entries using indexer assignment (`dict[key] = value`). However, `NSDictionary` in iOS/macOS is immutable and does not support setting values via indexer - this will throw a `NotSupportedException` at runtime. The existing methods in this file (e.g., `ToNSDictionary` at lines 153-170) correctly use a mutable .NET `Dictionary<NSString, NSObject>` to build the data and then convert it using `NSDictionary.FromObjectsAndKeys()` at the end.
Check failure on line 692 in test/Sentry.Tests/SentryHttpMessageHandlerTests.cs
sentry-warden / warden: find-bugs
Duplicate test method definitions will cause compilation error on Android
When the ANDROID preprocessor symbol is defined, both the `#if ANDROID || IOS || MACCATALYST` block (lines 616-694) and the `#if ANDROID` block (lines 696-765) will be compiled. This results in duplicate definitions of `HandleResponse_SpanExists_AddsReplayBreadcrumbData` and `HandleResponse_NoSpanExists_NoReplayBreadcrumbData` methods, which will cause a C# compilation error (CS0111: Type already defines a member with the same parameter types).