Imported Upstream version 5.16.0.100

Former-commit-id: 38faa55fb9669e35e7d8448b15c25dc447f25767
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-08-07 15:19:03 +00:00
parent 0a9828183b
commit 7d7f676260
4419 changed files with 170950 additions and 90273 deletions

View File

@@ -20,9 +20,6 @@
<Compile Include="$(CommonPath)\System\HResults.cs">
<Link>Common\System\HResults.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\IO\PathInternal.cs">
<Link>Common\System\IO\PathInternal.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\IO\PathInternal.CaseSensitivity.cs">
<Link>Common\System\IO\PathInternal.CaseSensitivity.cs</Link>
</Compile>
@@ -63,8 +60,8 @@
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.FormatMessage.cs">
<Link>Common\Interop\Windows\Interop.FormatMessage.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\IO\Win32Marshal.cs">
<Link>Common\System\IO\Win32Marshal.cs</Link>
<Compile Include="$(CommonPath)\CoreLib\System\IO\Win32Marshal.cs">
<Link>Common\CoreLib\System\IO\Win32Marshal.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\IO\DriveInfoInternal.Win32.cs">
<Link>Common\System\IO\DriveInfoInternal.Win32.cs</Link>
@@ -101,6 +98,7 @@
<Reference Include="System.Diagnostics.Debug" />
<Reference Include="System.Diagnostics.Tools" />
<Reference Include="System.IO.FileSystem" />
<Reference Include="System.Memory" />
<Reference Include="System.Resources.ResourceManager" />
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Extensions" />

View File

@@ -24,7 +24,7 @@ namespace System.IO
name = Path.GetPathRoot(driveName);
// Disallow null or empty drive letters and UNC paths
if (name == null || name.Length == 0 || name.StartsWith("\\\\", StringComparison.Ordinal))
throw new ArgumentException(SR.Arg_MustBeDriveLetterOrRootDir);
throw new ArgumentException(SR.Arg_MustBeDriveLetterOrRootDir, nameof(driveName));
}
// We want to normalize to have a trailing backslash so we don't have two equivalent forms and
// because some Win32 API don't work without it.
@@ -37,7 +37,7 @@ namespace System.IO
// On Windows this means it's between A and Z, ignoring case.
char letter = driveName[0];
if (!((letter >= 'A' && letter <= 'Z') || (letter >= 'a' && letter <= 'z')))
throw new ArgumentException(SR.Arg_MustBeDriveLetterOrRootDir);
throw new ArgumentException(SR.Arg_MustBeDriveLetterOrRootDir, nameof(driveName));
return name;
}

View File

@@ -17,22 +17,22 @@ namespace System.IO.FileSystem.DriveInfoTests
public class DriveInfoWindowsTests
{
[Theory]
[InlineData(":", null)]
[InlineData("://", null)]
[InlineData(@":\", null)]
[InlineData(":/", null)]
[InlineData(@":\\", null)]
[InlineData("Az", null)]
[InlineData("1", null)]
[InlineData("a1", null)]
[InlineData(@"\\share", null)]
[InlineData(@"\\", null)]
[InlineData("c ", null)]
[InlineData("", "path")]
[InlineData(" c", null)]
public void Ctor_InvalidPath_ThrowsArgumentException(string driveName, string paramName)
[InlineData(":")]
[InlineData("://")]
[InlineData(@":\")]
[InlineData(":/")]
[InlineData(@":\\")]
[InlineData("Az")]
[InlineData("1")]
[InlineData("a1")]
[InlineData(@"\\share")]
[InlineData(@"\\")]
[InlineData("c ")]
[InlineData("")]
[InlineData(" c")]
public void Ctor_InvalidPath_ThrowsArgumentException(string driveName)
{
AssertExtensions.Throws<ArgumentException>(paramName, null, () => new DriveInfo(driveName));
AssertExtensions.Throws<ArgumentException>("driveName", null, () => new DriveInfo(driveName));
}
[Fact]