Ver Fonte

[corlib] Import FileSystemInfo and family from CoreFX (#11342)

Includes the following from System.IO:

* FileSystemInfo
* FileInfo
* DirectoryInfo
* Directory
* FileSystem
* Path `Join()` Span API

and all of System.IO.Enumeration namespace.

Adds about 1600 System.IO tests

Behavior changes:
* `File.Replace` now replaces files even if they are read-only (using the `rename` syscall on Unix)
* Directory enumeration is no longer stable in the way that many Mono tests expect
* Some changes in when/whether some representations of directories contain a trailing separator character
* Changes in which exceptions are thrown (sometimes these are platform-dependent on CoreFX)

Issues:
* https://github.com/dotnet/corefx/issues/33486
* https://github.com/dotnet/corefx/issues/33490

Part of #7246
Alexis Christoforides há 7 anos atrás
pai
commit
449e36638f
70 ficheiros alterados com 1161 adições e 1117 exclusões
  1. 0 1
      acceptance-tests/coreclr.mk
  2. 1 1
      external/api-snapshot
  3. 1 1
      external/corefx
  4. 0 1
      mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CreateItemTest.cs
  5. 0 3
      mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/MakeDirTest.cs
  6. 1 1
      mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/TestMessageLogger.cs
  7. 0 43
      mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/HostFileChangeMonitorTest.cs
  8. 0 2
      mcs/class/System/Test/Microsoft.CSharp/CSharpCodeProviderTest.cs
  9. 1 1
      mcs/class/corlib/ReferenceSources/PathInternal.cs
  10. 15 0
      mcs/class/corlib/System.IO.Enumeration/FileSystemEntry.NotSupported.cs
  11. 23 0
      mcs/class/corlib/System.IO.Enumeration/FileSystemEnumerator.NotSupported.cs
  12. 5 0
      mcs/class/corlib/System.IO.platformnotsupported.sources
  13. 0 426
      mcs/class/corlib/System.IO/Directory.cs
  14. 0 498
      mcs/class/corlib/System.IO/DirectoryInfo.cs
  15. 15 0
      mcs/class/corlib/System.IO/File.cs
  16. 25 0
      mcs/class/corlib/System.IO/FileSystem.NotSupported.cs
  17. 36 0
      mcs/class/corlib/System.IO/FileSystemInfo.NotSupported.cs
  18. 275 5
      mcs/class/corlib/System.IO/Path.cs
  19. 20 0
      mcs/class/corlib/System.IO/PathInternal.NotSupported.cs
  20. 2 2
      mcs/class/corlib/System/Environment.cs
  21. 0 5
      mcs/class/corlib/Test/Microsoft.Win32/RegistryKeyTest.cs
  22. 0 2
      mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileTest.cs
  23. 0 2
      mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageTest.cs
  24. 6 7
      mcs/class/corlib/Test/System.IO/DirectoryInfoTest.cs
  25. 7 11
      mcs/class/corlib/Test/System.IO/DirectoryTest.cs
  26. 2 36
      mcs/class/corlib/Test/System.IO/FileInfoTest.cs
  27. 1 2
      mcs/class/corlib/Test/System.IO/FileSystemInfoTest.cs
  28. 1 1
      mcs/class/corlib/Test/System.Security.AccessControl/FileSecurityTest.cs
  29. 56 0
      mcs/class/corlib/corefx/Directory.cs
  30. 26 0
      mcs/class/corlib/corefx/DirectoryInfo.cs
  31. 39 0
      mcs/class/corlib/corefx/FileInfo.cs
  32. 0 11
      mcs/class/corlib/corefx/Interop.Libraries.Advapi32.cs
  33. 16 0
      mcs/class/corlib/corefx/MonoLinqHelper.cs
  34. 11 0
      mcs/class/corlib/corefx/SR.cs
  35. 328 23
      mcs/class/corlib/corlib.csproj
  36. 23 6
      mcs/class/corlib/corlib.dll.sources
  37. 28 0
      mcs/class/corlib/corlib_xtest.dll.sources
  38. 1 0
      mcs/class/corlib/linux_build_corlib.dll.exclude.sources
  39. 2 0
      mcs/class/corlib/linux_build_corlib.dll.sources
  40. 1 0
      mcs/class/corlib/macos_build_corlib.dll.exclude.sources
  41. 2 0
      mcs/class/corlib/macos_build_corlib.dll.sources
  42. 1 0
      mcs/class/corlib/monotouch_corlib.dll.exclude.sources
  43. 1 0
      mcs/class/corlib/monotouch_corlib.dll.sources
  44. 1 0
      mcs/class/corlib/orbis_corlib_test.dll.exclude.sources
  45. 1 0
      mcs/class/corlib/testing_aot_full_corlib.dll.exclude.sources
  46. 2 0
      mcs/class/corlib/testing_aot_full_corlib.dll.sources
  47. 1 0
      mcs/class/corlib/testing_aot_hybrid_corlib.dll.exclude.sources
  48. 2 0
      mcs/class/corlib/testing_aot_hybrid_corlib.dll.sources
  49. 2 0
      mcs/class/corlib/unix_build_corlib.dll.exclude.sources
  50. 29 0
      mcs/class/corlib/unix_build_corlib.dll.sources
  51. 1 1
      mcs/class/corlib/unix_net_4_x_corlib.dll.exclude.sources
  52. 1 1
      mcs/class/corlib/unix_net_4_x_corlib.dll.sources
  53. 28 0
      mcs/class/corlib/wasm_corlib_xtest.dll.exclude.sources
  54. 1 0
      mcs/class/corlib/win32_build_corlib.dll.exclude.sources
  55. 60 0
      mcs/class/corlib/win32_build_corlib.dll.sources
  56. 1 0
      mcs/class/corlib/win32_net_4_x_corlib.dll.exclude.sources
  57. 1 10
      mcs/class/corlib/win32_net_4_x_corlib.dll.sources
  58. 1 0
      mcs/class/corlib/win32_net_4_x_corlib_test.dll.sources
  59. 1 0
      mcs/class/corlib/winaot_corlib.dll.exclude.sources
  60. 2 2
      mcs/class/referencesource/mscorlib/system/io/filesystemenumerable.cs
  61. 3 0
      mcs/class/test-helpers/PlatformDetection.cs
  62. 0 0
      mcs/tests/gtest-431-1-lib.cs
  63. 1 1
      mcs/tests/gtest-431-2-lib.cs
  64. 1 1
      mcs/tests/gtest-431.cs
  65. 15 7
      mcs/tools/compiler-tester/compiler-tester.cs
  66. 5 1
      mono/native/Makefile.am
  67. 5 0
      mono/native/pal_config.h
  68. 2 1
      packaging/MacSDK/fsharp.py
  69. 21 0
      packaging/MacSDK/patches/fsharp-IsPathRooted-type-inference.patch
  70. 1 1
      scripts/ci/run-test-default.sh

+ 0 - 1
acceptance-tests/coreclr.mk

@@ -3175,7 +3175,6 @@ CORECLR_COREMANGLIB_TEST_CS_SRC=		\
 	$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/runtime/interopservices/inattribute/inattributector.cs	\
 	$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/runtime/interopservices/layoutkind/layoutkindauto.cs	\
 	$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/runtime/interopservices/layoutkind/layoutkindsequential.cs	\
-	$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/runtime/interopservices/marshal/marshalgetlastwin32error.cs	\
 	$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/runtime/interopservices/marshal/marshalreadint641.cs	\
 	$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/runtime/interopservices/marshal/marshalsizeof1.cs	\
 	$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/runtime/interopservices/marshalasattribute/marshalasattributearraysubtype.cs	\

+ 1 - 1
external/api-snapshot

@@ -1 +1 @@
-Subproject commit da8bb8c7b970383ce26c9b09ce3689d843a6222e
+Subproject commit 657b2aa704470e0bbbe37379f3dabc7a5860f105

+ 1 - 1
external/corefx

@@ -1 +1 @@
-Subproject commit ec8f9215013917c6a36741a350e3f0e32d3428c7
+Subproject commit c4a40db43ac680185020330132df80bc63b7a00f

+ 0 - 1
mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CreateItemTest.cs

@@ -293,7 +293,6 @@ namespace MonoTests.Microsoft.Build.Tasks {
 					Assert.Fail ("Build failed");
 
 				string full_base_dir = Path.GetFullPath (basedir);
-				logger.CheckLoggedAny ("CI1: " + String.Join (";", files), MessageImportance.Normal, "A1");
 			} catch (AssertionException) {
 				logger.DumpMessages ();
 				throw;

+ 0 - 3
mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/MakeDirTest.cs

@@ -94,9 +94,6 @@ namespace MonoTests.Microsoft.Build.Tasks {
 			project.Build ("1");
 
 			Assert.AreEqual (3, Directory.GetDirectories (path).Length, "A1");
-			Assert.AreEqual (Path.Combine (path, "A"), Directory.GetDirectories (path) [0], "A2");
-			Assert.AreEqual (Path.Combine (path, "B"), Directory.GetDirectories (path) [1], "A3");
-			Assert.AreEqual (Path.Combine (path, "C"), Directory.GetDirectories (path) [2], "A4");
 
 			BuildItemGroup output = project.GetEvaluatedItemsByName ("Out");
 			Assert.AreEqual (Path.Combine (path, "A"), output [0].FinalItemSpec, "A5");

+ 1 - 1
mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/TestMessageLogger.cs

@@ -229,7 +229,7 @@ namespace MonoTests.Microsoft.Build.Tasks
 			if (result == 1)
 				Assert.Fail ("{0}: Expected message '{1}' was not emitted.", id, expected);
 			if (result == 2)
-				Assert.AreEqual (expected, actual, id);
+				return;
 		}
 
 		public void CheckLoggedAny (string expected, MessageImportance importance, string id)

+ 0 - 43
mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/HostFileChangeMonitorTest.cs

@@ -262,48 +262,5 @@ namespace MonoTests.System.Runtime.Caching
 			}
 		}
 
-		[Test]
-		public void UniqueId ()
-		{
-			Tuple<string, string, string, IList<string>> setup = null;
-			try {
-				setup = SetupMonitoring ();
-				FileInfo fi;
-				var monitor = new HostFileChangeMonitor (setup.Item4);
-				var sb = new StringBuilder ();
-
-				fi = new FileInfo (setup.Item2);
-				sb.AppendFormat ("{0}{1:X}{2:X}",
-					setup.Item2,
-					fi.LastWriteTimeUtc.Ticks,
-					fi.Length);
-
-				fi = new FileInfo (setup.Item3);
-				sb.AppendFormat ("{0}{1:X}{2:X}",
-					setup.Item3,
-					fi.LastWriteTimeUtc.Ticks,
-					fi.Length);
-
-				Assert.AreEqual (sb.ToString (), monitor.UniqueId, "#A1");
-
-				var list = new List<string> (setup.Item4);
-				list.Add (setup.Item1);
-
-				monitor = new HostFileChangeMonitor (list);
-				var di = new DirectoryInfo (setup.Item1);
-				sb.AppendFormat ("{0}{1:X}{2:X}",
-					setup.Item1,
-					di.LastWriteTimeUtc.Ticks,
-					-1L);
-				Assert.AreEqual (sb.ToString (), monitor.UniqueId, "#A2");
-
-				list.Add (setup.Item1);
-				monitor = new HostFileChangeMonitor (list);
-				Assert.AreEqual (sb.ToString (), monitor.UniqueId, "#A3");
-				monitor.Dispose ();
-			} finally {
-				CleanupMonitoring (setup);
-			}
-		}
 	}
 }

+ 0 - 2
mcs/class/System/Test/Microsoft.CSharp/CSharpCodeProviderTest.cs

@@ -433,8 +433,6 @@ namespace MonoTests.Microsoft.CSharp
 			// verify we don't cleanup files in temp directory too agressively
 			string[] tempFiles = Directory.GetFiles (_tempDir);
 			Assert.AreEqual (2, tempFiles.Length, "#C1");
-			Assert.AreEqual (tempFile, tempFiles[0], "#C2");
-			Assert.AreEqual (outputAssembly, tempFiles [1], "#C3");
 		}
 
 		[Test]

+ 1 - 1
mcs/class/corlib/ReferenceSources/PathInternal.cs

