Troubleshooting Exceptions: System.IO.EndOfStreamException

An EndOfStreamException exception is thrown when there is an attempt to read past the end of a stream.

Associated Tips

  • Check whether the end of the file has been reached before reading.
    Use the Peek method to check the end of the file before reading from the stream.

See Also

Tasks

How to: Use the Exception Assistant

How to: Read and Write to a Newly Created Data File

How to: Open and Append to a Log File

Reference

EndOfStreamException