Demos failing at LoadWasapiDevicesCombo() - Could not load file or assembly

Jun 25, 2010 at 12:31 PM

I have just downloaded NAudio for an audio project.

Trying to run on Windows 7-64bit, Running existing binaries, or running in the IDE hits the same/similar error - See below.

The NAudio.dll file IS there where it is looking for it. I suspect it is a chained dependency issue.


When in the IDE, running NAudioDemo, this is at the point of the call: LoadWasapiDevicesCombo();

I have a fairly fresh Windows 7 install. I am no C# / .NET expert.

Development wise, not much more than Visual C# Express 2010 and NAudio installed.

Oh, I did install ASIO4ALL as I found mentioned somewhere.

What am I missing here? Do I need to install or register something else? Run as Administrator?


System.BadImageFormatException was unhandled
  Message=Could not load file or assembly 'NAudio, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
  FileName=NAudio, Version=, Culture=neutral, PublicKeyToken=null
  FusionLog==== Pre-bind state information ===
LOG: User = BigBlack\Peter
LOG: DisplayName = NAudio, Version=, Culture=neutral, PublicKeyToken=null
LOG: Appbase = file:///C:/Users/Peter/Documents/Visual C# Projects/NAudio-1-3/Source Code/NAudioDemo/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : NAudioDemo, Version=, Culture=neutral, PublicKeyToken=null.
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Peter\Documents\Visual C# Projects\NAudio-1-3\Source Code\NAudioDemo\bin\Debug\NAudioDemo.vshost.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/Peter/Documents/Visual C# Projects/NAudio-1-3/Source Code/NAudioDemo/bin/Debug/NAudio.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.

       at NAudioDemo.RecordingForm.LoadWasapiDevicesCombo()
       at NAudioDemo.RecordingForm..ctor() in C:\Users\Peter\Documents\Visual C# Projects\NAudio-1-3\Source Code\NAudioDemo\RecordingForm.cs:line 24
       at NAudioDemo.MainForm.buttonRecording_Click(Object sender, EventArgs e) in C:\Users\Peter\Documents\Visual C# Projects\NAudio-1-3\Source Code\NAudioDemo\MainForm.cs:line 38
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at NAudioDemo.Program.Main() in C:\Users\Peter\Documents\Visual C# Projects\NAudio-1-3\Source Code\NAudioDemo\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()


Jun 29, 2010 at 11:16 AM


the demos need to be rebuilt to target x86 to work on 64 bit windows. I've made the changes in the latest source code



Jun 29, 2010 at 3:01 PM

Ahh, OK. I have since run into that with a couple of other code demos I have been trying to run up on Win7-64. Brave new world of 64-bit I suppose...

I will give that a try. Thanks for the help.