When using kotlinx serialization and passing strin...
# serialization
h
When using kotlinx serialization and passing strings in KMP type safe destination via the NavHost, I've noticed that the String limit characters is bigger on the JVM than on iOS, it crashes on iOS without a specific error other than cryptic one
👀 1
Copy code
Can't show file for stack frame : <DBGLLDBStackFrame: 0x37481c010> - stackNumber:1 - name:kfun:kotlin.String#<get-length>(){}<http://kotlin.Int|kotlin.Int>. The file path does not exist on the file system: /opt/buildAgent/work/45667ea690d4c371/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/String.ktCan't show file for stack frame : <DBGLLDBStackFrame: 0x37481c010> - stackNumber:1 - name:kfun:kotlin.String#<get-length>(){}<http://kotlin.Int|kotlin.Int>. The file path does not exist on the file system: /opt/buildAgent/work/45667ea690d4c371/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/String.ktCan't show file for stack frame : <DBGLLDBStackFrame: 0x37481c010> - stackNumber:1 - name:kfun:kotlin.String#<get-length>(){}<http://kotlin.Int|kotlin.Int>. The file path does not exist on the file system: /opt/buildAgent/work/45667ea690d4c371/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/String.kt
 Type: LLDB
s
Care filing an issue? Would like to +1 it 👀
Also, with an example of how big exactly that String was 😄
👍 1
h
@Stylianos Gakis which board do i open it onto, will be happy to
s
"Android Public Tracker > App Development > Jetpack (androidx) > Navigation" feels right I'd say
h
I thought that first, i’m not sure whether this is actually an AndroidX issue or KotlinX serialization issue
s
I'd still file it there at first since it surfaces using the navigation code and I'm sure they would want to make sure it works. From that point yeah perhaps it will also need to be filed somewhere else too, but I still think we should hear what they think there too
👍 1
f
It happens on iOS App but not on Android App, same project KMP
h
@ferdialif02 i haven't the time to create a minimal reproducible repo, can you raise an issue on JetBrains tracker?
f
@Hristijan Hi ! unfortunately i have no time as well, might be able to do that on the weekend but i can't promise 😓
But turns out the limit at around 2k chars of string, i tried to chunk it into list but no luck
h
Yeah i tried it as a list and that's thow i found out, the list broke, thanks for confirming on the char limit, will try to make some time and report it, can't promise as well, really busy lately, idk if it's a smart idea to ping somebody from JetBrains
1
s
It's likely you'll get an answer that you should not be passing such huge lists around as nav args. These are also supposed to fit in a Bundle for saving state etc. Instead pass an identifier which can be used on the new destination and that can be used to fetch the list which should be stored in your data layer. Still might be worth a bug report, but I'd do that approach anyway if I bumped into this bug myself.
f
@Stylianos Gakis That is what i did, changed the parameter property to send only the identifier rather than full data, but i am just wondering why is it working on Android but not on iOS
h
@Stylianos Gakis this is a character limit on iOS and not how you pass around data, it's a bug But i understand your sentiment
s
Right, but the character limit is not 0 characters right? It's still in the thousands as I understand here
h
Not saying it's 0 but you'd expect similar behavior or at least a warning when writing someone that is based on kotlinx serialization, a descriptive error if you will
f
@Hristijan i forgot to tell you earlier, but when i ran the same test on iOS from Xcode ( running the app from xcode ) the app actually does not crash. Just when i try to run it from Android studio then it will be crash.
I do not know if it is some weird bug or something but for now i only pass short string only
h
Weird, I'll try to check that too
f
Though it was not crash when i ran on Xcode, it still crash when i ran it on actual iPhone through TestFlight
h
Same here, really weird
255 Views