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

@@ -1,9 +0,0 @@
Compat issues with assembly System.Threading.Timer:
CannotRemoveBaseTypeOrInterface : Type 'System.Threading.Timer' does not inherit from base type 'System.MarshalByRefObject' in the implementation but it does in the contract.
MembersMustExist : Member 'System.Threading.Timer..ctor(System.Threading.TimerCallback)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Threading.Timer..ctor(System.Threading.TimerCallback, System.Object, System.Int64, System.Int64)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Threading.Timer..ctor(System.Threading.TimerCallback, System.Object, System.UInt32, System.UInt32)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Threading.Timer.Change(System.Int64, System.Int64)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Threading.Timer.Change(System.UInt32, System.UInt32)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Threading.Timer.Dispose(System.Threading.WaitHandle)' does not exist in the implementation but it does exist in the contract.
Total Issues: 7

View File

@@ -6,7 +6,6 @@
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<ProjectGuid>{0F8B87B4-0E61-4DC6-9E90-CD4863025272}</ProjectGuid>
</PropertyGroup>
<!-- Help VS understand available configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Unix-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Unix-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Debug|AnyCPU'" />

View File

@@ -11,9 +11,6 @@
<Compile Include="TimerConstructorTests.cs" />
<Compile Include="TimerChangeTests.cs" />
<Compile Include="TimerFiringTests.cs" />
<Compile Include="TimerConstructorTests.netstandard.cs" />
<Compile Include="TimerChangeTests.netstandard.cs" />
<Compile Include="TimerFiringTests.netstandard.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
</Project>

View File

@@ -95,4 +95,22 @@ public partial class TimerChangeTests
Assert.True(are.WaitOne(TimeSpan.FromMilliseconds(TimerFiringTests.MaxPositiveTimeoutInMs)), "Should have received a timer event after this new duration");
}
}
[Fact]
public void Timer_Change_Int64_Negative()
{
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget).Change((long)-2, (long)-1));
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget).Change((long)-1, (long)-2));
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget).Change((long)0xffffffff, (long)-1));
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget).Change((long)-1, (long)0xffffffff));
}
[Fact]
public void Timer_Change_UInt32_Int64_AfterDispose_Throws()
{
var t = new Timer(EmptyTimerTarget);
t.Dispose();
Assert.Throws<ObjectDisposedException>(() => t.Change(0u, 0u));
Assert.Throws<ObjectDisposedException>(() => t.Change(0L, 0L));
}
}

View File

@@ -1,28 +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.
using System;
using System.Threading;
using Xunit;
public partial class TimerChangeTests
{
[Fact]
public void Timer_Change_Int64_Negative()
{
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget).Change((long)-2, (long)-1));
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget).Change((long)-1, (long)-2));
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget).Change((long)0xffffffff, (long)-1));
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget).Change((long)-1, (long)0xffffffff));
}
[Fact]
public void Timer_Change_UInt32_Int64_AfterDispose_Throws()
{
var t = new Timer(EmptyTimerTarget);
t.Dispose();
Assert.Throws<ObjectDisposedException>(() => t.Change(0u, 0u));
Assert.Throws<ObjectDisposedException>(() => t.Change(0L, 0L));
}
}

View File

@@ -72,4 +72,20 @@ public partial class TimerConstructorTests
using (var t = new Timer(null, null /* not relevant */, new TimeSpan(1) /* not relevant */, new TimeSpan(1) /* not relevant */)) { }
}));
}
[Fact]
public void Timer_Constructor_CallbackOnly_Negative()
{
Assert.Throws<ArgumentNullException>(() => new Timer(null));
}
[Fact]
public void Timer_Constructor_Int64_Negative()
{
Assert.Throws<ArgumentNullException>(() => new Timer(null, null, (long)-1, (long)-1));
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget, null, (long)-2, (long)-1));
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget, null, (long)-1, (long)-2));
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget, null, (long)0xffffffff, (long)-1));
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget, null, (long)-1, (long)0xffffffff));
}
}

