I am working with an Azure project that has contributed a few posts in the past too. Today, I ran into this error where my application would not run locally. Before I push it to cloud I always run my application locally to make sure everything is fine and especially to ensure that no silly mistake will make me push the application to cloud again.
Everytime I try to run the application it would throw this error "The number of WaitHandles must be less than or equal to 64". I tried to remove parallelism where I used waitAll from my code. Tried setting hard coded values rather then reading properties and stuff but to no avail.
Then I pushed my code to cloud and it worked fine. This gave me an idea that probably it has something to do with the number of instances that I am using.
The error indeed was a stupid one and that I had 64 worker role instances. It seems this is not allowed to have more than 64 total instances (web role(s) + worker role(s)) together.
Nevertheless, the other reason that can throw this error is if you have ParallelOperationThreadCount set to a number greater than 64. I hope this will come handy to me or someone else some day.