Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

'NationalInstruments.NI4882.Internal.GpibDLL' exception

So I created a program based off the SimpleAsynchronousReadWrite example program. I am able to communicate with my GPIB device on the development computer, but when I transfer the program to another computer I get "The type initializer 'NationalInstruments.4882.Internal.GpibDLL' threw an exception".

 

I realize this is a driver issue. I need the program to be run from a network of test computers (20+) and I don't want to install the ~600MB NI 488.2 Installer on each PC.

1) Is there a more compact version of the driver that doesnt include all the NI Software?

2) Is there a more portable way to do this by just including the DLL's?

 

More info:

*development PC windows 7, has NI 488.2  3.0.2 installed

*program in VS2010, C#, .NET4

*test PCs that throw exception: win7 and XP, no NI 488.2 installed

*I have tried including all dll's that are related to 488.2 with my release folder, still always throwing exception

 

Any hints or ideas would be appreciated.

 

Thanks,

David

 

0 Kudos
Message 1 of 12
(6,182 Views)

@aenima4386 wrote:

So I created a program based off the SimpleAsynchronousReadWrite example program. I am able to communicate with my GPIB device on the development computer, but when I transfer the program to another computer I get "The type initializer 'NationalInstruments.4882.Internal.GpibDLL' threw an exception".

 

I realize this is a driver issue. I need the program to be run from a network of test computers (20+) and I don't want to install the ~600MB NI 488.2 Installer on each PC.

1) Is there a more compact version of the driver that doesnt include all the NI Software?

2) Is there a more portable way to do this by just including the DLL's?

 

More info:

*development PC windows 7, has NI 488.2  3.0.2 installed

*program in VS2010, C#, .NET4

*test PCs that throw exception: win7 and XP, no NI 488.2 installed

*I have tried including all dll's that are related to 488.2 with my release folder, still always throwing exception

 

Any hints or ideas would be appreciated.

 

Thanks,

David

 


You can do it the way you want to do it, or you can do it the way NI meant for you to do it.

Up to you.

 

 

0 Kudos
Message 2 of 12
(6,181 Views)

Hi aenima4386, actually installing the driver is required to create the correct references to the DLLs and some other operating system stuf, since your goal is pushing this via network you can plan creating an installer and include the 488.2 driver with it, in that way you will not need to install it apart.

 

You can check the link: How Can I Include Additional Installers with My LabVIEW Applications' Installer? if you have any doubt about the process.

 

Regards,

 

Eric NI

0 Kudos
Message 3 of 12
(6,166 Views)

Thanks Eric. Sounds like this is my best option. I'll give it a shot.

0 Kudos
Message 4 of 12
(6,156 Views)

Hi Eric,

 

I got the same problem in another computer, just like the case with 'aenima4386', my program works fine in most comuputers, but got 'the type initializer for 'nationalInstruments.NI4882.Internal.GpibDll' threw an expception.' in another comuputer! Below are some information in the computer: 

 

- Windows 7

- 32 bits <-- is it possible the root casue?

      -- I found drivers are installed in the C:\Program Files, but not C:\Program Files (x86)

      -- From above, so I copies all DLL files in my local (in my program folder)

- NI488.2 2.7.3, I always used "default" setting when installing NI driver

- I used VS2012/C# to compile my program in my computer, and execute in this "problem" computer

- I don't think I should insall extra LavView libraries, should I?

 

Please give me your suggestion is there something I miss? Or what I should do?

Very thkanks for your help...

0 Kudos
Message 5 of 12
(5,566 Views)

Hello chlo41,

 

Do you mind pasting the full text of the error? I am hoping there will be some more clues in there.

 

It looks like Eric and the previous posters may be long gone from the forums, but I want to make sure you have a chance to have your question looked at.

 

Are your NI-488.2 drivers the same version across multiple computers?

Do the solutions presented in the discussions below have any effect on the error?

 

Deploy a .NET app with NI dlls?

 

NI488.2 throws an exception

 

 

---
Alex C.
Applications Engineer
National Instruments
ni.com/support
0 Kudos
Message 6 of 12
(5,532 Views)

Hi Alex,

 

