Fixed
Status Update
Comments
[Deleted User] <[Deleted User]> #2
Yigit, do you have time to fix it?
reemission of the same liveData is racy
reemission of the same liveData is racy
an...@google.com <an...@google.com> #4
Thanks for the detailed analysis. This may not be an issue anymore since we've started using Main.immediate there but I' not sure; I'll try to create a test case.
il...@google.com <il...@google.com>
il...@google.com <il...@google.com> #5
just emitting same live data reproduces the issue.
@Test
fun raceTest() {
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData)
emitSource(subLiveData) //crashes
}
subject.addObserver().apply {
testScope.advanceUntilIdle()
}
}
@Test
fun raceTest() {
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData)
emitSource(subLiveData) //crashes
}
subject.addObserver().apply {
testScope.advanceUntilIdle()
}
}
Description
Version used: 2.1.0-beta01
Devices/Android versions reproduced on: Compilation
After upgrading, I quickly got the following erros on my CI :
After checking a bit which dependency include jacocoagent, I found the culprits (ViewPager 2 does too) :
+--- androidx.navigation:navigation-ui-ktx:2.1.0-beta01
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.40 -> 1.3.41 (*)
| +--- androidx.navigation:navigation-ui:[2.1.0-beta01] -> 2.1.0-beta01
| | +--- com.google.android.material:material:1.0.0 -> 1.1.0-alpha08 (*)
| | +--- org.jacoco:org.jacoco.agent:0.8.3
| | +--- androidx.navigation:navigation-runtime:[2.1.0-beta01] -> 2.1.0-beta01 (*)
| | \--- androidx.transition:transition:1.0.1 (*)
| \--- androidx.navigation:navigation-runtime-ktx:[2.1.0-beta01] -> 2.1.0-beta01 (*)
Is that normal ? If it is, what can we do to avoid lint from failing ?