mirror of
https://github.com/ZuneDev/MicrosoftIris.git
synced 2026-07-27 13:13:29 -07:00
Fix invalid BSON
This commit is contained in:
@@ -44,7 +44,7 @@ internal class BsonFormatter : IFormatter
|
|||||||
|
|
||||||
// If the type is accessible from the current domain,
|
// If the type is accessible from the current domain,
|
||||||
// create an instance of it.
|
// create an instance of it.
|
||||||
var typeName = _serializer.Deserialize<string>(reader);
|
var typeName = reader.ReadAsString();
|
||||||
var type = Type.GetType(typeName);
|
var type = Type.GetType(typeName);
|
||||||
if (type != null)
|
if (type != null)
|
||||||
return _serializer.Deserialize(reader, type);
|
return _serializer.Deserialize(reader, type);
|
||||||
@@ -55,8 +55,12 @@ internal class BsonFormatter : IFormatter
|
|||||||
public void Serialize(Stream serializationStream, object graph)
|
public void Serialize(Stream serializationStream, object graph)
|
||||||
{
|
{
|
||||||
using BsonDataWriter writer = new(serializationStream);
|
using BsonDataWriter writer = new(serializationStream);
|
||||||
_serializer.Serialize(writer, graph?.GetType().FullName);
|
|
||||||
|
writer.WriteStartArray();
|
||||||
|
writer.WriteValue(graph?.GetType().FullName);
|
||||||
_serializer.Serialize(writer, graph);
|
_serializer.Serialize(writer, graph);
|
||||||
|
writer.WriteEndArray();
|
||||||
|
|
||||||
writer.Flush();
|
writer.Flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user