08-11-2023 09:49 AM
Hi,
I am upgrading an existing .NET/C# application to use the .NET libraries for NI-488.2 (version 13.0.45). Everything is working great as long as I am using USB GPIB adapters, but when I run my application on a machine that has a PCI GPIB board, the board is not detected.
In short, this code throws an exception when my PCI GPIB board is board number 0 (I also have a USB GPIB board at board number 1):
using NationalInstruments.NI4882;
var board = new Board(0);
NI-MAX can see the board and allows me to talk to devices connected to it.
Is the .NET library not compatible with PCI and older GPIB boards?
Solved! Go to Solution.
08-18-2023 01:48 PM
After further investigation, I discovered that this GPIB board detection process actually is successful with PCI-GPIB cards. Since my laptop is not able to accept a PCI card, I had to rely on someone at another physical location to help troubleshoot the issue.
The real issue turned out to be that invoking the FindListeners() method on the Board class instance throws an InvalidOperationException when there are no instruments connected to a GPIB board, regardless of whether it is a USB or PCI card. This was unexpected. I would have expected FindListeners() to simply return an empty list instead of throwing an exception. After changing my code to account for this, all is well.