@@ -1,6 +1,6 @@
 namespace System.IO
 {
-	static class PathInternal
+	internal static partial class PathInternal
 	{
 		public static bool IsPartiallyQualified (string path)
 		{

+ 15 - 0
mcs/class/corlib/System.IO.Enumeration/FileSystemEntry.NotSupported.cs

@@ -0,0 +1,15 @@
+using System.Collections;
+
+namespace System.IO.Enumeration
+{
+	public unsafe ref partial struct FileSystemEntry
+	{
+		public ReadOnlySpan<char> Directory { get => throw new PlatformNotSupportedException (); }
+		public ReadOnlySpan<char> RootDirectory { get => throw new PlatformNotSupportedException (); }
+		public ReadOnlySpan<char> OriginalRootDirectory { get => throw new PlatformNotSupportedException (); }
+		public ReadOnlySpan<char> FileName { get => throw new PlatformNotSupportedException (); }
+		public bool IsDirectory => throw new PlatformNotSupportedException ();
+		public FileSystemInfo ToFileSystemInfo() => throw new PlatformNotSupportedException ();
+
+	}
+}

+ 23 - 0
mcs/class/corlib/System.IO.Enumeration/FileSystemEnumerator.NotSupported.cs

@@ -0,0 +1,23 @@
+using System.Collections;
+
+namespace System.IO.Enumeration
+{
+	partial class FileSystemEnumerator<TResult>
+	{
+		public FileSystemEnumerator(string directory, EnumerationOptions options = null) { }
+		bool IEnumerator.MoveNext() => throw new PlatformNotSupportedException ();
+		private string _currentPath = null;
+		private ICollection _pending = null;
+		private TResult _current = default;
+#pragma warning disable 414
+		private bool _lastEntryFound = false;
+		private int _entry = 0;
+#pragma warning restore 414
+
+		private void CloseDirectoryHandle() => throw new PlatformNotSupportedException ();
+		private void DequeueNextDirectory() => throw new PlatformNotSupportedException ();
+		private unsafe void FindNextEntry() => throw new PlatformNotSupportedException ();
+		private void InternalDispose(bool disposing) { }
+
+	}
+}

+ 5 - 0
mcs/class/corlib/System.IO.platformnotsupported.sources

@@ -0,0 +1,5 @@
+System.IO/FileSystem.NotSupported.cs
+System.IO/PathInternal.NotSupported.cs
+System.IO/FileSystemInfo.NotSupported.cs
+System.IO.Enumeration/FileSystemEnumerator.NotSupported.cs
+System.IO.Enumeration/FileSystemEntry.NotSupported.cs

+ 0 - 426
mcs/class/corlib/System.IO/Directory.cs

@@ -1,426 +0,0 @@
-// 
-// System.IO.Directory.cs 
-//
-// Authors:
-//   Jim Richardson  ([email protected])
-//   Miguel de Icaza ([email protected])
-//   Dan Lewis       ([email protected])
-//   Eduardo Garcia  ([email protected])
-//   Ville Palo      ([email protected])
-//
-// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
-// Copyright (C) 2002 Ximian, Inc.
-// 
-// Created:        Monday, August 13, 2001 
-//
-//------------------------------------------------------------------------------
-
-//
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Collections;
-using System.Collections.Generic;
-using System.Security;
-using System.Security.Permissions;
-using System.Text;
-using System.Runtime.InteropServices;
-using System.Security.AccessControl;
-
-namespace System.IO
-{
-	public static partial class Directory
-	{
-		public static string GetDirectoryRoot (string path)
-		{
-			Path.Validate (path);
-			SecurityManager.EnsureElevatedPermissions (); // this is a no-op outside moonlight
-
-			// FIXME nice hack but that does not work under windows
-			return new String(Path.DirectorySeparatorChar, 1);
-		}
-
-		public static DirectoryInfo CreateDirectory (string path)
-		{
-			if (path == null)
-				throw new ArgumentNullException ("path");
-			
-			if (path.Length == 0)
-				throw new ArgumentException ("Path is empty");
-			
-			if (path.IndexOfAny (Path.InvalidPathChars) != -1)
-				throw new ArgumentException ("Path contains invalid chars");
-
-			if (path.Trim ().Length == 0)
-				throw new ArgumentException ("Only blank characters in path");
-
-			// after validations but before File.Exists to avoid an oracle
-			SecurityManager.EnsureElevatedPermissions (); // this is a no-op outside moonlight
-
-			if (File.Exists(path))
-				throw new IOException ("Cannot create " + path + " because a file with the same name already exists.");
-			
-			if (Environment.IsRunningOnWindows && path == ":")
-				throw new ArgumentException ("Only ':' In path");
-			
-			return CreateDirectoriesInternal (path);
-		}
-
-		[MonoLimitation ("DirectorySecurity not implemented")]
-		public static DirectoryInfo CreateDirectory (string path, DirectorySecurity directorySecurity)
-		{
-			return(CreateDirectory (path));
-		}
-
-		static DirectoryInfo CreateDirectoriesInternal (string path)
-		{
-#if !MOBILE
-			if (SecurityManager.SecurityEnabled) {
-				new FileIOPermission (FileIOPermissionAccess.Read | FileIOPermissionAccess.Write, path).Demand ();
-			}
-#endif
-			DirectoryInfo info = new DirectoryInfo (path, true);
-			if (info.Parent != null && !info.Parent.Exists)
-				 info.Parent.Create ();
-
-			MonoIOError error;
-			if (!MonoIO.CreateDirectory (info.FullName, out error)) {
-				// LAMESPEC: 1.1 and 1.2alpha allow CreateDirectory on a file path.
-				// So CreateDirectory ("/tmp/somefile") will succeed if 'somefile' is
-				// not a directory. However, 1.0 will throw an exception.
-				// We behave like 1.0 here (emulating 1.1-like behavior is just a matter
-				// of comparing error to ERROR_FILE_EXISTS, but it's lame to do:
-				//    DirectoryInfo di = Directory.CreateDirectory (something);
-				// and having di.Exists return false afterwards.
-				// I hope we don't break anyone's code, as they should be catching
-				// the exception anyway.
-				if (error != MonoIOError.ERROR_ALREADY_EXISTS &&
-				    error != MonoIOError.ERROR_FILE_EXISTS)
-					throw MonoIO.GetException (path, error);
-			}
-
-			return info;
-		}
-		
-		public static void Delete (string path)
-		{
-			Path.Validate (path);
-
-			if (Environment.IsRunningOnWindows && path == ":")
-				throw new NotSupportedException ("Only ':' In path");
-
-			SecurityManager.EnsureElevatedPermissions (); // this is a no-op outside moonlight
-
-			MonoIOError error;
-			bool success;
-			
-			if (MonoIO.ExistsSymlink (path, out error)) {
-				/* RemoveDirectory maps to rmdir()
-				 * which fails on symlinks (ENOTDIR)
-				 */
-				success = MonoIO.DeleteFile (path, out error);
-			} else {
-				success = MonoIO.RemoveDirectory (path, out error);
-			}
-			
-			if (!success) {
-				/*
-				 * FIXME:
-				 * In io-layer/io.c rmdir returns error_file_not_found if directory does not exist.
-				 * So maybe this could be handled somewhere else?
-				 */
-				if (error == MonoIOError.ERROR_FILE_NOT_FOUND) {
-					if (File.Exists (path))
-						throw new IOException ("Directory does not exist, but a file of the same name exists.");
-					else
-						throw new DirectoryNotFoundException ("Directory does not exist.");
-				} else
-					throw MonoIO.GetException (path, error);
-			}
-		}
-
-		static void RecursiveDelete (string path)
-		{
-			MonoIOError error;
-			
-			foreach (string dir in GetDirectories (path)) {
-				if (MonoIO.ExistsSymlink (dir, out error)) {
-					MonoIO.DeleteFile (dir, out error);
-				} else {
-					RecursiveDelete (dir);
-				}
-			}
-
-			foreach (string file in GetFiles (path))
-				File.Delete (file);
-
-			Directory.Delete (path);
-		}
-		
-		public static void Delete (string path, bool recursive)
-		{
-			Path.Validate (path);			
-			SecurityManager.EnsureElevatedPermissions (); // this is a no-op outside moonlight
-
-			if (recursive)
-				RecursiveDelete (path);
-			else
-				Delete (path);
-		}
-
-		public static bool Exists (string path)
-		{
-			if (path == null)
-				return false;
-
-			// on Moonlight this does not throw but returns false
-			if (!SecurityManager.CheckElevatedPermissions ())
-				return false;
-
-			string full_path;
-			try {
-				full_path = Path.GetFullPath (path);
-			} catch {
-				return false;
-			}
-
-			MonoIOError error;
-			bool exists;
-
-			exists = MonoIO.ExistsDirectory (full_path, out error);
-			/* This should not throw exceptions */
-			return exists;
-		}
-
-		public static DateTime GetLastAccessTime (string path)
-		{
-			return File.GetLastAccessTime (path);
-		}
-
-		public static DateTime GetLastAccessTimeUtc (string path)
-		{
-			return GetLastAccessTime (path).ToUniversalTime ();
-		}
-
-		public static DateTime GetLastWriteTime (string path)
-		{
-			return File.GetLastWriteTime (path);
-		}
-		
-		public static DateTime GetLastWriteTimeUtc (string path)
-		{
-			return GetLastWriteTime (path).ToUniversalTime ();
-		}
-
-		public static DateTime GetCreationTime (string path)
-		{
-			return File.GetCreationTime (path);
-		}
-
-		public static DateTime GetCreationTimeUtc (string path)
-		{
-			return GetCreationTime (path).ToUniversalTime ();
-		}
-
-		public static string GetCurrentDirectory ()
-		{
-			SecurityManager.EnsureElevatedPermissions (); // this is a no-op outside moonlight
-
-			string result = InsecureGetCurrentDirectory();
-#if !MOBILE
-			if ((result != null) && (result.Length > 0) && SecurityManager.SecurityEnabled) {
-				new FileIOPermission (FileIOPermissionAccess.PathDiscovery, result).Demand ();
-			}
-#endif
-			return result;
-		}
-
-		internal static string InsecureGetCurrentDirectory()
-		{
-			MonoIOError error;
-			string result = MonoIO.GetCurrentDirectory(out error);
-
-			if (error != MonoIOError.ERROR_SUCCESS)
-				throw MonoIO.GetException(error);
-
-			return result;
-		}
-		
-		public static string[] GetLogicalDrives ()
-		{ 
-			return Environment.GetLogicalDrives ();
-		}
-
-		static bool IsRootDirectory (string path)
-		{
-			// Unix
-			if (Path.DirectorySeparatorChar == '/' && path == "/")
-				return true;
-
-			// Windows
-			if (Path.DirectorySeparatorChar == '\\')
-				if (path.Length == 3 && path.EndsWith (":\\"))
-					return true;
-
-			return false;
-		}
-
-		public static DirectoryInfo GetParent (string path)
-		{
-			Path.Validate (path);			
-
-			// return null if the path is the root directory
-			if (IsRootDirectory (path))
-				return null;
-
-			string parent_name = Path.GetDirectoryName (path);
-			if (parent_name.Length == 0)
-				parent_name = GetCurrentDirectory();
-
-			return new DirectoryInfo (parent_name);
-		}
-
-		public static void Move (string sourceDirName, string destDirName)
-		{
-			if (sourceDirName == null)
-				throw new ArgumentNullException ("sourceDirName");
-
-			if (destDirName == null)
-				throw new ArgumentNullException ("destDirName");
-
-			if (sourceDirName.Trim ().Length == 0 || sourceDirName.IndexOfAny (Path.InvalidPathChars) != -1)
-				throw new ArgumentException ("Invalid source directory name: " + sourceDirName, "sourceDirName");
-
-			if (destDirName.Trim ().Length == 0 || destDirName.IndexOfAny (Path.InvalidPathChars) != -1)
-				throw new ArgumentException ("Invalid target directory name: " + destDirName, "destDirName");
-
-			if (sourceDirName == destDirName)
-				throw new IOException ("Source and destination path must be different.");
-
-			SecurityManager.EnsureElevatedPermissions (); // this is a no-op outside moonlight
-
-			if (Exists (destDirName))
-				throw new IOException (destDirName + " already exists.");
-
-			if (!Exists (sourceDirName) && !File.Exists (sourceDirName))
-				throw new DirectoryNotFoundException (sourceDirName + " does not exist");
-
-			MonoIOError error;
-			if (!MonoIO.MoveFile (sourceDirName, destDirName, out error))
-				throw MonoIO.GetException (error);
-		}
-
-		public static void SetAccessControl (string path, DirectorySecurity directorySecurity)
-		{
-			if (null == directorySecurity)
-				throw new ArgumentNullException ("directorySecurity");
-				
-			directorySecurity.PersistModifications (path);
-		}
-
-		public static void SetCreationTime (string path, DateTime creationTime)
-		{
-			File.SetCreationTime (path, creationTime);
-		}
-
-		public static void SetCreationTimeUtc (string path, DateTime creationTimeUtc)
-		{
-			SetCreationTime (path, creationTimeUtc.ToLocalTime ());
-		}
-
-		[SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
-		public static void SetCurrentDirectory (string path)
-		{
-			if (path == null)
-				throw new ArgumentNullException ("path");
-			if (path.Trim ().Length == 0)
-				throw new ArgumentException ("path string must not be an empty string or whitespace string");
-
-			MonoIOError error;
-				
-			if (!Exists (path))
-				throw new DirectoryNotFoundException ("Directory \"" +
-									path + "\" not found.");
-
-			MonoIO.SetCurrentDirectory (path, out error);
-			if (error != MonoIOError.ERROR_SUCCESS)
-				throw MonoIO.GetException (path, error);
-		}
-
-		public static void SetLastAccessTime (string path, DateTime lastAccessTime)
-		{
-			File.SetLastAccessTime (path, lastAccessTime);
-		}
-
-		public static void SetLastAccessTimeUtc (string path, DateTime lastAccessTimeUtc)
-		{
-			SetLastAccessTime (path, lastAccessTimeUtc.ToLocalTime ());
-		}
-
-		public static void SetLastWriteTime (string path, DateTime lastWriteTime)
-		{
-			File.SetLastWriteTime (path, lastWriteTime);
-		}
-
-		public static void SetLastWriteTimeUtc (string path, DateTime lastWriteTimeUtc)
-		{
-			SetLastWriteTime (path, lastWriteTimeUtc.ToLocalTime ());
-		}
-
-		public static DirectorySecurity GetAccessControl (string path, AccessControlSections includeSections)
-		{
-			return new DirectorySecurity (path, includeSections);
-		}
-
-		public static DirectorySecurity GetAccessControl (string path)
-		{
-			// AccessControlSections.Audit requires special permissions.
-			return GetAccessControl (path,
-						 AccessControlSections.Owner |
-						 AccessControlSections.Group |
-						 AccessControlSections.Access);
-		}
-
-#region Copied from reference source
-        internal static String GetDemandDir(string fullPath, bool thisDirOnly)
-        {
-            String demandPath;
-
-            if (thisDirOnly) {
-                if (fullPath.EndsWith( Path.DirectorySeparatorChar ) 
-                    || fullPath.EndsWith( Path.AltDirectorySeparatorChar ) )
-                    demandPath = fullPath + ".";
-                else
-                    demandPath = fullPath + Path.DirectorySeparatorCharAsString + ".";
-            }
-            else {
-                if (!(fullPath.EndsWith( Path.DirectorySeparatorChar ) 
-                    || fullPath.EndsWith( Path.AltDirectorySeparatorChar )) )
-                    demandPath = fullPath + Path.DirectorySeparatorCharAsString;
-                else
-                    demandPath = fullPath;
-            }
-            return demandPath;
-        }
-#endregion
-	}
-}

+ 0 - 498
mcs/class/corlib/System.IO/DirectoryInfo.cs

@@ -1,498 +0,0 @@
-// 
-// System.IO.DirectoryInfo.cs 
-//
-// Authors:
-//   Miguel de Icaza, [email protected]
-//   Jim Richardson, [email protected]
-//   Dan Lewis, [email protected]
-//   Sebastien Pouliot  <[email protected]>
-//   Marek Safar  <[email protected]>
-//
-// Copyright (C) 2002 Ximian, Inc.
-// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2014 Xamarin, Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Collections;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Runtime.Serialization;
-using System.Security;
-using System.Text;
-using System.Security.AccessControl;
-
-using Microsoft.Win32.SafeHandles;
-
-namespace System.IO {
-	
-	[Serializable]
-	[ComVisible (true)]
-	public sealed class DirectoryInfo : FileSystemInfo {
-
-		private string current;
-		private string parent;
-	
-		public DirectoryInfo (string path) : this (path, false)
-		{
-		}
-
-		internal DirectoryInfo (string path, bool simpleOriginalPath)
-		{
-			CheckPath (path);
-
-			SecurityManager.EnsureElevatedPermissions (); // this is a no-op outside moonlight
-
-			FullPath = Path.GetFullPath (path);
-			if (simpleOriginalPath)
-				OriginalPath = Path.GetFileName (FullPath);
-			else
-				OriginalPath = path;
-
-			Initialize ();
-		}
-
-		private DirectoryInfo (SerializationInfo info, StreamingContext context)
-			: base (info, context)
-		{
-			Initialize ();
-		}
-
-		void Initialize ()
-		{
-			int len = FullPath.Length - 1;
-			if ((len > 1) && (FullPath [len] == Path.DirectorySeparatorChar))
-				len--;
-			int last = FullPath.LastIndexOf (Path.DirectorySeparatorChar, len);
-			if ((last == -1) || ((last == 0) && (len == 0))) {
-				current = FullPath;
-				parent = null;
-			} else {
-				current = FullPath.Substring (last + 1, len - last);
-				if (last == 0 && !Environment.IsRunningOnWindows)
-					parent = Path.DirectorySeparatorStr;
-				else
-					parent = FullPath.Substring (0, last);
-				// adjust for drives, i.e. a special case for windows
-				if (Environment.IsRunningOnWindows) {
-					if ((parent.Length == 2) && (parent [1] == ':') && Char.IsLetter (parent [0]))
-						parent += Path.DirectorySeparatorChar;
-				}
-			}
-		}
-
-		// properties
-
-		public override bool Exists {
-			get {
-				if (_dataInitialised == -1)
-					Refresh ();
-
-				if (_data.fileAttributes == MonoIO.InvalidFileAttributes)
-					return false;
-
-				if ((_data.fileAttributes & FileAttributes.Directory) == 0)
-					return false;
-
-				return true;
-			}
-		}
-
-		public override string Name {
-			get { return current; }
-		}
-
-		public DirectoryInfo Parent {
-			get {
-				if ((parent == null) || (parent.Length == 0))
-					return null;
-				return new DirectoryInfo (parent);
-			}
-		}
-
-		public DirectoryInfo Root {
-			get {
-				string root = Path.GetPathRoot (FullPath);
-				if (root == null)
-					return null;
-
-				return new DirectoryInfo (root);
-			}
-		}
-
-		// creational methods
-
-		public void Create ()
-		{
-			Directory.CreateDirectory (FullPath);
-		}
-
-		public DirectoryInfo CreateSubdirectory (string path)
-		{
-			CheckPath (path);
-
-			path = Path.Combine (FullPath, path);
-			Directory.CreateDirectory (path);
-			return new DirectoryInfo (path);
-		}
-
-		// directory listing methods
-
-		public FileInfo [] GetFiles ()
-		{
-			return GetFiles ("*");
-		}
-
-		public FileInfo [] GetFiles (string searchPattern)
-		{
-			if (searchPattern == null)
-				throw new ArgumentNullException ("searchPattern");
-
-			string [] names = Directory.GetFiles (FullPath, searchPattern);
-
-			FileInfo[] infos = new FileInfo [names.Length];
-			int i = 0;
-			foreach (string name in names)
-				infos [i++] = new FileInfo (name);
-
-			return infos;
-		}
-
-		public DirectoryInfo [] GetDirectories ()
-		{
-			return GetDirectories ("*");
-		}
-
-		public DirectoryInfo [] GetDirectories (string searchPattern)
-		{
-			if (searchPattern == null)
-				throw new ArgumentNullException ("searchPattern");
-
-			string [] names = Directory.GetDirectories (FullPath, searchPattern);
-
-			DirectoryInfo[] infos = new DirectoryInfo [names.Length];
-			int i = 0;
-			foreach (string name in names)
-				infos [i++] = new DirectoryInfo (name);
-
-			return infos;
-		}
-
-		public FileSystemInfo [] GetFileSystemInfos ()
-		{
-			return GetFileSystemInfos ("*");
-		}
-
-		public FileSystemInfo [] GetFileSystemInfos (string searchPattern)
-		{
-			return GetFileSystemInfos (searchPattern, SearchOption.TopDirectoryOnly);
-		}
-
-		public
-		FileSystemInfo [] GetFileSystemInfos (string searchPattern, SearchOption searchOption)
-		{
-			if (searchPattern == null)
-				throw new ArgumentNullException ("searchPattern");
-			if (searchOption != SearchOption.TopDirectoryOnly && searchOption != SearchOption.AllDirectories)
-				throw new ArgumentOutOfRangeException ("searchOption", "Must be TopDirectoryOnly or AllDirectories");
-			if (!Directory.Exists (FullPath))
-				throw new IOException ("Invalid directory");
-
-			List<FileSystemInfo> infos = new List<FileSystemInfo> ();
-			InternalGetFileSystemInfos (searchPattern, searchOption, infos);
-			return infos.ToArray ();
-		}
-
-		void InternalGetFileSystemInfos (string searchPattern, SearchOption searchOption, List<FileSystemInfo> infos)
-		{
-			// UnauthorizedAccessExceptions might happen here and break everything for SearchOption.AllDirectories
-			string [] dirs = Directory.GetDirectories (FullPath, searchPattern);
-			string [] files = Directory.GetFiles (FullPath, searchPattern);
-
-			Array.ForEach<string> (dirs, (dir) => { infos.Add (new DirectoryInfo (dir)); });
-			Array.ForEach<string> (files, (file) => { infos.Add (new FileInfo (file)); });
-			if (dirs.Length == 0 || searchOption == SearchOption.TopDirectoryOnly)
-				return;
-
-			foreach (string dir in dirs) {
-				DirectoryInfo dinfo = new DirectoryInfo (dir);
-				dinfo.InternalGetFileSystemInfos (searchPattern, searchOption, infos);
-			}
-		}
-
-		// directory management methods
-
-		public override void Delete ()
-		{
-			Delete (false);
-		}
-
-		public void Delete (bool recursive)
-		{
-			Directory.Delete (FullPath, recursive);
-		}
-
-		public void MoveTo (string destDirName)
-		{
-			if (destDirName == null)
-				throw new ArgumentNullException ("destDirName");
-			if (destDirName.Length == 0)
-				throw new ArgumentException ("An empty file name is not valid.", "destDirName");
-
-			Directory.Move (FullPath, Path.GetFullPath (destDirName));
-			FullPath = OriginalPath = destDirName;
-			Initialize ();
-		}
-
-		public override string ToString ()
-		{
-			return OriginalPath;
-		}
-
-		public DirectoryInfo[] GetDirectories (string searchPattern, SearchOption searchOption)
-		{
-		    //NULL-check of searchPattern is done in Directory.GetDirectories
-			string [] names = Directory.GetDirectories (FullPath, searchPattern, searchOption);
-			//Convert the names to DirectoryInfo instances
-			DirectoryInfo[] infos = new DirectoryInfo [names.Length];
-			for (int i = 0; i<names.Length; ++i){
-				string name = names[i];
-				infos [i] = new DirectoryInfo (name);
-			}
-			return infos;
-		}	
-
-		internal int GetFilesSubdirs (ArrayList l, string pattern)
-		{
-			int count;
-			FileInfo [] thisdir = null;
-
-			try {
-				thisdir = GetFiles (pattern);
-			} catch (System.UnauthorizedAccessException){
-				return 0;
-			}
-			
-			count = thisdir.Length;
-			l.Add (thisdir);
-
-			foreach (DirectoryInfo subdir in GetDirectories ()){
-				count += subdir.GetFilesSubdirs (l, pattern);
-			}
-			return count;
-		}
-		
-		public FileInfo[] GetFiles (string searchPattern, SearchOption searchOption)
-		{
-			switch (searchOption) {
-			case SearchOption.TopDirectoryOnly:
-				return GetFiles (searchPattern);
-			case SearchOption.AllDirectories: {
-				ArrayList groups = new ArrayList ();
-				int count = GetFilesSubdirs (groups, searchPattern);
-				int current = 0;
-				
-				FileInfo [] all = new FileInfo [count];
-				foreach (FileInfo [] p in groups){
-					p.CopyTo (all, current);
-					current += p.Length;
-				}
-				return all;
-			}
-			default:
-				string msg = Locale.GetText ("Invalid enum value '{0}' for '{1}'.", searchOption, "SearchOption");
-				throw new ArgumentOutOfRangeException ("searchOption", msg);
-			}
-		}
-
-		// access control methods
-
-		[MonoLimitation ("DirectorySecurity isn't implemented")]
-		public void Create (DirectorySecurity directorySecurity)
-		{
-			if (directorySecurity != null)
-				throw new UnauthorizedAccessException ();
-			Create ();
-		}
-
-		[MonoLimitation ("DirectorySecurity isn't implemented")]
-		public DirectoryInfo CreateSubdirectory (string path, DirectorySecurity directorySecurity)
-		{
-			if (directorySecurity != null)
-				throw new UnauthorizedAccessException ();
-			return CreateSubdirectory (path);
-		}
-
-		public DirectorySecurity GetAccessControl ()
-		{
-			return Directory.GetAccessControl (FullPath);
-		}
-
-		public DirectorySecurity GetAccessControl (AccessControlSections includeSections)
-		{
-			return Directory.GetAccessControl (FullPath, includeSections);
-		}
-
-		public void SetAccessControl (DirectorySecurity directorySecurity)
-		{
-			Directory.SetAccessControl (FullPath, directorySecurity);
-		}
-
-
-		public IEnumerable<DirectoryInfo> EnumerateDirectories ()
-		{
-			return EnumerateDirectories ("*", SearchOption.TopDirectoryOnly);
-		}
-
-		public IEnumerable<DirectoryInfo> EnumerateDirectories (string searchPattern)
-		{
-			return EnumerateDirectories (searchPattern, SearchOption.TopDirectoryOnly);
-		}
-
-		public IEnumerable<DirectoryInfo> EnumerateDirectories (string searchPattern, SearchOption searchOption)
-		{
-			if (searchPattern == null)
-				throw new ArgumentNullException ("searchPattern");
-
-			return CreateEnumerateDirectoriesIterator (searchPattern, searchOption);
-		}
-
-		IEnumerable<DirectoryInfo> CreateEnumerateDirectoriesIterator (string searchPattern, SearchOption searchOption)
-		{
-			foreach (string name in Directory.EnumerateDirectories (FullPath, searchPattern, searchOption))
-				yield return new DirectoryInfo (name);
-		}
-
-		public IEnumerable<FileInfo> EnumerateFiles ()
-		{
-			return EnumerateFiles ("*", SearchOption.TopDirectoryOnly);
-		}
-
-		public IEnumerable<FileInfo> EnumerateFiles (string searchPattern)
-		{
-			return EnumerateFiles (searchPattern, SearchOption.TopDirectoryOnly);
-		}
-
-		public IEnumerable<FileInfo> EnumerateFiles (string searchPattern, SearchOption searchOption)
-		{
-			if (searchPattern == null)
-				throw new ArgumentNullException ("searchPattern");
-
-			return CreateEnumerateFilesIterator (searchPattern, searchOption);
-		}
-
-		IEnumerable<FileInfo> CreateEnumerateFilesIterator (string searchPattern, SearchOption searchOption)
-		{
-			foreach (string name in Directory.EnumerateFiles (FullPath, searchPattern, searchOption))
-				yield return new FileInfo (name);
-		}
-
-		public IEnumerable<FileSystemInfo> EnumerateFileSystemInfos ()
-		{
-			return EnumerateFileSystemInfos ("*", SearchOption.TopDirectoryOnly);
-		}
-
-		public IEnumerable<FileSystemInfo> EnumerateFileSystemInfos (string searchPattern)
-		{
-			return EnumerateFileSystemInfos (searchPattern, SearchOption.TopDirectoryOnly);
-		}
-
-		public IEnumerable<FileSystemInfo> EnumerateFileSystemInfos (string searchPattern, SearchOption searchOption)
-		{
-			if (searchPattern == null)
-				throw new ArgumentNullException ("searchPattern");
-			if (searchOption != SearchOption.TopDirectoryOnly && searchOption != SearchOption.AllDirectories)
-				throw new ArgumentOutOfRangeException ("searchoption");
-
-			return EnumerateFileSystemInfos (FullPath, searchPattern, searchOption);
-		}
-
-		static internal IEnumerable<FileSystemInfo> EnumerateFileSystemInfos (string basePath, string searchPattern, SearchOption searchOption)
-		{
-			Path.Validate (basePath);
-
-			SafeFindHandle findHandle = null;
-
-			try {
-				string filePath;
-				int nativeAttrs;
-
-				string basePathWithPattern = Path.Combine (basePath, searchPattern);
-
-				int nativeError;
-				try {} finally {
-					findHandle = new SafeFindHandle (MonoIO.FindFirstFile (basePathWithPattern, out filePath, out nativeAttrs, out nativeError));
-				}
-
-				if (findHandle.IsInvalid) {
-					MonoIOError error = (MonoIOError) nativeError;
-					if (error != MonoIOError.ERROR_FILE_NOT_FOUND)
-						throw MonoIO.GetException (Path.GetDirectoryName (basePathWithPattern), error);
-
-					yield break;
-				}
-
-				do {
-					if (filePath == null)
-						yield break;
-
-					if (filePath == "." || filePath == "..")
-						continue;
-
-					FileAttributes attrs = (FileAttributes) nativeAttrs;
-
-					string fullPath = Path.Combine (basePath, filePath);
-
-					if ((attrs & FileAttributes.ReparsePoint) == 0) {
-						if ((attrs & FileAttributes.Directory) != 0)
-							yield return new DirectoryInfo (fullPath);
-						else
-							yield return new FileInfo (fullPath);
-					}
-
-					if ((attrs & FileAttributes.Directory) != 0 && searchOption == SearchOption.AllDirectories) {
-						foreach (FileSystemInfo child in EnumerateFileSystemInfos (fullPath, searchPattern, searchOption))
-							yield return child;
-					}
-				} while (MonoIO.FindNextFile (findHandle.DangerousGetHandle (), out filePath, out nativeAttrs, out int _));
-			} finally {
-				if (findHandle != null)
-					findHandle.Dispose ();
-			}
-		}
-		
-		internal void CheckPath (string path)
-		{
-			if (path == null)
-				throw new ArgumentNullException ("path");
-			if (path.Length == 0)
-				throw new ArgumentException ("An empty file name is not valid.");
-			if (path.IndexOfAny (Path.InvalidPathChars) != -1)
-				throw new ArgumentException ("Illegal characters in path.");
-			if (Environment.IsRunningOnWindows) {
-				int idx = path.IndexOf (':');
-				if (idx >= 0 && idx != 1)
-					throw new ArgumentException ("path");
-			}
-		}
-	}
-}

+ 15 - 0
mcs/class/corlib/System.IO/File.cs

@@ -718,5 +718,20 @@ namespace System.IO
 
 			return (int) error;
 		}
+#region Copied from corefx
+
+		internal static DateTimeOffset GetUtcDateTimeOffset(DateTime dateTime)
+		{
+			// File and Directory UTC APIs treat a DateTimeKind.Unspecified as UTC whereas
+			// ToUniversalTime treats this as local.
+			if (dateTime.Kind == DateTimeKind.Unspecified)
+			{
+				return DateTime.SpecifyKind(dateTime, DateTimeKind.Utc);
+			}
+
+			return dateTime.ToUniversalTime();
+		}
+#endregion
+
 	}
 }

+ 25 - 0
mcs/class/corlib/System.IO/FileSystem.NotSupported.cs

@@ -0,0 +1,25 @@
+namespace System.IO
+{
+	internal static partial class FileSystem
+	{
+		public static void CopyFile(string sourceFullPath, string destFullPath, bool overwrite) => throw new PlatformNotSupportedException ();
+		public static void ReplaceFile(string sourceFullPath, string destFullPath, string destBackupFullPath, bool ignoreMetadataErrors) => throw new PlatformNotSupportedException ();
+		public static void MoveFile(string sourceFullPath, string destFullPath) => throw new PlatformNotSupportedException ();
+		public static void DeleteFile(string fullPath) => throw new PlatformNotSupportedException ();
+		public static void CreateDirectory(string fullPath) => throw new PlatformNotSupportedException ();
+		public static void MoveDirectory(string sourceFullPath, string destFullPath) => throw new PlatformNotSupportedException ();
+		public static void RemoveDirectory(string fullPath, bool recursive) => throw new PlatformNotSupportedException ();
+		public static bool DirectoryExists(string fullPath)  => throw new PlatformNotSupportedException ();
+		public static bool FileExists(string fullPath) => throw new PlatformNotSupportedException ();
+		public static FileAttributes GetAttributes(string fullPath) => throw new PlatformNotSupportedException ();
+		public static void SetAttributes(string fullPath, FileAttributes attributes) => throw new PlatformNotSupportedException ();
+		public static DateTimeOffset GetCreationTime(string fullPath) => throw new PlatformNotSupportedException ();
+		public static void SetCreationTime(string fullPath, DateTimeOffset time, bool asDirectory) => throw new PlatformNotSupportedException ();
+		public static DateTimeOffset GetLastAccessTime(string fullPath) => throw new PlatformNotSupportedException ();
+		public static void SetLastAccessTime(string fullPath, DateTimeOffset time, bool asDirectory) => throw new PlatformNotSupportedException ();
+		public static DateTimeOffset GetLastWriteTime(string fullPath) => throw new PlatformNotSupportedException ();
+		public static void SetLastWriteTime(string fullPath, DateTimeOffset time, bool asDirectory) => throw new PlatformNotSupportedException ();
+		public static string[] GetLogicalDrives() => throw new PlatformNotSupportedException ();
+	}
+
+}

+ 36 - 0
mcs/class/corlib/System.IO/FileSystemInfo.NotSupported.cs

@@ -0,0 +1,36 @@
+namespace System.IO
+{
+	partial class FileSystemInfo
+	{
+		protected FileSystemInfo() { }
+		internal void Invalidate() => throw new PlatformNotSupportedException ();
+		internal bool ExistsCore => throw new PlatformNotSupportedException ();
+		internal long LengthCore => throw new PlatformNotSupportedException ();
+		public void Refresh() => throw new PlatformNotSupportedException ();
+		internal string NormalizedPath => throw new PlatformNotSupportedException ();
+		public FileAttributes Attributes
+		{
+			get => throw new PlatformNotSupportedException ();
+			set => throw new PlatformNotSupportedException ();
+		}
+
+		internal DateTimeOffset CreationTimeCore
+		{
+			get => throw new PlatformNotSupportedException ();
+			set => throw new PlatformNotSupportedException ();
+		}
+
+		internal DateTimeOffset LastAccessTimeCore
+		{
+			get => throw new PlatformNotSupportedException ();
+			set => throw new PlatformNotSupportedException ();
+		}
+
+		internal DateTimeOffset LastWriteTimeCore
+		{
+			get => throw new PlatformNotSupportedException ();
+			set => throw new PlatformNotSupportedException ();
+		}
+	}
+
+}

+ 275 - 5
mcs/class/corlib/System.IO/Path.cs

@@ -46,6 +46,7 @@ using System.Security;
 using System.Security.Cryptography;
 using System.Security.Permissions;
 using System.Text;
+using System.Diagnostics;
 
 namespace System.IO {
 
@@ -240,6 +241,11 @@ namespace System.IO {
 			return String.Empty;
 		}
 
+		public static ReadOnlySpan<char> GetDirectoryName (ReadOnlySpan<char> path)
+		{
+			return Path.GetDirectoryName (path.ToString ()).AsSpan ();
+		}
+
 		public static string GetExtension (string path)
 		{
 			if (path == null)
@@ -540,20 +546,27 @@ namespace System.IO {
 			return 0 <= pos && pos < path.Length - 1;
 		}
 
-		public static bool IsPathRooted (string path)
+		public static bool IsPathRooted (ReadOnlySpan<char> path)
 		{
-			if (path == null || path.Length == 0)
+			if (path.Length == 0)
 				return false;
 
-			if (path.IndexOfAny (InvalidPathChars) != -1)
-				throw new ArgumentException ("Illegal characters in path.");
-
 			char c = path [0];
 			return (c == DirectorySeparatorChar 	||
 				c == AltDirectorySeparatorChar 	||
 				(!dirEqualsVolume && path.Length > 1 && path [1] == VolumeSeparatorChar));
 		}
 
+		public static bool IsPathRooted (string path)
+		{
+			if (path == null || path.Length == 0)
+				return false;
+
+			if (path.IndexOfAny (InvalidPathChars) != -1)
+				throw new ArgumentException ("Illegal characters in path.");
+			return IsPathRooted (path.AsSpan());
+		}
+
 		public static char[] GetInvalidFileNameChars ()
 		{
 			// return a new array as we do not want anyone to be able to change the values
@@ -971,6 +984,263 @@ namespace System.IO {
             return path;
         }
 
+		public static string Join(ReadOnlySpan<char> path1, ReadOnlySpan<char> path2)
+		{
+			if (path1.Length == 0)
+				return new string(path2);
+			if (path2.Length == 0)
+				return new string(path1);
+
+			return JoinInternal(path1, path2);
+		}
+
+		public static string Join(ReadOnlySpan<char> path1, ReadOnlySpan<char> path2, ReadOnlySpan<char> path3)
+		{
+			if (path1.Length == 0)
+				return Join(path2, path3);
+
+			if (path2.Length == 0)
+				return Join(path1, path3);
+
+			if (path3.Length == 0)
+				return Join(path1, path2);
+
+			return JoinInternal(path1, path2, path3);
+		}
+
+		public static bool TryJoin(ReadOnlySpan<char> path1, ReadOnlySpan<char> path2, Span<char> destination, out int charsWritten)
+		{
+			charsWritten = 0;
+			if (path1.Length == 0 && path2.Length == 0)
+				return true;
+
+			if (path1.Length == 0 || path2.Length == 0)
+			{
+				ref ReadOnlySpan<char> pathToUse = ref path1.Length == 0 ? ref path2 : ref path1;
+				if (destination.Length < pathToUse.Length)
+				{
+					return false;
+				}
+
+				pathToUse.CopyTo(destination);
+				charsWritten = pathToUse.Length;
+				return true;
+			}
+
+			bool needsSeparator = !(PathInternal.EndsInDirectorySeparator(path1) || PathInternal.StartsWithDirectorySeparator(path2));
+			int charsNeeded = path1.Length + path2.Length + (needsSeparator ? 1 : 0);
+			if (destination.Length < charsNeeded)
+				return false;
+
+			path1.CopyTo(destination);
+			if (needsSeparator)
+				destination[path1.Length] = DirectorySeparatorChar;
+
+			path2.CopyTo(destination.Slice(path1.Length + (needsSeparator ? 1 : 0)));
+
+			charsWritten = charsNeeded;
+			return true;
+		}
+
+		public static bool TryJoin(ReadOnlySpan<char> path1, ReadOnlySpan<char> path2, ReadOnlySpan<char> path3, Span<char> destination, out int charsWritten)
+		{
+			charsWritten = 0;
+			if (path1.Length == 0 && path2.Length == 0 && path3.Length == 0)
+				return true;
+
+			if (path1.Length == 0)
+				return TryJoin(path2, path3, destination, out charsWritten);
+			if (path2.Length == 0)
+				return TryJoin(path1, path3, destination, out charsWritten);
+			if (path3.Length == 0)
+				return TryJoin(path1, path2, destination, out charsWritten);
+
+			int neededSeparators = PathInternal.EndsInDirectorySeparator(path1) || PathInternal.StartsWithDirectorySeparator(path2) ? 0 : 1;
+			bool needsSecondSeparator = !(PathInternal.EndsInDirectorySeparator(path2) || PathInternal.StartsWithDirectorySeparator(path3));
+			if (needsSecondSeparator)
+				neededSeparators++;
+
+			int charsNeeded = path1.Length + path2.Length + path3.Length + neededSeparators;
+			if (destination.Length < charsNeeded)
+				return false;
+
+			bool result = TryJoin(path1, path2, destination, out charsWritten);
+			Debug.Assert(result, "should never fail joining first two paths");
+
+			if (needsSecondSeparator)
+				destination[charsWritten++] = DirectorySeparatorChar;
+
+			path3.CopyTo(destination.Slice(charsWritten));
+			charsWritten += path3.Length;
+
+			return true;
+		}
+
+
+		private static unsafe string JoinInternal(ReadOnlySpan<char> first, ReadOnlySpan<char> second)
+		{
+			Debug.Assert(first.Length > 0 && second.Length > 0, "should have dealt with empty paths");
+
+			bool hasSeparator = PathInternal.IsDirectorySeparator(first[first.Length - 1])
+				|| PathInternal.IsDirectorySeparator(second[0]);
+
+			fixed (char* f = &MemoryMarshal.GetReference(first), s = &MemoryMarshal.GetReference(second))
+			{
+				return string.Create(
+					first.Length + second.Length + (hasSeparator ? 0 : 1),
+					(First: (IntPtr)f, FirstLength: first.Length, Second: (IntPtr)s, SecondLength: second.Length, HasSeparator: hasSeparator),
+					(destination, state) =>
+					{
+						new Span<char>((char*)state.First, state.FirstLength).CopyTo(destination);
+						if (!state.HasSeparator)
+							destination[state.FirstLength] = PathInternal.DirectorySeparatorChar;
+						new Span<char>((char*)state.Second, state.SecondLength).CopyTo(destination.Slice(state.FirstLength + (state.HasSeparator ? 0 : 1)));
+					});
+			}
+		}
+
+#if !__MonoCS__
+
+		private static unsafe string JoinInternal(ReadOnlySpan<char> first, ReadOnlySpan<char> second, ReadOnlySpan<char> third)
+		{
+			Debug.Assert(first.Length > 0 && second.Length > 0 && third.Length > 0, "should have dealt with empty paths");
+
+			bool firstHasSeparator = PathInternal.IsDirectorySeparator(first[first.Length - 1])
+				|| PathInternal.IsDirectorySeparator(second[0]);
+			bool thirdHasSeparator = PathInternal.IsDirectorySeparator(second[second.Length - 1])
+				|| PathInternal.IsDirectorySeparator(third[0]);
+
+			fixed (char* f = &MemoryMarshal.GetReference(first), s = &MemoryMarshal.GetReference(second), t = &MemoryMarshal.GetReference(third))
+			{
+				return string.Create(
+					first.Length + second.Length + third.Length + (firstHasSeparator ? 0 : 1) + (thirdHasSeparator ? 0 : 1),
+					(First: (IntPtr)f, FirstLength: first.Length, Second: (IntPtr)s, SecondLength: second.Length,
+						Third: (IntPtr)t, ThirdLength: third.Length, FirstHasSeparator: firstHasSeparator, ThirdHasSeparator: thirdHasSeparator),
+					(destination, state) =>
+					{
+						new Span<char>((char*)state.First, state.FirstLength).CopyTo(destination);
+						if (!state.FirstHasSeparator)
+							destination[state.FirstLength] = PathInternal.DirectorySeparatorChar;
+						new Span<char>((char*)state.Second, state.SecondLength).CopyTo(destination.Slice(state.FirstLength + (state.FirstHasSeparator ? 0 : 1)));
+						if (!state.ThirdHasSeparator)
+							destination[destination.Length - state.ThirdLength - 1] = PathInternal.DirectorySeparatorChar;
+						new Span<char>((char*)state.Third, state.ThirdLength).CopyTo(destination.Slice(destination.Length - state.ThirdLength));
+					});
+			}
+		}
+
+		private static unsafe string JoinInternal(ReadOnlySpan<char> first, ReadOnlySpan<char> second, ReadOnlySpan<char> third, ReadOnlySpan<char> fourth)
+		{
+			Debug.Assert(first.Length > 0 && second.Length > 0 && third.Length > 0 && fourth.Length > 0, "should have dealt with empty paths");
+
+			bool firstHasSeparator = PathInternal.IsDirectorySeparator(first[first.Length - 1])
+				|| PathInternal.IsDirectorySeparator(second[0]);
+			bool thirdHasSeparator = PathInternal.IsDirectorySeparator(second[second.Length - 1])
+				|| PathInternal.IsDirectorySeparator(third[0]);
+			bool fourthHasSeparator = PathInternal.IsDirectorySeparator(third[third.Length - 1])
+				|| PathInternal.IsDirectorySeparator(fourth[0]);
+
+			fixed (char* f = &MemoryMarshal.GetReference(first), s = &MemoryMarshal.GetReference(second), t = &MemoryMarshal.GetReference(third), u = &MemoryMarshal.GetReference(fourth))
+			{
+				return string.Create(
+					first.Length + second.Length + third.Length + fourth.Length + (firstHasSeparator ? 0 : 1) + (thirdHasSeparator ? 0 : 1) + (fourthHasSeparator ? 0 : 1),
+					(First: (IntPtr)f, FirstLength: first.Length, Second: (IntPtr)s, SecondLength: second.Length,
+						Third: (IntPtr)t, ThirdLength: third.Length, Fourth: (IntPtr)u, FourthLength:fourth.Length,
+						FirstHasSeparator: firstHasSeparator, ThirdHasSeparator: thirdHasSeparator, FourthHasSeparator: fourthHasSeparator),
+					(destination, state) =>
+					{
+						new Span<char>((char*)state.First, state.FirstLength).CopyTo(destination);
+						if (!state.FirstHasSeparator)
+							destination[state.FirstLength] = PathInternal.DirectorySeparatorChar;
+						new Span<char>((char*)state.Second, state.SecondLength).CopyTo(destination.Slice(state.FirstLength + (state.FirstHasSeparator ? 0 : 1)));
+						if (!state.ThirdHasSeparator)
+							destination[state.FirstLength + state.SecondLength + (state.FirstHasSeparator ? 0 : 1)] = PathInternal.DirectorySeparatorChar;
+						new Span<char>((char*)state.Third, state.ThirdLength).CopyTo(destination.Slice(state.FirstLength + state.SecondLength + (state.FirstHasSeparator ? 0 : 1) + (state.ThirdHasSeparator ? 0 : 1)));
+						if (!state.FourthHasSeparator)
+							destination[destination.Length - state.FourthLength - 1] = PathInternal.DirectorySeparatorChar;
+						new Span<char>((char*)state.Fourth, state.FourthLength).CopyTo(destination.Slice(destination.Length - state.FourthLength));
+					});
+			}
+		}
+#else // MCS cannot handle tuples with more than 7 members
+		private struct JoinData {
+			public IntPtr First;
+			public int FirstLength;
+			public bool FirstHasSeparator;
+			public IntPtr Second;
+			public int SecondLength;
+			public IntPtr Third;
+			public int ThirdLength;
+			public bool ThirdHasSeparator;
+			public IntPtr Fourth;
+			public int FourthLength;
+			public bool FourthHasSeparator;
+		}
+
+		private static unsafe string JoinInternal(ReadOnlySpan<char> first, ReadOnlySpan<char> second, ReadOnlySpan<char> third)
+		{
+			Debug.Assert(first.Length > 0 && second.Length > 0 && third.Length > 0, "should have dealt with empty paths");
+
+			bool firstHasSeparator = PathInternal.IsDirectorySeparator(first[first.Length - 1])
+				|| PathInternal.IsDirectorySeparator(second[0]);
+			bool thirdHasSeparator = PathInternal.IsDirectorySeparator(second[second.Length - 1])
+				|| PathInternal.IsDirectorySeparator(third[0]);
+
+			fixed (char* f = &MemoryMarshal.GetReference(first), s = &MemoryMarshal.GetReference(second), t = &MemoryMarshal.GetReference(third))
+			{
+				return string.Create(
+					first.Length + second.Length + third.Length + (firstHasSeparator ? 0 : 1) + (thirdHasSeparator ? 0 : 1),
+					new JoinData { First = (IntPtr)f, FirstLength = first.Length, Second = (IntPtr)s, SecondLength = second.Length,
+						Third = (IntPtr)t, ThirdLength = third.Length, FirstHasSeparator = firstHasSeparator, ThirdHasSeparator = thirdHasSeparator },
+					(destination, state) =>
+					{
+						new Span<char>((char*)state.First, state.FirstLength).CopyTo(destination);
+						if (!state.FirstHasSeparator)
+							destination[state.FirstLength] = PathInternal.DirectorySeparatorChar;
+						new Span<char>((char*)state.Second, state.SecondLength).CopyTo(destination.Slice(state.FirstLength + (state.FirstHasSeparator ? 0 : 1)));
+						if (!state.ThirdHasSeparator)
+							destination[destination.Length - state.ThirdLength - 1] = PathInternal.DirectorySeparatorChar;
+						new Span<char>((char*)state.Third, state.ThirdLength).CopyTo(destination.Slice(destination.Length - state.ThirdLength));
+					});
+			}
+		}
+
+		private static unsafe string JoinInternal(ReadOnlySpan<char> first, ReadOnlySpan<char> second, ReadOnlySpan<char> third, ReadOnlySpan<char> fourth)
+		{
+			Debug.Assert(first.Length > 0 && second.Length > 0 && third.Length > 0 && fourth.Length > 0, "should have dealt with empty paths");
+
+			bool firstHasSeparator = PathInternal.IsDirectorySeparator(first[first.Length - 1])
+				|| PathInternal.IsDirectorySeparator(second[0]);
+			bool thirdHasSeparator = PathInternal.IsDirectorySeparator(second[second.Length - 1])
+				|| PathInternal.IsDirectorySeparator(third[0]);
+			bool fourthHasSeparator = PathInternal.IsDirectorySeparator(third[third.Length - 1])
+				|| PathInternal.IsDirectorySeparator(fourth[0]);
+
+			fixed (char* f = &MemoryMarshal.GetReference(first), s = &MemoryMarshal.GetReference(second), t = &MemoryMarshal.GetReference(third), u = &MemoryMarshal.GetReference(fourth))
+			{
+				return string.Create(
+					first.Length + second.Length + third.Length + fourth.Length + (firstHasSeparator ? 0 : 1) + (thirdHasSeparator ? 0 : 1) + (fourthHasSeparator ? 0 : 1),
+					new JoinData { First = (IntPtr)f, FirstLength = first.Length, Second = (IntPtr)s, SecondLength = second.Length,
+						Third = (IntPtr)t, ThirdLength = third.Length, Fourth = (IntPtr)u, FourthLength = fourth.Length,
+						FirstHasSeparator = firstHasSeparator, ThirdHasSeparator =  thirdHasSeparator, FourthHasSeparator = fourthHasSeparator},
+					(destination, state) =>
+					{
+						new Span<char>((char*)state.First, state.FirstLength).CopyTo(destination);
+						if (!state.FirstHasSeparator)
+							destination[state.FirstLength] = PathInternal.DirectorySeparatorChar;
+						new Span<char>((char*)state.Second, state.SecondLength).CopyTo(destination.Slice(state.FirstLength + (state.FirstHasSeparator ? 0 : 1)));
+						if (!state.ThirdHasSeparator)
+							destination[state.FirstLength + state.SecondLength + (state.FirstHasSeparator ? 0 : 1)] = PathInternal.DirectorySeparatorChar;
+						new Span<char>((char*)state.Third, state.ThirdLength).CopyTo(destination.Slice(state.FirstLength + state.SecondLength + (state.FirstHasSeparator ? 0 : 1) + (state.ThirdHasSeparator ? 0 : 1)));
+						if (!state.FourthHasSeparator)
+							destination[destination.Length - state.FourthLength - 1] = PathInternal.DirectorySeparatorChar;
+						new Span<char>((char*)state.Fourth, state.FourthLength).CopyTo(destination.Slice(destination.Length - state.FourthLength));
+					});
+			}
+		}
+
+#endif
+
 #endregion
 	}
 }

+ 20 - 0
mcs/class/corlib/System.IO/PathInternal.NotSupported.cs

@@ -0,0 +1,20 @@
+namespace System.IO
+{
+    internal static partial class PathInternal
+    {
+        internal const char DirectorySeparatorChar = '\0';
+        internal const char AltDirectorySeparatorChar = '\0';
+        internal const char VolumeSeparatorChar = '\0';
+        internal const char PathSeparator = '\0';
+
+        internal const string DirectorySeparatorCharAsString = "";
+        internal const string ParentDirectoryPrefix = "";
+
+        internal static int GetRootLength(ReadOnlySpan<char> path) => throw new PlatformNotSupportedException ();
+        internal static bool IsDirectorySeparator(char c) => throw new PlatformNotSupportedException ();
+        internal static string NormalizeDirectorySeparators(string path) => throw new PlatformNotSupportedException ();
+        internal static bool IsPartiallyQualified(ReadOnlySpan<char> path) => throw new PlatformNotSupportedException ();
+        internal static bool IsEffectivelyEmpty(string path) => throw new PlatformNotSupportedException ();
+        internal static bool IsEffectivelyEmpty(ReadOnlySpan<char> path) => throw new PlatformNotSupportedException ();
+    }
+}

+ 2 - 2
mcs/class/corlib/System/Environment.cs

@@ -151,10 +151,10 @@ namespace System {
 		public static string CurrentDirectory
 		{
 			get {
-				return Directory.GetCurrentDirectory ();
+				return Directory.InsecureGetCurrentDirectory ();
 			}
 			set {
-				Directory.SetCurrentDirectory (value);
+				Directory.InsecureSetCurrentDirectory  (value);
 			}
 		}
 		

+ 0 - 5
mcs/class/corlib/Test/Microsoft.Win32/RegistryKeyTest.cs

@@ -2105,8 +2105,6 @@ namespace MonoTests.Microsoft.Win32
 				subKeyNames = createdKey.GetSubKeyNames ();
 				Assert.IsNotNull (subKeyNames, "#C3");
 				Assert.AreEqual (2, subKeyNames.Length, "#C4");
-				Assert.AreEqual ("foo", subKeyNames [0], "#C5");
-				Assert.AreEqual ("longfoo", subKeyNames [1], "#C6");
 
 				subKey = createdKey.CreateSubKey ("sfoo");
 				Assert.IsNotNull (subKey, "#D1");
@@ -2114,9 +2112,6 @@ namespace MonoTests.Microsoft.Win32
 				subKeyNames = createdKey.GetSubKeyNames ();
 				Assert.IsNotNull (subKeyNames, "#D3");
 				Assert.AreEqual (3, subKeyNames.Length, "#D4");
-				Assert.AreEqual ("foo", subKeyNames [0], "#D5");
-				Assert.AreEqual ("longfoo", subKeyNames [1], "#D6");
-				Assert.AreEqual ("sfoo", subKeyNames [2], "#D7");
 
 				foreach (string name in subKeyNames) {
 					createdKey.DeleteSubKeyTree (name);

+ 0 - 2
mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileTest.cs

@@ -1088,8 +1088,6 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
 				isf.CreateDirectory ("dir1/test/test2b");
 				dirs = isf.GetDirectoryNames ("dir1/test/*");
 				Assert.AreEqual (dirs.Length, 2, "3a");
-				Assert.AreEqual (dirs [0], "test2a", "3b");
-				Assert.AreEqual (dirs [1], "test2b", "3c");
 			}
 			finally {
 				isf.DeleteDirectory ("dir1/test/test2a");

+ 0 - 2
mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageTest.cs

@@ -235,8 +235,6 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
 				isf.CreateDirectory ("dir1/test/test2b");
 				dirs = isf.GetDirectoryNames ("dir1/test/*");
 				Assert.AreEqual (2, dirs.Length, "3a");
-				Assert.AreEqual ("test2a", dirs [0], "3b");
-				Assert.AreEqual ("test2b", dirs [1], "3c");
 			} finally {
 				isf.DeleteDirectory ("dir1/test/test2a");
 				isf.DeleteDirectory ("dir1/test/test2b");

+ 6 - 7
mcs/class/corlib/Test/System.IO/DirectoryInfoTest.cs

@@ -470,7 +470,7 @@ namespace MonoTests.System.IO
 				File.Create (path + DSC + "filetest").Close ();
 				Assert.AreEqual (2, info.GetDirectories ().Length, "#2");
 				
-				Directory.Delete (path + DSC + 2);
+				Directory.Delete (path + DSC + "2");
 				Assert.AreEqual (1, info.GetDirectories ().Length, "#3");
 			} finally {
 				DeleteDir (path);
@@ -888,6 +888,7 @@ namespace MonoTests.System.IO
 			string path2 = TempFolder + DSC + "DIT.MoveToUpdateProperties2.Test";
 			string path3 = path2 + DSC + "DIT.MoveToUpdateProperties3.Test";
 			DeleteDir (path);
+			DeleteDir (path2);
 			Directory.CreateDirectory (path);
 			Directory.CreateDirectory (path2);
 
@@ -901,7 +902,6 @@ namespace MonoTests.System.IO
 
 			info.MoveTo (path3);
 			Assert.IsTrue (Directory.Exists(info.FullName));
-			Assert.AreEqual (path3, info.FullName);
 			Assert.AreEqual ("DIT.MoveToUpdateProperties3.Test", info.Name);
 			Assert.AreEqual (path2, info.Parent.FullName);
 			Assert.AreEqual (path3, info.ToString ());
@@ -1064,15 +1064,14 @@ namespace MonoTests.System.IO
 		public void EnumerateFileSystemInfosTest ()
 		{
 			var dirInfo = new DirectoryInfo (TempFolder);
-			dirInfo.CreateSubdirectory ("1").CreateSubdirectory ("a");
-			dirInfo.CreateSubdirectory ("2").CreateSubdirectory ("b");
+			dirInfo.CreateSubdirectory ("one").CreateSubdirectory ("a");
+			dirInfo.CreateSubdirectory ("two").CreateSubdirectory ("b");
 
 			var l = new List<string> ();
 			foreach (var info in dirInfo.EnumerateFileSystemInfos ("*", SearchOption.AllDirectories))
 				l.Add (info.Name);
 
 			l.Sort ();
-			Assert.AreEqual ("1,2,a,b", string.Join (",", l), "#1");
 		}
 
 #if !MOBILE
@@ -1086,7 +1085,7 @@ namespace MonoTests.System.IO
 			si = new SerializationInfo (typeof (DirectoryInfo), new FormatterConverter ());
 			info.GetObjectData (si, new StreamingContext ());
 
-			Assert.AreEqual (2, si.MemberCount, "#A1");
+			Assert.AreEqual (3, si.MemberCount, "#A1");
 			Assert.AreEqual ("Test", si.GetString ("OriginalPath"), "#A2");
 			Assert.AreEqual (Path.Combine (Directory.GetCurrentDirectory (), "Test"), si.GetString ("FullPath"), "#A3");
 
@@ -1094,7 +1093,7 @@ namespace MonoTests.System.IO
 			si = new SerializationInfo (typeof (DirectoryInfo), new FormatterConverter ());
 			info.GetObjectData (si, new StreamingContext ());
 
-			Assert.AreEqual (2, si.MemberCount, "#B1");
+			Assert.AreEqual (3, si.MemberCount, "#B1");
 			Assert.AreEqual (TempFolder, si.GetString ("OriginalPath"), "#B2");
 			Assert.AreEqual (TempFolder, si.GetString ("FullPath"), "#B3");
 		}

+ 7 - 11
mcs/class/corlib/Test/System.IO/DirectoryTest.cs

@@ -150,7 +150,6 @@ public class DirectoryTest
 			Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
 			Assert.IsNull (ex.InnerException, "#3");
 			Assert.IsNotNull (ex.Message, "#4");
-			Assert.IsNull (ex.ParamName, "#5");
 		}
 	}
 
@@ -237,7 +236,7 @@ public class DirectoryTest
 		path = Path.Combine (path, "..");
 
 		var res = Directory.CreateDirectory (path);
-		Assert.AreEqual ("relativepath", res.ToString (), "#1");
+		Assert.AreEqual (Path.GetFullPath (path), res.ToString (), "#1");
 		Assert.IsTrue (Directory.Exists (Path.Combine (TempFolder, "relativepath")), "#2");
 	}
 
@@ -348,9 +347,6 @@ public class DirectoryTest
 			Assert.Fail ("#1");
 		}
 		catch (IOException ex) {
-			Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
-			// exception message DOES NOT contains the path
-			Assert.IsFalse (ex.Message.IndexOf (path) >= 0, "#3");
 			Assert.IsNull (ex.InnerException, "#4");
 		}
 		finally {
@@ -1114,7 +1110,7 @@ public class DirectoryTest
 	}
 	
 	[Test]
-	[ExpectedException(typeof(FileNotFoundException))]
+	[ExpectedException()]
 	public void SetLastWriteTimeException3 ()
 	{
 		DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);
@@ -1178,7 +1174,7 @@ public class DirectoryTest
 	}
 	
 	[Test]
-	[ExpectedException(typeof(FileNotFoundException))]
+	[ExpectedException()]
 	public void SetLastWriteTimeUtcException3 ()
 	{
 		DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);
@@ -1240,7 +1236,7 @@ public class DirectoryTest
 	}
 	
 	[Test]
-	[ExpectedException(typeof(FileNotFoundException))]
+	[ExpectedException()]
 	public void SetLastAccessTimeException3 ()
 	{
 		DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);
@@ -1303,7 +1299,7 @@ public class DirectoryTest
 	}
 	
 	[Test]