Thanks for your support, and below are my feedback information for your kindly help. You can find figures and text file for your reference in <Win7 32.zip> or <Win7 32.7z>

 

  1. I've tried sample code [SimpleReadWrite] from official web site and execute it in the computer I mentioned before (Win 7, 32 bits, .Net framework v4.5...).
    - I can get the same "exception", please refer to <figure1-1.png>, and the problem was happened in highlight code: new Device(...)  
    - I can get the error message just like I descripted before, please refer to <figure1-2.png>, and you can see full text of the error here.
    - From above, I can get error in call stack, see <figure1-3.png> and see <call_stack1-3.txt> for more detail
  2. In program I wrote for testing, it works fine in most computers. But got exception when I executed in the computer I mentioned above!
    - It seems the problem was the same, excepted in new Device(...). Please refer to <figure2-1.png>, and you can see more information in the $exception portion below of figure2-1
    - It's stranged! If I select "Any CPU" to do compile, I could get warning message in teh Ouput portion below of figure2-2. But no more warning if I select "x86" only. I can't sure if this is key point.
    - I referenced to all NI related libraries either from C:\Program Files or local direction, got the same exception results
  3. As to my NI-488.2 drivers, I think it should be the same version across multiple computer (Please let me know how to get the information you need if my answer is incorrectly).
  4. For the soultions presented in the discussions below two links, I don't they are not do any effect (maybe I can't get the poionts in them)!
  5. DLLs versions information

      - <NationalInstruments.Common.dll> 8.7.35.131
      - <NationalInstruments.Common.Native.dll> 8.7.35.131
      - <NationalInstruments.NI4882.dll> 8.9.35.104
      Runtime version is v2.0.50727
      For your information

 

  • While I install NI-488.2 driver, I always do Next --> Next --> Next (all by default options). Should I select extra options when installation? What are them? And I think I just used GPIB functions, so I don't need to care LabView related files, am I right?

 

[Question]

      - Do you think 32 bits OS is key point?
      - Should I find DLLs with different versions?
      - Is it ok if I used VS2012? Or I should use older version?
      - What else information I should provide? Or something above are not clear, please let me know.

 

Thanks again for your help, and I hope the error must be resolved because the program is very important for me, and it should be workable in the "problem" computer!!

Download All
0 Kudos
Message 7 of 12
(5,522 Views)

Hi chlo41,

 

I have seeing some other forums with similar issues, so I think you can take a look, they may be helpful:

 

http://forums.ni.com/t5/Measurement-Studio-for-NET/System-TypeInitializationException-The-type-initi...

 

http://forums.ni.com/t5/Measurement-Studio-for-NET/TypeInitalizationException-The-type-initializer-f...

 

Also this document has some information about your case:

 

http://digital.ni.com/public.nsf/allkb/70648C253C7155FD862570ED005EA94E?OpenDocument

 

Hope this will help you!

 

Regards 

M

 

0 Kudos
Message 8 of 12
(5,485 Views)

Hi Mikirius,

 

Thanks for your kindly suggestion, and I've checked some issues you provided.
But unfortunely, I still got the same error I mentioned in original post!

Below are my test results

  1. http://forums.ni.com/t5/Measurement-Studio-for-NET/System-TypeInitializationException-The-type-initi...
    It seems used for "VisualStudio based installer project" (by merging .MSM files), so I don't think and I don't know how to apply the solution in my .EXE application. And then I also installed VS 2013 Redistributiable Packages (x86) in "problemed" computer, but still not work.
  2. http://forums.ni.com/t5/Measurement-Studio-for-NET/TypeInitalizationException-The-type-initializer-f...
    I specified and new added useLegacyV2RuntimeActivationPolicy="true" for the startup tag in <my_app_name_here.dll> and rebuilt my VS solution again, but got the same exception!
  3. http://digital.ni.com/public.nsf/allkb/70648C253C7155FD862570ED005EA94E?OpenDocument
    As to the information, I will re-install NI-488.2 driver and let you know the result

Regarding to above results, if there something I misunderstanding or needed to be tried, please let me know

Very thanks for your help...

0 Kudos
Message 9 of 12
(5,468 Views)

Hi chlo41,

 

I saw in your first post that in most of your computers your code works fine, lets start from there, what is the difference between the computers that the code works from the one that does not?

could you please let me know what is the system configuration from the ones that work and the one that does not? (Windows version, Visual Studio version, measurement studio version, drivers versions, etc.)

 

For me it looks that there is some in-compatibility issue or something like that, also the think that you did copying the dll from programs files to (x86) not usually work depends if the dll is calling some others dlls or if has some dependencies (also if it needs to be installed or just drop in the target file).

 

We will go from there

 

regards

M

0 Kudos
Message 10 of 12
(5,456 Views)