I just tried to run the NAudio demos and I'm getting a weird error:
System.BadImageFormatException: Could not load file or a
ssembly 'NAudio, Version=1.3.8.0, Culture=neutral, PublicKeyToken=null' or one o
f its dependencies. An attempt was made to load a program with an incorrect form
at.
File name: 'NAudio, Version=1.3.8.0, Culture=neutral, PublicKeyToken=null'
at NAudioWpfDemo.AudioGraph..ctor()
at NAudioWpfDemo.ControlPanelViewModel..ctor(IWaveFormRenderer waveFormRender
er, SpectrumAnalyser analyzer) in C:\Users\Admin\Downloads\NAudio-1.3\NAudio-1-3
\Source Code\NAudioWpfDemo\ControlPanelViewModel.cs:line 23
at NAudioWpfDemo.MainWindow..ctor() in C:\Users\Admin\Downloads\NAudio-1.3\NA
udio-1-3\Source Code\NAudioWpfDemo\MainWindow.xaml.cs:line 15
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\M
icrosoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure lo
gging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus
ion!EnableLog].
Since the last time I used NAudio demos I have changed from 32bit Windows XP to 64bit Windows 7. Would this cause this issue? Its very annoying as I was about to try my hand at audio in C# again
I have no experience with NAudio, but the exception you mention most often occurs when there is a bitness issue. Meaning that NAudio perhaps is compiled for 32 bit only, and you run 64 bit.
To try to fix this, in compilation properties for your project, set the output to be 32 bit (x86).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With