Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
When I add an item to Queue<T> it is null however I access it e.g. Queue.Dequeue().
I can see the item in the Queue in the debugger but when it is accessed I get null as explained above. Even if I do something like turning the queue into the list and accessing the item it ends up the same. Also the app seem to freeze in the next line after that, though I don't see anything in the output window.
When I change the app to use List<T> instead of Queue<T> it works correctly. And Queue<T> code worked perfectly on the UWP app. So there is some problem in MonoTouch.
Our unit tests does not show this behaviour. Can you please attach a test case so we can see how it's used and the exact build options that were used ? Thanks!
I'll see if I can make some testcase. Unfortunately this is a piece of software that has several tens of thousands of lines and it is hard to isolate some testcase from it.
If you can't see the behavior in the simple test case that you have tried, my guess would be that the next thing to test is to Enqueue one item on one thread and Dequeue it later from another thread, that's what my app is doing. If you still can't see it then there are some gremlins in my room :).
As I did some workaround by emulating Enqueue and Dequeue with List, I can't spend too much time trying to make a test case for the bug, but I'm still willing to help if I can.
If it's used from multiple threads then it's even more important for bus to see the code as not every usage of a Queue<T> is thread safe .
Note that the version of XI you're using, 9.6 (aka cycle 6), is using MS reference source code for the Queue<T> implementation, so the above warning fully applies.
As an alternative you might want to switch to ConcurrentQueue<T> to see if it solve your issue.
I believe you are right. It works on UWP, but I guess it is just by chance and may break in some future release, so I'll switch to the ConcurrentQueue.