08-30-2023 06:19 AM
I'm trying to develop a WPF application in .NET7 on VS2022 that uses DAQmx library.
I referenced -
Then, when the project's target platform is set to x64, the application crashes when it calls DaqSystem.Local.GetPhysicalChannels with a "System.AccessViolationException". This happen only when I run the program from the IDE. If I play the program straight from the "bin" folder, it runs nicely.
If I reference x86 version of DAQmx.dll and the project's target platform is set to x86, then the program runs both within the IDE and straight from the "bin" folder.
I want to keep developing the application with x64 target platform.
Any suggestions?
Solved! Go to Solution.
09-01-2023 10:19 AM
I am having the same issue here also. Not able to target x64. Have you found a solution?
09-05-2023 09:52 AM
I get that too, been trying to get around it for a couple of weeks, any update on that?
09-06-2023 08:35 AM - edited 09-06-2023 08:35 AM
NI-DAQmx is NOT yet .Net Core compatible. It requires the .Net Framework 4 to run. If you want to run in .Net Core you will have to target the according C DLL directly through .Net Interop.
Here is a possible start for a C# Interop layer to DAQmx: https://github.com/jrdnwrth/NetDAQmx
And here is the NI-VISA variant: https://github.com/jrdnwrth/NetVisa
09-06-2023 08:47 AM
Thanks for the reply!
But here's the strange thing - even the ni-DAQmx example solutions (Which runs on .NET framework 4.5) behave in the exact same way.
09-08-2023 06:37 PM
Not sure if it has to do with the Visual Studio version. I am using Visual Studio Community 2015 and NI-DAQmx 2023 Q2.
I can debug the shipping example without any issues. The default setting builds with 64-bit.
10-03-2023 06:55 AM
Hey Rolf, thanks for the answer.
Just note, I did use the example you presented from Github.
The same issue still persist when I configure VS to work on x64 platform. I.e., when I call any of the functions from the NI dll, a System.AccessViolationException is thrown.