feat: Add network details for session replay on iOS #4891
5 issues
High
NSDictionary indexer assignment will throw runtime exception - `src/Sentry/Platforms/Cocoa/Extensions/CocoaExtensions.cs:207-220`
The code creates an immutable NSDictionary<NSString, NSObject> on line 207 and then attempts to mutate it via indexer assignment on lines 216 and 220 (dict[key] = ...). In Cocoa, NSDictionary is immutable and does not support indexed assignment - this will throw a runtime exception. The existing code in this file correctly uses NSDictionary.FromObjectsAndKeys() with a temporary C# Dictionary (see lines 153-170) or NSMutableDictionary for mutation.
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).
Medium
Duplicate test methods defined for ANDROID platform - `test/Sentry.Tests/SentryHttpMessageHandlerTests.cs:617-667`
The test method HandleResponse_SpanExists_AddsReplayBreadcrumbData is defined twice - once in the #if ANDROID || IOS || MACCATALYST block (lines 617-667) and again in the #if ANDROID block (lines 697-740). Similarly, HandleResponse_NoSpanExists_NoReplayBreadcrumbData is duplicated. When compiled for ANDROID, this will cause a compiler error due to duplicate method definitions.
Synchronous Send_Executed_FailedRequestsCaptured test removed without replacement - `test/Sentry.Tests/SentryHttpMessageHandlerTests.cs:614-635`
The test Send_Executed_FailedRequestsCaptured that validates the failed request handler is invoked for synchronous HTTP calls has been removed. The async counterpart SendAsync_Executed_FailedRequestsCaptured (line 334) still exists. This reduces test coverage for the synchronous path, which is a deliberate feature of the handler (the file header comment notes all tests should cover both sync and async methods).
4 skills analyzed
| Skill | Findings | Duration | Cost |
|---|---|---|---|
| code-review | 3 | 1m 8s | $0.79 |
| find-bugs | 2 | 3m 13s | $1.95 |
| gha-security-review | 0 | 37.6s | $0.17 |
| security-review | 0 | 1m 46s | $0.29 |
Duration: 6m 45s · Tokens: 2.6M in / 20.1k out · Cost: $3.20 (+merge: $0.00, +dedup: $0.00)