1
Vote

Cannot convert int to byte exception in Read(byte[], int, int) method

description

This line in your Read(byte[], int, int) method throws an exception:

buffer[bytesRead + offset] = serialPort.ReadByte();

because serialPort.ReadByte() actually returns an int, which must be cast explicitly to byte.

comments