NAudio demos no longer work

I was just trying to run the NAudio demo and I get 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 the NAudio demo, I have changed from 32-bit Windows XP to 64-bit Windows 7. Can this cause this problem? Its very annoying when I was going to try myself again in audio in C #

+4
source share
2 answers

I have no experience with NAudio, but the exception that you mention most often occurs when there is a heartbeat problem. This means that NAudio may only be compiled for 32 bits and you are running 64 bit.

To fix this, in the compilation properties for your project, set the output to 32 bits (x86).

+7
source

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 probably targets AnyCPU as a platform, so the compiler emits an IL, which at runtime becomes either a 32- or 64-bit process based on your platform. The DLL you are using (NAudio) is probably built for the x86 platform only.

In the project properties, try to force the platform to be x86.

+3
source

Source: https://habr.com/ru/post/1309268/


All Articles