Add logging for deserialization

This commit is contained in:
2025-08-09 13:16:12 +03:00
parent cc7d2d478c
commit 8c137115f4
4 changed files with 28 additions and 8 deletions
+11 -2
View File
@@ -89,8 +89,17 @@ namespace mROA.Cbor
public object? Deserialize(ReadOnlyMemory<byte> rawMemory, Type type, IEndPointContext? context)
{
var reader = new CborReader(rawMemory);
return ReadData(reader, type, context);
try
{
var reader = new CborReader(rawMemory);
return ReadData(reader, type, context);
}
catch (Exception e)
{
Console.WriteLine($"Bad deserialization. Bytes: {rawMemory.ToArray().Select(b => $"{b:X}")}");
throw;
}
}
public T Cast<T>(object nonCasted, IEndPointContext? context)