public long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length) { // When messages are passed over the wire, the data is serialised here then deserialised on the other end and then the response // is serialised and returned and deserialised here. That means that the "buffer" reference that is populated on the other end // is not the same as the reference here - so we need to overwrite the input buffer with the data from the response message. ThrowIfDisposed(); var result = _reader.GetChars(_readerId, i, fieldoffset, buffer, bufferoffset, length); var numberOfBytesRead = result.Item1; var bytesRead = result.Item2; Array.Copy(bytesRead, buffer, numberOfBytesRead); return(numberOfBytesRead); }