Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
1 rating:
 1 out of 5     Rate this Document

"Failure Loading Driver Module" Error When Using Modular Instruments .NET Wrappers with NI-DAQmx in Visual Studio 2005 Visual C# or Visual Basic .NET

Primary Software: Driver Software>>NI-DMM
Primary Software Version: 2.5
Primary Software Fixed Version: N/A
Secondary Software: Driver Software>>NI-DAQmx, Driver Software>>NI-DAQ, Measurement Studio>>.NET Support

Problem: I am using NI Modular Instruments, such as NI-Scope, NI-FGEN, and so on, with Visual C# or Visual Basic .NET in Microsoft Visual Studio 2005. I am also using an NI-DAQmx device in the same application. The NI-DAQmx .NET DLL depends on NationalInstruments.Common.dll. When I add a reference to NationalInstruments.Common.dll to the project, I receive "Failure Loading Driver Module" exceptions. How can I fix this error?

Solution: This problem is related to the issue described in KB 2Q1HG8A6, "Unusual Error Messages Loading, Executing, or Debugging an Application When Using NI-DAQ for Windows." This problem occurs because Modular Instruments uses Traditional NI-DAQ for some of its underlying functionality. When debugging the application in Visual Studio 2005, there are DLL base address conflicts occuring, which do not allow the driver to load correctly. Visual Studio 2005 loads some additional DLLs when NationalInstruments.Common.dll is added as a reference. This behavior is specific to Visual Studio 2005 and does not occur in Visual Studio .NET 2003.

Note: This problem only occurs when the application is being debugged. This issue will not occur with a deployed application.

To debug the application and maintain functionality, complete the following steps:

  1. In the project Properties, under Debug, uncheck the Enable the Visual Studio hosting process check box.

  2. In the same Property page, check the box for the Enable unmanaged code debugging option to also fix the problem.
Changing these options prevents Visual Studio 2005 from loading DLLs whose loading addresses cause this problem. Refer to the Related Links section for more information.

Related Links: KB ID: 2Q1HG8A6: Unusual Error Messages Loading, Executing, or Debugging an Application When Using NI-DAQ for Windows

Attachments:





Report Date: 09/22/2006
Last Updated: 04/10/2007
Document ID: 40R9K8TX

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit