bonsai-rx / daqmx

Bonsai Library for interfacing with NI-DAQmx devices
https://bonsai-rx.org/daqmx
Other
1 stars 4 forks source link

instant crash using DAQmx Digital Output #16

Closed goyukiya closed 9 months ago

goyukiya commented 9 months ago

hi,

I am new to Bonsai and currently trying to use a digital output port on a NI DAQ device.

the workflow I am testing is as in the picture below ss

bonsai immediately crashes after starting and the errors below are displayed on the console.

Unhandled Exception: 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.DOChannel..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, tLineGrouping lineGrouping)
   at NationalInstruments.DAQmx.DOChannelCollection.CreateChannel(String lines, String nameToAssign, ChannelLineGrouping grouping)
   at Bonsai.DAQmx.DigitalOutput.CreateTask()
   at Bonsai.DAQmx.DigitalOutput.<>c__DisplayClass24_0`1.<ProcessSingleSample>b__0()
   at System.Reactive.Linq.ObservableImpl.Defer`1._.Run()
   at System.Reactive.Producer`1.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   at System.Reactive.Producer`1.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   at Bonsai.Expressions.InspectBuilder.<>c__DisplayClass47_0`1.<Process>b__0(IObserver`1 observer)
   at System.Reactive.AnonymousObservable`1.SubscribeCore(IObserver`1 observer)
   at System.Reactive.ObservableBase`1.Subscribe(IObserver`1 observer)
   at System.Reactive.Producer`1.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   at System.Reactive.Producer`1.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   at System.Reactive.Linq.ObservableImpl.Merge`1._.OnNext(IObservable`1 value)
   at System.Reactive.Linq.ObservableImpl.ToObservable`1._.LoopRec(State state, Action`1 recurse)
   at System.Reactive.Concurrency.Scheduler.<>c__DisplayClass50`1.<>c__DisplayClass52.<InvokeRec1>b__4f(IScheduler scheduler1, TState state3)
   at System.Reactive.Concurrency.ImmediateScheduler.AsyncLockScheduler.<>c__DisplayClass1`1.<Schedule>b__0()
   at System.Reactive.Concurrency.AsyncLock.Wait(Action action)
   at System.Reactive.Concurrency.ImmediateScheduler.AsyncLockScheduler.Schedule[TState](TState state, Func`3 action)
   at System.Reactive.Concurrency.Scheduler.<>c__DisplayClass50`1.<InvokeRec1>b__4e(TState state2)
   at System.Reactive.Linq.ObservableImpl.ToObservable`1._.LoopRec(State state, Action`1 recurse)
   at System.Reactive.Concurrency.Scheduler.InvokeRec1[TState](IScheduler scheduler, Pair`2 pair)
   at System.Reactive.Concurrency.ImmediateScheduler.Schedule[TState](TState state, Func`3 action)
   at System.Reactive.Concurrency.Scheduler.Schedule[TState](IScheduler scheduler, TState state, Action`2 action)
   at System.Reactive.Linq.ObservableImpl.ToObservable`1._.Run()
   at System.Reactive.Producer`1.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   at System.Reactive.Linq.ObservableImpl.Merge`1._.Run()
   at System.Reactive.Producer`1.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   at System.Reactive.Linq.ObservableImpl.Multicast`3._.Run()
   at System.Reactive.Producer`1.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   at System.Reactive.Producer`1.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   at System.Reactive.Linq.ObservableImpl.TakeUntil`2._.Run()
   at System.Reactive.Producer`1.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   at System.Reactive.Linq.ObservableImpl.Using`2._.Run()
   at System.Reactive.Producer`1.Run(IScheduler _, State x)
   at System.Reactive.Concurrency.ScheduledItem`2.InvokeCore()
   at System.Reactive.Concurrency.CurrentThreadScheduler.Trampoline.Run(SchedulerQueue`1 queue)
   at System.Reactive.Concurrency.CurrentThreadScheduler.Schedule[TState](TState state, TimeSpan dueTime, Func`3 action)   at System.Reactive.Concurrency.LocalScheduler.Schedule[TState](TState state, Func`3 action)
   at System.Reactive.Producer`1.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   at System.Reactive.Concurrency.Synchronization.<>c__DisplayClass2`1.<>c__DisplayClass4.<SubscribeOn>b__1()
   at System.Reactive.Concurrency.Scheduler.Invoke(IScheduler scheduler, Action action)
   at System.Reactive.Concurrency.CatchScheduler`1.<>c__DisplayClass5`1.<Wrap>b__4(IScheduler self, TState state)
   at System.Reactive.Concurrency.EventLoopScheduler.Run()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

there is no other application running on the system (Windows 10, NI-DAQmx Runtime 2023 Q4) and the device works fine with NI MAX, Matlab and the C-API.

any idea on what could cause this crash?

goyukiya commented 9 months ago

FYI the issue was solved by downgrading NI-DAQmx to 21.8.