This project has moved and is read-only. For the latest updates, please go here.

WaveFileReader: EndOfStreamException

Feb 11, 2009 at 6:39 PM
On Vista, I am able to play a certain file through Media Player, however when I attempt to read it with the WaveFileReader I receive "System.IO.EndOfStreamException: Unable to read beyond the end of the stream". Other wav files are read successfully by WaveFileReader.

I need to be able to handle or prevent this from occurring. Any suggestions?

using (WaveFileReader sourceStream = new WaveFileReader(location)){...}

at System.IO.__Error.EndOfFile()
at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
at System.IO.BinaryReader.ReadInt32()
at NAudio.Wave.WaveFileReader.ReadWaveHeader(Stream streamref WaveFormat formatref Int64 dataChunkPositionref Int32 dataChunkLengthList`1 chunks)
at NAudio.Wave.WaveFileReader..ctor(Stream inputStream)
at NAudio.Wave.WaveFileReader..ctor(String waveFile)

Feb 11, 2009 at 8:26 PM
Have you tried with the very latest code from the source code tab? I fixed a similar issue very recently.
If that doesn't work, upload your wav file somewhere, and I will have a look to see what is causing the issue.

Feb 12, 2009 at 2:41 PM
Mark, thanks for responding. I am using the latest: v2.0.50727. I sent you an email which you can respond to, so that I can send you the wav file.