Primitives.kt RuntimeError: dereferencing a null pointer
The kotlin-serialization library crashes with a null pointer exception when initializing the Serializer in the code of a third-party library compiled with an older version of kotlin. When using such Serializers directly in the code, there is no crash.
wasm stack trace
Primitives.kt:79 Uncaught (in promise) RuntimeError: dereferencing a null pointer
at <vs-control.client:wasm>.kotlinx.serialization.internal.checkName (Primitives.kt:79:36)
at <vs-control.client:wasm>.kotlinx.serialization.internal.PrimitiveDescriptorSafe (Primitives.kt:72:5)
at <vs-control.client:wasm>.kotlinx.serialization.descriptors.PrimitiveSerialDescriptor (SerialDescriptors.kt:91:12)
at <vs-control.client:wasm>.com.arkivanov.essenty.statekeeper.Serializer.<init> (SerializableContainer.kt:66:53)
at <vs-control.client:wasm>.com.arkivanov.essenty.statekeeper.Serializer_getInstance (vs-control-client-wasm-wasm-js.wasm:0x2f6155)
at <vs-control.client:wasm>.com.arkivanov.decompose.router.children.Companion.<init> (vs-control-client-wasm-wasm-js.wasm:0x2fccd2)
at <vs-control.client:wasm>.com.arkivanov.decompose.router.children.Companion_getInstance (vs-control-client-wasm-wasm-js.wasm:0x2fcd08)
at <vs-control.client:wasm>.com.arkivanov.decompose.router.children.childrenNavigator (vs-control-client-wasm-wasm-js.wasm:0x2fcab5)
at <vs-control.client:wasm>.com.arkivanov.decompose.router.children.children (ChildrenFactory.kt:127:25)
at <vs-control.client:wasm>.com.arkivanov.decompose.router.children.children$default (vs-control-client-wasm-wasm-js.wasm:0x2fc3ec)
Environment
- Kotlin version: 2.0.0-Beta4
- Library version: 1.6.2
- Kotlin platforms: WASM
- Gradle version: 8.6
- Other relevant context: Decompose 3.0.0-alpha07
Do you have a project with a reproducer, by any chance? It's hard to tell what happened from the stacktrace alone.
Yes, I have a project with 100 percent reproduction. You need to rollback to the specified commit and call gradle :client:wasm:wasmJsBrowserDevelopmentRun. It crashes immediately at the start, you don’t need to do anything additional. If you roll back one more commit earlier, kotlin-beta01 will be there and everything works.
Repo: https://github.com/VladislavSumin/vs-control
Revision: c2257bc76d9a8ad68f1460e361dadb511593b1fa
I'm receiving the same error
dereferencing a null pointer RuntimeError: dereferencing a null pointer at DroidJobsKMP:webApp-wasm.kotlinx.serialization.internal.checkName (http://localhost:8080/webApp-wasm.wasm:wasm-function[57078]:0x89fe45)
I'm also receiving a similar error with serialization and WASM when using Beta4
I was able to reproduce the error, but it seems it is connected to Kotlin/WASM itself. Has anyone reported it to the YouTrack?
It seems to be fixed with Kotlin version 2.0.0-Beta5, and I no longer receive the error. If you want to use 2.0.0-Beta5, compose compiler 1.5.11-kt-2.0.0-Beta5 works.
@VladislavSumin Can you confirm that using 2.0.0-Beta5 indeed solves the issue?
@sandwwraith Yes I get the same error with the kotlin version Beta5