trying to play a .wav file in my application for a preview.
-> following code is beeing executed:
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = this.UnderlyingAudioFile.FullName;
player.Play();
Error occurs:
System.IO.FileNotFoundException: 'Please be sure a sound file exists at the specified location.'
this.UnderlyingAudioFile.FullName; Beeing a System.IO.FileInfo Object;
the path is definitely correct. I checked 3 times and can copy paste it from this.UnderlyingAudioFile.FullName;
This Error actually occurs, when the other thread cannot access the File.
in my case, I had to open the file with fileshare.read property:
this.Reader = new BinaryReader(File.Open(path,FileMode.Open,FileAccess.Read,FileShare.Read));