Imported Upstream version 5.10.0.47

Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-24 17:04:36 +00:00
parent 88ff76fe28
commit e46a49ecf1
5927 changed files with 226314 additions and 129848 deletions

View File

@ -270,7 +270,7 @@ namespace System.Collections.ObjectModel
}
/// <summary>
/// Disallow reentrant attempts to change this collection. E.g. a event handler
/// Disallow reentrant attempts to change this collection. E.g. an event handler
/// of the CollectionChanged event is not allowed to make changes to this collection.
/// </summary>
/// <remarks>

View File

@ -19,7 +19,6 @@ namespace System.Collections.ObjectModel.Tests
[Theory]
[MemberData(nameof(SerializeDeserialize_Roundtrips_MemberData))]
[SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Serialization still WIP in UapAot: https://github.com/dotnet/corefx/issues/18942")]
public void SerializeDeserialize_Roundtrips(TestCollection c)
{
TestCollection clone = BinaryFormatterHelpers.Clone(c);

View File

@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using Xunit;
namespace System.Collections.ObjectModel.Tests
@ -123,8 +124,20 @@ namespace System.Collections.ObjectModel.Tests
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework | TargetFrameworkMonikers.UapAot)]
public static void DebuggerAttributeTests()
{
DebuggerAttributes.ValidateDebuggerDisplayReferences(new ObservableCollection<int>());
DebuggerAttributes.ValidateDebuggerTypeProxyProperties(new ObservableCollection<int>());
ObservableCollection<int> col = new ObservableCollection<int>(new[] {1, 2, 3, 4});
DebuggerAttributes.ValidateDebuggerDisplayReferences(col);
DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(col);
PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute<DebuggerBrowsableAttribute>().State == DebuggerBrowsableState.RootHidden);
int[] items = itemProperty.GetValue(info.Instance) as int[];
Assert.Equal(col, items);
}
[Fact]
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework | TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")]
public static void DebuggerAttribute_NullCollection_ThrowsArgumentNullException()
{
TargetInvocationException ex = Assert.Throws<TargetInvocationException>(() => DebuggerAttributes.ValidateDebuggerTypeProxyProperties(typeof(ObservableCollection<int>), null));
ArgumentNullException argumentNullException = Assert.IsType<ArgumentNullException>(ex.InnerException);
}
private partial class ObservableCollectionSubclass<T> : ObservableCollection<T>

View File

@ -20,7 +20,6 @@ namespace System.Collections.ObjectModel.Tests
[Theory]
[MemberData(nameof(SerializeDeserialize_Roundtrips_MemberData))]
[SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Serialization still WIP in UapAot: https://github.com/dotnet/corefx/issues/18942")]
public void SerializeDeserialize_Roundtrips(ObservableCollection<int> c)
{
ObservableCollection<int> clone = BinaryFormatterHelpers.Clone(c);

View File

@ -214,11 +214,24 @@ namespace System.Collections.ObjectModel.Tests
[SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")]
public static void DebuggerAttributeTests()
{
DebuggerAttributes.ValidateDebuggerDisplayReferences(new ReadOnlyDictionary<int, int>(new Dictionary<int, int>()));
DebuggerAttributes.ValidateDebuggerTypeProxyProperties(new ReadOnlyDictionary<int, int>(new Dictionary<int, int>()));
ReadOnlyDictionary<int, int> dict = new ReadOnlyDictionary<int, int>(new Dictionary<int, int>{{1, 2}, {2, 4}, {3, 6}});
DebuggerAttributes.ValidateDebuggerDisplayReferences(dict);
DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(dict);
PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute<DebuggerBrowsableAttribute>().State == DebuggerBrowsableState.RootHidden);
KeyValuePair<int, int>[] pairs = itemProperty.GetValue(info.Instance) as KeyValuePair<int, int>[];
Assert.Equal(dict, pairs);
DebuggerAttributes.ValidateDebuggerDisplayReferences(new ReadOnlyDictionary<int, int>(new Dictionary<int, int>()).Keys);
DebuggerAttributes.ValidateDebuggerDisplayReferences(new ReadOnlyDictionary<int, int>(new Dictionary<int, int>()).Values);
DebuggerAttributes.ValidateDebuggerDisplayReferences(dict.Keys);
info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(typeof(ReadOnlyDictionary<int, int>.KeyCollection), new Type[] { typeof(int) }, dict.Keys);
itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute<DebuggerBrowsableAttribute>().State == DebuggerBrowsableState.RootHidden);
int[] items = itemProperty.GetValue(info.Instance) as int[];
Assert.Equal(dict.Keys, items);
DebuggerAttributes.ValidateDebuggerDisplayReferences(dict.Values);
info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(typeof(ReadOnlyDictionary<int, int>.KeyCollection), new Type[] { typeof(int) }, dict.Values);
itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute<DebuggerBrowsableAttribute>().State == DebuggerBrowsableState.RootHidden);
items = itemProperty.GetValue(info.Instance) as int[];
Assert.Equal(dict.Values, items);
}
[Fact]

View File

@ -19,7 +19,6 @@ namespace System.Collections.ObjectModel.Tests
[Theory]
[MemberData(nameof(SerializeDeserialize_Roundtrips_MemberData))]
[SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Serialization still WIP in UapAot: https://github.com/dotnet/corefx/issues/18942")]
public void SerializeDeserialize_Roundtrips(ReadOnlyDictionary<string, string> d)
{
ReadOnlyDictionary<string, string> clone = BinaryFormatterHelpers.Clone(d);

View File

@ -4,6 +4,8 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using Xunit;
namespace System.Collections.ObjectModel.Tests
@ -202,8 +204,20 @@ namespace System.Collections.ObjectModel.Tests
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework | TargetFrameworkMonikers.UapAot)]
public static void DebuggerAttribute_Tests()
{
DebuggerAttributes.ValidateDebuggerDisplayReferences(new ReadOnlyObservableCollection<int>(new ObservableCollection<int>()));
DebuggerAttributes.ValidateDebuggerTypeProxyProperties(new ReadOnlyObservableCollection<int>(new ObservableCollection<int>()));
ReadOnlyObservableCollection<int> col = new ReadOnlyObservableCollection<int>(new ObservableCollection<int>(new[] {1, 2, 3, 4}));
DebuggerAttributes.ValidateDebuggerDisplayReferences(col);
DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(col);
PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute<DebuggerBrowsableAttribute>().State == DebuggerBrowsableState.RootHidden);
int[] items = itemProperty.GetValue(info.Instance) as int[];
Assert.Equal(col, items);
}
[Fact]
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework | TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")]
public static void DebuggerAttribute_NullCollection_ThrowsArgumentNullException()
{
TargetInvocationException ex = Assert.Throws<TargetInvocationException>(() => DebuggerAttributes.ValidateDebuggerTypeProxyProperties(typeof(ReadOnlyObservableCollection<int>), null));
ArgumentNullException argumentNullException = Assert.IsType<ArgumentNullException>(ex.InnerException);
}
}

View File

@ -20,7 +20,6 @@ namespace System.Collections.ObjectModel.Tests
[Theory]
[MemberData(nameof(SerializeDeserialize_Roundtrips_MemberData))]
[SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Serialization still WIP in UapAot: https://github.com/dotnet/corefx/issues/18942")]
public void SerializeDeserialize_Roundtrips(ReadOnlyObservableCollection<int> c)
{
ReadOnlyObservableCollection<int> clone = BinaryFormatterHelpers.Clone(c);

View File

@ -27,9 +27,6 @@
<Compile Include="$(CommonTestPath)\System\Collections\IDictionaryTest.cs">
<Link>Common\System\CollectionsIDictionaryTest.cs</Link>
</Compile>
<Compile Include="$(CommonTestPath)\System\PlatformDetection.cs">
<Link>Common\System\PlatformDetection.cs</Link>
</Compile>
<Compile Include="ComponentModel\INotifyPropertyChangingTests.cs" />
<Compile Include="ComponentModel\PropertyChangingEventArgsTests.cs" />
<Compile Include="KeyedCollection\TestMethods.cs" />