Hmm, what's wrong here? Why won't the second one d...
# kotlin-native
d
Hmm, what's wrong here? Why won't the second one detach?
Copy code
val works = DetachedObjectGraph(TransferMode.SAFE) {
    mutableMapOf<String, String>()
}

var result: Result<String>? = null
val breaks = DetachedObjectGraph(TransferMode.SAFE) {
    val map = works.attach()
    result = runCatching { map.keys.first() } // This here.... what's wrong?
    println(result) // Failure(kotlin.NoSuchElementException: Collection is empty.)
    map
}
// kotlin.IllegalStateException: Illegal transfer state.
println(breaks.attach()) // Doesn't get here
println(result)