This, as it turned out, is a console constraint .
Try this method:
var bufsize = 320; Stream stream = Console.OpenStandardInput(bufsize); TextReader inReader = (stream == Stream.Null) ? StreamReader.Null : TextReader.Synchronized( new StreamReader(stream, Console.InputEncoding, false, bufsize, true)); Console.SetIn(inReader);
Set the buffer size as needed.
The code is honestly overseen by ILSpy in the Console.In method.
The real limit is 254 characters: 256 bytes is the size of the buffer, plus two bytes are reserved for CRLF. Similarly, in the case of manual installation of bufsize actual size will be two bytes smaller.
In reality, I couldn't make the buffer smaller than 256.
If you want to handle symbols of other languages correctly and set Console.InputEncoding = Encoding.Unicode; , do not forget that your buffer will spend two bytes per character. If you, for example, set the buffer size to 320, this will give you only 160 Unicode characters (and will be automatically raised to 256).