This occasionally made the BasicManualParallelBuilds test fail on Jenkins.
…ref, enums, native types, and generic sharing. Use it in places where possible.
After MemoryCache was imported from referencesources, some tests started failing occasionally. Cross-testing on MS.NET showed that you need to access the cached item to make MemoryCache.GetCount() reliably return the correct number after an item was expired from the cache. Also removed __MonoTimerPeriod and __MonoEmulateOneCPU configuration variables, they were used in Mono code before and don't make sense with the new code.
The unstable image seemed to cause problems recently. We should just use the default image and fetch Cygwin ourselves. Also added caching of the Cygwin files and simplified the script a bit.
There was a memory leak caused by not having a lookup mechanism for the RegistryKey. In addition, the entire code to dispose code was never used (due to the leak), and it was wrong. In addition, added locking to the "values" field, which currently was racy. No test cases, the repro is to run the above code for about 5 minutes.