NETMF, Queue, Threads, Classes


I have a Queue of objects, each object (A class) has a reference to another class.

The objects are added to the queue on the main thread with Enqueue.

The objects are removed from the queue and processed using Dequeue.

I’m using a lock around both the enqueue and dequeue calls.

Right after the enqueue, I can see the object in the queue and the reference is set using the debugger.

In the thread however, the queue has one item but it is an object with a null reference.

Am I missing something ? I would define the Queue as being volatile, but this isn’t supported in NETMF.

Hard to answer a coding question without seeing the code! :wink:

I’ve just found I was being an idiot and setting the reference to null before I used it. :C