Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting an AccessViolationException in CreateChannel(...)

Hi,

 

I am getting an AccessViolationException when trying to create a pulse channel. The exception is...

 

"System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at nNIMSAI100.tChannelListCache.getChannelListForInitialization(tChannelListCache* )
at NationalInstruments.DAQmx.Channel..ctor(Task task, tCaseInsensitiveBasicString<wchar_t\,_STL::char_traits<wchar_t>\,_STL::allocator<wchar_t>\,nNIDMXS100::tLocaleConsideringWideStringComparitor\,nNIDMXS100::tLocaleConsideringWideStringCaseForcer>* virtualChannelName, tCaseInsensitiveBasicString<wchar_t\,_STL::char_traits<wchar_t>\,_STL::allocator<wchar_t>\,nNIDMXS100::tLocaleConsideringWideStringComparitor\,nNIDMXS100::tLocaleConsideringWideStringCaseForcer>* physicalChannelName, Int32 usageType, tChannelType channelType, tLineGrouping lineGrouping, tCaseInsensitiveBasicString<wchar_t\,_STL::char_traits<wchar_t>\,_STL::allocator<wchar_t>\,nNIDMXS100::tLocaleConsideringWideStringComparitor\,nNIDMXS100::tLocaleConsideringWideStringCaseForcer>* customScaleName)
at NationalInstruments.DAQmx.COChannel..ctor(Task task, tCaseInsensitiveBasicString<wchar_t\,_STL::char_traits<wchar_t>\,_STL::allocator<wchar_t>\,nNIDMXS100::tLocaleConsideringWideStringComparitor\,nNIDMXS100::tLocaleConsideringWideStringCaseForcer>* virtualChannelName, tCaseInsensitiveBasicString<wchar_t\,_STL::char_traits<wchar_t>\,_STL::allocator<wchar_t>\,nNIDMXS100::tLocaleConsideringWideStringComparitor\,nNIDMXS100::tLocaleConsideringWideStringCaseForcer>* physicalChannelName, Int32 usageType, tCaseInsensitiveBasicString<wchar_t\,_STL::char_traits<wchar_t>\,_STL::allocator<wchar_t>\,nNIDMXS100::tLocaleConsideringWideStringComparitor\,nNIDMXS100::tLocaleConsideringWideStringCaseForcer>* customScale)
at NationalInstruments.DAQmx.COChannelCollection.CreateChannel(String counter, String nameToAssignChannel, COOutputType type, String customScaleName)
at NationalInstruments.DAQmx.COChannelCollection.CreatePulseChannelTicks(String counter, String nameToAssignChannel, String sourceTerminal, COPulseIdleState idleState, Int32 initialDelay, Int32 lowTicks, Int32 highTicks)"

 

When I install older NI-DAQ™mx drivers on my machine (i.e. v21.8) there is no issue. The exception occurred when I try to run my program with the latest (2025 Q2) drivers installed.

Do you know what the problem is and how I can get around it without reverting to older drivers? Due to company policies, I need to be using the latest drivers available.

 

If you need more information just let me know. Thank you for your assistance.

 

Kindest Regards,

Rupesh

0 Kudos
Message 1 of 2
(121 Views)

Hi Rupesh,

 

Interesting that changing to an older version eliminates the problem...

 

Are you developing in Visual Studio?

Are you using .NET core or framework?

Which version of .NET are you using?

 

Could you share a code snippet / example to replicate the error?

 

Best regards

Leonard

0 Kudos
Message 2 of 2
(71 Views)