Move Environment and friends to corefx
Currently System.Runtime.Extensions type forwards to the Environment in the runtime, which means we need to implement functionality in both coreclr and corert. It's also missing functionality, which means to add that functionality back we'd need to do so in both runtimes, and we'd miss out on sharing code with elsewhere in corefx.
This commit:
1) Adds Environment, EnvironmentVariableTarget, OperatingSystem, and PlatformID to corefx so that System.Runtime.Extensions contains the type rather than forwarding to it.
2) Adds implementations of all of the missing members: CommandLine, CurrentDirectory, ExitCode, Is64BitProcess, Is64BitOperatingSystem, OSVersion, SystemPageSize, UserInteractive, UserName, UserDomainName, Version, WorkingSet, GetLogicalDrives, GetFolderPath, and the overloads of Get/SetEnvironmentVariable(s) that take an EnvironmentVariableTarget.
3) Adds the additional members to the contract.
4) Adds some basic tests to ensure basic functionality works.
Work that still needs to be done after this:
1) Add an EnvironmentAugments type to System.Private.Corelib in both corefx and corert, use that to replace the reflection-based hack in this commit, then remove the current Environment from Corelib's model.xml so that the rewriter will make it internal. As part of this, we need to determine how to handle "IsAppXmodel/DesignMode" from corefx, whether we need two different builds for Win32/WinRT, etc.
2) Fix Get/SetEnvironmentVariable(s) to not ignore the EnvironmentVariableTarget. This should be doable once (1) is done.
3) Add more support to the Unix implementation of GetFolderPath for more special folders
4) Add a GetTickCount method to the System.Native native lib, ala the implementation in libcoreclr; the current implementation is functional but slower than it could be.
5) Implement more Windows functionality if/when missing functions become available: SHGetFolderPath and GetVersionExW.
6) Use GetLogicalProcessInformationEx in ProcessorCount (or delegate to the implementation in coreclr).
I will open issues for each of these prior to merging this commit.
Commit migrated from https://github.com/dotnet/corefx/commit/
fe5f4fbebc9e85c8e512a273567719dca15ac764