Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

NI4882.Device.Notify method crashes with VS2005

I had code where I used the "Notify" method of class "NationalInstruments.NI4882.Device" to set a callback method when RQS bit is set.  My code worked great with VS2003.  Now I tried the same code with VS2005 and I get the error below:
PInvokeStackImbalance was detected
Message: A call to PInvoke function 'NationalInstruments.NI4882!g::a' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
 
This happens only in debug mode and I came across someone who had similar issue and the suggested resolution was to press continue button.  Well, I really don't like that resolution if I am dealing with 20 pieces of equipment and I have to press continue for every instance of the Device class.  I also saw a comment that setting "Control.CheckForIllegalCrossThreadCalls" to false would take care of this issue; however, it didn't work on my pc.
 
I already tried the latest Measurement Studio release 8.01 and I still get same error.
 
Regards,
Rudy.
0 Kudos
Message 1 of 11
(4,790 Views)
Hi Rudy,

This is very interesting indeed. I'll take a look into this and let you know what we find out.

Regards,
Matt S.

LabVIEW Integration Engineer with experience in LabVIEW Real-Time, LabVIEW FPGA, DAQ, Machine Vision, as well as C/C++. CLAD, working on CLD and CLA.
Message 2 of 11
(4,773 Views)
I am experiencing exactly the same problem. I've contacted NI Tech Support last week, but there is no resolution so far.
0 Kudos
Message 3 of 11
(4,707 Views)
So it appears that this may be an issue caused by using a slightly older version of the .NET assemblies (the 1.1 .NET assemblies). You can get the 2.0 .NET assemblies off of the NI Driver CD. If you start using those assemblies this issue should be resolved.

Please let me know if this doesn't straighten this out for the both of you and we'll continue looking into it for you.

Regards,
Matt S.

LabVIEW Integration Engineer with experience in LabVIEW Real-Time, LabVIEW FPGA, DAQ, Machine Vision, as well as C/C++. CLAD, working on CLD and CLA.
0 Kudos
Message 4 of 11
(4,702 Views)
Just an update on this, make sure you have the latest NI Device Driver CD to get the .NET 2.0 assemblies. The CD released in August 2006 should have the correct installers.

Regards,
Matt S.

LabVIEW Integration Engineer with experience in LabVIEW Real-Time, LabVIEW FPGA, DAQ, Machine Vision, as well as C/C++. CLAD, working on CLD and CLA.
0 Kudos
Message 5 of 11
(4,673 Views)
Matt,
Can you send me a link to download this updated driver?
If I really have to get the CD, then can you give me more information on how to get the CD?  I usualy get the CDs with my NI cards.
 
 
Regards,
Rudy.
0 Kudos
Message 6 of 11
(4,665 Views)
Hi Rudy,

There's almost always a current version of the NI Device Driver CD on the FTP site.

you can go to

ftp://ftp.ni.com/outgoing

and look for a folder called NI Device Driver CD or a name similar to that. The version up right now is the August 06 version I mentioned. Reinstalling the NI-488.2 driver from that driver CD and making sure that you select support for .NET should get the correct assemblies for you.

Regards,
Matt S.

LabVIEW Integration Engineer with experience in LabVIEW Real-Time, LabVIEW FPGA, DAQ, Machine Vision, as well as C/C++. CLAD, working on CLD and CLA.
0 Kudos
Message 7 of 11
(4,646 Views)
Hi Matt,

You are absolutely right, installing the latest version of NI drivers and corresponding support for VS 2005 helped. Both the drivers and assemblies have been updated by the installer.

Thank you.

Michael
0 Kudos
Message 8 of 11
(4,533 Views)
Hello,

    I am downloading new drivers because of the problem described above. However, I need to support application that I cannot move from VS2003 (and .NET FW 1.1) to VS2005. So, my question if new drivers are backward compatible and would it be possible to continue development in VS2003 (and .NET FW 1.1)? Does anybody have any experince like this?

regards,
Roman.
0 Kudos
Message 9 of 11
(4,257 Views)
Hello

The drivers are designed to be backwards compatible. The above problem occurs if you try and use the .NET 1.1 version of the driver asseblies in VS2005. The problem goes away once you use the .NET 2.0 version of the driver assemblies.

You will be able to keep working with your application in VS2003 even if you upgrade the drivers. We will continue to provide support for the .NET 1.1 driver assemblies.

Bilal Durrani
NI
0 Kudos
Message 10 of 11
(4,248 Views)