Quantcast
Channel: Digital I/O topics
Viewing all articles
Browse latest Browse all 2167

AccessViolationException using DigitalSingleChannelWriter.WriteSingleSampleSingleLine

$
0
0

Hi,

 

Sometimes I get a System.AccessViolationException, here is the C# code:

StopTask(tsk);
tsk.Timing.SampleTimingType = SampleTimingType.OnDemand;
DigitalSingleChannelWriter writer = new DigitalSingleChannelWriter(tsk.Stream);
writer.WriteSingleSampleSingleLine(true, data);

This happens, if the Task "tsk" has done other actions (waveform output) before calling the StopTask.

 

I already found a solution for this: calling

tsk.Control(TaskAction.Verify); 

 after stopping the task.

 

I'm lucky to have a solution, but now I want to understand what is happening here:

- what exactly is TaskAction.Verify doing?

- is it a good practice to call TaskAction.Verify after every TaskAction.Stop every time? Are there any risks?

 

Thanks,

Jochen


Viewing all articles
Browse latest Browse all 2167

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>