question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deserialize empty protobuf list on iOS

See original GitHub issue

I have the following data class:

@Serializable
data class Test (
        @Optional @SerialId(1) var events: List<Event> = emptyList(),
        @Optional @SerialId(2) var games: List<Game> = emptyList()
)

Protobuf deserialization (proto3) works correctly on Android and iOS if both values are not empty. If at least one list property is empty (empty list), the deserialization fails on iOS with error: Unexpected EOF.

If empty property is commented out of data class, deserialization works on iOS as well.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sandwwraithcommented, Feb 5, 2019
0reactions
webfrea-kcommented, Feb 5, 2019

You are correct! I managed to make the response shorter and data is indeed handled correctly on iOS as well.

  • Max length working on both platforms (that I can re-produce): 96735 bytes
  • Length working on android and not on iOS: 128153 bytes
Read more comments on GitHub >

github_iconTop Results From Across the Web

Language Guide (proto3) | Protocol Buffers - Google Developers
The default value for repeated fields is empty (generally an empty list in ... this is represented when the message is deserialized is...
Read more >
Protobuf-net deserializes empty collection to null when the ...
I would argue null should never be used and having an empty list instead should be the default value; at the very least...
Read more >
Introduction to Protocol Buffers on iOS - RayWenderlich.com
Integrate the List of Speakers. With the My Badge tab done, it's time to turn your attention to the currently blank Speakers tab....
Read more >
Protobuf-net: the unofficial manual - CodeProject
NET library for serialization based on Google's Protocol Buffers. ... The list data type is not recorded, and during deserialization it ...
Read more >
MessagePack: It's like JSON. but fast and small.
Serialize /Deserialize for OCaml types (with meta_conv) ... Serialize.serialize_string (msgpack_of_t { int = 42; ... lib/core. List your implementation here!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found