Imported Upstream version 5.4.0.167

Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-08-21 15:34:15 +00:00
parent e49d6f06c0
commit 536cd135cc
12856 changed files with 563812 additions and 223249 deletions

View File

@@ -2,7 +2,8 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyKey>MSFT</AssemblyKey>
<IsNETCoreApp>true</IsNETCoreApp>
<IsUAP>true</IsUAP>
</PropertyGroup>

View File

@@ -5,7 +5,6 @@
<ProjectGuid>{77E702D9-C6D8-4CE4-9941-D3056C3CCBED}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<!-- Help VS understand available configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Linux-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Linux-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-OSX-Debug|AnyCPU'" />

View File

@@ -595,7 +595,7 @@ namespace System.IO
}
// Return the results.
return tcs.Task.Status == TaskStatus.RanToCompletion ?
return tcs.Task.IsCompletedSuccessfully ?
tcs.Task.Result :
WaitForChangedResult.TimedOutResult;
}

View File

@@ -38,6 +38,9 @@ namespace System.IO
}
protected InternalBufferOverflowException(SerializationInfo info, StreamingContext context)
: base(info, context) { }
: base(info, context)
{
throw new PlatformNotSupportedException();
}
}
}

View File

@@ -125,8 +125,10 @@ namespace System.IO.Tests
}
[Theory]
[OuterLoop("This test has a longer than average timeout and may fail intermittently")]
[InlineData(WatcherChangeTypes.Created)]
[InlineData(WatcherChangeTypes.Deleted)]
[ActiveIssue("dotnet/corefx #18308", TargetFrameworkMonikers.NetFramework)]
public void CreatedDeleted_Success(WatcherChangeTypes changeType)
{
using (var testDirectory = new TempDirectory(GetTestFilePath()))
@@ -134,7 +136,7 @@ namespace System.IO.Tests
{
for (int i = 1; i <= DefaultAttemptsForExpectedEvent; i++)
{
Task<WaitForChangedResult> t = Task.Run(() => fsw.WaitForChanged(changeType, WaitForExpectedEventTimeout));
Task<WaitForChangedResult> t = Task.Run(() => fsw.WaitForChanged(changeType, LongWaitTimeout));
while (!t.IsCompleted)
{
string path = Path.Combine(testDirectory.Path, Path.GetRandomFileName());
@@ -164,6 +166,7 @@ namespace System.IO.Tests
}
[Fact]
[OuterLoop("This test has a longer than average timeout and may fail intermittently")]
public void Changed_Success()
{
using (var testDirectory = new TempDirectory(GetTestFilePath()))
@@ -174,7 +177,7 @@ namespace System.IO.Tests
string name = Path.Combine(testDirectory.Path, Path.GetRandomFileName());
File.Create(name).Dispose();
Task<WaitForChangedResult> t = Task.Run(() => fsw.WaitForChanged(WatcherChangeTypes.Changed, WaitForExpectedEventTimeout));
Task<WaitForChangedResult> t = Task.Run(() => fsw.WaitForChanged(WatcherChangeTypes.Changed, LongWaitTimeout));
while (!t.IsCompleted)
{
File.AppendAllText(name, "text");
@@ -199,6 +202,7 @@ namespace System.IO.Tests
}
[Fact]
[OuterLoop("This test has a longer than average timeout and may fail intermittently")]
public void Renamed_Success()
{
using (var testDirectory = new TempDirectory(GetTestFilePath()))
@@ -207,7 +211,7 @@ namespace System.IO.Tests
for (int i = 1; i <= DefaultAttemptsForExpectedEvent; i++)
{
Task<WaitForChangedResult> t = Task.Run(() =>
fsw.WaitForChanged(WatcherChangeTypes.Renamed | WatcherChangeTypes.Created, WaitForExpectedEventTimeout)); // on some OSes, the renamed might come through as Deleted/Created
fsw.WaitForChanged(WatcherChangeTypes.Renamed | WatcherChangeTypes.Created, LongWaitTimeout)); // on some OSes, the renamed might come through as Deleted/Created
string name = Path.Combine(testDirectory.Path, Path.GetRandomFileName());
File.Create(name).Dispose();

View File

@@ -97,11 +97,11 @@ namespace System.IO.Tests
using (var testDirectory = new TempDirectory(GetTestFilePath()))
{
// Null filter
Assert.Throws<ArgumentNullException>("filter", () => new FileSystemWatcher(testDirectory.Path, null));
AssertExtensions.Throws<ArgumentNullException>("filter", () => new FileSystemWatcher(testDirectory.Path, null));
// Null path
Assert.Throws<ArgumentNullException>("path", () => new FileSystemWatcher(null));
Assert.Throws<ArgumentNullException>("path", () => new FileSystemWatcher(null, "*"));
AssertExtensions.Throws<ArgumentNullException>("path", () => new FileSystemWatcher(null));
AssertExtensions.Throws<ArgumentNullException>("path", () => new FileSystemWatcher(null, "*"));
}
}
@@ -112,12 +112,12 @@ namespace System.IO.Tests
using (var testDirectory = new TempDirectory(GetTestFilePath()))
{
// Empty path
Assert.Throws<ArgumentException>("path", () => new FileSystemWatcher(string.Empty));
Assert.Throws<ArgumentException>("path", () => new FileSystemWatcher(string.Empty, "*"));
AssertExtensions.Throws<ArgumentException>("path", () => new FileSystemWatcher(string.Empty));
AssertExtensions.Throws<ArgumentException>("path", () => new FileSystemWatcher(string.Empty, "*"));
// Invalid directory
Assert.Throws<ArgumentException>("path", () => new FileSystemWatcher(GetTestFilePath()));
Assert.Throws<ArgumentException>("path", () => new FileSystemWatcher(GetTestFilePath(), "*"));
AssertExtensions.Throws<ArgumentException>("path", () => new FileSystemWatcher(GetTestFilePath()));
AssertExtensions.Throws<ArgumentException>("path", () => new FileSystemWatcher(GetTestFilePath(), "*"));
}
}
@@ -497,8 +497,11 @@ namespace System.IO.Tests
watcher.Path = ".";
Assert.Equal(".", watcher.Path);
watcher.Path = "..";
Assert.Equal("..", watcher.Path);
if (!PlatformDetection.IsWinRT)
{
watcher.Path = "..";
Assert.Equal("..", watcher.Path);
}
string currentDir = Path.GetFullPath(".").TrimEnd('.', Path.DirectorySeparatorChar);
watcher.Path = currentDir;

View File

@@ -11,13 +11,11 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Windows_NT-Release|AnyCPU'" />
<ItemGroup>
<Compile Include="FileSystemWatcher.netstandard.cs" />
<Compile Include="FileSystemWatcher.cs" />
<Compile Include="InternalBufferOverflowException.cs" />
<Compile Include="$(CommonTestPath)\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs">
<Link>Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Args.ErrorEventArgs.cs" />
<Compile Include="Args.FileSystemEventArgs.cs" />
<Compile Include="Args.RenamedEventArgs.cs" />
@@ -39,6 +37,9 @@
<SubType>Component</SubType>
</Compile>
<Compile Include="Utility\FileSystemWatcherTest.cs" />
<Compile Include="$(CommonTestPath)\System\AssertExtensions.cs">
<Link>Common\System\AssertExtensions.cs</Link>
</Compile>
<Compile Include="$(CommonTestPath)\System\IO\FileCleanupTestBase.cs">
<Link>Common\System\IO\FileCleanupTestBase.cs</Link>
</Compile>
@@ -53,4 +54,4 @@
</Compile>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
</Project>