Serialization in C#
Hi,
I'm trying to serialize the internal state of the board so that I can download logged data after disconnecting/reconnecting (in C#, UWP). But no matter what I do, it seems that deserializing the object fails with a SerializationException exception. So I boiled it down to a minimal example where this happens:
var board = MbientLab.MetaWear.Win10.Application.GetMetaWearBoard(device);
await board.InitializeAsync();
await board.SerializeAsync();
await board.DeserializeAsync(); // <- An exception of type 'System.Runtime.Serialization.SerializationException' occurred in System.Private.CoreLib.ni.dll but was not handled in user code: Deserialized object with reference id 'i52' not found in stream.
Even if I try to clear the board state from all routes/etc via board.TearDown() before serializing, I still get the same exception as follows:
var board = MbientLab.MetaWear.Win10.Application.GetMetaWearBoard(device);
await board.InitializeAsync();
board.TearDown();
await board.SerializeAsync();
await board.DeserializeAsync(); // <- same exception thrown
I'm using C# API v0.2.0 (using NuGet) and MetaMotionR board model# 5 with FW revision 1.3.4 and HW revision 0.2.
Your assistance is appreciated in advance.
This discussion has been closed.
Comments
PreserveObjectReferences = true
does not properly serialize the data on UWP, which is a problem since the unit tests generate completely different files.