private byte[] JustSerialize(object value, out uint flag) { using var builder = new SequenceBuilder(MemoryPool <byte> .Shared); var t = new BinaryItemFormatter(); flag = t.Serialize(builder, value); return(builder.Commit().ToArray()); }
public void Commit() { try { finalBody = bodyBuilder.Commit(); } catch (Exception e) { bodyBuilder.Dispose(); throw new InvalidOperationException("Fatal exception: could not build the binary request. See the inner exception for details.", e); } }
public void KeyFormatterTests(string input) { var transformer = new Utf8KeyFormatter(); using var builder = new SequenceBuilder(MemoryPool <byte> .Shared); transformer.Serialize(builder, input); var expected = new UTF8Encoding(false).GetBytes(input); Assert.Equal(expected, builder.Commit().ToArray()); }
public void KeyFormatterTests(string prefix, string key) { var transformer = new NamespacingKeyFormatter(prefix); using var builder = new SequenceBuilder(MemoryPool <byte> .Shared); transformer.Serialize(builder, key); var expected = new UTF8Encoding(false).GetBytes(prefix + key); Assert.Equal(expected, builder.Commit().ToArray()); }