Using NMF 4.2.2 on Plus2.
I cannot get SreamReader.Readline to read more than 185 lines from a text file before it throws an
'System.IndexOutOfRangeException' occurred in System.IO.dll
/*
// 4096 lines of values to be read from "myfile.txt"
14837,80
14845,80
14854,80
14862,80
14871,80
14879,80
14888,81
14896,81
14905,81
14913,81
14921,81
.......
.......
// total of 4096 lines
*/
/*
A first chance exception of type 'System.IndexOutOfRangeException' occurred in System.IO.dll An unhandled exception of type 'System.IndexOutOfRangeException' occurred in System.IO.dll
*/
static void xx()
{
string name = "SDmyfile.txt";
int line = 0;
using (FileStream fs = File.OpenRead(name)) {
StreamReader strm = new StreamReader(fs);
do {
string s = strm.ReadLine();
line++;
} while (strm.EndOfStream == false);
fs.Close();
}
}
When debugger breaks because of exception these are the values of StreamReader
BaseStream.Position = 2048
BaseStream.Length = 46755
BaseStream.EndOfStream = 1
m_curBufLen = 512
m_curBufPos = 512
GC reports 73500 kb free memory
Looks to me that there is a bug in streamReader.
The Exception is thrown at strm.ReadLine()
Can you try the above on a Plus2 to verify that my code is okay ?
Or am I doing something wrong ??
regards
Per