RawBinaryTranscoder writes invalid DataFormat

Hi all.

Such code throws an error “The RawBinaryTranscoder can only decode byte arrays.”. It causes because RawBinaryTranscoder is getting DataFormat.Reserved instead of DataFormat.Binary.

var result1 = collection.InsertAsync("testId", byteArray, options => options
    .Transcoder(new Transcoder())).Result;
var result2 = collection.GetAsync("testId", options => options
    .Transcoder(new Transcoder())).Result;
var bytes = result2.ContentAs<byte[]>();

@Ramirag what is the Transcoder object you are passing in ?

.Transcoder(new Transcoder())).Result;

Instead can you explicitly specify RawBinaryTranscoder if thats what you intend to use ?

Oh sorry. It’s RawBinaryTranscoder. I’ve played with your sources and have forgotten to change a name before coping here.

1 Like

ah ok, no worries totally understand - can you also let us know what you pass in as byteArray
are you converting to byteArray or are you receiving a stream

Just looking at the tests everything seems to be looking good and so asking.

Just random 256 bytes.

Thanks for reporting @Ramirag; this is indeed a bug. Ticket can be found here.