I think this is a mistake.
Disposing the sourceStream is not the responsibility of the WaveFormatConversionStream class.
I see no point in disposing a resource which was not created by the class itself.
For example: converting a stream to different formats or demultiplexing it succeeds first, then throwing NullReferenceException because sourceStream was disposed in the meantime.
Comments: You are right. I designed this class many years ago and would probably make a different decision today. It's convenient in some circumstances and a pain in others. The workaround I use when I need one is to decorate the input what I call an "IgnoreDisposeStream" which simply ignores calls to dispose but passes all other stream methods through to the source. I will consider this change for a future NAudio though
Disposing the sourceStream is not the responsibility of the WaveFormatConversionStream class.
I see no point in disposing a resource which was not created by the class itself.
For example: converting a stream to different formats or demultiplexing it succeeds first, then throwing NullReferenceException because sourceStream was disposed in the meantime.
Comments: You are right. I designed this class many years ago and would probably make a different decision today. It's convenient in some circumstances and a pain in others. The workaround I use when I need one is to decorate the input what I call an "IgnoreDisposeStream" which simply ignores calls to dispose but passes all other stream methods through to the source. I will consider this change for a future NAudio though