-
Notifications
You must be signed in to change notification settings - Fork 620
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
Crash in serialization code on iOS #225
Comments
More info: if I pass serializer to JSON.parse() method as below @Serializable
data class Foo(@SerialName("Bar") val Bars: List<Bar>? = null) {
@Serializable
data class Bar(...)
companion object {
@JvmStatic
fun parse(jsonText: String): Foo = JSON.nonstrict.parse(serializer(), jsonText)
}
} I get the following error
Is the error related to Main Thread? (CheckIsMainThread) |
Hi, for the first exception I can say that it is not working by design – since there are no reflection on K/N, Second issue is likely indeed connected with threading. From which thread you're trying to use a parser? K/N has limitations on access to global constants from different threads. |
It is indeed connected to recent changes in K/N mutability policy. Now global |
@sandwwraith Thank you for the information! I'm indeed deserializing on a worker thread. Will be looking forward to the workaround to resume my project. Please update the thread when it is available. Thank you again. |
…ser, so it is now accessible from multiple workers Fixes #225
@sandwwraith Thank you for the quick fix! I can confirm that the problem is resolved in eap13 branch. |
Fixed in |
My serializable classes don't use unsupported native features - no enums, arrays, etc. They only use Lists, Strings and Ints. Android project has no problem serializing/deserializaing the classes. Native project for iOS compiles without errors. But as soon as I try to deserialize a string on iOS, I get the error below. I copied the string that crashes deserialization on iOS and tested it using JUnit in my Android library and it deserializes without problems.
Foo.parse()
is the method that I call from iOS and Android:Am I doing anything wrong here?
Thank you in advance!
The text was updated successfully, but these errors were encountered: