开发者

NAudio demos not working anymore

开发者 https://www.devze.com 2022-12-30 04:27 出处:网络
I just tried to run the NAudio demos and I\'m getting a weird error: System.BadImageFormatException: Could not load file or a

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].

Sinc开发者_Python百科e 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).


Your program is trying to load a 32-bit DLL into a 64-bit process (or vice versa). On Windows, a 32-bit program can only load a 32-bit DLL and a 64-bit program can only load a 64-bit DLL.

Your program is probably targeting AnyCPU as the platform, so the compiler emits IL which, at runtime, becomes either a 32- or 64-bit process based on your platform. The DLL you're using (NAudio) is probably built for the x86 platform only.

In your project properties, try forcing the platform to be x86.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号