View File

@@ -1,26 +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.
using System;
using System.Threading;
using Xunit;
public partial class TimerConstructorTests
{
[Fact]
public void Timer_Constructor_CallbackOnly_Negative()
{
Assert.Throws<ArgumentNullException>(() => new Timer(null));
}
[Fact]
public void Timer_Constructor_Int64_Negative()
{
Assert.Throws<ArgumentNullException>(() => new Timer(null, null, (long)-1, (long)-1));
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget, null, (long)-2, (long)-1));
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget, null, (long)-1, (long)-2));
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget, null, (long)0xffffffff, (long)-1));
Assert.Throws<ArgumentOutOfRangeException>(() => new Timer(EmptyTimerTarget, null, (long)-1, (long)0xffffffff));
}
}

View File

@@ -169,4 +169,44 @@ public partial class TimerFiringTests
t.Dispose();
}
}
[Fact]
public void Timer_Constructor_CallbackOnly_Change()
{
var e = new ManualResetEvent(false);
using (var t = new Timer(s => e.Set()))
{
t.Change(0u, 0u);
Assert.True(e.WaitOne(MaxPositiveTimeoutInMs));
}
}
[Fact]
public void Timer_Dispose_WaitHandle_Negative()
{
Assert.Throws<ArgumentNullException>(() => new Timer(s => { }).Dispose(null));
}
[Fact]
public void Timer_Dispose_WaitHandle()
{
int tickCount = 0;
var someTicksPending = new ManualResetEvent(false);
var completeTicks = new ManualResetEvent(false);
var allTicksCompleted = new ManualResetEvent(false);
var t =
new Timer(s =>
{
if (Interlocked.Increment(ref tickCount) == 2)
someTicksPending.Set();
Assert.True(completeTicks.WaitOne(MaxPositiveTimeoutInMs));
Interlocked.Decrement(ref tickCount);
}, null, 0, 1);
Assert.True(someTicksPending.WaitOne(MaxPositiveTimeoutInMs));
completeTicks.Set();
t.Dispose(allTicksCompleted);
Assert.True(allTicksCompleted.WaitOne(MaxPositiveTimeoutInMs));
Assert.Equal(0, tickCount);
Assert.Throws<ObjectDisposedException>(() => t.Change(0, 0));
}
}

View File

@@ -1,51 +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.
using System;
using System.Linq;
using System.Threading;
using Xunit;
public partial class TimerFiringTests
{
[Fact]
public void Timer_Constructor_CallbackOnly_Change()
{
var e = new ManualResetEvent(false);
using (var t = new Timer(s => e.Set()))
{
t.Change(0u, 0u);
Assert.True(e.WaitOne(MaxPositiveTimeoutInMs));
}
}
[Fact]
public void Timer_Dispose_WaitHandle_Negative()
{
Assert.Throws<ArgumentNullException>(() => new Timer(s => { }).Dispose(null));
}
[Fact]
public void Timer_Dispose_WaitHandle()
{
int tickCount = 0;
var someTicksPending = new ManualResetEvent(false);
var completeTicks = new ManualResetEvent(false);
var allTicksCompleted = new ManualResetEvent(false);
var t =
new Timer(s =>
{
if (Interlocked.Increment(ref tickCount) == 2)
someTicksPending.Set();
Assert.True(completeTicks.WaitOne(MaxPositiveTimeoutInMs));
Interlocked.Decrement(ref tickCount);
}, null, 0, 1);
Assert.True(someTicksPending.WaitOne(MaxPositiveTimeoutInMs));
completeTicks.Set();
t.Dispose(allTicksCompleted);
Assert.True(allTicksCompleted.WaitOne(MaxPositiveTimeoutInMs));
Assert.Equal(0, tickCount);
Assert.Throws<ObjectDisposedException>(() => t.Change(0, 0));
}
}