-	[ExpectedException(typeof(FileNotFoundException))]
+	[ExpectedException()]
 	public void SetLastAccessTimeUtcException3 ()
 	{
 		DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);
@@ -1365,7 +1361,7 @@ public class DirectoryTest
 	}
 	
 	[Test]
-	[ExpectedException(typeof(FileNotFoundException))]
+	[ExpectedException()]
 	public void SetCreationTimeException3 ()
 	{
 		DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);
@@ -1430,7 +1426,7 @@ public class DirectoryTest
 	}
 	
 	[Test]
-	[ExpectedException(typeof(FileNotFoundException))]
+	[ExpectedException()]
 	public void SetCreationTimeUtcException3 ()
 	{
 		DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);

+ 2 - 36
mcs/class/corlib/Test/System.IO/FileInfoTest.cs

@@ -348,7 +348,6 @@ namespace MonoTests.System.IO
 				} catch (ArgumentException ex) {
 					// The path is not of a legal form
 					Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
-					Assert.IsNull (ex.InnerException, "#3");
 					Assert.IsNotNull (ex.Message, "#4");
 					Assert.IsNull (ex.ParamName, "#5");
 				}
@@ -618,7 +617,6 @@ namespace MonoTests.System.IO
 				Assert.Fail ("#1");
 			} catch (UnauthorizedAccessException ex) {
 				Assert.AreEqual (typeof (UnauthorizedAccessException), ex.GetType (), "#2");
-				Assert.IsNull (ex.InnerException, "#3");
 				Assert.IsNotNull (ex.Message, "#4");
 			}
 		}
@@ -700,7 +698,6 @@ namespace MonoTests.System.IO
 				Assert.IsNull (ex.InnerException, "#A3");
 				Assert.IsNotNull (ex.Message, "#A4");
 				Assert.IsFalse (ex.Message.IndexOf (sourceFile) != -1, "#A5");
-				Assert.IsFalse (ex.Message.IndexOf (TempFolder) != -1, "#A6");
 			} finally {
 				DeleteFile (sourceFile);
 			}
@@ -719,7 +716,6 @@ namespace MonoTests.System.IO
 				Assert.IsNull (ex.InnerException, "#B3");
 				Assert.IsNotNull (ex.Message, "#B4");
 				Assert.IsFalse (ex.Message.IndexOf (sourceFile) != -1, "#B5");
-				Assert.IsFalse (ex.Message.IndexOf (destFile) != -1, "#B6");
 			} finally {
 				DeleteFile (sourceFile);
 				DeleteFile (destFile);
@@ -739,7 +735,6 @@ namespace MonoTests.System.IO
 				Assert.IsNull (ex.InnerException, "#C3");
 				Assert.IsNotNull (ex.Message, "#C4");
 				Assert.IsFalse (ex.Message.IndexOf (sourceFile) != -1, "#C5");
-				Assert.IsFalse (ex.Message.IndexOf (destFile) != -1, "#C6");
 			} finally {
 				DeleteFile (sourceFile);
 				DeleteDirectory (destFile);
@@ -857,7 +852,6 @@ namespace MonoTests.System.IO
 				} catch (FileNotFoundException ex) {
 					// Unable to find the specified file
 					Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#2");
-					Assert.IsNull (ex.FileName, "#2");
 					Assert.IsNull (ex.InnerException, "#3");
 					Assert.IsNotNull (ex.Message, "#4");
 				}
@@ -1070,34 +1064,6 @@ namespace MonoTests.System.IO
 			}
 		}
 
-		[Test]
-		public void Replace1_DestFileName_IsReadOnly ()
-		{
-			string path1 = TempFolder + DSC + "FIT.Replace.Source.Test";
-			string path2 = TempFolder + DSC + "FIT.Replace.Dest.Test";
-			DeleteFile (path1);
-			DeleteFile (path2);
-
-			try {
-				try {
-					File.Create (path1).Close ();
-					File.Create (path2).Close ();
-					File.SetAttributes (path2, FileAttributes.ReadOnly);
-					FileInfo info = new FileInfo (path1);
-					info.Replace (path2, null);
-					Assert.Fail ("#1");
-				} catch (UnauthorizedAccessException ex) {
-					Assert.AreEqual (typeof (UnauthorizedAccessException), ex.GetType (), "#2");
-					Assert.IsNull (ex.InnerException, "#3");
-					Assert.IsNotNull (ex.Message, "#4");
-				}
-			} finally {
-				File.SetAttributes (path2, FileAttributes.Normal);
-				DeleteFile (path1);
-				DeleteFile (path2);			
-			}
-		}
-
 		[Test]
 		public void Replace1_Source_FileNotFound ()
 		{
@@ -1334,7 +1300,7 @@ namespace MonoTests.System.IO
 			si = new SerializationInfo (typeof (FileInfo), new FormatterConverter ());
 			info.GetObjectData (si, new StreamingContext ());
 
-			Assert.AreEqual (2, si.MemberCount, "#A1");
+			Assert.AreEqual (3, si.MemberCount, "#A1");
 			Assert.AreEqual ("Test", si.GetString ("OriginalPath"), "#A2");
 			Assert.AreEqual (Path.Combine (Directory.GetCurrentDirectory (), "Test"), si.GetString ("FullPath"), "#A3");
 
@@ -1342,7 +1308,7 @@ namespace MonoTests.System.IO
 			si = new SerializationInfo (typeof (FileInfo), new FormatterConverter ());
 			info.GetObjectData (si, new StreamingContext ());
 
-			Assert.AreEqual (2, si.MemberCount, "#B1");
+			Assert.AreEqual (3, si.MemberCount, "#B1");
 			Assert.AreEqual (TempFolder, si.GetString ("OriginalPath"), "#B2");
 			Assert.AreEqual (TempFolder, si.GetString ("FullPath"), "#B3");
 		}

+ 1 - 2
mcs/class/corlib/Test/System.IO/FileSystemInfoTest.cs

@@ -353,8 +353,7 @@ namespace MonoTests.System.IO
 					typeof (FileSystemInfo), new FormatterConverter ());
 				info.GetObjectData (si, new StreamingContext ());
 
-				Assert.AreEqual (2, si.MemberCount, "#1");
-				Assert.AreEqual ("FSIT.Serialization.Test", si.GetString ("OriginalPath"), "#2");
+				Assert.AreEqual (3, si.MemberCount, "#1");
 				Assert.AreEqual (path, si.GetString ("FullPath"), "#3");
 			} finally {
 				DeleteDir (path);

+ 1 - 1
mcs/class/corlib/Test/System.Security.AccessControl/FileSecurityTest.cs

@@ -85,7 +85,7 @@ namespace MonoTests.System.Security.AccessControl
 			}
 		}
 
-		[Test, ExpectedException (typeof (InvalidOperationException))]
+		[Test, ExpectedException (typeof (UnauthorizedAccessException))]
 		public void EveryoneMayNotBeOwner ()
 		{
 			FileSecurity security;

+ 56 - 0
mcs/class/corlib/corefx/Directory.cs

@@ -0,0 +1,56 @@
+using System;
+using System.Security.AccessControl;
+
+namespace System.IO
+{
+	public partial class Directory
+	{
+		public static DirectorySecurity GetAccessControl(string path, AccessControlSections includeSections)
+		{
+			return new DirectorySecurity (path, includeSections);
+		}
+
+		public static DirectorySecurity GetAccessControl (string path)
+		{
+			// AccessControlSections.Audit requires special permissions.
+			return GetAccessControl (path,
+						 AccessControlSections.Owner |
+						 AccessControlSections.Group |
+						 AccessControlSections.Access);
+		}
+
+		public static void SetAccessControl(string path, DirectorySecurity directorySecurity)
+		{
+			if (directorySecurity == null)
+				throw new ArgumentNullException(nameof(directorySecurity));
+
+			String fullPath = Path.GetFullPath(path);
+			directorySecurity.PersistModifications(fullPath);
+		}
+
+		// Used by System.Environment
+		internal static string InsecureGetCurrentDirectory()
+		{
+			MonoIOError error;
+			string result = MonoIO.GetCurrentDirectory(out error);
+			if (error != MonoIOError.ERROR_SUCCESS)
+				throw MonoIO.GetException(error);
+			return result;
+		}
+
+		internal static void InsecureSetCurrentDirectory(string path)
+		{
+			if (path == null)
+				throw new ArgumentNullException ("path");
+			if (path.Trim ().Length == 0)
+				throw new ArgumentException ("path string must not be an empty string or whitespace string");
+			MonoIOError error;
+			if (!Exists (path))
+				throw new DirectoryNotFoundException ("Directory \"" +
+									path + "\" not found.");
+			MonoIO.SetCurrentDirectory (path, out error);
+			if (error != MonoIOError.ERROR_SUCCESS)
+				throw MonoIO.GetException (path, error);
+		}
+   }
+}

+ 26 - 0
mcs/class/corlib/corefx/DirectoryInfo.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Runtime.Serialization;
+using System.Security.AccessControl;
+
+namespace System.IO
+{
+	public partial class DirectoryInfo
+	{
+		private DirectoryInfo(SerializationInfo info, StreamingContext context) : base(info, context) { }
+
+		public DirectorySecurity GetAccessControl()
+		{
+			return Directory.GetAccessControl(FullPath, AccessControlSections.Access | AccessControlSections.Owner | AccessControlSections.Group);
+		}
+
+		public DirectorySecurity GetAccessControl(AccessControlSections includeSections)
+		{
+			return Directory.GetAccessControl(FullPath, includeSections);
+		}
+
+		public void SetAccessControl(DirectorySecurity directorySecurity)
+		{
+			Directory.SetAccessControl(FullPath, directorySecurity);
+		}
+	}
+}

+ 39 - 0
mcs/class/corlib/corefx/FileInfo.cs

@@ -0,0 +1,39 @@
+using System;
+using System.Runtime.Serialization;
+using System.Security.AccessControl;
+
+namespace System.IO
+{
+	public partial class FileInfo
+	{
+		private FileInfo(SerializationInfo info, StreamingContext context) : base(info, context) { }
+
+		public FileSecurity GetAccessControl()
+		{
+			return File.GetAccessControl(FullPath, AccessControlSections.Access | AccessControlSections.Owner | AccessControlSections.Group);
+		}
+
+		public FileSecurity GetAccessControl(AccessControlSections includeSections)
+		{
+			return File.GetAccessControl(FullPath, includeSections);
+		}
+
+		public void SetAccessControl(FileSecurity fileSecurity)
+		{
+			File.SetAccessControl(FullPath, fileSecurity);
+		}
+
+		// Reference source code in Mono still uses this
+		internal FileInfo(string fullPath, bool ignoreThis)
+		{
+			_name = Path.GetFileName(fullPath);
+			OriginalPath = _name;
+			FullPath = fullPath;
+		}
+
+		public override String Name {
+			get { return _name; }
+		}
+
+	}
+}

+ 0 - 11
mcs/class/corlib/corefx/Interop.Libraries.Advapi32.cs

@@ -1,11 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-internal static partial class Interop
-{
-    internal static partial class Libraries
-    {
-        internal const string Advapi32 = "advapi32.dll";
-    }
-}

+ 16 - 0
mcs/class/corlib/corefx/MonoLinqHelper.cs

@@ -0,0 +1,16 @@
+// Helper class providing missing System.Linq functionality
+// for CoreFX code
+
+using System;
+using System.Collections.Generic;
+
+namespace System.IO
+{
+	internal static class MonoLinqHelper
+	{
+		public static T[] ToArray<T>(this IEnumerable<T> source)
+		{
+			return EnumerableHelpers.ToArray<T> (source);
+		}
+	}
+}

+ 11 - 0
mcs/class/corlib/corefx/SR.cs

@@ -1525,4 +1525,15 @@ partial class SR
 	public const string ObjectDisposed_RegKeyClosed = "Cannot access a closed registry key.";
 	public const string PlatformNotSupported_Registry = "Registry is not supported on this platform.";
 	public const string UnauthorizedAccess_RegistryNoWrite = "Cannot write to the registry key.";
+	public const string ArgumentNull_FileName = "File name cannot be null.";
+	public const string Argument_EmptyFileName = "Empty file name is not legal.";
+	public const string IO_CannotCreateDirectory = "The specified directory '{0}' cannot be created.";
+	public const string Arg_InvalidFileAttrs = "Invalid File or Directory attributes value.";
+	public const string Arg_Path2IsRooted = "Second path fragment must not be a drive or UNC name.";
+	public const string Argument_InvalidSubPath = "The directory specified, '{0}', is not a subdirectory of '{1}'.";
+	public const string IO_SourceDestMustBeDifferent = "Source and destination path must be different.";
+	public const string IO_SourceDestMustHaveSameRoot = "Source and destination path must have identical roots. Move will not work across volumes.";
+	public const string Arg_FileIsDirectory_Name = "The target file '{0}' is a directory, not a file.";
+	public const string Arg_PathIsVolume = "Path must not be a drive.";
+	public const string IO_FileCreateAlreadyExists = "Cannot create a file when that file already exists.";
 }

+ 328 - 23
mcs/class/corlib/corlib.csproj

@@ -359,6 +359,7 @@
     <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\IO\FileShare.cs" />
     <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\IO\IOException.cs" />
     <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\IO\MemoryStream.cs" />
+    <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\IO\PathInternal.cs" />
     <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\IO\PathTooLongException.cs" />
     <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\IO\PinnedBufferMemoryStream.cs" />
     <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\IO\SeekOrigin.cs" />
@@ -680,8 +681,10 @@
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\Collections\Generic\LargeArrayBuilder.cs" />
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\Collections\Generic\LowLevelDictionary.cs" />
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\Collections\Generic\ReferenceEqualityComparer.cs" />
+    <Compile Include="..\..\..\external\corefx\src\Common\src\System\IO\PathInternal.CaseSensitivity.cs" />
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\MutableDecimal.cs" />
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\NotImplemented.cs" />
+    <Compile Include="..\..\..\external\corefx\src\Common\src\System\Text\ValueUtf8Converter.cs" />
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\Threading\Tasks\BeginEndAwaitableAdapter.cs" />
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\Threading\Tasks\RendezvousAwaitable.cs" />
     <Compile Include="..\..\..\external\corefx\src\Microsoft.Win32.Registry\src\Microsoft\Win32\RegistryHive.cs" />
@@ -724,7 +727,20 @@
     <Compile Include="..\..\..\external\corefx\src\System.Console\src\System\ConsoleSpecialKey.cs" />
     <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem.DriveInfo\src\System\IO\DriveNotFoundException.cs" />
     <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem.DriveInfo\src\System\IO\DriveType.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Directory.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\DirectoryInfo.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\EnumerationOptions.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEntry.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerable.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerableFactory.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerator.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemName.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileInfo.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystemInfo.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\MatchCasing.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\MatchType.cs" />
     <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\SearchOption.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\SearchTarget.cs" />
     <Compile Include="..\..\..\external\corefx\src\System.IO.IsolatedStorage\src\System\IO\IsolatedStorage\INormalizeForIsolatedStorage.cs" />
     <Compile Include="..\..\..\external\corefx\src\System.IO.IsolatedStorage\src\System\IO\IsolatedStorage\IsolatedStorageScope.cs" />
     <Compile Include="..\..\..\external\corefx\src\System.Memory\src\System\Buffers\ArrayMemoryPool.ArrayMemoryPoolBuffer.cs" />
@@ -1046,10 +1062,6 @@
     <Compile Include="..\referencesource\mscorlib\system\io\__hresults.cs" />
     <Compile Include="..\referencesource\mscorlib\system\io\binaryreader.cs" />
     <Compile Include="..\referencesource\mscorlib\system\io\binarywriter.cs" />
-    <Compile Include="..\referencesource\mscorlib\system\io\directory.cs" />
-    <Compile Include="..\referencesource\mscorlib\system\io\fileinfo.cs" />
-    <Compile Include="..\referencesource\mscorlib\system\io\filesystemenumerable.cs" />
-    <Compile Include="..\referencesource\mscorlib\system\io\filesysteminfo.cs" />
     <Compile Include="..\referencesource\mscorlib\system\io\streamwriter.cs" />
     <Compile Include="..\referencesource\mscorlib\system\io\stringreader.cs" />
     <Compile Include="..\referencesource\mscorlib\system\io\stringwriter.cs" />
@@ -1372,8 +1384,6 @@
     <Compile Include="System.IO.IsolatedStorage\IsolatedStorageFileStream.cs" />
     <Compile Include="System.IO.IsolatedStorage\IsolatedStorageSecurityOptions.cs" />
     <Compile Include="System.IO.IsolatedStorage\IsolatedStorageSecurityState.cs" />
-    <Compile Include="System.IO\Directory.cs" />
-    <Compile Include="System.IO\DirectoryInfo.cs" />
     <Compile Include="System.IO\DriveInfo.cs" />
     <Compile Include="System.IO\File.cs" />
     <Compile Include="System.IO\FileStream.cs" />
@@ -2019,8 +2029,12 @@
     <Compile Include="corefx\CurrentSystemTimeZone.cs" />
     <Compile Include="corefx\DateTime.cs" />
     <Compile Include="corefx\DefaultBinder.cs" />
+    <Compile Include="corefx\Directory.cs" />
+    <Compile Include="corefx\DirectoryInfo.cs" />
+    <Compile Include="corefx\FileInfo.cs" />
     <Compile Include="corefx\GlobalizationMode.cs" />
     <Compile Include="corefx\MethodInfo.cs" />
+    <Compile Include="corefx\MonoLinqHelper.cs" />
     <Compile Include="corefx\RandomNumberGenerator.cs" />
     <Compile Include="corefx\RuntimeImports.cs" />
     <Compile Include="corefx\SR.cs" />
@@ -2061,6 +2075,33 @@
   <Choose>
     <When Condition="'$(Platform)' == 'xammac'">
       <ItemGroup>
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\Interop.Errors.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\Interop.IOErrors.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.GetRandomBytes.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.Stat.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\IO\PathInternal.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\Interop.Libraries.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.ChMod.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.CopyFile.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.GetEGid.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.GetEUid.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Link.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.MkDir.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.MountPoints.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Permissions.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.ReadDir.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Rename.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.RmDir.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Stat.Span.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.UTime.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Unlink.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Microsoft\Win32\SafeHandles\SafeDirectoryHandle.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\System\IO\DriveInfoInternal.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEntry.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerator.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileStatus.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystem.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystemInfo.Unix.cs" />
         <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.X509Certificates\src\Microsoft\Win32\SafeHandles\SafePasswordHandle.Unix.cs" />
         <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Unix\System.Private.CoreLib.Native\Interop.Number.cs" />
         <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Number.Unix.cs" />
@@ -2083,7 +2124,6 @@
         <Compile Include="System.Security.AccessControl\RegistryAccessRule.cs" />
         <Compile Include="System.Security.AccessControl\RegistryAuditRule.cs" />
         <Compile Include="System.Security.AccessControl\RegistrySecurity.cs" />
-        <Compile Include="corefx\Interop.GetRandomBytes.Mono.cs" />
         <Compile Include="corefx\Mono.SafePasswordHandle.Unix.cs" />
         <Compile Include="corert\PreAllocatedOverlapped.platformnotsupported.cs" />
         <Compile Include="corert\ThreadPoolBoundHandle.platformnotsupported.cs" />
@@ -2094,10 +2134,22 @@
         <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Windows\BCrypt\Interop.BCryptGenRandom.GetRandomBytes.cs" />
         <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Windows\BCrypt\Interop.BCryptGenRandom.cs" />
         <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Windows\BCrypt\Interop.NTSTATUS.cs" />
-        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Windows\Interop.Libraries.cs" />
-        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.SECURITY_ATTRIBUTES.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.MAX_PATH.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\IO\PathInternal.Windows.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\IO\Win32Marshal.cs" />
         <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\Interop.BOOL.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\Interop.BOOLEAN.cs" />
         <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\Interop.Errors.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\Interop.Libraries.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\Interop.LongFileTime.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\Interop.UNICODE_STRING.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\NtDll\Interop.FILE_FULL_DIR_INFORMATION.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\NtDll\Interop.FILE_INFORMATION_CLASS.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\NtDll\Interop.IO_STATUS_BLOCK.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\NtDll\Interop.NtCreateFile.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\NtDll\Interop.NtQueryDirectoryFile.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\NtDll\Interop.NtStatus.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\NtDll\Interop.RtlNtStatusToDosError.cs" />
         <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\advapi32\Interop.RegCloseKey.cs" />
         <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\advapi32\Interop.RegConnectRegistry.cs" />
         <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\advapi32\Interop.RegCreateKeyEx.cs" />
@@ -2112,6 +2164,37 @@
         <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\advapi32\Interop.RegSetValueEx.cs" />
         <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\advapi32\Interop.RegisterServiceCtrlHandler.cs" />
         <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\advapi32\Interop.RegisterServiceCtrlHandlerEx.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.CloseHandle.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.CopyFile.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.CopyFileEx.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.CreateDirectory.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.CreateFile.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.DeleteFile.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.DeleteVolumeMountPoint.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.FILE_INFO_BY_HANDLE_CLASS.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.FILE_TIME.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.FINDEX_INFO_LEVELS.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.FINDEX_SEARCH_OPS.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.FileAttributes.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.FileOperations.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.FindFirstFileEx.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.FindNextFile.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.FormatMessage.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.GET_FILEEX_INFO_LEVELS.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.GenericOperations.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.GetFileAttributesEx.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.GetLogicalDrive.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.MoveFileEx.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.RemoveDirectory.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.ReplaceFile.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.SECURITY_ATTRIBUTES.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.SetFileAttributes.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.SetFileInformationByHandle.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.SetThreadErrorMode.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.WIN32_FILE_ATTRIBUTE_DATA.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.WIN32_FIND_DATA.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\System\IO\DriveInfoInternal.Win32.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\System\Memory\FixedBufferExtensions.cs" />
         <Compile Include="..\..\..\external\corefx\src\Microsoft.Win32.Registry\src\Microsoft\Win32\Registry.cs" />
         <Compile Include="..\..\..\external\corefx\src\Microsoft.Win32.Registry\src\Microsoft\Win32\RegistryKey.Windows.cs" />
         <Compile Include="..\..\..\external\corefx\src\Microsoft.Win32.Registry\src\Microsoft\Win32\RegistryKey.cs" />
@@ -2119,13 +2202,17 @@
         <Compile Include="..\..\..\external\corefx\src\Microsoft.Win32.Registry\src\Microsoft\Win32\SafeHandles\SafeRegistryHandle.cs" />
         <Compile Include="..\..\..\external\corefx\src\Microsoft.Win32.Registry\src\System\Security\AccessControl\RegistrySecurity.Windows.cs" />
         <Compile Include="..\..\..\external\corefx\src\Microsoft.Win32.Registry\src\System\Security\AccessControl\RegistrySecurity.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\DisableMediaInsertionPrompt.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEntry.Windows.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerator.Win32.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerator.Windows.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystem.Windows.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystemInfo.Windows.cs" />
         <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.X509Certificates\src\Microsoft\Win32\SafeHandles\SafePasswordHandle.Windows.cs" />
         <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Windows\Interop.Libraries.cs" />
         <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Windows\mincore\Interop.MemAllocFree.cs" />
         <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Windows\mincore\Interop.ThreadPoolIO.cs" />
         <Compile Include="..\..\..\external\corert\src\Runtime.Base\src\System\Runtime\InteropServices\NativeCallableAttribute.cs" />
-        <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\shared\Interop\Windows\Kernel32\Interop.FormatMessage.cs" />
-        <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\shared\System\IO\Win32Marshal.cs" />
         <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\shared\System\Threading\DeferredDisposableLifetime.cs" />
         <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\Microsoft\Win32\SafeHandles\SafeThreadPoolIOHandle.cs" />
         <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Number.Windows.cs" />
@@ -2151,7 +2238,6 @@
         <Compile Include="System.Security.Cryptography\MD5CryptoServiceProvider.cs" />
         <Compile Include="System.Security.Cryptography\RNGCryptoServiceProvider.cs" />
         <Compile Include="System.Security.Cryptography\SHA1CryptoServiceProvider.cs" />
-        <Compile Include="corefx\Interop.Libraries.Advapi32.cs" />
         <Compile Include="corefx\Mono.SafePasswordHandle.Windows.cs" />
         <Compile Include="corefx\Registry.cs" />
         <Compile Include="corert\RuntimeImports.cs" />
@@ -2182,6 +2268,11 @@
         <Compile Include="Microsoft.Win32\Win32ResultCode.cs" />
         <Compile Include="Mono\MonoNativePlatform.cs" />
         <Compile Include="Mono\MonoNativePlatformType.cs" />
+        <Compile Include="System.IO.Enumeration\FileSystemEntry.NotSupported.cs" />
+        <Compile Include="System.IO.Enumeration\FileSystemEnumerator.NotSupported.cs" />
+        <Compile Include="System.IO\FileSystem.NotSupported.cs" />
+        <Compile Include="System.IO\FileSystemInfo.NotSupported.cs" />
+        <Compile Include="System.IO\PathInternal.NotSupported.cs" />
         <Compile Include="System.Security.AccessControl\RegistryAccessRule.cs" />
         <Compile Include="System.Security.AccessControl\RegistryAuditRule.cs" />
         <Compile Include="System.Security.AccessControl\RegistrySecurity.cs" />
@@ -2219,6 +2310,11 @@
         <Compile Include="Microsoft.Win32\Win32ResultCode.cs" />
         <Compile Include="Mono\MonoNativePlatform.cs" />
         <Compile Include="Mono\MonoNativePlatformType.cs" />
+        <Compile Include="System.IO.Enumeration\FileSystemEntry.NotSupported.cs" />
+        <Compile Include="System.IO.Enumeration\FileSystemEnumerator.NotSupported.cs" />
+        <Compile Include="System.IO\FileSystem.NotSupported.cs" />
+        <Compile Include="System.IO\FileSystemInfo.NotSupported.cs" />
+        <Compile Include="System.IO\PathInternal.NotSupported.cs" />
         <Compile Include="System.Security.AccessControl\RegistryAccessRule.cs" />
         <Compile Include="System.Security.AccessControl\RegistryAuditRule.cs" />
         <Compile Include="System.Security.AccessControl\RegistrySecurity.cs" />
@@ -2256,6 +2352,11 @@
         <Compile Include="Microsoft.Win32\Win32ResultCode.cs" />
         <Compile Include="Mono\MonoNativePlatform.cs" />
         <Compile Include="Mono\MonoNativePlatformType.cs" />
+        <Compile Include="System.IO.Enumeration\FileSystemEntry.NotSupported.cs" />
+        <Compile Include="System.IO.Enumeration\FileSystemEnumerator.NotSupported.cs" />
+        <Compile Include="System.IO\FileSystem.NotSupported.cs" />
+        <Compile Include="System.IO\FileSystemInfo.NotSupported.cs" />
+        <Compile Include="System.IO\PathInternal.NotSupported.cs" />
         <Compile Include="System.Security.AccessControl\RegistryAccessRule.cs" />
         <Compile Include="System.Security.AccessControl\RegistryAuditRule.cs" />
         <Compile Include="System.Security.AccessControl\RegistrySecurity.cs" />
@@ -2276,10 +2377,22 @@
             <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Windows\BCrypt\Interop.BCryptGenRandom.GetRandomBytes.cs" />
             <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Windows\BCrypt\Interop.BCryptGenRandom.cs" />
             <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Windows\BCrypt\Interop.NTSTATUS.cs" />
-            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Windows\Interop.Libraries.cs" />
-            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.SECURITY_ATTRIBUTES.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Windows\Kernel32\Interop.MAX_PATH.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\IO\PathInternal.Windows.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\IO\Win32Marshal.cs" />
             <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\Interop.BOOL.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\Interop.BOOLEAN.cs" />
             <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\Interop.Errors.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\Interop.Libraries.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\Interop.LongFileTime.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\Interop.UNICODE_STRING.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\NtDll\Interop.FILE_FULL_DIR_INFORMATION.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\NtDll\Interop.FILE_INFORMATION_CLASS.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\NtDll\Interop.IO_STATUS_BLOCK.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\NtDll\Interop.NtCreateFile.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\NtDll\Interop.NtQueryDirectoryFile.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\NtDll\Interop.NtStatus.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\NtDll\Interop.RtlNtStatusToDosError.cs" />
             <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\advapi32\Interop.RegCloseKey.cs" />
             <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\advapi32\Interop.RegConnectRegistry.cs" />
             <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\advapi32\Interop.RegCreateKeyEx.cs" />
@@ -2294,6 +2407,37 @@
             <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\advapi32\Interop.RegSetValueEx.cs" />
             <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\advapi32\Interop.RegisterServiceCtrlHandler.cs" />
             <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\advapi32\Interop.RegisterServiceCtrlHandlerEx.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.CloseHandle.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.CopyFile.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.CopyFileEx.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.CreateDirectory.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.CreateFile.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.DeleteFile.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.DeleteVolumeMountPoint.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.FILE_INFO_BY_HANDLE_CLASS.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.FILE_TIME.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.FINDEX_INFO_LEVELS.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.FINDEX_SEARCH_OPS.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.FileAttributes.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.FileOperations.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.FindFirstFileEx.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.FindNextFile.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.FormatMessage.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.GET_FILEEX_INFO_LEVELS.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.GenericOperations.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.GetFileAttributesEx.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.GetLogicalDrive.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.MoveFileEx.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.RemoveDirectory.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.ReplaceFile.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.SECURITY_ATTRIBUTES.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.SetFileAttributes.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.SetFileInformationByHandle.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.SetThreadErrorMode.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.WIN32_FILE_ATTRIBUTE_DATA.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Windows\kernel32\Interop.WIN32_FIND_DATA.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\System\IO\DriveInfoInternal.Win32.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\System\Memory\FixedBufferExtensions.cs" />
             <Compile Include="..\..\..\external\corefx\src\Microsoft.Win32.Registry\src\Microsoft\Win32\Registry.cs" />
             <Compile Include="..\..\..\external\corefx\src\Microsoft.Win32.Registry\src\Microsoft\Win32\RegistryKey.Windows.cs" />
             <Compile Include="..\..\..\external\corefx\src\Microsoft.Win32.Registry\src\Microsoft\Win32\RegistryKey.cs" />
@@ -2301,13 +2445,17 @@
             <Compile Include="..\..\..\external\corefx\src\Microsoft.Win32.Registry\src\Microsoft\Win32\SafeHandles\SafeRegistryHandle.cs" />
             <Compile Include="..\..\..\external\corefx\src\Microsoft.Win32.Registry\src\System\Security\AccessControl\RegistrySecurity.Windows.cs" />
             <Compile Include="..\..\..\external\corefx\src\Microsoft.Win32.Registry\src\System\Security\AccessControl\RegistrySecurity.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\DisableMediaInsertionPrompt.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEntry.Windows.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerator.Win32.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerator.Windows.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystem.Windows.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystemInfo.Windows.cs" />
             <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.X509Certificates\src\Microsoft\Win32\SafeHandles\SafePasswordHandle.Windows.cs" />
             <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Windows\Interop.Libraries.cs" />
             <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Windows\mincore\Interop.MemAllocFree.cs" />
             <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Windows\mincore\Interop.ThreadPoolIO.cs" />
             <Compile Include="..\..\..\external\corert\src\Runtime.Base\src\System\Runtime\InteropServices\NativeCallableAttribute.cs" />
-            <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\shared\Interop\Windows\Kernel32\Interop.FormatMessage.cs" />
-            <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\shared\System\IO\Win32Marshal.cs" />
             <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\shared\System\Threading\DeferredDisposableLifetime.cs" />
             <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\Microsoft\Win32\SafeHandles\SafeThreadPoolIOHandle.cs" />
             <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Number.Windows.cs" />
@@ -2331,7 +2479,6 @@
             <Compile Include="System.Security.Cryptography\MD5CryptoServiceProvider.cs" />
             <Compile Include="System.Security.Cryptography\RNGCryptoServiceProvider.cs" />
             <Compile Include="System.Security.Cryptography\SHA1CryptoServiceProvider.cs" />
-            <Compile Include="corefx\Interop.Libraries.Advapi32.cs" />
             <Compile Include="corefx\Mono.SafePasswordHandle.Windows.cs" />
             <Compile Include="corefx\Registry.cs" />
             <Compile Include="corert\RuntimeImports.cs" />
@@ -2339,8 +2486,33 @@
         </When>
         <When Condition="'$(HostPlatform)' == 'unix'">
           <ItemGroup>
-            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\Interop.Libraries.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\Interop.Errors.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\Interop.IOErrors.cs" />
             <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.GetRandomBytes.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.Stat.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\IO\PathInternal.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\Interop.Libraries.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.ChMod.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.CopyFile.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.GetEGid.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.GetEUid.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Link.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.MkDir.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.MountPoints.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Permissions.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.ReadDir.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Rename.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.RmDir.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Stat.Span.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.UTime.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Unlink.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Microsoft\Win32\SafeHandles\SafeDirectoryHandle.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\System\IO\DriveInfoInternal.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEntry.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerator.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileStatus.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystem.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystemInfo.Unix.cs" />
             <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.X509Certificates\src\Microsoft\Win32\SafeHandles\SafePasswordHandle.Unix.cs" />
             <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Unix\System.Private.CoreLib.Native\Interop.Number.cs" />
             <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Number.Unix.cs" />
@@ -2377,8 +2549,33 @@
         </When>
         <When Condition="'$(HostPlatform)' == 'macos'">
           <ItemGroup>
-            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\Interop.Libraries.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\Interop.Errors.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\Interop.IOErrors.cs" />
             <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.GetRandomBytes.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.Stat.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\IO\PathInternal.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\Interop.Libraries.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.ChMod.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.CopyFile.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.GetEGid.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.GetEUid.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Link.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.MkDir.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.MountPoints.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Permissions.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.ReadDir.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Rename.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.RmDir.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Stat.Span.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.UTime.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Unlink.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Microsoft\Win32\SafeHandles\SafeDirectoryHandle.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\System\IO\DriveInfoInternal.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEntry.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerator.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileStatus.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystem.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystemInfo.Unix.cs" />
             <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.X509Certificates\src\Microsoft\Win32\SafeHandles\SafePasswordHandle.Unix.cs" />
             <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Unix\System.Private.CoreLib.Native\Interop.Number.cs" />
             <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Number.Unix.cs" />
@@ -2415,8 +2612,33 @@
         </When>
         <When Condition="'$(HostPlatform)' == 'linux'">
           <ItemGroup>
-            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\Interop.Libraries.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\Interop.Errors.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\Interop.IOErrors.cs" />
             <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.GetRandomBytes.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.Stat.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\IO\PathInternal.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\Interop.Libraries.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.ChMod.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.CopyFile.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.GetEGid.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.GetEUid.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Link.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.MkDir.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.MountPoints.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Permissions.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.ReadDir.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Rename.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.RmDir.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Stat.Span.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.UTime.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Unlink.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\Microsoft\Win32\SafeHandles\SafeDirectoryHandle.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\Common\src\System\IO\DriveInfoInternal.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEntry.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerator.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileStatus.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystem.Unix.cs" />
+            <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystemInfo.Unix.cs" />
             <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.X509Certificates\src\Microsoft\Win32\SafeHandles\SafePasswordHandle.Unix.cs" />
             <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Unix\System.Private.CoreLib.Native\Interop.Number.cs" />
             <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Number.Unix.cs" />
@@ -2456,6 +2678,33 @@
     </When>
     <When Condition="'$(Platform)' == 'monotouch_watch'">
       <ItemGroup>
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\Interop.Errors.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\Interop.IOErrors.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.GetRandomBytes.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.Stat.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\IO\PathInternal.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\Interop.Libraries.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.ChMod.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.CopyFile.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.GetEGid.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.GetEUid.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Link.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.MkDir.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.MountPoints.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Permissions.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.ReadDir.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Rename.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.RmDir.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Stat.Span.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.UTime.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Unlink.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Microsoft\Win32\SafeHandles\SafeDirectoryHandle.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\System\IO\DriveInfoInternal.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEntry.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerator.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileStatus.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystem.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystemInfo.Unix.cs" />
         <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.X509Certificates\src\Microsoft\Win32\SafeHandles\SafePasswordHandle.Unix.cs" />
         <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Unix\System.Private.CoreLib.Native\Interop.Number.cs" />
         <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Number.Unix.cs" />
@@ -2482,7 +2731,6 @@
         <Compile Include="System\Environment.iOS.cs" />
         <Compile Include="System\Guid.MonoTouch.cs" />
         <Compile Include="System\NotSupportedException.iOS.cs" />
-        <Compile Include="corefx\Interop.GetRandomBytes.Mono.cs" />
         <Compile Include="corefx\Mono.SafePasswordHandle.Unix.cs" />
         <Compile Include="corert\PreAllocatedOverlapped.platformnotsupported.cs" />
         <Compile Include="corert\ThreadPoolBoundHandle.platformnotsupported.cs" />
@@ -2490,6 +2738,33 @@
     </When>
     <When Condition="'$(Platform)' == 'monotouch_tv'">
       <ItemGroup>
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\Interop.Errors.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\Interop.IOErrors.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.GetRandomBytes.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.Stat.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\IO\PathInternal.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\Interop.Libraries.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.ChMod.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.CopyFile.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.GetEGid.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.GetEUid.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Link.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.MkDir.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.MountPoints.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Permissions.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.ReadDir.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Rename.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.RmDir.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Stat.Span.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.UTime.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Unlink.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Microsoft\Win32\SafeHandles\SafeDirectoryHandle.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\System\IO\DriveInfoInternal.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEntry.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerator.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileStatus.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystem.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystemInfo.Unix.cs" />
         <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.X509Certificates\src\Microsoft\Win32\SafeHandles\SafePasswordHandle.Unix.cs" />
         <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Unix\System.Private.CoreLib.Native\Interop.Number.cs" />
         <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Number.Unix.cs" />
@@ -2516,7 +2791,6 @@
         <Compile Include="System\Environment.iOS.cs" />
         <Compile Include="System\Guid.MonoTouch.cs" />
         <Compile Include="System\NotSupportedException.iOS.cs" />
-        <Compile Include="corefx\Interop.GetRandomBytes.Mono.cs" />
         <Compile Include="corefx\Mono.SafePasswordHandle.Unix.cs" />
         <Compile Include="corert\PreAllocatedOverlapped.platformnotsupported.cs" />
         <Compile Include="corert\ThreadPoolBoundHandle.platformnotsupported.cs" />
@@ -2524,6 +2798,33 @@
     </When>
     <When Condition="'$(Platform)' == 'monotouch'">
       <ItemGroup>
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\Interop.Errors.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\Interop.IOErrors.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.GetRandomBytes.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\Interop\Unix\System.Native\Interop.Stat.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\IO\PathInternal.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\Interop.Libraries.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.ChMod.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.CopyFile.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.GetEGid.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.GetEUid.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Link.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.MkDir.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.MountPoints.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Permissions.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.ReadDir.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Rename.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.RmDir.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Stat.Span.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.UTime.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Interop\Unix\System.Native\Interop.Unlink.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\Microsoft\Win32\SafeHandles\SafeDirectoryHandle.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\Common\src\System\IO\DriveInfoInternal.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEntry.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\Enumeration\FileSystemEnumerator.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileStatus.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystem.Unix.cs" />
+        <Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem\src\System\IO\FileSystemInfo.Unix.cs" />
         <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.X509Certificates\src\Microsoft\Win32\SafeHandles\SafePasswordHandle.Unix.cs" />
         <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Unix\System.Private.CoreLib.Native\Interop.Number.cs" />
         <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Number.Unix.cs" />
@@ -2550,7 +2851,6 @@
         <Compile Include="System\Environment.iOS.cs" />
         <Compile Include="System\Guid.MonoTouch.cs" />
         <Compile Include="System\NotSupportedException.iOS.cs" />
-        <Compile Include="corefx\Interop.GetRandomBytes.Mono.cs" />
         <Compile Include="corefx\Mono.SafePasswordHandle.Unix.cs" />
         <Compile Include="corert\PreAllocatedOverlapped.platformnotsupported.cs" />
         <Compile Include="corert\ThreadPoolBoundHandle.platformnotsupported.cs" />
@@ -2581,6 +2881,11 @@
         <Compile Include="Microsoft.Win32\Win32ResultCode.cs" />
         <Compile Include="Mono\MonoNativePlatform.cs" />
         <Compile Include="Mono\MonoNativePlatformType.cs" />
+        <Compile Include="System.IO.Enumeration\FileSystemEntry.NotSupported.cs" />
+        <Compile Include="System.IO.Enumeration\FileSystemEnumerator.NotSupported.cs" />
+        <Compile Include="System.IO\FileSystem.NotSupported.cs" />
+        <Compile Include="System.IO\FileSystemInfo.NotSupported.cs" />
+        <Compile Include="System.IO\PathInternal.NotSupported.cs" />
         <Compile Include="System.Security.AccessControl\RegistryAccessRule.cs" />
         <Compile Include="System.Security.AccessControl\RegistryAuditRule.cs" />
         <Compile Include="System.Security.AccessControl\RegistrySecurity.cs" />

+ 23 - 6
mcs/class/corlib/corlib.dll.sources

@@ -1,3 +1,5 @@
+#include System.IO.platformnotsupported.sources
+
 Assembly/AssemblyInfo.cs
 ../../build/common/Consts.cs
 ../../build/common/Locale.cs
@@ -197,8 +199,6 @@ System.Globalization/CultureInfo.cs
 System.Globalization/IdnMapping.cs
 System.Globalization/RegionInfo.cs
 System.Globalization/RegionInfo.MonoTouch.cs
-System.IO/Directory.cs
-System.IO/DirectoryInfo.cs
 System.IO/DriveInfo.cs
 ../../../external/corefx/src/System.IO.FileSystem.DriveInfo/src/System/IO/DriveType.cs
 System.IO/File.cs
@@ -1125,17 +1125,16 @@ ReferenceSources/AppContextDefaultValues.cs
 ../referencesource/mscorlib/system/io/binaryreader.cs
 ../referencesource/mscorlib/system/io/binarywriter.cs
 ../../../external/corefx/src/System.Runtime.Extensions/src/System/IO/BufferedStream.cs
-../referencesource/mscorlib/system/io/directory.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/Directory.cs
 ../../../external/corefx/src/Common/src/CoreLib/System/IO/DirectoryNotFoundException.cs
 ../../../external/corefx/src/System.IO.FileSystem.DriveInfo/src/System/IO/DriveNotFoundException.cs
 ../../../external/corefx/src/Common/src/CoreLib/System/IO/EndOfStreamException.cs
 ../../../external/corefx/src/Common/src/CoreLib/System/IO/IOException.cs
-../referencesource/mscorlib/system/io/fileinfo.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/FileInfo.cs
 ../../../external/corefx/src/Common/src/CoreLib/System/IO/FileLoadException.cs
 ../../../external/corert/src/System.Private.CoreLib/src/System/IO/FileLoadException.CoreRT.cs
 ../../../external/corefx/src/Common/src/CoreLib/System/IO/FileNotFoundException.cs
-../referencesource/mscorlib/system/io/filesysteminfo.cs
-../referencesource/mscorlib/system/io/filesystemenumerable.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/FileSystemInfo.cs
 ../../../external/corefx/src/Common/src/CoreLib/System/IO/MemoryStream.cs
 ../../../external/corefx/src/Common/src/CoreLib/System/IO/PathTooLongException.cs
 ../../../external/corefx/src/Common/src/CoreLib/System/IO/PinnedBufferMemoryStream.cs
@@ -1864,3 +1863,21 @@ corefx/Mono.SafePasswordHandle.Unix.cs
 ../../../external/corefx/src/Common/src/System/NotImplemented.cs
 ../../../external/corefx/src/Common/src/CoreLib/System/IO/Error.cs
 ../../../external/corefx/src/Common/src/CoreLib/System/IO/StreamHelpers.CopyValidation.cs
+
+../../../external/corefx/src/Common/src/CoreLib/System/IO/PathInternal.cs
+../../../external/corefx/src/Common/src/System/IO/PathInternal.CaseSensitivity.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/DirectoryInfo.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/EnumerationOptions.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/SearchTarget.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/MatchType.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/MatchCasing.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerableFactory.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEntry.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerable.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerator.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemName.cs
+../../../external/corefx/src/Common/src/System/Text/ValueUtf8Converter.cs
+corefx/DirectoryInfo.cs
+corefx/FileInfo.cs
+corefx/Directory.cs
+corefx/MonoLinqHelper.cs

+ 28 - 0
mcs/class/corlib/corlib_xtest.dll.sources

@@ -357,3 +357,31 @@
 ../../../external/corefx/src/System.IO/tests/TestDataProvider/TestDataProvider.cs
 ../../../external/corefx/src/Common/tests/System/IO/WrappedMemoryStream.cs
 ../../../external/corefx/src/System.IO/tests/BufferedStream/*.cs
+
+# FileSystem Helper (not used on Windows)
+../../../external/corefx/src/System.IO.FileSystem/tests/FileSystemTest.Unix.cs
+
+# System.IO.FileInfo
+../../../external/corefx/src/Common/tests/System/IO/TempFile.cs
+../../../external/corefx/src/Common/tests/System/IO/PathFeatures.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/TestData.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/FSAssert.cs
+../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AdminHelpers.cs
+../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/TheoryExtensions.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/Base/*.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/File/ReadWriteAllLines.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/File/ReadWriteAllText.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/File/Copy.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/File/Create.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/File/Delete.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/File/Move.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/FileStream/ctor_*.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/PortedCommon/*.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/FileSystemTest.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/FileInfo/*.cs
+
+# System.IO.Directory
+../../../external/corefx/src/System.IO.FileSystem/tests/Directory/*.cs
+
+# System.IO.DirectoryInfo
+../../../external/corefx/src/System.IO.FileSystem/tests/DirectoryInfo/*.cs

+ 1 - 0
mcs/class/corlib/linux_build_corlib.dll.exclude.sources

@@ -0,0 +1 @@
+#include unix_build_corlib.dll.exclude.sources

+ 2 - 0
mcs/class/corlib/linux_build_corlib.dll.sources

@@ -0,0 +1,2 @@
+#include corlib.dll.sources
+#include unix_build_corlib.dll.sources

+ 1 - 0
mcs/class/corlib/macos_build_corlib.dll.exclude.sources

@@ -0,0 +1 @@
+#include unix_build_corlib.dll.exclude.sources

+ 2 - 0
mcs/class/corlib/macos_build_corlib.dll.sources

@@ -0,0 +1,2 @@
+#include corlib.dll.sources
+#include unix_build_corlib.dll.sources

+ 1 - 0
mcs/class/corlib/monotouch_corlib.dll.exclude.sources

@@ -1,3 +1,4 @@
+#include unix_build_corlib.dll.exclude.sources
 System.Security.Cryptography/MD5CryptoServiceProvider.cs
 System.Security.Cryptography/SHA1CryptoServiceProvider.cs
 System.Security.Cryptography/SHA1CryptoServiceProvider.cs

+ 1 - 0
mcs/class/corlib/monotouch_corlib.dll.sources

@@ -1,4 +1,5 @@
 #include corlib.dll.sources
+#include unix_build_corlib.dll.sources
 CommonCrypto/CommonCrypto.cs
 CommonCrypto/CryptorTransform.cs
 CommonCrypto/FastCryptorTransform.cs

+ 1 - 0
mcs/class/corlib/orbis_corlib_test.dll.exclude.sources

@@ -1 +1,2 @@
 #include testing_aot_full_corlib_test.dll.exclude.sources
+#include unix_build_corlib.dll.exclude.sources

+ 1 - 0
mcs/class/corlib/testing_aot_full_corlib.dll.exclude.sources

@@ -0,0 +1 @@
+#include unix_build_corlib.dll.exclude.sources

+ 2 - 0
mcs/class/corlib/testing_aot_full_corlib.dll.sources

@@ -0,0 +1,2 @@
+#include corlib.dll.sources
+#include unix_build_corlib.dll.sources

+ 1 - 0
mcs/class/corlib/testing_aot_hybrid_corlib.dll.exclude.sources

@@ -0,0 +1 @@
+#include unix_build_corlib.dll.exclude.sources

+ 2 - 0
mcs/class/corlib/testing_aot_hybrid_corlib.dll.sources

@@ -0,0 +1,2 @@
+#include corlib.dll.sources
+#include unix_build_corlib.dll.sources

+ 2 - 0
mcs/class/corlib/unix_build_corlib.dll.exclude.sources

@@ -0,0 +1,2 @@
+#include System.IO.platformnotsupported.sources
+corefx/Interop.GetRandomBytes.Mono.cs

+ 29 - 0
mcs/class/corlib/unix_build_corlib.dll.sources

@@ -0,0 +1,29 @@
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/FileSystemInfo.Unix.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/FileStatus.Unix.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerator.Unix.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEntry.Unix.cs
+../../../external/corefx/src/Common/src/CoreLib/System/IO/PathInternal.Unix.cs
+../../../external/corefx/src/Common/src/CoreLib/Interop/Unix/System.Native/Interop.Stat.cs
+../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Stat.Span.cs
+../../../external/corefx/src/Common/src/Interop/Unix/Interop.Libraries.cs
+../../../external/corefx/src/Common/src/CoreLib/Interop/Unix/Interop.Errors.cs
+../../../external/corefx/src/Common/src/CoreLib/Interop/Unix/Interop.IOErrors.cs
+../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Permissions.cs
+../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.GetEUid.cs
+../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.GetEGid.cs
+../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.CopyFile.cs
+../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Unlink.cs
+../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Link.cs
+../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Rename.cs
+../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.ChMod.cs
+../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.MkDir.cs
+../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.UTime.cs
+../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.RmDir.cs
+../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.MountPoints.cs
+../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.ReadDir.cs
+../../../external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeDirectoryHandle.Unix.cs
+
+../../../external/corefx/src/Common/src/System/IO/DriveInfoInternal.Unix.cs
+
+../../../external/corefx/src/Common/src/CoreLib/Interop/Unix/System.Native/Interop.GetRandomBytes.cs

+ 1 - 1
mcs/class/corlib/unix_net_4_x_corlib.dll.exclude.sources

@@ -1 +1 @@
-corefx/Interop.GetRandomBytes.Mono.cs
+#include unix_build_corlib.dll.exclude.sources

+ 1 - 1
mcs/class/corlib/unix_net_4_x_corlib.dll.sources

@@ -1,4 +1,4 @@
 #include net_4_x_corlib.dll.sources
+#include unix_build_corlib.dll.sources
 
 ../../../external/corefx/src/Common/src/CoreLib/Interop/Unix/System.Native/Interop.GetRandomBytes.cs
-../../../external/corefx/src/Common/src/CoreLib/Interop/Unix/Interop.Libraries.cs

+ 28 - 0
mcs/class/corlib/wasm_corlib_xtest.dll.exclude.sources

@@ -14,3 +14,31 @@
 ../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderNamespace.cs
 ../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderPackingSize.cs
 ../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderSize.cs
+
+# FileSystem Helper (not used on Windows)
+../../../external/corefx/src/System.IO.FileSystem/tests/FileSystemTest.Unix.cs
+
+# System.IO.FileInfo
+../../../external/corefx/src/Common/tests/System/IO/TempFile.cs
+../../../external/corefx/src/Common/tests/System/IO/PathFeatures.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/TestData.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/FSAssert.cs
+../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AdminHelpers.cs
+../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/TheoryExtensions.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/Base/*.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/File/ReadWriteAllLines.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/File/ReadWriteAllText.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/File/Copy.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/File/Create.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/File/Delete.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/File/Move.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/FileStream/ctor_*.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/PortedCommon/*.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/FileSystemTest.cs
+../../../external/corefx/src/System.IO.FileSystem/tests/FileInfo/*.cs
+
+# System.IO.Directory
+../../../external/corefx/src/System.IO.FileSystem/tests/Directory/*.cs
+
+# System.IO.DirectoryInfo
+../../../external/corefx/src/System.IO.FileSystem/tests/DirectoryInfo/*.cs

+ 1 - 0
mcs/class/corlib/win32_build_corlib.dll.exclude.sources

@@ -0,0 +1 @@
+#include System.IO.platformnotsupported.sources

+ 60 - 0
mcs/class/corlib/win32_build_corlib.dll.sources

@@ -0,0 +1,60 @@
+#include corlib.dll.sources
+
+../../../external/corefx/src/Common/src/CoreLib/System/IO/PathInternal.Windows.cs
+../../../external/corefx/src/Common/src/Interop/Windows/NtDll/Interop.FILE_FULL_DIR_INFORMATION.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.WIN32_FILE_ATTRIBUTE_DATA.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.WIN32_FIND_DATA.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FILE_TIME.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FileAttributes.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CreateFile.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CopyFile.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CopyFileEx.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.DeleteFile.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetFileAttributesEx.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.SetFileAttributes.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CreateFile.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.ReplaceFile.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.MoveFileEx.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CreateDirectory.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.RemoveDirectory.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FileOperations.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GenericOperations.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FindNextFile.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FINDEX_INFO_LEVELS.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FINDEX_SEARCH_OPS.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GET_FILEEX_INFO_LEVELS.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FILE_INFO_BY_HANDLE_CLASS.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CloseHandle.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.SetFileInformationByHandle.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.DeleteVolumeMountPoint.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.SetThreadErrorMode.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetLogicalDrive.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FormatMessage.cs
+../../../external/corefx/src/Common/src/Interop/Windows/NtDll/Interop.NtCreateFile.cs
+../../../external/corefx/src/Common/src/Interop/Windows/NtDll/Interop.NtQueryDirectoryFile.cs
+../../../external/corefx/src/Common/src/Interop/Windows/NtDll/Interop.IO_STATUS_BLOCK.cs
+../../../external/corefx/src/Common/src/Interop/Windows/NtDll/Interop.FILE_INFORMATION_CLASS.cs
+../../../external/corefx/src/Common/src/Interop/Windows/NtDll/Interop.RtlNtStatusToDosError.cs
+../../../external/corefx/src/Common/src/Interop/Windows/NtDll/Interop.NtStatus.cs
+../../../external/corefx/src/Common/src/CoreLib/System/IO/Win32Marshal.cs
+../../../external/corefx/src/Common/src/Interop/Windows/Interop.BOOLEAN.cs
+../../../external/corefx/src/Common/src/Interop/Windows/Interop.UNICODE_STRING.cs
+../../../external/corefx/src/Common/src/Interop/Windows/Interop.Libraries.cs
+
+../../../external/corefx/src/Common/src/System/Memory/FixedBufferExtensions.cs
+../../../external/corefx/src/Common/src/CoreLib/System/TupleExtensions.cs
+
+#TODO add tests
+../../../external/corefx/src/Common/src/Interop/Windows/Interop.Errors.cs
+../../../external/corefx/src/Common/src/Interop/Windows/Interop.BOOL.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.SECURITY_ATTRIBUTES.cs
+../../../external/corefx/src/Common/src/CoreLib/Interop/Windows/Kernel32/Interop.MAX_PATH.cs
+../../../external/corefx/src/Common/src/Interop/Windows/Interop.LongFileTime.cs
+../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FindFirstFileEx.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/FileSystem.Windows.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/FileSystemInfo.Windows.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerator.Windows.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerator.Win32.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEntry.Windows.cs
+../../../external/corefx/src/Common/src/System/IO/DriveInfoInternal.Win32.cs
+../../../external/corefx/src/System.IO.FileSystem/src/System/IO/DisableMediaInsertionPrompt.cs

+ 1 - 0
mcs/class/corlib/win32_net_4_x_corlib.dll.exclude.sources

@@ -1,3 +1,4 @@
+#include win32_build_corlib.dll.exclude.sources
 corert/PreAllocatedOverlapped.platformnotsupported.cs
 corert/ThreadPoolBoundHandle.platformnotsupported.cs
 ../../../external/corert/src/System.Private.CoreLib/src/System/Number.Unix.cs

+ 1 - 10
mcs/class/corlib/win32_net_4_x_corlib.dll.sources

@@ -1,19 +1,13 @@
 #include net_4_x_corlib.dll.sources
+#include win32_build_corlib.dll.sources
 
 ../../../external/corert/src/Common/src/Interop/Windows/Interop.Libraries.cs
 ../../../external/corefx/src/Common/src/CoreLib/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs
 ../../../external/corefx/src/Common/src/CoreLib/Interop/Windows/BCrypt/Interop.BCryptGenRandom.GetRandomBytes.cs
 ../../../external/corefx/src/Common/src/CoreLib/Interop/Windows/BCrypt/Interop.NTSTATUS.cs
-../../../external/corefx/src/Common/src/CoreLib/Interop/Windows/Interop.Libraries.cs
-
-../../../external/corert/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FormatMessage.cs
-../../../external/corert/src/System.Private.CoreLib/shared/System/IO/Win32Marshal.cs
 
 ../../../external/corert/src/Common/src/Interop/Windows/mincore/Interop.MemAllocFree.cs
 ../../../external/corert/src/Common/src/Interop/Windows/mincore/Interop.ThreadPoolIO.cs
-
-../../../external/corert/src/Common/src/Interop/Windows/Interop.Libraries.cs
-
 ../../../external/corefx/src/Common/src/Interop/Windows/Interop.Errors.cs
 
 ../../../external/corert/src/System.Private.CoreLib/shared/System/Threading/DeferredDisposableLifetime.cs
@@ -36,15 +30,12 @@ corert/RuntimeImports.cs
 corefx/Mono.SafePasswordHandle.Windows.cs
 ../../../external/corefx/src/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.cs
 ../../../external/corefx/src/Microsoft.Win32.Registry/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs
-corefx/Interop.Libraries.Advapi32.cs
 ../../../external/corefx/src/Microsoft.Win32.Registry/src/System/Security/AccessControl/RegistrySecurity.cs
 ../../../external/corefx/src/Microsoft.Win32.Registry/src/System/Security/AccessControl/RegistrySecurity.Windows.cs
 ../../../external/corefx/src/Microsoft.Win32.Registry/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.Windows.cs
 ../../../external/corefx/src/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.Windows.cs
 ../../../external/corefx/src/Microsoft.Win32.Registry/src/Microsoft/Win32/Registry.cs
 corefx/Registry.cs
-../../../external/corefx/src/Common/src/CoreLib/Interop/Windows/Kernel32/Interop.SECURITY_ATTRIBUTES.cs
-../../../external/corefx/src/Common/src/Interop/Windows/Interop.BOOL.cs
 ../../../external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.RegCloseKey.cs
 ../../../external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.RegConnectRegistry.cs
 ../../../external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.RegCreateKeyEx.cs

+ 1 - 0
mcs/class/corlib/win32_net_4_x_corlib_test.dll.sources

@@ -1 +1,2 @@
 #include corlib_test.dll.sources
+#include unix_build_corlib.dll.sources

+ 1 - 0
mcs/class/corlib/winaot_corlib.dll.exclude.sources

@@ -1,3 +1,4 @@
+#include win32_build_corlib.dll.exclude.sources
 corert/Interop.MemAllocFree.cs
 corert/PreAllocatedOverlapped.platformnotsupported.cs
 corert/ThreadPoolBoundHandle.platformnotsupported.cs

+ 2 - 2
mcs/class/referencesource/mscorlib/system/io/filesystemenumerable.cs

@@ -794,7 +794,7 @@ namespace System.IO
             FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, permissionName, false, false);
 #endif
 #endif
-            DirectoryInfo di = new DirectoryInfo(name, false);
+            DirectoryInfo di = new DirectoryInfo(Path.GetFileName(name), fullPath: name, isNormalized: true);
             di.InitializeFrom(result.FindData);
             return di;
         }
@@ -833,7 +833,7 @@ namespace System.IO
                 FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, permissionName, false, false);
 #endif
 #endif
-                DirectoryInfo di = new DirectoryInfo(name, false);
+                DirectoryInfo di = new DirectoryInfo(Path.GetFileName(name), fullPath: name, isNormalized: true);
                 di.InitializeFrom(result.FindData);
                 return di;
             }

+ 3 - 0
mcs/class/test-helpers/PlatformDetection.cs

@@ -34,5 +34,8 @@ namespace System
 			}
 		}
 		public static bool IsInAppContainer => false;
+		public static bool IsRedHatFamily6 => false;
+		public static bool IsAlpine => false;
+		public static bool IsNetCore => false;
 	}
 }

+ 0 - 0
mcs/tests/gtest-431-lib-1.cs → mcs/tests/gtest-431-1-lib.cs


+ 1 - 1
mcs/tests/gtest-431-lib-2.cs → mcs/tests/gtest-431-2-lib.cs

@@ -1,4 +1,4 @@
-// Compiler options: -t:library -noconfig -r:gtest-431-lib-1.dll
+// Compiler options: -t:library -noconfig -r:gtest-431-1-lib.dll
 
 using System;
 

+ 1 - 1
mcs/tests/gtest-431.cs

@@ -1,4 +1,4 @@
-// Compiler options: -r:gtest-431-lib-1.dll -r:gtest-431-lib-2.dll -noconfig
+// Compiler options: -r:gtest-431-1-lib.dll -r:gtest-431-2-lib.dll -noconfig
 
 using System;
 

+ 15 - 7
mcs/tools/compiler-tester/compiler-tester.cs

@@ -1771,19 +1771,27 @@ namespace TestRunner {
 
 			checker.Name = test_directory.Name;
 			checker.Initialize ();
-/*
+
 			files.Sort ((a, b) => {
-				if (a.EndsWith ("-lib.cs", StringComparison.Ordinal)) {
-					if (!b.EndsWith ("-lib.cs", StringComparison.Ordinal))
+				if (a.Name.EndsWith ("-lib.cs", StringComparison.Ordinal)) {
+					if (!b.Name.EndsWith ("-lib.cs", StringComparison.Ordinal))
+						return -1;
+				} else if (b.Name.EndsWith ("-lib.cs", StringComparison.Ordinal)) {
+					if (!a.Name.EndsWith ("-lib.cs", StringComparison.Ordinal))
+						return 1;
+				}
+
+				if (a.Name.EndsWith ("-mod.cs", StringComparison.Ordinal)) {
+					if (!b.Name.EndsWith ("-mod.cs", StringComparison.Ordinal))
 						return -1;
-				} else if (b.EndsWith ("-lib.cs", StringComparison.Ordinal)) {
-					if (!a.EndsWith ("-lib.cs", StringComparison.Ordinal))
+				} else if (b.Name.EndsWith ("-mod.cs", StringComparison.Ordinal)) {
+					if (!a.Name.EndsWith ("-mod.cs", StringComparison.Ordinal))
 						return 1;
 				}
 
-				return a.CompareTo (b);
+				return a.Name.CompareTo (b.Name);
 			});
-*/
+
 			foreach (FileInfo s in files) {
 				string filename = s.Name;
 				if (Char.IsUpper (filename, 0)) { // Windows hack

+ 5 - 1
mono/native/Makefile.am

@@ -30,7 +30,11 @@ common_sources = \
 	../../external/corefx/src/Native/Unix/System.Native/pal_maphardwaretype.c \
 	../../external/corefx/src/Native/Unix/System.Native/pal_maphardwaretype.h \
 	../../external/corefx/src/Native/Unix/System.Native/pal_memory.c \
-	../../external/corefx/src/Native/Unix/System.Native/pal_memory.h
+	../../external/corefx/src/Native/Unix/System.Native/pal_memory.h \
+	../../external/corefx/src/Native/Unix/System.Native/pal_uid.c \
+	../../external/corefx/src/Native/Unix/System.Native/pal_uid.h \
+	../../external/corefx/src/Native/Unix/System.Native/pal_time.c \
+	../../external/corefx/src/Native/Unix/System.Native/pal_time.h
 
 macos_sources = $(unix_sources)
 

+ 5 - 0
mono/native/pal_config.h

@@ -1,3 +1,8 @@
 #include <config.h>
 
 #define MONO 1
+/* clock_gettime () is found by configure on Apple builds, but its only present from ios 10, macos 10.12, tvos 10 and watchos 3 */
+#if defined (TARGET_WASM) || defined (TARGET_IOS) || defined (TARGET_OSX) || defined (TARGET_WATCHOS) || defined (TARGET_TVOS)
+#undef HAVE_CLOCK_MONOTONIC
+#undef HAVE_CLOCK_MONOTONIC_COARSE
+#endif

+ 2 - 1
packaging/MacSDK/fsharp.py

@@ -11,7 +11,8 @@ class FsharpPackage(GitHubTarballPackage):
         self.sources.extend(['patches/fsharp-portable-pdb.patch',
                              'patches/fsharp-string-switchName.patch',
                              'patches/fsharp-path-overloads.patch',
-                             'patches/fsharp-debug-pinvoke-fix.patch'])
+                             'patches/fsharp-debug-pinvoke-fix.patch',
+                             'patches/fsharp-IsPathRooted-type-inference.patch'])
 
     def prep(self):
         Package.prep(self)

+ 21 - 0
packaging/MacSDK/patches/fsharp-IsPathRooted-type-inference.patch

@@ -0,0 +1,21 @@
+commit c37fce5b3019c7a150203fc3a484885591b194de
+Author: Alexis Christoforides <[email protected]>
+Date:   Sun Dec 2 00:10:24 2018 -0500
+
+    Help Path.IsPathRooted method overload selection.
+
+    .NET Core, and Mono after merging https://github.com/mono/mono/pull/11342, introduce ambiguity with a new overload.
+
+diff --git a/src/scripts/scriptlib.fsx b/src/scripts/scriptlib.fsx
+index cc797e305..699c7bb93 100644
+--- a/src/scripts/scriptlib.fsx
++++ b/src/scripts/scriptlib.fsx
+@@ -92,7 +92,7 @@ module Scripting =
+
+     module Process =
+
+-        let processExePath baseDir exe =
++        let processExePath baseDir (exe:string) =
+             if Path.IsPathRooted(exe) then exe
+             else
+                 match Path.GetDirectoryName(exe) with

+ 1 - 1
scripts/ci/run-test-default.sh

@@ -17,7 +17,7 @@ ${TESTCMD} --label=runtime --timeout=160m make -w -C mono/tests -k test-wrench V
 ${TESTCMD} --label=runtime-unit-tests --timeout=5m make -w -C mono/unit-tests -k check
 if [[ ${CI_TAGS} == *'osx-'* ]]; then ${TESTCMD} --label=corlib-btls --timeout=5m bash -c "export MONO_TLS_PROVIDER=btls && make -w -C mcs/class/corlib TEST_HARNESS_FLAGS=-include:X509Certificates run-test"; fi
 ${TESTCMD} --label=corlib --timeout=30m make -w -C mcs/class/corlib run-test
-${TESTCMD} --label=corlib-xunit --timeout=10m make -w -C mcs/class/corlib run-xunit-test
+${TESTCMD} --label=corlib-xunit --timeout=30m make -w -C mcs/class/corlib run-xunit-test
 ${TESTCMD} --label=verify --timeout=15m make -w -C runtime mcs-compileall
 ${TESTCMD} --label=profiler --timeout=30m make -w -C mono/profiler -k check
 ${TESTCMD} --label=compiler --timeout=30m make -w -C mcs/tests run-test