Quantcast
Channel: NAudio
Viewing all articles
Browse latest Browse all 5831

Commented Unassigned: Error Handling for Corrupt Files [16466]

$
0
0
We are using NAudio in a media library application. As part of our unit testing suite, we run empty MP3 files (0 bytes) through our code to verify that corrupt files are handled correctly.

Unfortunately, the Mp3FileReader constructor throws a NullReferenceException, which isn't very descriptive and could happen for other reasons. Worse, it leaves the file reference open, so we're unable to clean up the empty test files.

Can we get a more robust exception, and some resource disposing? Thanks!
Comments: I've checked in a fix. Will throw InvalidDataException now if there is a zero length file. To be honest though, I tend to recommend using MediaFoundationReader wherever possible now as it is faster and copes better with odd MP3 files

Viewing all articles
Browse latest Browse all 5831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>