-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JsonDecodingException in VersionedCodec #80
Comments
Hi @shlauzer. Is there a reason you are using the As for the crash - it looks like the JSON file is malformed. I assume this was because the coroutine context was cancelled amid a write operation. This could be fixed in #77 but further investigation is needed. |
Hi @xxfast. Actually we don't need versioning in this moment and we can use |
@shlauzer depends. Refer to this doc for binary compatible migrations https://xxfast.github.io/KStore/using-versioning.html#binary-incompatible-changes |
@xxfast As far as I understand we still need VersiondedCodec. If we decide to change our model we will be able to catch our jsonElement with version = 0 and migrate it manually. |
We've got the non-fatal error in Crashlytics with the following stacktrace:
Non-fatal Exception: kotlinx.serialization.json.internal.JsonDecodingException Unexpected JSON token at offset 0: Expected numeric literal at path: $ JSON input: kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException (JsonExceptions.kt:24) kotlinx.serialization.json.okio.OkioStreamsKt.decodeFromBufferedSource (OkioStreams.kt:65) io.github.xxfast.kstore.file.extensions.VersionedCodec.decode (KVersionedStore.kt:68) io.github.xxfast.kstore.KStore$read$2.invokeSuspend (KStore.kt:40) ...
We use KStore 0.6.0 in the similar way:
where storePath is
application.applicationContext.filesDir.path + "/cross_sell"
It looks like a problem in version file reading: https://github.com/xxfast/KStore/blob/0.6.0/kstore-file/src/commonMain/kotlin/io/github/xxfast/kstore/file/extensions/KVersionedStore.kt#L67C33-L68C1. Have you any ideas?
Also I see that you are going to save version to file metadata instead. Do you have any plans?
The text was updated successfully, but these errors were encountered: