Serialize and deserialize a mesh to a file

I’m trying to serialize and deserialize a mesh to a file,
the first part is working, however, the deserialization is through an error.
what should I do to fix it?

Still haven’t tested this but I believe you should use pickle

I tried with pickle, and it didn’t work with meshes as well.

it’s very strange that CommonObjectToByteArray worked well, however, ByteArrayToCommonObject gives this error:

“1. Solution exception:The type arguments for method ‘ByteArrayToCommonObject’ cannot be inferred from the usage. Try specifying the type arguments explicitly.”

I have the same problem. Have you found any solution for that problem?
I have tried pickle and json(archive3dm) types, but the byteArray has a significantly smaller size.