From 7515999d4881e72f13283b0b5f9892685536a992 Mon Sep 17 00:00:00 2001 From: Yoshi Askharoun Date: Thu, 25 May 2023 02:27:06 -0500 Subject: [PATCH] Prototype of serialization for types that don't exist in the client domain --- UIX/Microsoft/Iris/Debug/BsonFormatter.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/UIX/Microsoft/Iris/Debug/BsonFormatter.cs b/UIX/Microsoft/Iris/Debug/BsonFormatter.cs index 0b02926..9def495 100644 --- a/UIX/Microsoft/Iris/Debug/BsonFormatter.cs +++ b/UIX/Microsoft/Iris/Debug/BsonFormatter.cs @@ -41,12 +41,21 @@ internal class BsonFormatter : IFormatter { CloseInput = false }; + + // If the type is accessible from the current domain, + // create an instance of it. + var typeName = _serializer.Deserialize(reader); + var type = Type.GetType(typeName); + if (type != null) + return _serializer.Deserialize(reader, type); + return _serializer.Deserialize(reader); } public void Serialize(Stream serializationStream, object graph) { using BsonDataWriter writer = new(serializationStream); + _serializer.Serialize(writer, graph?.GetType().FullName); _serializer.Serialize(writer, graph); writer.Flush(); }