Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

AccessViolationException using DigitalSingleChannelWriter.WriteSingleSampleSingleLine

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

0 Kudos
Message 1 of 2
(3,168 Views)

Hello Jochen,

 

Have you had a chance to review this info?

__________________________________________
The best way to thank, is to give KUDOS
0 Kudos
Message 2 of 2
(1,700 Views)