Skip to content

Navigation tracking containing an int List breaks breadcrumb serialization via ClassCastException #4964

@SpiritCroc

Description

@SpiritCroc

Integration

sentry-android

Build System

Gradle

AGP Version

8.13.0

Proguard

Enabled

Version

6.17.0 - 6.28.0

Steps to Reproduce

We found that using androidx.navigation with a destination route holding a variable of type List<Int>? would lead to sentry collecting breadcrumbs that it is unable to serialize, and thus cause dropped crash reports.

We were eventually able to work around this issue by storing our navigation parameter as List<String>? instead, which avoids using a primitive java type and thus avoids this class cast exception.

Expected Result

Sentry should just work even if we use integer lists for our androidx.navigation.

Actual Result

Sentry debug logs give us the following:

12-12 10:08:34.539 16511 16614 E Sentry  : Serialization task failed
12-12 10:08:34.539 16511 16614 E Sentry  : java.lang.ClassCastException: int[] cannot be cast to java.lang.Object[]
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.JsonObjectSerializer.serialize(JsonObjectSerializer.java:57)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.JsonObjectSerializer.serializeMap(JsonObjectSerializer.java:130)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.JsonObjectSerializer.serialize(JsonObjectSerializer.java:59)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.JsonObjectSerializer.serializeMap(JsonObjectSerializer.java:130)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.JsonObjectSerializer.serialize(JsonObjectSerializer.java:59)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.JsonObjectWriter.value(JsonObjectWriter.java:108)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.JsonObjectWriter.value(JsonObjectWriter.java:9)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.Breadcrumb.serialize(Breadcrumb.java:768)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.JsonObjectSerializer.serialize(JsonObjectSerializer.java:53)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.JsonObjectWriter.value(JsonObjectWriter.java:108)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.JsonSerializer.serializeToString(JsonSerializer.java:276)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.JsonSerializer.serialize(JsonSerializer.java:208)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.cache.PersistingScopeObserver$1.toStream(PersistingScopeObserver.java:102)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.cache.PersistingScopeObserver$1.toStream(PersistingScopeObserver.java:84)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.cache.tape.FileObjectQueue.add(FileObjectQueue.java:58)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.cache.PersistingScopeObserver.lambda$addBreadcrumb$2$io-sentry-cache-PersistingScopeObserver(PersistingScopeObserver.java:129)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.cache.PersistingScopeObserver$$ExternalSyntheticLambda13.run(D8$$SyntheticClass:0)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.cache.PersistingScopeObserver.lambda$serializeToDisk$13$io-sentry-cache-PersistingScopeObserver(PersistingScopeObserver.java:248)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at io.sentry.cache.PersistingScopeObserver$$ExternalSyntheticLambda9.run(D8$$SyntheticClass:0)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:520)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at java.util.concurrent.FutureTask.run(FutureTask.java:317)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:348)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1154)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:652)
12-12 10:08:34.539 16511 16614 E Sentry  : 	at java.lang.Thread.run(Thread.java:1563)

Metadata

Metadata

Assignees

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions