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
GitHub or Developer Community 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.
Created attachment 8628 [details]
two CSharp files compressed
the attached two samples are from "Exam Ref 80-483 Programming in C#".
the execution result should be (and tested under windows with .net 4.5.1):
but under Mono stable 3.10 from Xamarian Repo, running under XUbuntu 14.04.1
I am not sure what Exam Ref sample this are but they are wrong. The execution results are racy and you can get any of possible 4 combinations. You can modify the source code and add Thread.Sleep (5); before any of results[index] sets to simulate the race easier.
How you analyzed the code?
It's not about racy condition at all. It's about 3 parallel tasks and parent wait for them all before continue.
if you run the same code under Windows without any modification, you will get the result as mentioned. Did you try it under windows?
not sure about Thread.Sleep(5); because it's about tasks not threads. it should be .wait(); and it's the last statement in the code.
It's racy, parent don't wait on them which can be easily tested when you do more than just simple assignment, e.g. Thread.Sleep