Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Perez Rodriguez <joperezr@microsoft.com>2016-09-01 21:30:16 +0300
committerJose Perez Rodriguez <joperezr@microsoft.com>2016-09-01 21:30:16 +0300
commitea0cc674b8116a10c18c2879390c39ec08df8020 (patch)
tree0e44817e176b10d52a3b86643acd2b5df9951cc3
parentb9a615433b4093ff3326adf6bcdf20333fcc025c (diff)
parent022a8c2088582c3175e7aee4ad4c97c3cea58a28 (diff)
Merge remote-tracking branch 'upstream/master' into dev/api
-rw-r--r--BuildToolsVersion.txt2
-rw-r--r--Documentation/project-docs/performance-tests.md2
-rw-r--r--Documentation/project-docs/project-nuget-dependencies.md33
-rw-r--r--Packaging.props7
-rw-r--r--README.md9
-rw-r--r--build.proj5
-rw-r--r--config.json15
-rw-r--r--dependencies.props4
-rw-r--r--dir.props4
-rw-r--r--dir.targets7
-rw-r--r--dir.traversal.targets26
-rw-r--r--init-tools.cmd6
-rwxr-xr-xinit-tools.sh7
-rw-r--r--netci.groovy10
-rw-r--r--pkg/Microsoft.NETCore.Platforms/runtime.json2
-rw-r--r--pkg/Microsoft.NETCore.Targets/Microsoft.NETCore.Targets.pkgproj1
-rw-r--r--pkg/Microsoft.Private.PackageBaseline/Microsoft.Private.PackageBaseline.pkgproj5
-rw-r--r--pkg/Microsoft.Private.PackageBaseline/Microsoft.Private.PackageBaseline.props6
-rw-r--r--pkg/Microsoft.Private.PackageBaseline/baseline.packages.props442
-rw-r--r--pkg/Microsoft.Private.PackageBaseline/native.library.packages.props44
-rw-r--r--pkg/Microsoft.Private.PackageBaseline/packageIndex.json2427
-rw-r--r--pkg/Microsoft.Private.PackageBaseline/stable.packages.props1321
-rw-r--r--pkg/baseline/baseline.props6
-rwxr-xr-xrun-test.sh49
-rw-r--r--run.cmd1
-rwxr-xr-xrun.sh1
-rwxr-xr-xscripts/arm32_ci_script.sh56
-rw-r--r--src/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.cs8
-rw-r--r--src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Digest.cs45
-rw-r--r--src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Err.cs1
-rw-r--r--src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs48
-rw-r--r--src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.PAL_HashAlgorithm.cs19
-rw-r--r--src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Symmetric.cs99
-rw-r--r--src/Common/src/Interop/Unix/Interop.Libraries.cs2
-rw-r--r--src/Common/src/Interop/Windows/Crypt32/Interop.FindOidInfo.cs2
-rw-r--r--src/Common/src/Interop/Windows/sspicli/Interop.LSAStructs.cs34
-rw-r--r--src/Common/src/Interop/Windows/sspicli/SecuritySafeHandles.cs2
-rw-r--r--src/Common/src/Interop/Windows/winhttp/Interop.winhttp.cs8
-rw-r--r--src/Common/src/Interop/Windows/winhttp/Interop.winhttp_types.cs5
-rw-r--r--src/Common/src/System/Dynamic/Utils/Error.cs8
-rw-r--r--src/Common/src/System/Dynamic/Utils/ExpressionUtils.cs14
-rw-r--r--src/Common/src/System/IO/PathInternal.Windows.cs31
-rw-r--r--src/Common/src/System/Net/HttpKnownHeaderNames.TryGetHeaderName.cs153
-rw-r--r--src/Common/src/System/Xml/XmlCharType.cs1
-rw-r--r--src/Common/test-runtime/project.json76
-rw-r--r--src/Common/tests/System/Collections/ICollection.NonGeneric.Tests.cs8
-rw-r--r--src/Common/tests/System/Collections/TestingTypes.cs79
-rw-r--r--src/Common/tests/System/Net/Configuration.Http.cs5
-rw-r--r--src/Common/tests/System/Net/Http/LoopbackServer.cs22
-rw-r--r--src/Common/tests/System/ObjectCloner.cs31
-rw-r--r--src/Common/tests/System/PlatformDetection.cs17
-rw-r--r--src/Common/tests/System/RuntimeDetection.cs19
-rw-r--r--src/Microsoft.CSharp/dir.props7
-rw-r--r--src/Microsoft.CSharp/pkg/Microsoft.CSharp.pkgproj3
-rw-r--r--src/Microsoft.CSharp/pkg/ValidationSuppression.txt2
-rw-r--r--src/Microsoft.CSharp/ref/Microsoft.CSharp.csproj1
-rw-r--r--src/Microsoft.CSharp/src/Microsoft.CSharp.csproj2
-rw-r--r--src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/PredefinedMembers.cs2
-rw-r--r--src/Microsoft.VisualBasic/dir.props8
-rw-r--r--src/Microsoft.VisualBasic/pkg/Microsoft.VisualBasic.pkgproj3
-rw-r--r--src/Microsoft.VisualBasic/pkg/ValidationSuppression.txt2
-rw-r--r--src/Microsoft.VisualBasic/ref/Microsoft.VisualBasic.csproj1
-rw-r--r--src/Microsoft.VisualBasic/src/Microsoft.VisualBasic.vbproj2
-rw-r--r--src/Microsoft.Win32.Primitives/dir.props7
-rw-r--r--src/Microsoft.Win32.Primitives/ref/Microsoft.Win32.Primitives.csproj2
-rw-r--r--src/Microsoft.Win32.Primitives/src/Microsoft.Win32.Primitives.csproj2
-rw-r--r--src/Microsoft.Win32.Registry.AccessControl/dir.props7
-rw-r--r--src/Microsoft.Win32.Registry.AccessControl/ref/Microsoft.Win32.Registry.AccessControl.csproj2
-rw-r--r--src/Microsoft.Win32.Registry.AccessControl/src/Microsoft.Win32.Registry.AccessControl.csproj2
-rw-r--r--src/Microsoft.Win32.Registry/dir.props7
-rw-r--r--src/Microsoft.Win32.Registry/ref/Microsoft.Win32.Registry.csproj2
-rw-r--r--src/Microsoft.Win32.Registry/src/Microsoft.Win32.Registry.csproj2
-rw-r--r--src/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.cs6
-rw-r--r--src/Microsoft.Win32.Registry/tests/Microsoft.Win32.Registry.Tests.csproj4
-rw-r--r--src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKeyCreateSubKeyTestsBase.cs37
-rw-r--r--src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKeyDeleteSubKeyTestsBase.cs36
-rw-r--r--src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKeyDeleteSubKeyTreeTestsBase.cs36
-rw-r--r--src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKeyOpenSubKeyTestsBase.cs32
-rw-r--r--src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_CreateSubKey_str.cs12
-rw-r--r--src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_CreateSubKey_str_rkpc.cs22
-rw-r--r--src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKeyTree.cs22
-rw-r--r--src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKeyTree_str.cs13
-rw-r--r--src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKey_Str_Bln.cs22
-rw-r--r--src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKey_str.cs12
-rw-r--r--src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_OpenSubKey_str.cs12
-rw-r--r--src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_OpenSubKey_str_b.cs22
-rw-r--r--src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_OpenSubKey_str_rkpc.cs25
-rw-r--r--src/Microsoft.Win32.Registry/tests/RegistryTestsBase.cs114
-rw-r--r--src/Native/Unix/Common/pal_config.h.in1
-rw-r--r--src/Native/Unix/System.Native/pal_interfaceaddresses.cpp15
-rw-r--r--src/Native/Unix/System.Native/pal_io.cpp34
-rw-r--r--src/Native/Unix/System.Net.Http.Native/pal_multi.cpp33
-rw-r--r--src/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt3
-rw-r--r--src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_digest.cpp150
-rw-r--r--src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_digest.h51
-rw-r--r--src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_hmac.cpp111
-rw-r--r--src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_hmac.h46
-rw-r--r--src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_secimportexport.cpp5
-rw-r--r--src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_secimportexport.h9
-rw-r--r--src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_symmetric.cpp134
-rw-r--r--src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_symmetric.h103
-rw-r--r--src/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt23
-rw-r--r--src/Native/Unix/System.Security.Cryptography.Native/pal_pkcs12.cpp10
-rw-r--r--src/Native/Unix/configure.cmake35
-rwxr-xr-xsrc/Native/build-native.sh25
-rw-r--r--src/Native/pkg/dir.props3
-rw-r--r--src/Native/pkg/runtime.native.System.Data.SqlClient.sni/runtime.native.System.Data.SqlClient.sni.pkgproj8
-rw-r--r--src/Native/pkg/runtime.native.System.Data.SqlClient.sni/win/runtime.native.System.Data.SqlClient.sni.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.IO.Compression/debian/runtime.native.System.IO.Compression.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.IO.Compression/fedora/23/runtime.native.System.IO.Compression.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.IO.Compression/fedora/24/runtime.native.System.IO.Compression.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.IO.Compression/opensuse/13.2/runtime.native.System.IO.Compression.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.IO.Compression/opensuse/42.1/runtime.native.System.IO.Compression.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.IO.Compression/osx/runtime.native.System.IO.Compression.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.IO.Compression/rhel/runtime.native.System.IO.Compression.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.IO.Compression/runtime.native.System.IO.Compression.builds12
-rw-r--r--src/Native/pkg/runtime.native.System.IO.Compression/runtime.native.System.IO.Compression.pkgproj12
-rw-r--r--src/Native/pkg/runtime.native.System.IO.Compression/ubuntu/14.04/runtime.native.System.IO.Compression.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.IO.Compression/ubuntu/16.04/runtime.native.System.IO.Compression.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.IO.Compression/ubuntu/16.10/runtime.native.System.IO.Compression.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.IO.Compression/win/runtime.native.System.IO.Compression.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.IO.Compression/win10/runtime.native.System.IO.Compression.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Http/debian/runtime.native.System.Net.Http.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Http/fedora/23/runtime.native.System.Net.Http.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Http/fedora/24/runtime.native.System.Net.Http.pkgproj (renamed from src/System.Diagnostics.Debug.SymbolReader/pkg/System.Diagnostics.Debug.SymbolReader.pkgproj)11
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Http/opensuse/13.2/runtime.native.System.Net.Http.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Http/opensuse/42.1/runtime.native.System.Net.Http.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Http/osx/runtime.native.System.Net.Http.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Http/rhel/runtime.native.System.Net.Http.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Http/runtime.native.System.Net.Http.builds12
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Http/runtime.native.System.Net.Http.pkgproj10
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Http/ubuntu/14.04/runtime.native.System.Net.Http.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Http/ubuntu/16.04/runtime.native.System.Net.Http.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Http/ubuntu/16.10/runtime.native.System.Net.Http.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Security/debian/runtime.native.System.Net.Security.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Security/fedora/23/runtime.native.System.Net.Security.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Security/fedora/24/runtime.native.System.Net.Security.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Security/opensuse/13.2/runtime.native.System.Net.Security.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Security/opensuse/42.1/runtime.native.System.Net.Security.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Security/osx/runtime.native.System.Net.Security.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Security/rhel/runtime.native.System.Net.Security.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Security/runtime.native.System.Net.Security.builds12
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Security/runtime.native.System.Net.Security.pkgproj10
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Security/ubuntu/14.04/runtime.native.System.Net.Security.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Security/ubuntu/16.04/runtime.native.System.Net.Security.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Net.Security/ubuntu/16.10/runtime.native.System.Net.Security.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography.Apple/osx/runtime.native.System.Security.Cryptography.Apple.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography.Apple/runtime.native.System.Security.Cryptography.Apple.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/debian/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/fedora/23/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/fedora/24/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/opensuse/13.2/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/opensuse/42.1/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/osx/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/rhel/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/runtime.native.System.Security.Cryptography.OpenSsl.builds48
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj45
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/ubuntu/14.04/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/ubuntu/16.04/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/ubuntu/16.10/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography/debian/runtime.native.System.Security.Cryptography.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography/fedora/23/runtime.native.System.Security.Cryptography.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography/fedora/24/runtime.native.System.Security.Cryptography.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography/opensuse/13.2/runtime.native.System.Security.Cryptography.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography/opensuse/42.1/runtime.native.System.Security.Cryptography.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography/osx/runtime.native.System.Security.Cryptography.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography/rhel/runtime.native.System.Security.Cryptography.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography/runtime.native.System.Security.Cryptography.builds12
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography/runtime.native.System.Security.Cryptography.pkgproj10
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography/ubuntu/14.04/runtime.native.System.Security.Cryptography.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography/ubuntu/16.04/runtime.native.System.Security.Cryptography.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System.Security.Cryptography/ubuntu/16.10/runtime.native.System.Security.Cryptography.pkgproj15
-rw-r--r--src/Native/pkg/runtime.native.System/debian/runtime.native.System.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System/fedora/23/runtime.native.System.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System/fedora/24/runtime.native.System.pkgproj18
-rw-r--r--src/Native/pkg/runtime.native.System/opensuse/13.2/runtime.native.System.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System/opensuse/42.1/runtime.native.System.pkgproj18
-rw-r--r--src/Native/pkg/runtime.native.System/osx/runtime.native.System.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System/rhel/runtime.native.System.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System/runtime.native.System.builds12
-rw-r--r--src/Native/pkg/runtime.native.System/runtime.native.System.pkgproj10
-rw-r--r--src/Native/pkg/runtime.native.System/ubuntu/14.04/runtime.native.System.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System/ubuntu/16.04/runtime.native.System.pkgproj1
-rw-r--r--src/Native/pkg/runtime.native.System/ubuntu/16.10/runtime.native.System.pkgproj18
-rw-r--r--src/System.AppContext/dir.props7
-rw-r--r--src/System.AppContext/ref/4.0.0/System.AppContext.depproj1
-rw-r--r--src/System.AppContext/ref/System.AppContext.csproj2
-rw-r--r--src/System.AppContext/src/System.AppContext.csproj2
-rw-r--r--src/System.Buffers/dir.props7
-rw-r--r--src/System.Buffers/src/System.Buffers.csproj2
-rw-r--r--src/System.Collections.Concurrent/dir.props7
-rw-r--r--src/System.Collections.Concurrent/pkg/System.Collections.Concurrent.pkgproj6
-rw-r--r--src/System.Collections.Concurrent/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Collections.Concurrent/ref/4.0.0/System.Collections.Concurrent.depproj1
-rw-r--r--src/System.Collections.Concurrent/ref/System.Collections.Concurrent.csproj1
-rw-r--r--src/System.Collections.Concurrent/src/System.Collections.Concurrent.csproj2
-rw-r--r--src/System.Collections.Concurrent/tests/ConcurrentDicionary/ConcurrentDictionaryTests.cs12
-rw-r--r--src/System.Collections.Immutable/dir.props8
-rw-r--r--src/System.Collections.Immutable/src/System.Collections.Immutable.csproj11
-rw-r--r--src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Builder.cs6
-rw-r--r--src/System.Collections.Immutable/tests/ImmutableArrayBuilderTest.cs10
-rw-r--r--src/System.Collections.NonGeneric/dir.props7
-rw-r--r--src/System.Collections.NonGeneric/ref/System.Collections.NonGeneric.csproj2
-rw-r--r--src/System.Collections.NonGeneric/src/System.Collections.NonGeneric.csproj2
-rw-r--r--src/System.Collections.NonGeneric/tests/ArrayListTests.cs4
-rw-r--r--src/System.Collections.NonGeneric/tests/DictionaryBaseTests.cs3
-rw-r--r--src/System.Collections.NonGeneric/tests/HashtableTests.cs8
-rw-r--r--src/System.Collections.NonGeneric/tests/QueueTests.cs2
-rw-r--r--src/System.Collections.NonGeneric/tests/SortedListTests.cs6
-rw-r--r--src/System.Collections.NonGeneric/tests/StackTests.cs2
-rw-r--r--src/System.Collections.Specialized/dir.props7
-rw-r--r--src/System.Collections.Specialized/ref/System.Collections.Specialized.csproj2
-rw-r--r--src/System.Collections.Specialized/src/System.Collections.Specialized.csproj2
-rw-r--r--src/System.Collections.Specialized/src/System/Collections/Specialized/ListDictionary.cs11
-rw-r--r--src/System.Collections.Specialized/tests/HybridDictionary/HybridDictionary.KeysTests.cs49
-rw-r--r--src/System.Collections.Specialized/tests/HybridDictionary/HybridDictionary.ValuesTests.cs49
-rw-r--r--src/System.Collections.Specialized/tests/HybridDictionary/HybridDictionaryTests.cs17
-rw-r--r--src/System.Collections.Specialized/tests/ListDictionary/ListDictionary.IDictionary.Tests.cs31
-rw-r--r--src/System.Collections.Specialized/tests/ListDictionary/ListDictionary.Keys.Tests.cs62
-rw-r--r--src/System.Collections.Specialized/tests/ListDictionary/ListDictionary.Values.Tests.cs62
-rw-r--r--src/System.Collections.Specialized/tests/NameObjectCollectionBase/NameObjectCollectionBase.CopyToTests.cs2
-rw-r--r--src/System.Collections.Specialized/tests/NameObjectCollectionBase/NameObjectCollectionBase.KeysTests.cs2
-rw-r--r--src/System.Collections.Specialized/tests/NameValueCollection/NameValueCollection.CopyToTests.cs2
-rw-r--r--src/System.Collections/dir.props7
-rw-r--r--src/System.Collections/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Collections/ref/4.0.0/System.Collections.depproj1
-rw-r--r--src/System.Collections/ref/System.Collections.csproj1
-rw-r--r--src/System.Collections/src/System.Collections.csproj2
-rw-r--r--src/System.Collections/src/System/Collections/Generic/Queue.cs54
-rw-r--r--src/System.Collections/src/System/Collections/Generic/SortedList.cs3
-rw-r--r--src/System.Collections/src/System/Collections/Generic/Stack.cs20
-rw-r--r--src/System.Collections/tests/Generic/Comparers/Comparer.Generic.Tests.cs137
-rw-r--r--src/System.Collections/tests/Generic/Comparers/Comparer.Tests.cs346
-rw-r--r--src/System.Collections/tests/Generic/Comparers/Comparers.Generic.cs64
-rw-r--r--src/System.Collections/tests/System.Collections.Tests.csproj9
-rw-r--r--src/System.ComponentModel.Annotations/dir.props7
-rw-r--r--src/System.ComponentModel.Annotations/ref/4.0.0/System.ComponentModel.Annotations.depproj1
-rw-r--r--src/System.ComponentModel.Annotations/ref/4.0.10/System.ComponentModel.Annotations.depproj1
-rw-r--r--src/System.ComponentModel.Annotations/ref/System.ComponentModel.Annotations.csproj2
-rw-r--r--src/System.ComponentModel.Annotations/src/System.ComponentModel.Annotations.csproj2
-rw-r--r--src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EmailAddressAttribute.cs2
-rw-r--r--src/System.ComponentModel.Annotations/tests/AssociationAttributeTests.cs65
-rw-r--r--src/System.ComponentModel.Annotations/tests/CompareAttributeTests.cs108
-rw-r--r--src/System.ComponentModel.Annotations/tests/CreditCardAttributeTests.cs85
-rw-r--r--src/System.ComponentModel.Annotations/tests/CustomValidationAttributeTests.cs344
-rw-r--r--src/System.ComponentModel.Annotations/tests/DataTypeAttributeTests.cs145
-rw-r--r--src/System.ComponentModel.Annotations/tests/EditableAttributeTests.cs4
-rw-r--r--src/System.ComponentModel.Annotations/tests/EmailAddressAttributeTests.cs119
-rw-r--r--src/System.ComponentModel.Annotations/tests/EnumDataTypeAttributeTests.cs226
-rw-r--r--src/System.ComponentModel.Annotations/tests/MaxLengthAttributeTests.cs116
-rw-r--r--src/System.ComponentModel.Annotations/tests/MinLengthAttributeTests.cs87
-rw-r--r--src/System.ComponentModel.EventBasedAsync/dir.props7
-rw-r--r--src/System.ComponentModel.EventBasedAsync/pkg/System.ComponentModel.EventBasedAsync.pkgproj3
-rw-r--r--src/System.ComponentModel.EventBasedAsync/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.ComponentModel.EventBasedAsync/ref/4.0.0/System.ComponentModel.EventBasedAsync.depproj1
-rw-r--r--src/System.ComponentModel.EventBasedAsync/ref/System.ComponentModel.EventBasedAsync.csproj1
-rw-r--r--src/System.ComponentModel.EventBasedAsync/src/System.ComponentModel.EventBasedAsync.csproj2
-rw-r--r--src/System.ComponentModel.EventBasedAsync/src/System/ComponentModel/AsyncOperation.cs1
-rw-r--r--src/System.ComponentModel.Primitives/dir.props7
-rw-r--r--src/System.ComponentModel.Primitives/ref/System.ComponentModel.Primitives.csproj2
-rw-r--r--src/System.ComponentModel.Primitives/src/System.ComponentModel.Primitives.csproj2
-rw-r--r--src/System.ComponentModel.Primitives/src/System/ComponentModel/EventHandlerList.cs2
-rw-r--r--src/System.ComponentModel.Primitives/tests/EventHandlerListTests.cs177
-rw-r--r--src/System.ComponentModel.Primitives/tests/System.ComponentModel.Primitives.Tests.csproj3
-rw-r--r--src/System.ComponentModel.TypeConverter/dir.props7
-rw-r--r--src/System.ComponentModel.TypeConverter/ref/4.0/System.ComponentModel.TypeConverter.depproj1
-rw-r--r--src/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.csproj2
-rw-r--r--src/System.ComponentModel.TypeConverter/src/System.ComponentModel.TypeConverter.csproj2
-rw-r--r--src/System.ComponentModel.TypeConverter/src/System/ComponentModel/AttributeProviderAttribute.cs6
-rw-r--r--src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MemberDescriptor.cs1
-rw-r--r--src/System.ComponentModel.TypeConverter/src/System/ComponentModel/NullableConverter.cs1
-rw-r--r--src/System.ComponentModel.TypeConverter/src/System/ComponentModel/PropertyDescriptor.cs1
-rw-r--r--src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs1
-rw-r--r--src/System.ComponentModel/dir.props7
-rw-r--r--src/System.ComponentModel/pkg/System.ComponentModel.pkgproj3
-rw-r--r--src/System.ComponentModel/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.ComponentModel/ref/System.ComponentModel.csproj1
-rw-r--r--src/System.ComponentModel/src/System.ComponentModel.csproj2
-rw-r--r--src/System.Composition.AttributedModel/dir.props8
-rw-r--r--src/System.Composition.AttributedModel/src/System.Composition.AttributedModel.csproj14
-rw-r--r--src/System.Composition.Convention/dir.props8
-rw-r--r--src/System.Composition.Convention/src/System.Composition.Convention.csproj14
-rw-r--r--src/System.Composition.Hosting/dir.props8
-rw-r--r--src/System.Composition.Hosting/src/System.Composition.Hosting.csproj14
-rw-r--r--src/System.Composition.Runtime/dir.props8
-rw-r--r--src/System.Composition.Runtime/src/System.Composition.Runtime.csproj14
-rw-r--r--src/System.Composition.TypedParts/dir.props8
-rw-r--r--src/System.Composition.TypedParts/src/System.Composition.TypedParts.csproj14
-rw-r--r--src/System.Composition/dir.props8
-rw-r--r--src/System.Composition/pkg/System.Composition.pkgproj4
-rw-r--r--src/System.Console/dir.props7
-rw-r--r--src/System.Console/ref/System.Console.csproj2
-rw-r--r--src/System.Console/src/System.Console.csproj2
-rw-r--r--src/System.Console/src/System/ConsolePal.Windows.cs2
-rw-r--r--src/System.Data.Common/dir.props7
-rw-r--r--src/System.Data.Common/pkg/System.Data.Common.pkgproj5
-rw-r--r--src/System.Data.Common/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Data.Common/ref/System.Data.Common.csproj10
-rw-r--r--src/System.Data.Common/src/System.Data.Common.csproj10
-rw-r--r--src/System.Data.SqlClient/System.Data.SqlClient.sln16
-rw-r--r--src/System.Data.SqlClient/dir.props7
-rw-r--r--src/System.Data.SqlClient/ref/4.0/System.Data.SqlClient.depproj1
-rw-r--r--src/System.Data.SqlClient/ref/System.Data.SqlClient.csproj2
-rw-r--r--src/System.Data.SqlClient/src/Interop/SNINativeMethodWrapper.Windows.cs14
-rw-r--r--src/System.Data.SqlClient/src/System.Data.SqlClient.csproj3
-rw-r--r--src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNINpHandle.cs4
-rw-r--r--src/System.Data.SqlClient/src/System/Data/SqlClient/SqlClientDiagnosticListenerExtensions.cs6
-rw-r--r--src/System.Data.SqlClient/tests/FunctionalTests/DiagnosticTest.cs6
-rw-r--r--src/System.Data.SqlClient/tests/FunctionalTests/FakeDiagnosticListenerObserver.cs6
-rw-r--r--src/System.Data.SqlClient/tests/ManualTests/DataCommon/CheckConnStrSetupFactAttribute.cs6
-rw-r--r--src/System.Data.SqlClient/tests/ManualTests/SQL/SplitPacketTest/SplitPacketTest.cs4
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/IMonitorLoader/IMonitorLoader.cs33
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/IMonitorLoader/IMonitorLoader.csproj24
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/IMonitorLoader/MonitorMetrics.cs96
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/IMonitorLoader/project.json9
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/AsyncUtils.cs201
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataSource.cs160
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressConnection.cs236
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressErrors.cs216
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressFactory.cs955
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressReader.cs350
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressSettings.cs305
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataTestGroup.cs698
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/Extensions.cs94
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/StressConfigReader.cs83
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/StressTest.config20
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/System.Data.StressFramework.csproj39
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/TrackedRandom.cs184
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/project.json40
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/Constants.cs53
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/DeadlockDetection.cs192
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/DeadlockDetectionTaskScheduler.cs94
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/FakeConsole.cs34
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/GlobalExceptionHandlerAttribute.cs16
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/GlobalTestCleanupAttribute.cs16
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/GlobalTestSetupAttribute.cs16
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/ITestAttributeFilter.cs11
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/Logger.cs227
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/MemApi.Unix.cs21
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/MemApi.Windows.cs22
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/MonitorLoadUtils.cs49
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/MultithreadedTest.cs170
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/PerfCounters.cs34
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/Program.cs277
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/RecordedExceptions.cs107
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/SqlScript.cs64
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/StressEngine.cs209
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/StressTest.cs155
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/System.Data.StressRunner.csproj58
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/Test.cs119
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestAttribute.cs272
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestBase.cs173
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestCleanupAttribute.cs16
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestFinder.cs167
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestMetrics.cs362
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestSetupAttribute.cs16
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestVariationAttribute.cs35
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/ThreadPoolTest.cs174
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/VersionUtil.cs42
-rw-r--r--src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/project.json47
-rw-r--r--src/System.Diagnostics.Contracts/dir.props7
-rw-r--r--src/System.Diagnostics.Contracts/pkg/System.Diagnostics.Contracts.pkgproj3
-rw-r--r--src/System.Diagnostics.Contracts/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Diagnostics.Contracts/ref/System.Diagnostics.Contracts.csproj1
-rw-r--r--src/System.Diagnostics.Contracts/src/System.Diagnostics.Contracts.csproj2
-rw-r--r--src/System.Diagnostics.Debug.SymbolReader/pkg/System.Diagnostics.Debug.SymbolReader.builds9
-rw-r--r--src/System.Diagnostics.Debug.SymbolReader/src/System.Diagnostics.Debug.SymbolReader.builds9
-rw-r--r--src/System.Diagnostics.Debug.SymbolReader/src/System.Diagnostics.Debug.SymbolReader.csproj21
-rw-r--r--src/System.Diagnostics.Debug.SymbolReader/src/System/Diagnostics/Debug/SymbolReader/SymbolReader.cs369
-rw-r--r--src/System.Diagnostics.Debug.SymbolReader/src/project.json10
-rw-r--r--src/System.Diagnostics.Debug/dir.props7
-rw-r--r--src/System.Diagnostics.Debug/pkg/System.Diagnostics.Debug.pkgproj3
-rw-r--r--src/System.Diagnostics.Debug/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Diagnostics.Debug/ref/4.0.0/System.Diagnostics.Debug.depproj1
-rw-r--r--src/System.Diagnostics.Debug/ref/System.Diagnostics.Debug.csproj1
-rw-r--r--src/System.Diagnostics.Debug/src/System.Diagnostics.Debug.csproj2
-rw-r--r--src/System.Diagnostics.Debug/tests/DebugTests.cs6
-rw-r--r--src/System.Diagnostics.DiagnosticSource/dir.props7
-rw-r--r--src/System.Diagnostics.DiagnosticSource/ref/System.Diagnostics.DiagnosticSource.csproj1
-rw-r--r--src/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj30
-rw-r--r--src/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceEventSourceBridgeTests.cs6
-rw-r--r--src/System.Diagnostics.FileVersionInfo/dir.props7
-rw-r--r--src/System.Diagnostics.FileVersionInfo/ref/System.Diagnostics.FileVersionInfo.csproj2
-rw-r--r--src/System.Diagnostics.FileVersionInfo/src/System.Diagnostics.FileVersionInfo.csproj2
-rw-r--r--src/System.Diagnostics.FileVersionInfo/src/System/Diagnostics/FileVersionInfo.Metadata.cs115
-rw-r--r--src/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.TestAssembly/Assembly1.cs4
-rw-r--r--src/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/FileVersionInfoTest.cs10
-rw-r--r--src/System.Diagnostics.PerformanceCounter/dir.props7
-rw-r--r--src/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj1
-rw-r--r--src/System.Diagnostics.Process/dir.props7
-rw-r--r--src/System.Diagnostics.Process/ref/4.0/System.Diagnostics.Process.depproj1
-rw-r--r--src/System.Diagnostics.Process/ref/System.Diagnostics.Process.csproj2
-rw-r--r--src/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj2
-rw-r--r--src/System.Diagnostics.Process/src/System/Diagnostics/Process.OSX.cs2
-rw-r--r--src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Linux.cs2
-rw-r--r--src/System.Diagnostics.Process/tests/ProcessModuleTests.cs4
-rw-r--r--src/System.Diagnostics.Process/tests/ProcessStreamReadTests.cs26
-rw-r--r--src/System.Diagnostics.Process/tests/ProcessTests.cs3
-rw-r--r--src/System.Diagnostics.Process/tests/ProcessThreadTests.cs55
-rw-r--r--src/System.Diagnostics.StackTrace/dir.props7
-rw-r--r--src/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.csproj2
-rw-r--r--src/System.Diagnostics.StackTrace/src/System.Diagnostics.StackTrace.csproj3
-rw-r--r--src/System.Diagnostics.StackTrace/src/System/Diagnostics/StackTraceSymbols.CoreCLR.cs4
-rw-r--r--src/System.Diagnostics.TextWriterTraceListener/dir.props7
-rw-r--r--src/System.Diagnostics.TextWriterTraceListener/ref/System.Diagnostics.TextWriterTraceListener.csproj2
-rw-r--r--src/System.Diagnostics.TextWriterTraceListener/src/System.Diagnostics.TextWriterTraceListener.csproj2
-rw-r--r--src/System.Diagnostics.Tools/dir.props7
-rw-r--r--src/System.Diagnostics.Tools/pkg/System.Diagnostics.Tools.pkgproj3
-rw-r--r--src/System.Diagnostics.Tools/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Diagnostics.Tools/ref/System.Diagnostics.Tools.csproj1
-rw-r--r--src/System.Diagnostics.Tools/src/System.Diagnostics.Tools.csproj2
-rw-r--r--src/System.Diagnostics.TraceSource/dir.props7
-rw-r--r--src/System.Diagnostics.TraceSource/ref/System.Diagnostics.TraceSource.csproj2
-rw-r--r--src/System.Diagnostics.TraceSource/src/System.Diagnostics.TraceSource.csproj2
-rw-r--r--src/System.Diagnostics.Tracing/dir.props7
-rw-r--r--src/System.Diagnostics.Tracing/pkg/aot/System.Diagnostics.Tracing.pkgproj1
-rw-r--r--src/System.Diagnostics.Tracing/ref/4.0.0/System.Diagnostics.Tracing.depproj1
-rw-r--r--src/System.Diagnostics.Tracing/ref/4.0.10/System.Diagnostics.Tracing.depproj1
-rw-r--r--src/System.Diagnostics.Tracing/ref/4.0.20/System.Diagnostics.Tracing.depproj1
-rw-r--r--src/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.csproj2
-rw-r--r--src/System.Diagnostics.Tracing/src/System.Diagnostics.Tracing.csproj2
-rw-r--r--src/System.Drawing.Primitives/dir.props7
-rw-r--r--src/System.Drawing.Primitives/ref/System.Drawing.Primitives.csproj2
-rw-r--r--src/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj2
-rw-r--r--src/System.Dynamic.Runtime/dir.props7
-rw-r--r--src/System.Dynamic.Runtime/pkg/System.Dynamic.Runtime.pkgproj3
-rw-r--r--src/System.Dynamic.Runtime/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Dynamic.Runtime/ref/4.0.0/System.Dynamic.Runtime.depproj1
-rw-r--r--src/System.Dynamic.Runtime/ref/System.Dynamic.Runtime.csproj1
-rw-r--r--src/System.Dynamic.Runtime/src/System.Dynamic.Runtime.csproj2
-rw-r--r--src/System.Dynamic.Runtime/src/System/Linq/Expressions/DynamicExpression.cs22
-rw-r--r--src/System.Globalization.Calendars/dir.props7
-rw-r--r--src/System.Globalization.Calendars/ref/System.Globalization.Calendars.csproj2
-rw-r--r--src/System.Globalization.Calendars/src/System.Globalization.Calendars.csproj2
-rw-r--r--src/System.Globalization.Extensions/dir.props7
-rw-r--r--src/System.Globalization.Extensions/ref/System.Globalization.Extensions.csproj2
-rw-r--r--src/System.Globalization.Extensions/src/System.Globalization.Extensions.csproj2
-rw-r--r--src/System.Globalization/dir.props7
-rw-r--r--src/System.Globalization/pkg/System.Globalization.pkgproj3
-rw-r--r--src/System.Globalization/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Globalization/ref/4.0.0/System.Globalization.depproj1
-rw-r--r--src/System.Globalization/ref/System.Globalization.csproj1
-rw-r--r--src/System.Globalization/src/System.Globalization.csproj2
-rw-r--r--src/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs20
-rw-r--r--src/System.Globalization/tests/RegionInfo/RegionInfoTests.Properties.cs9
-rw-r--r--src/System.IO.Compression.ZipFile/dir.props7
-rw-r--r--src/System.IO.Compression.ZipFile/ref/System.IO.Compression.ZipFile.csproj2
-rw-r--r--src/System.IO.Compression.ZipFile/src/System.IO.Compression.ZipFile.csproj2
-rw-r--r--src/System.IO.Compression/dir.props7
-rw-r--r--src/System.IO.Compression/ref/4.0.0/System.IO.Compression.depproj1
-rw-r--r--src/System.IO.Compression/ref/System.IO.Compression.csproj2
-rw-r--r--src/System.IO.Compression/src/Resources/Strings.resx3
-rw-r--r--src/System.IO.Compression/src/System.IO.Compression.csproj2
-rw-r--r--src/System.IO.Compression/src/System/IO/Compression/Inflater.cs10
-rw-r--r--src/System.IO.Compression/src/System/IO/Compression/ZipArchive.cs39
-rw-r--r--src/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs14
-rw-r--r--src/System.IO.FileSystem.AccessControl/dir.props7
-rw-r--r--src/System.IO.FileSystem.AccessControl/ref/System.IO.FileSystem.AccessControl.csproj2
-rw-r--r--src/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj2
-rw-r--r--src/System.IO.FileSystem.DriveInfo/dir.props7
-rw-r--r--src/System.IO.FileSystem.DriveInfo/ref/System.IO.FileSystem.DriveInfo.csproj2
-rw-r--r--src/System.IO.FileSystem.DriveInfo/src/System.IO.FileSystem.DriveInfo.csproj2
-rw-r--r--src/System.IO.FileSystem.Primitives/dir.props7
-rw-r--r--src/System.IO.FileSystem.Primitives/ref/System.IO.FileSystem.Primitives.csproj2
-rw-r--r--src/System.IO.FileSystem.Primitives/src/System.IO.FileSystem.Primitives.csproj2
-rw-r--r--src/System.IO.FileSystem.Watcher/dir.props7
-rw-r--r--src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.csproj2
-rw-r--r--src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj3
-rw-r--r--src/System.IO.FileSystem/dir.props7
-rw-r--r--src/System.IO.FileSystem/ref/System.IO.FileSystem.csproj2
-rw-r--r--src/System.IO.FileSystem/src/System.IO.FileSystem.csproj2
-rw-r--r--src/System.IO.IsolatedStorage/dir.props7
-rw-r--r--src/System.IO.IsolatedStorage/ref/System.IO.IsolatedStorage.csproj9
-rw-r--r--src/System.IO.IsolatedStorage/src/System.IO.IsolatedStorage.csproj2
-rw-r--r--src/System.IO.IsolatedStorage/src/project.json1
-rw-r--r--src/System.IO.MemoryMappedFiles/dir.props7
-rw-r--r--src/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.csproj2
-rw-r--r--src/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj2
-rw-r--r--src/System.IO.Packaging/dir.props7
-rw-r--r--src/System.IO.Packaging/ref/System.IO.Packaging.csproj2
-rw-r--r--src/System.IO.Packaging/src/System.IO.Packaging.csproj2
-rw-r--r--src/System.IO.Pipes.AccessControl/dir.props7
-rw-r--r--src/System.IO.Pipes.AccessControl/ref/System.IO.Pipes.AccessControl.csproj2
-rw-r--r--src/System.IO.Pipes.AccessControl/src/System.IO.Pipes.AccessControl.csproj2
-rw-r--r--src/System.IO.Pipes/dir.props7
-rw-r--r--src/System.IO.Pipes/ref/System.IO.Pipes.csproj2
-rw-r--r--src/System.IO.Pipes/src/System.IO.Pipes.csproj2
-rw-r--r--src/System.IO.Pipes/tests/NativeOverlapped.unix.cs3
-rw-r--r--src/System.IO.UnmanagedMemoryStream/dir.props7
-rw-r--r--src/System.IO.UnmanagedMemoryStream/ref/System.IO.UnmanagedMemoryStream.csproj2
-rw-r--r--src/System.IO.UnmanagedMemoryStream/src/System.IO.UnmanagedMemoryStream.csproj2
-rw-r--r--src/System.IO/dir.props7
-rw-r--r--src/System.IO/ref/4.0.0/System.IO.depproj1
-rw-r--r--src/System.IO/ref/4.0.10/System.IO.depproj1
-rw-r--r--src/System.IO/ref/System.IO.csproj9
-rw-r--r--src/System.IO/src/System.IO.csproj9
-rw-r--r--src/System.Linq.Expressions/dir.props7
-rw-r--r--src/System.Linq.Expressions/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Linq.Expressions/ref/4.0.0/System.Linq.Expressions.depproj1
-rw-r--r--src/System.Linq.Expressions/ref/4.0.10/System.Linq.Expressions.depproj1
-rw-r--r--src/System.Linq.Expressions/ref/System.Linq.Expressions.csproj2
-rw-r--r--src/System.Linq.Expressions/src/System.Linq.Expressions.csproj7
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs28
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/Common/ConstantCheck.cs (renamed from src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/ConstantCheck.cs)2
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/ILGen.cs17
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Address.cs22
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs11
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/StackSpiller.cs20
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/VariableBinder.cs5
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/ElementInit.cs4
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/Error.cs14
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/ExpressionStringBuilder.cs37
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/IndexExpression.cs14
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/ConstantCheck.cs104
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/LightCompiler.cs84
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/InvocationExpression.cs32
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/MemberExpression.cs5
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/MethodCallExpression.cs52
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/NewExpression.cs26
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/SwitchExpression.cs2
-rw-r--r--src/System.Linq.Expressions/src/System/Linq/Expressions/UnaryExpression.cs8
-rw-r--r--src/System.Linq.Expressions/tests/BinaryOperators/Coalesce/BinaryCoalesceTests.cs1026
-rw-r--r--src/System.Linq.Expressions/tests/BinaryOperators/Coalesce/BinaryNullableCoalesceTests.cs608
-rw-r--r--src/System.Linq.Expressions/tests/Call/CallTests.cs229
-rw-r--r--src/System.Linq.Expressions/tests/CompilerTests.cs130
-rw-r--r--src/System.Linq.Expressions/tests/DebugInfo/DebugInfoExpressionTests.cs61
-rw-r--r--src/System.Linq.Expressions/tests/DebugInfo/SymbolDocumentInfoTests.cs65
-rw-r--r--src/System.Linq.Expressions/tests/HelperTypes.cs20
-rw-r--r--src/System.Linq.Expressions/tests/IndexExpression/IndexExpressionHelpers.cs28
-rw-r--r--src/System.Linq.Expressions/tests/IndexExpression/IndexExpressionTests.cs55
-rw-r--r--src/System.Linq.Expressions/tests/IndexExpression/IndexExpressionVisitorTests.cs81
-rw-r--r--src/System.Linq.Expressions/tests/IndexExpression/SampleClassWithProperties.cs27
-rw-r--r--src/System.Linq.Expressions/tests/Invoke/InvocationTests.cs169
-rw-r--r--src/System.Linq.Expressions/tests/ListInit/ElementInitTests.cs8
-rw-r--r--src/System.Linq.Expressions/tests/Member/MemberAccessTests.cs209
-rw-r--r--src/System.Linq.Expressions/tests/New/NewTests.cs248
-rw-r--r--src/System.Linq.Expressions/tests/Switch/SwitchTests.cs10
-rw-r--r--src/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj16
-rw-r--r--src/System.Linq.Expressions/tests/Unary/IncDecAssign/PostDecrementAssignTests.cs2
-rw-r--r--src/System.Linq.Expressions/tests/Unary/IncDecAssign/PostIncrementAssignTests.cs2
-rw-r--r--src/System.Linq.Expressions/tests/Unary/IncDecAssign/PreDecrementAssignTests.cs2
-rw-r--r--src/System.Linq.Expressions/tests/Unary/IncDecAssign/PreIncrementAssignTests.cs2
-rw-r--r--src/System.Linq.Expressions/tests/Visitor/VisitorTests.cs9
-rw-r--r--src/System.Linq.Parallel/dir.props7
-rw-r--r--src/System.Linq.Parallel/pkg/System.Linq.Parallel.pkgproj3
-rw-r--r--src/System.Linq.Parallel/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Linq.Parallel/ref/System.Linq.Parallel.csproj1
-rw-r--r--src/System.Linq.Parallel/src/System.Linq.Parallel.csproj2
-rw-r--r--src/System.Linq.Queryable/dir.props7
-rw-r--r--src/System.Linq.Queryable/pkg/System.Linq.Queryable.pkgproj3
-rw-r--r--src/System.Linq.Queryable/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Linq.Queryable/ref/System.Linq.Queryable.csproj1
-rw-r--r--src/System.Linq.Queryable/src/System.Linq.Queryable.csproj2
-rw-r--r--src/System.Linq/dir.props7
-rw-r--r--src/System.Linq/ref/4.0.0/System.Linq.depproj1
-rw-r--r--src/System.Linq/ref/System.Linq.csproj2
-rw-r--r--src/System.Linq/src/System.Linq.csproj2
-rw-r--r--src/System.Linq/src/System/Linq/Union.cs1
-rw-r--r--src/System.Net.Http.Rtc/dir.props7
-rw-r--r--src/System.Net.Http.Rtc/ref/System.Net.Http.Rtc.csproj2
-rw-r--r--src/System.Net.Http.Rtc/src/System.Net.Http.Rtc.csproj2
-rw-r--r--src/System.Net.Http.WinHttpHandler/dir.props7
-rw-r--r--src/System.Net.Http.WinHttpHandler/ref/System.Net.Http.WinHttpHandler.csproj2
-rw-r--r--src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj10
-rw-r--r--src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.msbuild8
-rw-r--r--src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs40
-rw-r--r--src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpResponseParser.cs38
-rw-r--r--src/System.Net.Http.WinHttpHandler/tests/FunctionalTests/WinHttpHandlerTest.cs2
-rw-r--r--src/System.Net.Http.WinHttpHandler/tests/UnitTests/FakeInterop.cs9
-rw-r--r--src/System.Net.Http/dir.props7
-rw-r--r--src/System.Net.Http/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Net.Http/ref/4.0/System.Net.Http.depproj1
-rw-r--r--src/System.Net.Http/ref/System.Net.Http.csproj10
-rw-r--r--src/System.Net.Http/src/System.Net.Http.builds4
-rw-r--r--src/System.Net.Http/src/System.Net.Http.csproj48
-rw-r--r--src/System.Net.Http/src/System/Net/Http/HttpContent.cs3
-rw-r--r--src/System.Net.Http/src/project.json7
-rw-r--r--src/System.Net.Http/tests/FunctionalTests/CancellationTest.cs4
-rw-r--r--src/System.Net.Http/tests/FunctionalTests/FakeDiagnosticSourceListenerObserver.cs6
-rw-r--r--src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ClientCertificates.cs1
-rw-r--r--src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.MaxResponseHeadersLength.cs2
-rw-r--r--src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.cs1
-rw-r--r--src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs101
-rw-r--r--src/System.Net.Http/tests/FunctionalTests/HttpClientMiniStressTest.cs8
-rw-r--r--src/System.Net.Http/tests/FunctionalTests/prerequisites/BasicAuthModule.cs4
-rw-r--r--src/System.Net.NameResolution/dir.props7
-rw-r--r--src/System.Net.NameResolution/ref/System.Net.NameResolution.csproj2
-rw-r--r--src/System.Net.NameResolution/src/System.Net.NameResolution.csproj2
-rw-r--r--src/System.Net.NetworkInformation/dir.props7
-rw-r--r--src/System.Net.NetworkInformation/ref/4.0.0/System.Net.NetworkInformation.depproj1
-rw-r--r--src/System.Net.NetworkInformation/ref/System.Net.NetworkInformation.csproj2
-rw-r--r--src/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj3
-rw-r--r--src/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPAddressInformationCollection.cs1
-rw-r--r--src/System.Net.NetworkInformation/src/System/Net/NetworkInformation/LinuxNetworkInterface.cs42
-rw-r--r--src/System.Net.NetworkInformation/src/System/Net/NetworkInformation/OsxNetworkInterface.cs43
-rw-r--r--src/System.Net.Ping/dir.props7
-rw-r--r--src/System.Net.Ping/ref/System.Net.Ping.csproj2
-rw-r--r--src/System.Net.Ping/src/System.Net.Ping.csproj2
-rw-r--r--src/System.Net.Primitives/dir.props7
-rw-r--r--src/System.Net.Primitives/pkg/System.Net.Primitives.pkgproj3
-rw-r--r--src/System.Net.Primitives/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Net.Primitives/ref/3.9.0/System.Net.Primitives.depproj1
-rw-r--r--src/System.Net.Primitives/ref/4.0.0/System.Net.Primitives.depproj1
-rw-r--r--src/System.Net.Primitives/ref/System.Net.Primitives.csproj1
-rw-r--r--src/System.Net.Primitives/src/System.Net.Primitives.csproj3
-rw-r--r--src/System.Net.Primitives/tests/PerformanceTests/System.Net.Primitives.Performance.Tests.csproj2
-rw-r--r--src/System.Net.Requests/dir.props7
-rw-r--r--src/System.Net.Requests/pkg/System.Net.Requests.pkgproj3
-rw-r--r--src/System.Net.Requests/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Net.Requests/ref/3.9.0/System.Net.Requests.depproj1
-rw-r--r--src/System.Net.Requests/ref/4.0.0/System.Net.Requests.depproj1
-rw-r--r--src/System.Net.Requests/ref/System.Net.Requests.csproj1
-rw-r--r--src/System.Net.Requests/src/System.Net.Requests.csproj2
-rw-r--r--src/System.Net.Requests/tests/WebRequestTest.cs19
-rw-r--r--src/System.Net.Security/dir.props7
-rw-r--r--src/System.Net.Security/ref/System.Net.Security.csproj2
-rw-r--r--src/System.Net.Security/src/System.Net.Security.csproj5
-rw-r--r--src/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs1
-rw-r--r--src/System.Net.Security/tests/FunctionalTests/UnixGssFakeNegotiateStream.cs4
-rw-r--r--src/System.Net.Security/tests/FunctionalTests/UnixGssFakeStreamFramer.cs4
-rw-r--r--src/System.Net.Sockets/dir.props7
-rw-r--r--src/System.Net.Sockets/ref/System.Net.Sockets.csproj2
-rw-r--r--src/System.Net.Sockets/src/System.Net.Sockets.csproj3
-rw-r--r--src/System.Net.WebHeaderCollection/dir.props7
-rw-r--r--src/System.Net.WebHeaderCollection/pkg/System.Net.WebHeaderCollection.pkgproj3
-rw-r--r--src/System.Net.WebHeaderCollection/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Net.WebHeaderCollection/ref/System.Net.WebHeaderCollection.csproj1
-rw-r--r--src/System.Net.WebHeaderCollection/src/System.Net.WebHeaderCollection.csproj2
-rw-r--r--src/System.Net.WebSockets.Client/dir.props7
-rw-r--r--src/System.Net.WebSockets.Client/ref/System.Net.WebSockets.Client.csproj2
-rw-r--r--src/System.Net.WebSockets.Client/src/System.Net.WebSockets.Client.csproj2
-rw-r--r--src/System.Net.WebSockets/dir.props7
-rw-r--r--src/System.Net.WebSockets/ref/System.Net.WebSockets.csproj2
-rw-r--r--src/System.Net.WebSockets/src/System.Net.WebSockets.csproj2
-rw-r--r--src/System.Net.WebSockets/src/System/Net/WebSockets/WebSocketException.cs5
-rw-r--r--src/System.Net.WebSockets/tests/WebSocketExceptionTests.cs100
-rw-r--r--src/System.Numerics.Vectors.WindowsRuntime/dir.props7
-rw-r--r--src/System.Numerics.Vectors.WindowsRuntime/pkg/System.Numerics.Vectors.WindowsRuntime.pkgproj7
-rw-r--r--src/System.Numerics.Vectors.WindowsRuntime/pkg/ValidationSuppression.txt1
-rw-r--r--src/System.Numerics.Vectors.WindowsRuntime/src/System.Numerics.Vectors.WindowsRuntime.csproj4
-rw-r--r--src/System.Numerics.Vectors.WindowsRuntime/src/project.json2
-rw-r--r--src/System.Numerics.Vectors/dir.props7
-rw-r--r--src/System.Numerics.Vectors/ref/4.0.0/System.Numerics.Vectors.depproj1
-rw-r--r--src/System.Numerics.Vectors/ref/System.Numerics.Vectors.csproj2
-rw-r--r--src/System.Numerics.Vectors/src/System.Numerics.Vectors.csproj12
-rw-r--r--src/System.ObjectModel/dir.props7
-rw-r--r--src/System.ObjectModel/pkg/System.ObjectModel.pkgproj3
-rw-r--r--src/System.ObjectModel/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.ObjectModel/ref/4.0.0/System.ObjectModel.depproj1
-rw-r--r--src/System.ObjectModel/ref/System.ObjectModel.csproj1
-rw-r--r--src/System.ObjectModel/src/System.ObjectModel.csproj2
-rw-r--r--src/System.Private.DataContractSerialization/dir.props7
-rw-r--r--src/System.Private.DataContractSerialization/pkg/System.Private.DataContractSerialization.pkgproj2
-rw-r--r--src/System.Private.DataContractSerialization/src/System.Private.DataContractSerialization.csproj2
-rw-r--r--src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContract.cs43
-rw-r--r--src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlObjectSerializerWriteContext.cs24
-rw-r--r--src/System.Private.Uri/dir.props7
-rw-r--r--src/System.Private.Uri/pkg/System.Private.Uri.pkgproj2
-rw-r--r--src/System.Private.Uri/src/System.Private.Uri.csproj2
-rw-r--r--src/System.Private.Uri/src/System/DomainNameHelper.cs2
-rw-r--r--src/System.Private.Uri/src/System/UriBuilder.cs2
-rw-r--r--src/System.Private.Uri/tests/FunctionalTests/UriBuilderTests.cs3
-rw-r--r--src/System.Private.Xml/src/System/Xml/NameTable.cs8
-rw-r--r--src/System.Private.Xml/src/System/Xml/Serialization/XmlAnyAttributeAttribute.cs2
-rw-r--r--src/System.Private.Xml/src/System/Xml/Serialization/XmlAnyElementAttribute.cs7
-rw-r--r--src/System.Private.Xml/src/System/Xml/Serialization/XmlArrayAttribute.cs8
-rw-r--r--src/System.Private.Xml/src/System/Xml/Serialization/XmlArrayItemAttribute.cs12
-rw-r--r--src/System.Private.Xml/src/System/Xml/Serialization/XmlAttributeAttribute.cs10
-rw-r--r--src/System.Private.Xml/src/System/Xml/Serialization/XmlAttributeOverrides.cs5
-rw-r--r--src/System.Private.Xml/src/System/Xml/Serialization/XmlChoiceIdentifierAttribute.cs4
-rw-r--r--src/System.Private.Xml/src/System/Xml/Serialization/XmlElementAttribute.cs12
-rw-r--r--src/System.Private.Xml/src/System/Xml/Serialization/XmlEnumAttribute.cs4
-rw-r--r--src/System.Private.Xml/src/System/Xml/Serialization/XmlIgnoreAttribute.cs2
-rw-r--r--src/System.Private.Xml/src/System/Xml/Serialization/XmlIncludeAttribute.cs3
-rw-r--r--src/System.Private.Xml/src/System/Xml/Serialization/XmlMembersMapping.cs5
-rw-r--r--src/System.Private.Xml/src/System/Xml/Serialization/XmlNamespaceDeclarationsAttribute.cs2
-rw-r--r--src/System.Private.Xml/src/System/Xml/Serialization/XmlRootAttribute.cs7
-rw-r--r--src/System.Private.Xml/src/System/Xml/Serialization/XmlTextAttribute.cs5
-rw-r--r--src/System.Private.Xml/src/System/Xml/Serialization/XmlTypeAttribute.cs7
-rw-r--r--src/System.Private.Xml/src/System/Xml/Serialization/XmlTypeMapping.cs5
-rw-r--r--src/System.Private.Xml/src/System/Xml/XmlNameTable.cs5
-rw-r--r--src/System.Private.Xml/src/System/Xml/XmlNamespaceScope.cs4
-rw-r--r--src/System.Private.Xml/src/System/Xml/XmlNodeOrder.cs5
-rw-r--r--src/System.Private.Xml/src/System/Xml/XmlNodeType.cs19
-rw-r--r--src/System.Reflection.Context/dir.props7
-rw-r--r--src/System.Reflection.Context/pkg/System.Reflection.Context.pkgproj3
-rw-r--r--src/System.Reflection.Context/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Reflection.Context/ref/System.Reflection.Context.csproj1
-rw-r--r--src/System.Reflection.Context/src/System.Reflection.Context.csproj2
-rw-r--r--src/System.Reflection.DispatchProxy/dir.props7
-rw-r--r--src/System.Reflection.DispatchProxy/ref/System.Reflection.DispatchProxy.csproj2
-rw-r--r--src/System.Reflection.DispatchProxy/src/System.Reflection.DispatchProxy.csproj2
-rw-r--r--src/System.Reflection.Emit.ILGeneration/dir.props7
-rw-r--r--src/System.Reflection.Emit.ILGeneration/pkg/System.Reflection.Emit.ILGeneration.pkgproj9
-rw-r--r--src/System.Reflection.Emit.ILGeneration/pkg/ValidationSuppression.txt3
-rw-r--r--src/System.Reflection.Emit.ILGeneration/ref/System.Reflection.Emit.ILGeneration.csproj1
-rw-r--r--src/System.Reflection.Emit.ILGeneration/src/System.Reflection.Emit.ILGeneration.csproj2
-rw-r--r--src/System.Reflection.Emit.Lightweight/dir.props7
-rw-r--r--src/System.Reflection.Emit.Lightweight/pkg/System.Reflection.Emit.Lightweight.pkgproj9
-rw-r--r--src/System.Reflection.Emit.Lightweight/pkg/ValidationSuppression.txt3
-rw-r--r--src/System.Reflection.Emit.Lightweight/ref/System.Reflection.Emit.Lightweight.csproj1
-rw-r--r--src/System.Reflection.Emit.Lightweight/src/System.Reflection.Emit.Lightweight.csproj2
-rw-r--r--src/System.Reflection.Emit/dir.props7
-rw-r--r--src/System.Reflection.Emit/pkg/System.Reflection.Emit.pkgproj3
-rw-r--r--src/System.Reflection.Emit/pkg/ValidationSuppression.txt3
-rw-r--r--src/System.Reflection.Emit/ref/System.Reflection.Emit.csproj1
-rw-r--r--src/System.Reflection.Emit/src/System.Reflection.Emit.csproj2
-rw-r--r--src/System.Reflection.Emit/tests/AssemblyBuilderTests.cs192
-rw-r--r--src/System.Reflection.Emit/tests/ConstructorBuilder/ConstructorBuilderSetCustomAttribute.cs33
-rw-r--r--src/System.Reflection.Emit/tests/EnumBuilder/EnumBuilder.Methods.Tests.cs9
-rw-r--r--src/System.Reflection.Emit/tests/EnumBuilder/EnumBuilder.Properties.Tests.cs63
-rw-r--r--src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs56
-rw-r--r--src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineType.cs116
-rw-r--r--src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderGetArrayMethod.cs4
-rw-r--r--src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderSetCustomAttribute.cs11
-rw-r--r--src/System.Reflection.Emit/tests/System.Reflection.Emit.Tests.csproj3
-rw-r--r--src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderAssembly.cs21
-rw-r--r--src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDeclaringType.cs26
-rw-r--r--src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineConstructor.cs5
-rw-r--r--src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineNestedType.cs40
-rw-r--r--src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderFullName.cs29
-rw-r--r--src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderMakeGenericType.cs3
-rw-r--r--src/System.Reflection.Emit/tests/Utilities.cs56
-rw-r--r--src/System.Reflection.Extensions/dir.props7
-rw-r--r--src/System.Reflection.Extensions/pkg/System.Reflection.Extensions.pkgproj3
-rw-r--r--src/System.Reflection.Extensions/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Reflection.Extensions/pkg/aot/System.Reflection.Extensions.pkgproj1
-rw-r--r--src/System.Reflection.Extensions/ref/System.Reflection.Extensions.csproj1
-rw-r--r--src/System.Reflection.Extensions/src/System.Reflection.Extensions.csproj2
-rw-r--r--src/System.Reflection.Metadata/dir.props8
-rw-r--r--src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md4
-rw-r--r--src/System.Reflection.Metadata/src/Resources/Strings.resx7
-rw-r--r--src/System.Reflection.Metadata/src/System.Reflection.Metadata.csproj18
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/AbstractMemoryBlock.cs3
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/PathUtilities.cs82
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobBuilder.cs10
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobReader.cs10
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/MetadataReaderExtensions.cs14
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/BlobHeap.cs267
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/GuidHeap.cs30
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/Heaps.cs633
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/NamespaceCache.cs2
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/StringHeap.cs342
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/UserStringHeap.cs48
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/VirtualHeap.cs71
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReader.WinMD.cs64
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReader.cs93
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReaderProvider.cs48
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataStringComparer.cs10
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/PEReaderExtensions.cs5
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/ImportScope.cs2
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/MethodDebugInformation.cs2
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/PortablePdbVersions.cs3
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/Handles.TypeSystem.cs10
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/DebugDirectory/DebugDirectoryBuilder.cs35
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/DebugDirectory/DebugDirectoryEntry.cs7
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEMemoryBlock.cs2
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs340
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEStreamOptions.cs7
-rw-r--r--src/System.Reflection.Metadata/src/System/Reflection/Throw.cs12
-rw-r--r--src/System.Reflection.Metadata/tests/Metadata/HandleTests.cs32
-rw-r--r--src/System.Reflection.Metadata/tests/Metadata/MetadataReaderProviderTests.cs63
-rw-r--r--src/System.Reflection.Metadata/tests/Metadata/MetadataReaderTests.cs110
-rw-r--r--src/System.Reflection.Metadata/tests/Metadata/PortablePdb/DocumentNameTests.cs14
-rw-r--r--src/System.Reflection.Metadata/tests/PortableExecutable/DebugDirectoryBuilderTests.cs148
-rw-r--r--src/System.Reflection.Metadata/tests/PortableExecutable/DebugDirectoryTests.cs242
-rw-r--r--src/System.Reflection.Metadata/tests/PortableExecutable/PEReaderTests.cs521
-rw-r--r--src/System.Reflection.Metadata/tests/PortableExecutable/TestStream.cs24
-rw-r--r--src/System.Reflection.Metadata/tests/Resources/Misc/Debug.cs4
-rw-r--r--src/System.Reflection.Metadata/tests/Resources/Misc/Deterministic.cs4
-rw-r--r--src/System.Reflection.Metadata/tests/Resources/PortablePdbs/Documents.Embedded.dllbin0 -> 4096 bytes
-rw-r--r--src/System.Reflection.Metadata/tests/Resources/PortablePdbs/Documents.cmd1
-rw-r--r--src/System.Reflection.Metadata/tests/Resources/PortablePdbs/Documents.cs6
-rw-r--r--src/System.Reflection.Metadata/tests/Resources/TestResources.cs1
-rw-r--r--src/System.Reflection.Metadata/tests/System.Reflection.Metadata.Tests.csproj15
-rw-r--r--src/System.Reflection.Metadata/tests/TestUtilities/AssertEx.cs17
-rw-r--r--src/System.Reflection.Metadata/tests/TestUtilities/LoaderUtilities.cs31
-rw-r--r--src/System.Reflection.Metadata/tests/TestUtilities/TestBuilders.cs30
-rw-r--r--src/System.Reflection.Metadata/tests/TestUtilities/TestMetadataStringDecoder.cs26
-rw-r--r--src/System.Reflection.Metadata/tests/Utilities/MemoryBlockTests.cs25
-rw-r--r--src/System.Reflection.Primitives/dir.props7
-rw-r--r--src/System.Reflection.Primitives/pkg/System.Reflection.Primitives.pkgproj3
-rw-r--r--src/System.Reflection.Primitives/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Reflection.Primitives/pkg/aot/System.Reflection.Primitives.pkgproj1
-rw-r--r--src/System.Reflection.Primitives/src/System.Reflection.Primitives.csproj11
-rw-r--r--src/System.Reflection.Primitives/src/project.json2
-rw-r--r--src/System.Reflection.TypeExtensions/dir.props7
-rw-r--r--src/System.Reflection.TypeExtensions/ref/4.0.0/System.Reflection.TypeExtensions.depproj1
-rw-r--r--src/System.Reflection.TypeExtensions/ref/System.Reflection.TypeExtensions.csproj2
-rw-r--r--src/System.Reflection.TypeExtensions/src/System.Reflection.TypeExtensions.csproj2
-rw-r--r--src/System.Reflection.TypeExtensions/tests/AssemblyExtensionTests.cs (renamed from src/System.Reflection.TypeExtensions/tests/Assembly/AssemblyExtensionTests.cs)10
-rw-r--r--src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoConstructorName.cs18
-rw-r--r--src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoInvoke1.cs166
-rw-r--r--src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoInvoke2.cs172
-rw-r--r--src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoInvokeArrayTests.cs269
-rw-r--r--src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoMemberType.cs31
-rw-r--r--src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoTests.cs87
-rw-r--r--src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoTypeConstructorName.cs17
-rw-r--r--src/System.Reflection.TypeExtensions/tests/ConstructorInfo/InvokeArrayCtors.cs299
-rw-r--r--src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoAddEventHandler.cs131
-rw-r--r--src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoAttributesProperty.cs80
-rw-r--r--src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoEventHandlerType.cs81
-rw-r--r--src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetAddMethod1.cs97
-rw-r--r--src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetAddMethod2.cs130
-rw-r--r--src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetRaiseMethod1.cs73
-rw-r--r--src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetRaiseMethod2.cs106
-rw-r--r--src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetRemoveMethod1.cs122
-rw-r--r--src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetRemoveMethod2.cs111
-rw-r--r--src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoIsSpecialName.cs77
-rw-r--r--src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoMemberType.cs77
-rw-r--r--src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoRemoveEventHandler.cs138
-rw-r--r--src/System.Reflection.TypeExtensions/tests/EventInfoTests.cs200
-rw-r--r--src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoAttributes.cs101
-rw-r--r--src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoFieldType.cs128
-rw-r--r--src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoGetValue1.cs159
-rw-r--r--src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsAssembly.cs101
-rw-r--r--src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsFamily.cs101
-rw-r--r--src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsFamilyAndAssembly.cs119
-rw-r--r--src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsFamilyOrAssembly.cs121
-rw-r--r--src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsInitOnly.cs131
-rw-r--r--src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsLiteral.cs72
-rw-r--r--src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsPrivate.cs101
-rw-r--r--src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsPublic.cs101
-rw-r--r--src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsSpecialName.il629
-rw-r--r--src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsStatic.cs101
-rw-r--r--src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoMemberType.cs101
-rw-r--r--src/System.Reflection.TypeExtensions/tests/FieldInfoTests.cs115
-rw-r--r--src/System.Reflection.TypeExtensions/tests/Helpers.cs14
-rw-r--r--src/System.Reflection.TypeExtensions/tests/System.Reflection.TypeExtensions.Tests.csproj40
-rw-r--r--src/System.Reflection/dir.props7
-rw-r--r--src/System.Reflection/pkg/aot/System.Reflection.pkgproj1
-rw-r--r--src/System.Reflection/ref/4.0.0/System.Reflection.depproj1
-rw-r--r--src/System.Reflection/ref/4.0.10/System.Reflection.depproj1
-rw-r--r--src/System.Reflection/ref/System.Reflection.csproj2
-rw-r--r--src/System.Reflection/src/System.Reflection.csproj2
-rw-r--r--src/System.Reflection/tests/Assembly/Assembly_CustomAttributeTests.cs198
-rw-r--r--src/System.Reflection/tests/Assembly/Assembly_DefinedTypeTests.cs440
-rw-r--r--src/System.Reflection/tests/Assembly/Assembly_EmbeddedFiles.cs31
-rw-r--r--src/System.Reflection/tests/Assembly/Assembly_EntryPointTests.cs23
-rw-r--r--src/System.Reflection/tests/Assembly/Assembly_EqualsTests.cs44
-rw-r--r--src/System.Reflection/tests/Assembly/Assembly_ExportedTypesTests.cs183
-rw-r--r--src/System.Reflection/tests/Assembly/Assembly_GetEntryAssembly.cs21
-rw-r--r--src/System.Reflection/tests/Assembly/Assembly_GetHashcodeTests.cs86
-rw-r--r--src/System.Reflection/tests/Assembly/Assembly_GetTypeTests.cs156
-rw-r--r--src/System.Reflection/tests/Assembly/Assembly_IsDynamicTests.cs57
-rw-r--r--src/System.Reflection/tests/Assembly/Assembly_LoadTests.cs54
-rw-r--r--src/System.Reflection/tests/Assembly/Assembly_LocationTests.cs19
-rw-r--r--src/System.Reflection/tests/Assembly/Assembly_Members.cs160
-rw-r--r--src/System.Reflection/tests/Assembly/Assembly_ModulesTests.cs64
-rw-r--r--src/System.Reflection/tests/Assembly/Assembly_ToStringTests.cs50
-rw-r--r--src/System.Reflection/tests/AssemblyTests.cs343
-rw-r--r--src/System.Reflection/tests/Common.cs109
-rw-r--r--src/System.Reflection/tests/Common/ReflectionTestData.cs328
-rw-r--r--src/System.Reflection/tests/ExceptionTests.cs4
-rw-r--r--src/System.Reflection/tests/FieldInfo/FieldInfo_CustomAttributeTests.cs25
-rw-r--r--src/System.Reflection/tests/MemberInfoTests.cs4
-rw-r--r--src/System.Reflection/tests/MethodInfo/MethodInfo_CustomAttributeTests.cs28
-rw-r--r--src/System.Reflection/tests/Module/ModuleTests.cs13
-rw-r--r--src/System.Reflection/tests/Resources/EmbeddedImage.png (renamed from src/System.Reflection/tests/Assembly/EmbeddedImage.png)bin10163 -> 10163 bytes
-rw-r--r--src/System.Reflection/tests/Resources/ResourceTextFile.txt (renamed from src/System.Reflection/tests/ManifestResourceInfo/ResourceTextFile.txt)0
-rw-r--r--src/System.Reflection/tests/System.Reflection.Tests.csproj23
-rw-r--r--src/System.Resources.Reader/dir.props7
-rw-r--r--src/System.Resources.Reader/ref/System.Resources.Reader.csproj2
-rw-r--r--src/System.Resources.Reader/src/System.Resources.Reader.csproj2
-rw-r--r--src/System.Resources.ResourceManager/dir.props7
-rw-r--r--src/System.Resources.ResourceManager/pkg/System.Resources.ResourceManager.pkgproj3
-rw-r--r--src/System.Resources.ResourceManager/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Resources.ResourceManager/pkg/aot/System.Resources.ResourceManager.pkgproj1
-rw-r--r--src/System.Resources.ResourceManager/ref/System.Resources.ResourceManager.csproj1
-rw-r--r--src/System.Resources.ResourceManager/src/System.Resources.ResourceManager.csproj2
-rw-r--r--src/System.Resources.Writer/dir.props7
-rw-r--r--src/System.Resources.Writer/ref/System.Resources.Writer.csproj2
-rw-r--r--src/System.Resources.Writer/src/System.Resources.Writer.csproj2
-rw-r--r--src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.il2
-rw-r--r--src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.ilproj2
-rw-r--r--src/System.Runtime.CompilerServices.VisualC/dir.props7
-rw-r--r--src/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.csproj2
-rw-r--r--src/System.Runtime.CompilerServices.VisualC/src/System.Runtime.CompilerServices.VisualC.csproj2
-rw-r--r--src/System.Runtime.Extensions/dir.props7
-rw-r--r--src/System.Runtime.Extensions/ref/4.0.0/System.Runtime.Extensions.depproj1
-rw-r--r--src/System.Runtime.Extensions/ref/4.0.10/System.Runtime.Extensions.depproj1
-rw-r--r--src/System.Runtime.Extensions/ref/System.Runtime.Extensions.csproj2
-rw-r--r--src/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj3
-rw-r--r--src/System.Runtime.Extensions/src/netstandard15aot/project.json12
-rw-r--r--src/System.Runtime.Extensions/src/project.json2
-rw-r--r--src/System.Runtime.Handles/dir.props7
-rw-r--r--src/System.Runtime.Handles/pkg/System.Runtime.Handles.pkgproj3
-rw-r--r--src/System.Runtime.Handles/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Runtime.Handles/ref/System.Runtime.Handles.csproj1
-rw-r--r--src/System.Runtime.Handles/src/System.Runtime.Handles.csproj2
-rw-r--r--src/System.Runtime.InteropServices.RuntimeInformation/dir.props7
-rw-r--r--src/System.Runtime.InteropServices.RuntimeInformation/ref/System.Runtime.InteropServices.RuntimeInformation.csproj2
-rw-r--r--src/System.Runtime.InteropServices.RuntimeInformation/src/System.Runtime.InteropServices.RuntimeInformation.csproj2
-rw-r--r--src/System.Runtime.InteropServices.WindowsRuntime/dir.props7
-rw-r--r--src/System.Runtime.InteropServices.WindowsRuntime/pkg/System.Runtime.InteropServices.WindowsRuntime.pkgproj3
-rw-r--r--src/System.Runtime.InteropServices.WindowsRuntime/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Runtime.InteropServices.WindowsRuntime/ref/System.Runtime.InteropServices.WindowsRuntime.csproj1
-rw-r--r--src/System.Runtime.InteropServices.WindowsRuntime/src/System.Runtime.InteropServices.WindowsRuntime.csproj2
-rw-r--r--src/System.Runtime.InteropServices/dir.props7
-rw-r--r--src/System.Runtime.InteropServices/pkg/aot/System.Runtime.InteropServices.pkgproj1
-rw-r--r--src/System.Runtime.InteropServices/ref/4.0.0/System.Runtime.InteropServices.depproj1
-rw-r--r--src/System.Runtime.InteropServices/ref/4.0.10/System.Runtime.InteropServices.depproj1
-rw-r--r--src/System.Runtime.InteropServices/ref/4.0.20/System.Runtime.InteropServices.depproj1
-rw-r--r--src/System.Runtime.InteropServices/ref/4.1/System.Runtime.InteropServices.depproj1
-rw-r--r--src/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.csproj2
-rw-r--r--src/System.Runtime.InteropServices/src/System.Runtime.InteropServices.csproj2
-rw-r--r--src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.cs10
-rw-r--r--src/System.Runtime.Loader/dir.props7
-rw-r--r--src/System.Runtime.Loader/ref/System.Runtime.Loader.csproj2
-rw-r--r--src/System.Runtime.Loader/src/System.Runtime.Loader.csproj2
-rw-r--r--src/System.Runtime.Numerics/dir.props7
-rw-r--r--src/System.Runtime.Numerics/pkg/System.Runtime.Numerics.pkgproj3
-rw-r--r--src/System.Runtime.Numerics/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Runtime.Numerics/ref/System.Runtime.Numerics.csproj1
-rw-r--r--src/System.Runtime.Numerics/src/System.Runtime.Numerics.csproj2
-rw-r--r--src/System.Runtime.Serialization.Formatters/dir.props7
-rw-r--r--src/System.Runtime.Serialization.Formatters/ref/System.Runtime.Serialization.Formatters.csproj2
-rw-r--r--src/System.Runtime.Serialization.Formatters/src/System.Runtime.Serialization.Formatters.csproj3
-rw-r--r--src/System.Runtime.Serialization.Json/dir.props7
-rw-r--r--src/System.Runtime.Serialization.Json/pkg/System.Runtime.Serialization.Json.pkgproj3
-rw-r--r--src/System.Runtime.Serialization.Json/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Runtime.Serialization.Json/ref/System.Runtime.Serialization.Json.csproj1
-rw-r--r--src/System.Runtime.Serialization.Json/src/System.Runtime.Serialization.Json.csproj2
-rw-r--r--src/System.Runtime.Serialization.Primitives/dir.props7
-rw-r--r--src/System.Runtime.Serialization.Primitives/ref/4.0.0/System.Runtime.Serialization.Primitives.depproj1
-rw-r--r--src/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.csproj2
-rw-r--r--src/System.Runtime.Serialization.Primitives/src/System.Runtime.Serialization.Primitives.csproj2
-rw-r--r--src/System.Runtime.Serialization.Xml/dir.props7
-rw-r--r--src/System.Runtime.Serialization.Xml/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Runtime.Serialization.Xml/ref/4.0.0/System.Runtime.Serialization.Xml.depproj1
-rw-r--r--src/System.Runtime.Serialization.Xml/ref/System.Runtime.Serialization.Xml.csproj2
-rw-r--r--src/System.Runtime.Serialization.Xml/src/System.Runtime.Serialization.Xml.csproj2
-rw-r--r--src/System.Runtime.WindowsRuntime.UI.Xaml/dir.props7
-rw-r--r--src/System.Runtime.WindowsRuntime.UI.Xaml/pkg/System.Runtime.WindowsRuntime.UI.Xaml.pkgproj7
-rw-r--r--src/System.Runtime.WindowsRuntime.UI.Xaml/pkg/ValidationSuppression.txt1
-rw-r--r--src/System.Runtime.WindowsRuntime.UI.Xaml/ref/System.Runtime.WindowsRuntime.UI.Xaml.csproj2
-rw-r--r--src/System.Runtime.WindowsRuntime.UI.Xaml/src/System.Runtime.WindowsRuntime.UI.Xaml.csproj2
-rw-r--r--src/System.Runtime.WindowsRuntime/dir.props7
-rw-r--r--src/System.Runtime.WindowsRuntime/pkg/System.Runtime.WindowsRuntime.pkgproj7
-rw-r--r--src/System.Runtime.WindowsRuntime/pkg/ValidationSuppression.txt1
-rw-r--r--src/System.Runtime.WindowsRuntime/ref/4.0.0/System.Runtime.WindowsRuntime.depproj1
-rw-r--r--src/System.Runtime.WindowsRuntime/ref/System.Runtime.WindowsRuntime.csproj2
-rw-r--r--src/System.Runtime.WindowsRuntime/src/System.Runtime.WindowsRuntime.csproj2
-rw-r--r--src/System.Runtime/dir.props7
-rw-r--r--src/System.Runtime/pkg/aot/System.Runtime.pkgproj1
-rw-r--r--src/System.Runtime/ref/4.0.0/System.Runtime.depproj1
-rw-r--r--src/System.Runtime/ref/4.0.10/System.Runtime.depproj1
-rw-r--r--src/System.Runtime/ref/4.0.20/System.Runtime.depproj1
-rw-r--r--src/System.Runtime/ref/System.Runtime.csproj2
-rw-r--r--src/System.Runtime/src/System.Runtime.csproj2
-rw-r--r--src/System.Runtime/tests/System/EnumTests.cs769
-rw-r--r--src/System.Runtime/tests/System/GCTests.cs2
-rw-r--r--src/System.Runtime/tests/System/IntPtrTests.cs2
-rw-r--r--src/System.Runtime/tests/System/StringTests.cs135
-rw-r--r--src/System.Security.AccessControl/dir.props7
-rw-r--r--src/System.Security.AccessControl/ref/System.Security.AccessControl.csproj2
-rw-r--r--src/System.Security.AccessControl/src/System.Security.AccessControl.csproj2
-rw-r--r--src/System.Security.AccessControl/tests/System.Security.AccessControl.Tests.csproj1
-rw-r--r--src/System.Security.Claims/dir.props7
-rw-r--r--src/System.Security.Claims/ref/System.Security.Claims.csproj2
-rw-r--r--src/System.Security.Claims/src/System.Security.Claims.csproj2
-rw-r--r--src/System.Security.Cryptography.Algorithms/System.Security.Cryptography.Algorithms.sln10
-rw-r--r--src/System.Security.Cryptography.Algorithms/dir.props7
-rw-r--r--src/System.Security.Cryptography.Algorithms/ref/4.0/System.Security.Cryptography.Algorithms.depproj1
-rw-r--r--src/System.Security.Cryptography.Algorithms/ref/4.1/System.Security.Cryptography.Algorithms.depproj1
-rw-r--r--src/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.csproj2
-rw-r--r--src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.OSX.cs34
-rw-r--r--src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AppleCCCryptor.cs225
-rw-r--r--src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.OSX.cs247
-rw-r--r--src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.OSX.cs34
-rw-r--r--src/System.Security.Cryptography.Algorithms/src/Resources/Strings.resx3
-rw-r--r--src/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj66
-rw-r--r--src/System.Security.Cryptography.Algorithms/tests/HashAlgorithmTest.cs95
-rw-r--r--src/System.Security.Cryptography.Algorithms/tests/HmacTests.cs96
-rw-r--r--src/System.Security.Cryptography.Algorithms/tests/Sha1Tests.cs6
-rw-r--r--src/System.Security.Cryptography.Algorithms/tests/Sha256Tests.cs8
-rw-r--r--src/System.Security.Cryptography.Algorithms/tests/Sha384Tests.cs8
-rw-r--r--src/System.Security.Cryptography.Algorithms/tests/Sha512Tests.cs8
-rw-r--r--src/System.Security.Cryptography.Cng/dir.props7
-rw-r--r--src/System.Security.Cryptography.Cng/ref/4.0/System.Security.Cryptography.Cng.depproj1
-rw-r--r--src/System.Security.Cryptography.Cng/ref/4.1/System.Security.Cryptography.Cng.depproj1
-rw-r--r--src/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.csproj2
-rw-r--r--src/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj2
-rw-r--r--src/System.Security.Cryptography.Csp/dir.props7
-rw-r--r--src/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.csproj2
-rw-r--r--src/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj2
-rw-r--r--src/System.Security.Cryptography.Encoding/dir.props7
-rw-r--r--src/System.Security.Cryptography.Encoding/ref/System.Security.Cryptography.Encoding.csproj2
-rw-r--r--src/System.Security.Cryptography.Encoding/src/System.Security.Cryptography.Encoding.csproj2
-rw-r--r--src/System.Security.Cryptography.OpenSsl/dir.props7
-rw-r--r--src/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.csproj2
-rw-r--r--src/System.Security.Cryptography.OpenSsl/src/System.Security.Cryptography.OpenSsl.csproj2
-rw-r--r--src/System.Security.Cryptography.Pkcs/dir.props7
-rw-r--r--src/System.Security.Cryptography.Pkcs/ref/System.Security.Cryptography.Pkcs.csproj2
-rw-r--r--src/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj2
-rw-r--r--src/System.Security.Cryptography.Primitives/dir.props7
-rw-r--r--src/System.Security.Cryptography.Primitives/ref/System.Security.Cryptography.Primitives.csproj2
-rw-r--r--src/System.Security.Cryptography.Primitives/src/System.Security.Cryptography.Primitives.csproj2
-rw-r--r--src/System.Security.Cryptography.ProtectedData/dir.props7
-rw-r--r--src/System.Security.Cryptography.ProtectedData/ref/System.Security.Cryptography.ProtectedData.csproj2
-rw-r--r--src/System.Security.Cryptography.ProtectedData/src/System.Security.Cryptography.ProtectedData.csproj2
-rw-r--r--src/System.Security.Cryptography.X509Certificates/dir.props7
-rw-r--r--src/System.Security.Cryptography.X509Certificates/ref/4.0/System.Security.Cryptography.X509Certificates.csproj1
-rw-r--r--src/System.Security.Cryptography.X509Certificates/ref/System.Security.Cryptography.X509Certificates.csproj2
-rw-r--r--src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/DirectoryBasedStoreProvider.cs38
-rw-r--r--src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs68
-rw-r--r--src/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj4
-rw-r--r--src/System.Security.Cryptography.X509Certificates/tests/FindTests.cs76
-rw-r--r--src/System.Security.Cryptography.X509Certificates/tests/X509FilesystemTests.Unix.cs73
-rw-r--r--src/System.Security.Cryptography.X509Certificates/tests/X509StoreTests.cs43
-rw-r--r--src/System.Security.Principal.Windows/dir.props7
-rw-r--r--src/System.Security.Principal.Windows/ref/System.Security.Principal.Windows.csproj2
-rw-r--r--src/System.Security.Principal.Windows/src/System.Security.Principal.Windows.csproj2
-rw-r--r--src/System.Security.Principal/dir.props7
-rw-r--r--src/System.Security.Principal/pkg/System.Security.Principal.pkgproj3
-rw-r--r--src/System.Security.Principal/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Security.Principal/ref/System.Security.Principal.csproj1
-rw-r--r--src/System.Security.Principal/src/System.Security.Principal.csproj2
-rw-r--r--src/System.Security.SecureString/dir.props7
-rw-r--r--src/System.Security.SecureString/ref/System.Security.SecureString.csproj2
-rw-r--r--src/System.Security.SecureString/src/System.Security.SecureString.csproj2
-rw-r--r--src/System.ServiceProcess.ServiceController/dir.props7
-rw-r--r--src/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.csproj2
-rw-r--r--src/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj2
-rw-r--r--src/System.Text.Encoding.CodePages/dir.props7
-rw-r--r--src/System.Text.Encoding.CodePages/ref/System.Text.Encoding.CodePages.csproj2
-rw-r--r--src/System.Text.Encoding.CodePages/src/System.Text.Encoding.CodePages.csproj12
-rw-r--r--src/System.Text.Encoding.CodePages/src/System/Text/EncodingTable.cs13
-rw-r--r--src/System.Text.Encoding.Extensions/dir.props7
-rw-r--r--src/System.Text.Encoding.Extensions/pkg/System.Text.Encoding.Extensions.pkgproj3
-rw-r--r--src/System.Text.Encoding.Extensions/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Text.Encoding.Extensions/ref/4.0.0/System.Text.Encoding.Extensions.depproj1
-rw-r--r--src/System.Text.Encoding.Extensions/ref/System.Text.Encoding.Extensions.csproj1
-rw-r--r--src/System.Text.Encoding.Extensions/src/System.Text.Encoding.Extensions.csproj2
-rw-r--r--src/System.Text.Encoding/dir.props7
-rw-r--r--src/System.Text.Encoding/pkg/System.Text.Encoding.pkgproj3
-rw-r--r--src/System.Text.Encoding/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Text.Encoding/ref/4.0.0/System.Text.Encoding.depproj1
-rw-r--r--src/System.Text.Encoding/ref/System.Text.Encoding.csproj1
-rw-r--r--src/System.Text.Encoding/src/System.Text.Encoding.csproj2
-rw-r--r--src/System.Text.Encodings.Web/dir.props7
-rw-r--r--src/System.Text.Encodings.Web/src/System.Text.Encodings.Web.csproj2
-rw-r--r--src/System.Text.RegularExpressions/dir.props7
-rw-r--r--src/System.Text.RegularExpressions/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Text.RegularExpressions/ref/4.0.0/System.Text.RegularExpressions.depproj1
-rw-r--r--src/System.Text.RegularExpressions/ref/4.0.10/System.Text.RegularExpressions.depproj1
-rw-r--r--src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.csproj2
-rw-r--r--src/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj2
-rw-r--r--src/System.Text.RegularExpressions/tests/PrecompiledRegexScenarioTest.cs6
-rw-r--r--src/System.Text.RegularExpressions/tests/Regex.Groups.Tests.cs12
-rw-r--r--src/System.Text.RegularExpressions/tests/RegexGroupNameTests.cs5
-rw-r--r--src/System.Threading.AccessControl/dir.props7
-rw-r--r--src/System.Threading.AccessControl/ref/System.Threading.AccessControl.csproj2
-rw-r--r--src/System.Threading.AccessControl/src/System.Threading.AccessControl.csproj2
-rw-r--r--src/System.Threading.Overlapped/dir.props7
-rw-r--r--src/System.Threading.Overlapped/ref/System.Threading.Overlapped.csproj2
-rw-r--r--src/System.Threading.Overlapped/src/System.Threading.Overlapped.csproj2
-rw-r--r--src/System.Threading.Tasks.Dataflow/dir.props8
-rw-r--r--src/System.Threading.Tasks.Dataflow/src/System.Threading.Tasks.Dataflow.WP8.csproj2
-rw-r--r--src/System.Threading.Tasks.Dataflow/src/System.Threading.Tasks.Dataflow.csproj12
-rw-r--r--src/System.Threading.Tasks.Extensions/dir.props7
-rw-r--r--src/System.Threading.Tasks.Extensions/src/System.Threading.Tasks.Extensions.csproj15
-rw-r--r--src/System.Threading.Tasks.Extensions/src/System/Runtime/CompilerServices/AsyncBuilderAttribute.cs18
-rw-r--r--src/System.Threading.Tasks.Extensions/src/System/Threading/Tasks/ValueTask.cs3
-rw-r--r--src/System.Threading.Tasks.Extensions/src/project.json4
-rw-r--r--src/System.Threading.Tasks.Extensions/tests/ValueTaskTests.cs15
-rw-r--r--src/System.Threading.Tasks.Parallel/dir.props7
-rw-r--r--src/System.Threading.Tasks.Parallel/pkg/System.Threading.Tasks.Parallel.pkgproj3
-rw-r--r--src/System.Threading.Tasks.Parallel/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Threading.Tasks.Parallel/ref/System.Threading.Tasks.Parallel.csproj1
-rw-r--r--src/System.Threading.Tasks.Parallel/src/System.Threading.Tasks.Parallel.csproj2
-rw-r--r--src/System.Threading.Tasks/dir.props7
-rw-r--r--src/System.Threading.Tasks/pkg/System.Threading.Tasks.pkgproj3
-rw-r--r--src/System.Threading.Tasks/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Threading.Tasks/ref/4.0.0/System.Threading.Tasks.depproj1
-rw-r--r--src/System.Threading.Tasks/ref/System.Threading.Tasks.csproj1
-rw-r--r--src/System.Threading.Tasks/src/System.Threading.Tasks.csproj2
-rw-r--r--src/System.Threading.Thread/dir.props7
-rw-r--r--src/System.Threading.Thread/ref/System.Threading.Thread.csproj2
-rw-r--r--src/System.Threading.Thread/src/System.Threading.Thread.csproj2
-rw-r--r--src/System.Threading.ThreadPool/dir.props7
-rw-r--r--src/System.Threading.ThreadPool/ref/System.Threading.ThreadPool.csproj2
-rw-r--r--src/System.Threading.ThreadPool/src/System.Threading.ThreadPool.csproj2
-rw-r--r--src/System.Threading.Timer/dir.props7
-rw-r--r--src/System.Threading.Timer/pkg/System.Threading.Timer.pkgproj3
-rw-r--r--src/System.Threading.Timer/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Threading.Timer/ref/System.Threading.Timer.csproj1
-rw-r--r--src/System.Threading.Timer/src/System.Threading.Timer.csproj2
-rw-r--r--src/System.Threading/dir.props7
-rw-r--r--src/System.Threading/pkg/System.Threading.pkgproj3
-rw-r--r--src/System.Threading/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Threading/ref/4.0.0/System.Threading.depproj1
-rw-r--r--src/System.Threading/ref/System.Threading.csproj1
-rw-r--r--src/System.Threading/src/System.Threading.csproj2
-rw-r--r--src/System.ValueTuple/dir.props7
-rw-r--r--src/System.ValueTuple/src/System.ValueTuple.csproj4
-rw-r--r--src/System.ValueTuple/src/System/ValueTuple/ValueTuple.cs8
-rw-r--r--src/System.ValueTuple/tests/ExtensionsTests.cs703
-rw-r--r--src/System.ValueTuple/tests/System.ValueTuple.Tests.csproj11
-rw-r--r--src/System.ValueTuple/tests/TupleElementNamesAttribute/UnitTests.cs43
-rw-r--r--src/System.ValueTuple/tests/TupleElementNamesTests.cs46
-rw-r--r--src/System.ValueTuple/tests/ValueTuple/ExtensionsTests.cs701
-rw-r--r--src/System.ValueTuple/tests/ValueTuple/UnitTests.cs1209
-rw-r--r--src/System.ValueTuple/tests/ValueTupleTests.cs1216
-rw-r--r--src/System.Xml.ReaderWriter/dir.props7
-rw-r--r--src/System.Xml.ReaderWriter/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Xml.ReaderWriter/ref/4.0.0/System.Xml.ReaderWriter.depproj1
-rw-r--r--src/System.Xml.ReaderWriter/ref/System.Xml.ReaderWriter.csproj2
-rw-r--r--src/System.Xml.ReaderWriter/src/System.Xml.ReaderWriter.csproj4
-rw-r--r--src/System.Xml.XDocument/dir.props7
-rw-r--r--src/System.Xml.XDocument/pkg/System.Xml.XDocument.pkgproj3
-rw-r--r--src/System.Xml.XDocument/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Xml.XDocument/ref/4.0.0/System.Xml.XDocument.depproj1
-rw-r--r--src/System.Xml.XDocument/ref/System.Xml.XDocument.csproj1
-rw-r--r--src/System.Xml.XDocument/src/System.Xml.XDocument.csproj2
-rw-r--r--src/System.Xml.XPath.XDocument/dir.props7
-rw-r--r--src/System.Xml.XPath.XDocument/ref/System.Xml.XPath.XDocument.csproj2
-rw-r--r--src/System.Xml.XPath.XDocument/src/System.Xml.XPath.XDocument.csproj2
-rw-r--r--src/System.Xml.XPath.XmlDocument/dir.props7
-rw-r--r--src/System.Xml.XPath.XmlDocument/ref/System.Xml.XPath.XmlDocument.csproj2
-rw-r--r--src/System.Xml.XPath.XmlDocument/src/System.Xml.XPath.XmlDocument.csproj2
-rw-r--r--src/System.Xml.XPath/dir.props7
-rw-r--r--src/System.Xml.XPath/ref/System.Xml.XPath.csproj2
-rw-r--r--src/System.Xml.XPath/src/System.Xml.XPath.csproj2
-rw-r--r--src/System.Xml.XmlDocument/dir.props7
-rw-r--r--src/System.Xml.XmlDocument/ref/System.Xml.XmlDocument.csproj2
-rw-r--r--src/System.Xml.XmlDocument/src/System.Xml.XmlDocument.csproj2
-rw-r--r--src/System.Xml.XmlSerializer/dir.props7
-rw-r--r--src/System.Xml.XmlSerializer/pkg/System.Xml.XmlSerializer.pkgproj3
-rw-r--r--src/System.Xml.XmlSerializer/pkg/ValidationSuppression.txt2
-rw-r--r--src/System.Xml.XmlSerializer/ref/4.0.0/System.Xml.XmlSerializer.depproj1
-rw-r--r--src/System.Xml.XmlSerializer/ref/System.Xml.XmlSerializer.csproj1
-rw-r--r--src/System.Xml.XmlSerializer/src/System.Xml.XmlSerializer.csproj2
-rw-r--r--src/System.Xml.Xsl.Primitives/dir.props7
-rw-r--r--src/System.Xml.Xsl.Primitives/ref/System.Xml.Xsl.Primitives.csproj2
1135 files changed, 24833 insertions, 16277 deletions
diff --git a/BuildToolsVersion.txt b/BuildToolsVersion.txt
index d194eccfb5..b361f7b142 100644
--- a/BuildToolsVersion.txt
+++ b/BuildToolsVersion.txt
@@ -1 +1 @@
-1.0.26-prerelease-00730-01 \ No newline at end of file
+1.0.26-prerelease-00731-01
diff --git a/Documentation/project-docs/performance-tests.md b/Documentation/project-docs/performance-tests.md
index 36f612a106..c9bbfb5aaf 100644
--- a/Documentation/project-docs/performance-tests.md
+++ b/Documentation/project-docs/performance-tests.md
@@ -22,7 +22,7 @@ Running the tests
### Windows
Performance test files (if present) are stored within a library's ```tests/Performance``` directory and contain test methods that are all marked with a perf-specific *Benchmark* attribute. The performance tests will only be run if the ```performance``` property is set to ```true```.
-To build and run the tests using msbuild for a project, run ```msbuild /t:BuildAndTest /p:Performance=true /p:Configuration=Release``` from the tests directory. If the v5.0 assemblies aren't installed on your system, an error will be raised and no tests will be run.
+To build and run the tests using msbuild for a project, run ```msbuild /t:BuildAndTest /p:Performance=true /p:ConfigurationGroup=Release /p:OSGroup=Windows_NT``` from the tests directory. If the v5.0 assemblies aren't installed on your system, an error will be raised and no tests will be run.
Note: Because build.cmd runs tests concurrently, it's not recommended that you execute the perf tests using it.
diff --git a/Documentation/project-docs/project-nuget-dependencies.md b/Documentation/project-docs/project-nuget-dependencies.md
index 92cb341d10..844ed6bce4 100644
--- a/Documentation/project-docs/project-nuget-dependencies.md
+++ b/Documentation/project-docs/project-nuget-dependencies.md
@@ -10,21 +10,15 @@ As a historical note, `project.json` files in CoreFX previously had floating dep
Dependency version validation
-----------------------------
-The dependencies in each CoreFX project.json file are validated by a few rules to ensure package versions across the repository stay in sync. These rules are in `dir.props`, as `ValidationPattern` items. Each `ValidationPattern` item includes a regular expression that matches a set of package identities and metadata describing which version is expected for that regular expression. The metadata must be one of these:
-
-* `ExpectedPrerelease`: a prerelease version is expected, but any major, minor, and patch versions are fine. For example, an `ExpectedVersion` of `rc-12345` is valid for `1.0.0-rc-12345`, `5.4.3-rc-12345`, or any other `*-rc-12345`
-* `ExpectedVersion`: the full version string needs to match exactly. An example is `1.0.0-prerelease`.
+The dependencies in each CoreFX project.json file are validated by a few rules in `dependencies.props` to ensure package versions across the repository stay in sync.
Errors you can expect from failed dependency version validation are like the following:
- error : Dependency validation error: for System.IO 4.0.10-rc2-10000 in src\System.Collections\tests\project.json package prerelease is 'rc2-10000', but expected 'rc2-23604' for packages matching '^((System\..*)|(Microsoft\.CSharp)|(Microsoft\.NETCore.*)|(Microsoft\.Win32\..*)|(Microsoft\.VisualBasic))(?<!TestData)$'
-
- error : Dependency validation error: for System.Linq 4.0.0-beta-* in src\System.Collections\tests\project.json package prerelease is 'beta-', but expected 'rc2-23604' for packages matching '^((System\..*)|(Microsoft\.CSharp)|(Microsoft\.NETCore.*)|(Microsoft\.Win32\..*)|(Microsoft\.VisualBasic))(?<!TestData)$'
- error : Floating dependency detected: System.Linq 4.0.0-beta-* in src\System.Collections\tests\project.json
+ C:\git\corefx\Tools\VersionTools.targets(47,5): error : Dependency verification errors detected. To automatically fix based on dependency rules, run the msbuild target 'UpdateDependencies' [C:\git\corefx\build.proj]
+ C:\git\corefx\Tools\VersionTools.targets(47,5): error : Dependencies invalid: In 'C:\git\corefx\src\Common\test-runtime\project.json', 'Microsoft.DotNet.BuildTools.TestSuite 1.0.0-prerelease-00704-04' must be '1.0.0-prerelease-00704-05' (Microsoft.DotNet.BuildTools.TestSuite) [C:\git\corefx\build.proj]
+ C:\git\corefx\Tools\VersionTools.targets(47,5): error : Dependencies invalid: In 'C:\git\corefx\src\Common\tests\project.json', 'Microsoft.xunit.netcore.extensions 1.0.0-prerelease-00704-04' must be '1.0.0-prerelease-00704-05' (Microsoft.xunit.netcore.extensions) [C:\git\corefx\build.proj]
- error : Dependency validation error: for xunit 2.0.0 in src\System.Collections\tests\project.json package version is '2.0.0' but expected '2.1.0' for packages matching '^xunit$'
-
-To fix these, you can manually modify the `project.json` files mentioned or automatically fix them using the `UpdateInvalidPackageVersions` target described in the next section.
+To fix these, you can manually modify the `project.json` files mentioned or automatically fix them using the `UpdateDependencies` target described in the next section.
Upgrading a package dependency
------------------------------
@@ -33,22 +27,11 @@ To update a package that isn't validated by a rule, simply change the project.js
To update a package that is validated, follow these steps:
-1. Edit `ValidationPattern` item(s) in `dir.props` in the CoreFX root.
+1. Edit the versions repo commit hashes in `(CoreFx|CoreClr|External)CurrentRef` and `StaticDependency` versions in `dependencies.props` in the CoreFX root.
2. Run the dependency update target in the repository root using this command:
- build.cmd -UpdateInvalidPackageVersions
+ build-managed.cmd -- /t:UpdateDependencies
3. Commit the automated updates in an independent commit, isolating them from other changes. This makes pull requests easier to review.
-The `UpdateInvalidPackageVersions` target looks through all dependencies, using the validation rules to update any invalid versions. The build prints out which dependencies are updated and which project.json files are written.
-
-Recovering from a non-existent prerelease dependency
-----------------------------------------------------
-
-Sometimes upgrading the prerelease version can make `project.json` files contain dependencies that don't exist. For example, if you update a rule's valid prerelease from `beta-100` to `beta-200`, but around `beta-150` a stable version of `System.Foo` was released and prereleases changed from `1.0.0-beta-...` to `1.1.0-beta-...`, automatic package updating would result in a dependency on `1.0.0-beta-200`. However, only `1.1.0-beta-200` exists.
-
-To fix this, use the `UpdatePackageDependencyVersion` target:
-
- msbuild /t:UpdatePackageDependencyVersion /p:PackageId=System.Foo;OldVersion=1.0.0-beta-200;NewVersion=1.1.0-beta-200
-
-This updates the `System.Foo` version in all `project.json` files in CoreFX.
+The `UpdateDependencies` target looks through all dependencies, using the validation rules to update any invalid versions. On `/verbosity:Normal` or higher, it logs which files were changed.
diff --git a/Packaging.props b/Packaging.props
index 11a54d01bf..a7f40068a0 100644
--- a/Packaging.props
+++ b/Packaging.props
@@ -19,6 +19,9 @@
<!-- temporary change until buildtools can be updated https://github.com/dotnet/buildtools/issues/831 -->
<LineupPackageVersion Condition="'$(LineupPackageVersion)' == ''">1.0.3</LineupPackageVersion>
<PlatformPackageVersion Condition="'$(PlatformPackageVersion)' == ''">1.0.2</PlatformPackageVersion>
+
+ <!-- by default all packages will use the same version which revs with respect to product version -->
+ <PackageVersion Condition="'$(PackageVersion)' == ''">4.3.0</PackageVersion>
<SkipValidatePackageTargetFramework>true</SkipValidatePackageTargetFramework>
</PropertyGroup>
@@ -36,11 +39,11 @@
<!-- Add required legal files to packages -->
<ItemGroup Condition="'$(MSBuildProjectExtension)' == '.pkgproj'">
<File Condition="Exists('$(PackageLicenseFile)')"
- Include="$(PackageLicenseFile)" >
+ Include="$(PackageLicenseFile)" >
<SkipPackageFileCheck>true</SkipPackageFileCheck>
</File>
<File Condition="Exists('$(PackageThirdPartyNoticesFile)')"
- Include="$(PackageThirdPartyNoticesFile)" >
+ Include="$(PackageThirdPartyNoticesFile)" >
<SkipPackageFileCheck>true</SkipPackageFileCheck>
</File>
</ItemGroup>
diff --git a/README.md b/README.md
index b1a47c7b12..a1c838c544 100644
--- a/README.md
+++ b/README.md
@@ -55,6 +55,15 @@ Want to chat with other members of the CoreFX community?
This project has adopted the code of conduct defined by the [Contributor Covenant](http://contributor-covenant.org/)
to clarify expected behavior in our community. For more information, see the [.NET Foundation Code of Conduct](http://www.dotnetfoundation.org/code-of-conduct).
+### Reporting security issues and security bugs
+
+Security issues and bugs should be reported privately, via email, to the
+Microsoft Security Response Center (MSRC) <secure@microsoft.com>. You should
+receive a response within 24 hours. If for some reason you do not, please follow
+up via email to ensure we received your original message. Further information,
+including the MSRC PGP key, can be found in the
+[Security TechCenter](https://technet.microsoft.com/en-us/security/ff852094.aspx).
+
## .NET Core Library Components
The repo contains the source for each of the assemblies that comprises .NET Core. Each ```Microsoft.*``` or ```System.``` folder under
diff --git a/build.proj b/build.proj
index 95f8e2b2cb..35dfd6f64e 100644
--- a/build.proj
+++ b/build.proj
@@ -80,7 +80,12 @@
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Restoring all packages..." />
+ <IsRestoreRequired ProjectJsons="@(ProjectJsonFiles)" PackagesFolder="$(PackagesDir)">
+ <Output TaskParameter="RestoreRequired" PropertyName="RestoreRequired" />
+ </IsRestoreRequired>
+
<Exec Command="$(DnuRestoreCommand) @(DnuRestoreDir->'&quot;%(Identity)&quot;', ' ')"
+ Condition="'$(RestoreRequired)' == 'true'"
StandardOutputImportance="Low"
CustomErrorRegularExpression="(^Unable to locate .*)|(^Updating the invalid lock file with .*)"
ContinueOnError="ErrorAndContinue" />
diff --git a/config.json b/config.json
index 655daab1fe..111ddd6db6 100644
--- a/config.json
+++ b/config.json
@@ -216,12 +216,6 @@
"values": [],
"defaultValue": ""
},
- "UpdateInvalidPackageVersions": {
- "description": "MsBuild target that looks through all dependencies and using the validation rules, updates any invalid versions.",
- "valueType": "target",
- "values": [],
- "defaultValue": ""
- },
"CleanAllProjects": {
"description": "MsBuild target that deletes the binary output directory.",
"valueType": "target",
@@ -239,7 +233,13 @@
"valueType": "target",
"values": [],
"defaultValue": ""
- }
+ },
+ "ProducesTarget": {
+ "description": "MsBuild target that displays all of the artifacts this repo produces.",
+ "valueType": "target",
+ "values": [],
+ "defaultValue": ""
+ }
},
"commands": {
"build-managed": {
@@ -407,7 +407,6 @@
"toolName": "msbuild",
"settings": {
"Project": "src/packages.builds",
- "MsBuildParameters": "default",
"ProducesTarget":"default"
}
}
diff --git a/dependencies.props b/dependencies.props
index 2040aee237..0e5a18ad9f 100644
--- a/dependencies.props
+++ b/dependencies.props
@@ -85,6 +85,10 @@
<Version>2.1.0</Version>
</StaticDependency>
+ <!--
+ The NETNative targeting pack is in the projectn-tfs build-info, but auto-upgrade isn't wanted.
+ Verify it at a static version rather than referencing the build-info.
+ -->
<StaticDependency Include="Microsoft.xunit.netcore.extensions;Microsoft.DotNet.BuildTools.TestSuite">
<Version>1.0.0-prerelease-00704-03</Version>
</StaticDependency>
diff --git a/dir.props b/dir.props
index f553470812..4abbeb7a6c 100644
--- a/dir.props
+++ b/dir.props
@@ -2,7 +2,7 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Condition="Exists('..\dir.props')" Project="..\dir.props" />
- <!-- We shipped assembly file version 4.6.x up until the end of rc3. Version assembly as
+ <!-- We shipped assembly file version 4.6.x up until the end of rc3. Version assembly as
4.6.x to ensure compatability in Visual Studio for an in-place update. -->
<PropertyGroup>
<MajorVersion>4</MajorVersion>
@@ -18,7 +18,7 @@
</PropertyGroup>
<PropertyGroup>
- <XunitPerfAnalysisPackageVersion>1.0.0-alpha-build0039</XunitPerfAnalysisPackageVersion>
+ <XunitPerfAnalysisPackageVersion>1.0.0-alpha-build0040</XunitPerfAnalysisPackageVersion>
</PropertyGroup>
<PropertyGroup>
diff --git a/dir.targets b/dir.targets
index f005cc67c5..a90c46c08a 100644
--- a/dir.targets
+++ b/dir.targets
@@ -71,4 +71,11 @@
</TestNugetTargetMoniker>
</ItemGroup>
+ <Target Name="ProducesPackageId"
+ Returns="@(PackageIds)">
+ <ItemGroup>
+ <PackageIds Include="$(Id)" />
+ </ItemGroup>
+ </Target>
+
</Project>
diff --git a/dir.traversal.targets b/dir.traversal.targets
index 52422a4c92..11ee4e1831 100644
--- a/dir.traversal.targets
+++ b/dir.traversal.targets
@@ -86,6 +86,32 @@
ContinueOnError="ErrorAndContinue" />
</Target>
+ <Target Name="ProducesPackageId"
+ Returns="@(PackageIds)"
+ DependsOnTargets="FilterProjects">
+ <MSBuild Targets="ProducesPackageId"
+ Projects="@(Project)"
+ BuildInParallel="true"
+ ContinueOnError="ErrorAndContinue">
+ <Output TaskParameter="TargetOutputs"
+ ItemName="PackageIds" />
+ </MSBuild>
+ <ItemGroup>
+ <PackageIds Include="@(PackageIds)" />
+ </ItemGroup>
+ </Target>
+
+ <Target Name="ProducesTarget" DependsOnTargets="FilterProjects">
+ <MSBuild Targets="ProducesPackageId"
+ Projects="@(Project)"
+ BuildInParallel="true"
+ ContinueOnError="ErrorAndContinue">
+ <Output TaskParameter="TargetOutputs"
+ ItemName="PackageIds" />
+ </MSBuild>
+ <Message Text="%(PackageIds.Identity)" Importance="High" />
+ </Target>
+
<Target Name="BuildAllProjects" DependsOnTargets="FilterProjects">
<PropertyGroup>
<DefaultBuildAllTarget Condition="'$(DefaultBuildAllTarget)'==''">$(MSBuildProjectDefaultTargets)</DefaultBuildAllTarget>
diff --git a/init-tools.cmd b/init-tools.cmd
index 87d989982b..7acf858eb5 100644
--- a/init-tools.cmd
+++ b/init-tools.cmd
@@ -43,7 +43,7 @@ set DOTNET_LOCAL_PATH=%DOTNET_PATH%%DOTNET_ZIP_NAME%
echo Installing '%DOTNET_REMOTE_PATH%' to '%DOTNET_LOCAL_PATH%' >> "%INIT_TOOLS_LOG%"
powershell -NoProfile -ExecutionPolicy unrestricted -Command "$retryCount = 0; $success = $false; do { try { (New-Object Net.WebClient).DownloadFile('%DOTNET_REMOTE_PATH%', '%DOTNET_LOCAL_PATH%'); $success = $true; } catch { if ($retryCount -ge 6) { throw; } else { $retryCount++; Start-Sleep -Seconds (5 * $retryCount); } } } while ($success -eq $false); Add-Type -Assembly 'System.IO.Compression.FileSystem' -ErrorVariable AddTypeErrors; if ($AddTypeErrors.Count -eq 0) { [System.IO.Compression.ZipFile]::ExtractToDirectory('%DOTNET_LOCAL_PATH%', '%DOTNET_PATH%') } else { (New-Object -com shell.application).namespace('%DOTNET_PATH%').CopyHere((new-object -com shell.application).namespace('%DOTNET_LOCAL_PATH%').Items(),16) }" >> "%INIT_TOOLS_LOG%"
if NOT exist "%DOTNET_LOCAL_PATH%" (
- echo ERROR: Could not install dotnet cli correctly. See '%INIT_TOOLS_LOG%' for more details.
+ echo ERROR: Could not install dotnet cli correctly. See '%INIT_TOOLS_LOG%' for more details. 1>&2
exit /b 1
)
@@ -54,7 +54,7 @@ echo Restoring BuildTools version %BUILDTOOLS_VERSION%...
echo Running: "%DOTNET_CMD%" restore "%PROJECT_JSON_FILE%" --no-cache --packages %PACKAGES_DIR% --source "%BUILDTOOLS_SOURCE%" >> "%INIT_TOOLS_LOG%"
call "%DOTNET_CMD%" restore "%PROJECT_JSON_FILE%" --no-cache --packages %PACKAGES_DIR% --source "%BUILDTOOLS_SOURCE%" >> "%INIT_TOOLS_LOG%"
if NOT exist "%BUILD_TOOLS_PATH%init-tools.cmd" (
- echo ERROR: Could not restore build tools correctly. See '%INIT_TOOLS_LOG%' for more details.
+ echo ERROR: Could not restore build tools correctly. See '%INIT_TOOLS_LOG%' for more details. 1>&2
exit /b 1
)
@@ -65,7 +65,7 @@ echo Running: "%BUILD_TOOLS_PATH%init-tools.cmd" "%~dp0" "%DOTNET_CMD%" "%TOOLRU
call "%BUILD_TOOLS_PATH%init-tools.cmd" "%~dp0" "%DOTNET_CMD%" "%TOOLRUNTIME_DIR%" >> "%INIT_TOOLS_LOG%"
set INIT_TOOLS_ERRORLEVEL=%ERRORLEVEL%
if not [%INIT_TOOLS_ERRORLEVEL%]==[0] (
- echo ERROR: An error occured when trying to initialize the tools. Please check '%INIT_TOOLS_LOG%' for more details.
+ echo ERROR: An error occured when trying to initialize the tools. Please check '%INIT_TOOLS_LOG%' for more details. 1>&2
exit /b %INIT_TOOLS_ERRORLEVEL%
)
diff --git a/init-tools.sh b/init-tools.sh
index 480e87427d..17897fb0e6 100755
--- a/init-tools.sh
+++ b/init-tools.sh
@@ -31,7 +31,7 @@ OSName=$(uname -s)
__DOTNET_PKG=dotnet-dev-ubuntu.14.04-x64
else
source /etc/os-release
- if [[ "$ID" == "ubuntu" && "$VERSION_ID" != "14.04" && "$VERSION_ID" != "16.04" ]]; then
+ if [[ "$ID" == "ubuntu" && "$VERSION_ID" != "14.04" && "$VERSION_ID" != "16.04" && "$VERSION_ID" != "16.10" ]]; then
echo "Unsupported Ubuntu version, falling back to Ubuntu 14.04."
__DOTNET_PKG=dotnet-dev-ubuntu.14.04-x64
else
@@ -47,7 +47,6 @@ OSName=$(uname -s)
;;
esac
fi
-
if [ ! -e $__INIT_TOOLS_DONE_MARKER ]; then
if [ -e $__TOOLRUNTIME_DIR ]; then rm -rf -- $__TOOLRUNTIME_DIR; fi
echo "Running: $__scriptpath/init-tools.sh" > $__init_tools_log
@@ -76,14 +75,14 @@ if [ ! -e $__INIT_TOOLS_DONE_MARKER ]; then
echo "Restoring BuildTools version $__BUILD_TOOLS_PACKAGE_VERSION..."
echo "Running: $__DOTNET_CMD restore \"$__PROJECT_JSON_FILE\" --no-cache --packages $__PACKAGES_DIR --source $__BUILDTOOLS_SOURCE" >> $__init_tools_log
$__DOTNET_CMD restore "$__PROJECT_JSON_FILE" --no-cache --packages $__PACKAGES_DIR --source $__BUILDTOOLS_SOURCE >> $__init_tools_log
- if [ ! -e "$__BUILD_TOOLS_PATH/init-tools.sh" ]; then echo "ERROR: Could not restore build tools correctly. See '$__init_tools_log' for more details."; fi
+ if [ ! -e "$__BUILD_TOOLS_PATH/init-tools.sh" ]; then echo "ERROR: Could not restore build tools correctly. See '$__init_tools_log' for more details."1>&2; fi
fi
echo "Initializing BuildTools..."
echo "Running: $__BUILD_TOOLS_PATH/init-tools.sh $__scriptpath $__DOTNET_CMD $__TOOLRUNTIME_DIR" >> $__init_tools_log
$__BUILD_TOOLS_PATH/init-tools.sh $__scriptpath $__DOTNET_CMD $__TOOLRUNTIME_DIR >> $__init_tools_log
if [ "$?" != "0" ]; then
- echo "ERROR: An error occured when trying to initialize the tools. Please check '$__init_tools_log' for more details."
+ echo "ERROR: An error occured when trying to initialize the tools. Please check '$__init_tools_log' for more details."1>&2
exit 1
fi
touch $__INIT_TOOLS_DONE_MARKER
diff --git a/netci.groovy b/netci.groovy
index 1e7e8b449f..232e0bcfac 100644
--- a/netci.groovy
+++ b/netci.groovy
@@ -240,7 +240,8 @@ def osShortName = ['Windows 10': 'win10',
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
// Add the unit test results
Utilities.addXUnitDotNETResults(newJob, 'bin/tests/**/testResults.xml')
-
+ // Add archival for the built data.
+ Utilities.addArchival(newJob, "msbuild.log", '', doNotFailIfNothingArchived=true, archiveOnlyIfSuccessful=false)
// Set up appropriate triggers. PR on demand, otherwise nightly
if (isPR) {
// Set PR trigger.
@@ -327,8 +328,7 @@ def osShortName = ['Windows 10': 'win10',
Utilities.addPrivateGithubPRTriggerForBranch(newJob, branch, "Windows_NT ARM64 ${configurationGroup} Build and Test", "(?i).*test\\W+ARM64\\W+${os}\\W+${configurationGroup}", null, arm64Users)
// Set up a per-push trigger
- // Temporarily disabled until private triggers are stable
- // Utilities.addGithubPushTrigger(newJob)
+ Utilities.addGithubPushTrigger(newJob)
// Get results
Utilities.addXUnitDotNETResults(newJob, 'bin/tests/testresults/**/testResults.xml')
@@ -383,7 +383,7 @@ def osShortName = ['Windows 10': 'win10',
archiveContents += ",bin/build.tar.gz"
}
// Add archival for the built data.
- Utilities.addArchival(newJob, archiveContents)
+ Utilities.addArchival(newJob, archiveContents, '', doNotFailIfNothingArchived=true, archiveOnlyIfSuccessful=false)
// Set up triggers
if (isPR) {
// Set PR trigger, we run Windows_NT, Ubuntu 14.04, CentOS 7.1 and OSX on every PR.
@@ -445,7 +445,7 @@ def osShortName = ['Windows 10': 'win10',
// Set up triggers
if (isPR) {
if (osName == 'LinuxARMEmulator') {
- Utilities.addGithubPRTriggerForBranch(newJob, branch, "Innerloop Linux ARM Emulator ${configurationGroup} Cross Build", "(?i).*test\\W+Innerloop\\W+Linux\\W+ARM\\W+Emulator\\W+${configurationGroup}\\W+Cross\\W+Build.*")
+ Utilities.addGithubPRTriggerForBranch(newJob, branch, "Innerloop Linux ARM Emulator ${configurationGroup} Cross Build")
}
}
else {
diff --git a/pkg/Microsoft.NETCore.Platforms/runtime.json b/pkg/Microsoft.NETCore.Platforms/runtime.json
index d1095fd108..54769f2662 100644
--- a/pkg/Microsoft.NETCore.Platforms/runtime.json
+++ b/pkg/Microsoft.NETCore.Platforms/runtime.json
@@ -227,7 +227,7 @@
},
"ol.7.0": {
- "#import": [ "ol.7", "rhel.7.0-x64" ]
+ "#import": [ "ol.7", "rhel.7.0" ]
},
"ol.7.0-x64": {
"#import": [ "ol.7", "ol.7-x64", "rhel.7.0-x64" ]
diff --git a/pkg/Microsoft.NETCore.Targets/Microsoft.NETCore.Targets.pkgproj b/pkg/Microsoft.NETCore.Targets/Microsoft.NETCore.Targets.pkgproj
index 161f40c9e3..64109cdc1f 100644
--- a/pkg/Microsoft.NETCore.Targets/Microsoft.NETCore.Targets.pkgproj
+++ b/pkg/Microsoft.NETCore.Targets/Microsoft.NETCore.Targets.pkgproj
@@ -23,6 +23,7 @@
<NativePackage Include="runtime.native.System.Net.Http" />
<NativePackage Include="runtime.native.System.Security.Cryptography" />
<NativePackage Include="runtime.native.System.Security.Cryptography.Apple" />
+ <NativePackage Include="runtime.native.System.Security.Cryptography.OpenSsl" />
<NativePackage Include="runtime.native.System.Net.Security" />
</ItemGroup>
diff --git a/pkg/Microsoft.Private.PackageBaseline/Microsoft.Private.PackageBaseline.pkgproj b/pkg/Microsoft.Private.PackageBaseline/Microsoft.Private.PackageBaseline.pkgproj
index 9dc1511bc6..c6c3ba7523 100644
--- a/pkg/Microsoft.Private.PackageBaseline/Microsoft.Private.PackageBaseline.pkgproj
+++ b/pkg/Microsoft.Private.PackageBaseline/Microsoft.Private.PackageBaseline.pkgproj
@@ -9,7 +9,10 @@
</PropertyGroup>
<ItemGroup>
- <File Include="*.props">
+ <File Include="Microsoft.Private.PackageBaseline.props">
+ <TargetPath>build</TargetPath>
+ </File>
+ <File Include="packageIndex.json">
<TargetPath>build</TargetPath>
</File>
</ItemGroup>
diff --git a/pkg/Microsoft.Private.PackageBaseline/Microsoft.Private.PackageBaseline.props b/pkg/Microsoft.Private.PackageBaseline/Microsoft.Private.PackageBaseline.props
index 880efa7573..6f80bb9fa6 100644
--- a/pkg/Microsoft.Private.PackageBaseline/Microsoft.Private.PackageBaseline.props
+++ b/pkg/Microsoft.Private.PackageBaseline/Microsoft.Private.PackageBaseline.props
@@ -1,5 +1,5 @@
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="stable.packages.props" />
- <Import Project="baseline.packages.props" />
- <Import Project="native.library.packages.props" />
+ <ItemGroup>
+ <PackageIndex Include="$(MSBuildThisFileDirectory)packageIndex.json" />
+ </ItemGroup>
</Project>
diff --git a/pkg/Microsoft.Private.PackageBaseline/baseline.packages.props b/pkg/Microsoft.Private.PackageBaseline/baseline.packages.props
deleted file mode 100644
index 2c8277a853..0000000000
--- a/pkg/Microsoft.Private.PackageBaseline/baseline.packages.props
+++ /dev/null
@@ -1,442 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <BaseLinePropsFile Condition="'$(BaseLinePropsFile)' == ''">$(MSBuildThisFileFullPath)</BaseLinePropsFile>
- </PropertyGroup>
- <ItemGroup>
- <BaseLinePackage Include="Microsoft.CSharp">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="Microsoft.VisualBasic">
- <Version>10.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="Microsoft.Win32.Primitives">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="Microsoft.Win32.Registry.AccessControl">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="Microsoft.Win32.Registry">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.AppContext">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Buffers">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Collections.Concurrent">
- <Version>4.0.12</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Collections.Immutable">
- <Version>1.2.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Collections.NonGeneric">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Collections">
- <Version>4.0.11</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Collections.Specialized">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.ComponentModel.Annotations">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.ComponentModel.EventBasedAsync">
- <Version>4.0.11</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.ComponentModel">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.ComponentModel.Primitives">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.ComponentModel.TypeConverter">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Console">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Data.Common">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Data.SqlClient">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Diagnostics.Contracts">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Diagnostics.Debug">
- <Version>4.0.11</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Diagnostics.DiagnosticSource">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Diagnostics.FileVersionInfo">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Diagnostics.Process">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Diagnostics.StackTrace">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Diagnostics.TextWriterTraceListener">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Diagnostics.Tools">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Diagnostics.TraceSource">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Diagnostics.Tracing">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Drawing.Primitives">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Dynamic.Runtime">
- <Version>4.0.11</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Globalization.Calendars">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Globalization.Extensions">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Globalization">
- <Version>4.0.11</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.IO.Compression">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.IO.Compression.ZipFile">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.IO.FileSystem.AccessControl">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.IO.FileSystem.DriveInfo">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.IO.FileSystem">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.IO.FileSystem.Primitives">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.IO.FileSystem.Watcher">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.IO.IsolatedStorage">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.IO.MemoryMappedFiles">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.IO">
- <Version>4.2.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.IO.Packaging">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.IO.Pipes">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.IO.UnmanagedMemoryStream">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Linq.Expressions">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Linq">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Linq.Parallel">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Linq.Queryable">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Net.Http">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Net.Http.Rtc">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Net.Http.WinHttpHandler">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Net.NameResolution">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Net.NetworkInformation">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Net.Ping">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Net.Primitives">
- <Version>4.0.11</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Net.Requests">
- <Version>4.0.11</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Net.Security">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Net.Sockets">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Net.WebHeaderCollection">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Net.WebSockets.Client">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Net.WebSockets">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Numerics.Vectors">
- <Version>4.1.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Numerics.Vectors.WindowsRuntime">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.ObjectModel">
- <Version>4.0.12</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Reflection.Context">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Reflection.DispatchProxy">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Reflection.Emit.ILGeneration">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Reflection.Emit.Lightweight">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Reflection.Emit">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Reflection.Extensions">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Reflection.Metadata">
- <Version>1.4.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Reflection">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Reflection.Primitives">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Reflection.TypeExtensions">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Resources.Reader">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Resources.ReaderWriter">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Resources.ResourceManager">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Resources.Writer">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Runtime.CompilerServices.VisualC">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Runtime.Extensions">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Runtime.Handles">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Runtime.InteropServices">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Runtime.InteropServices.PInvoke">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Runtime.InteropServices.RuntimeInformation">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Runtime.InteropServices.WindowsRuntime">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Runtime.Loader">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Runtime.Numerics">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Runtime">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Runtime.Serialization.Json">
- <Version>4.0.2</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Runtime.Serialization.Primitives">
- <Version>4.1.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Runtime.Serialization.Xml">
- <Version>4.1.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Runtime.WindowsRuntime">
- <Version>4.0.11</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Runtime.WindowsRuntime.UI.Xaml">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Security.AccessControl">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Security.Claims">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Security.Cryptography.Algorithms">
- <Version>4.2.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Security.Cryptography.Cng">
- <Version>4.2.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Security.Cryptography.Csp">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Security.Cryptography.Encoding">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Security.Cryptography.OpenSsl">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Security.Cryptography.Primitives">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Security.Cryptography.ProtectedData">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Security.Cryptography.X509Certificates">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Security.Principal">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Security.Principal.Windows">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.ServiceProcess.ServiceController">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Text.Encoding.CodePages">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Text.Encoding.Extensions">
- <Version>4.0.11</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Text.Encoding">
- <Version>4.0.11</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Text.Encodings.Web">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Text.RegularExpressions">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Threading.AccessControl">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Threading">
- <Version>4.0.11</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Threading.Overlapped">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Threading.Tasks.Dataflow">
- <Version>4.6.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Threading.Tasks.Extensions">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Threading.Tasks">
- <Version>4.0.11</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Threading.Tasks.Parallel">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Threading.Thread">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Threading.ThreadPool">
- <Version>4.0.10</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Threading.Timer">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.ValueTuple">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Xml.ReaderWriter">
- <Version>4.0.11</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Xml.XDocument">
- <Version>4.0.11</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Xml.XmlDocument">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Xml.XmlSerializer">
- <Version>4.0.11</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Xml.XPath">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Xml.XPath.XDocument">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Xml.XPath.XmlDocument">
- <Version>4.0.1</Version>
- </BaseLinePackage>
-
- <!-- private dependencies -->
- <BaseLinePackage Include="runtime.native.System">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="runtime.native.System.Data.SqlClient.sni">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="runtime.native.System.IO.Compression">
- <Version>4.1.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="runtime.native.System.Net.Http">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="runtime.native.System.Net.Security">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="runtime.native.System.Security.Cryptography">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="runtime.native.System.Security.Cryptography.Apple">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Private.DataContractSerialization">
- <Version>4.1.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Private.Uri">
- <Version>4.0.1</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Private.Xml">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- <BaseLinePackage Include="System.Private.Xml.Linq">
- <Version>4.0.0</Version>
- </BaseLinePackage>
- </ItemGroup>
-</Project>
diff --git a/pkg/Microsoft.Private.PackageBaseline/native.library.packages.props b/pkg/Microsoft.Private.PackageBaseline/native.library.packages.props
deleted file mode 100644
index d3a350f731..0000000000
--- a/pkg/Microsoft.Private.PackageBaseline/native.library.packages.props
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <!-- This file contains a map of native-library -> package so that we can harvest package dependencies from native references -->
-
- <!-- runtime.native.System -->
- <NativeLibrary Include="System.Native">
- <Package>runtime.native.System</Package>
- </NativeLibrary>
-
- <!-- runtime.native.System.Data.SqlClient.sni -->
- <NativeLibrary Include="sni.dll">
- <Package>runtime.native.System.Data.SqlClient.sni</Package>
- </NativeLibrary>
-
- <!-- runtime.native.System.IO.Compression -->
- <NativeLibrary Include="clrcompression.dll">
- <Package>runtime.native.System.IO.Compression</Package>
- </NativeLibrary>
- <NativeLibrary Include="System.IO.Compression.Native">
- <Package>runtime.native.System.IO.Compression</Package>
- </NativeLibrary>
-
- <!-- runtime.native.System.Net.Http -->
- <NativeLibrary Include="System.Net.Http.Native">
- <Package>runtime.native.System.Net.Http</Package>
- </NativeLibrary>
-
- <!-- runtime.native.System.Net.Security -->
- <NativeLibrary Include="System.Net.Security.Native">
- <Package>runtime.native.System.Net.Security</Package>
- </NativeLibrary>
-
- <!-- runtime.native.System.Security.Cryptography -->
- <NativeLibrary Include="System.Security.Cryptography.Native">
- <Package>runtime.native.System.Security.Cryptography</Package>
- </NativeLibrary>
-
- <!-- runtime.native.System.Security.Cryptography.Apple -->
- <NativeLibrary Include="System.Security.Cryptography.Native.Apple">
- <Package>runtime.native.System.Security.Cryptography.Apple</Package>
- </NativeLibrary>
- </ItemGroup>
-</Project>
diff --git a/pkg/Microsoft.Private.PackageBaseline/packageIndex.json b/pkg/Microsoft.Private.PackageBaseline/packageIndex.json
new file mode 100644
index 0000000000..160b5b7d7a
--- /dev/null
+++ b/pkg/Microsoft.Private.PackageBaseline/packageIndex.json
@@ -0,0 +1,2427 @@
+{
+ "Packages": {
+ "Microsoft.CSharp": {
+ "StableVersions": [
+ "4.0.1",
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "Microsoft.NETCore": {
+ "StableVersions": [
+ "5.0.0",
+ "5.0.1",
+ "5.0.2"
+ ]
+ },
+ "Microsoft.NETCore.Platforms": {
+ "StableVersions": [
+ "1.0.0",
+ "1.0.1"
+ ]
+ },
+ "Microsoft.NETCore.Portable.Compatibility": {
+ "StableVersions": [
+ "1.0.1",
+ "1.0.0",
+ "1.0.2"
+ ],
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "1.0.0"
+ }
+ },
+ "Microsoft.NETCore.Runtime": {
+ "StableVersions": [
+ "1.0.0",
+ "1.0.1"
+ ]
+ },
+ "Microsoft.NETCore.Runtime.CoreCLR": {
+ "StableVersions": [
+ "1.0.1",
+ "1.0.2",
+ "1.0.3"
+ ]
+ },
+ "Microsoft.NETCore.Runtime.Native": {
+ "StableVersions": [
+ "1.0.0",
+ "1.0.1"
+ ]
+ },
+ "Microsoft.NETCore.Targets": {
+ "StableVersions": [
+ "1.0.0",
+ "1.0.1",
+ "1.0.2"
+ ]
+ },
+ "Microsoft.NETCore.Targets.NETFramework": {
+ "StableVersions": [
+ "4.6.0"
+ ]
+ },
+ "Microsoft.NETCore.Targets.UniversalWindowsPlatform": {
+ "StableVersions": [
+ "5.0.0"
+ ]
+ },
+ "Microsoft.NETCore.TestHost": {
+ "StableVersions": [
+ "1.0.0"
+ ]
+ },
+ "Microsoft.NETCore.UniversalWindowsPlatform": {
+ "StableVersions": [
+ "5.0.0",
+ "5.1.0",
+ "5.2.0",
+ "5.2.1",
+ "5.2.2"
+ ]
+ },
+ "Microsoft.NETCore.Windows.ApiSets": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "Microsoft.VisualBasic": {
+ "StableVersions": [
+ "10.0.1",
+ "10.0.0"
+ ],
+ "BaselineVersion": "10.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "10.0.0.0": "10.0.0",
+ "10.0.1.0": "10.0.1"
+ }
+ },
+ "Microsoft.Win32.Primitives": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.0.2"
+ }
+ },
+ "Microsoft.Win32.Registry": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "Microsoft.Win32.Registry.AccessControl": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "NETStandard.Library": {
+ "StableVersions": [
+ "1.6.0"
+ ]
+ },
+ "runtime.any.System.Collections": {
+ "StableVersions": [
+ "4.0.11"
+ ]
+ },
+ "runtime.any.System.Diagnostics.Tools": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.any.System.Diagnostics.Tracing": {
+ "StableVersions": [
+ "4.1.0"
+ ]
+ },
+ "runtime.any.System.Globalization": {
+ "StableVersions": [
+ "4.0.11"
+ ]
+ },
+ "runtime.any.System.Globalization.Calendars": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.any.System.IO": {
+ "StableVersions": [
+ "4.1.0"
+ ]
+ },
+ "runtime.any.System.Reflection": {
+ "StableVersions": [
+ "4.1.0"
+ ]
+ },
+ "runtime.any.System.Reflection.Extensions": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.any.System.Reflection.Primitives": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.any.System.Resources.ResourceManager": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.any.System.Runtime": {
+ "StableVersions": [
+ "4.1.0"
+ ]
+ },
+ "runtime.any.System.Runtime.Handles": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.any.System.Runtime.InteropServices": {
+ "StableVersions": [
+ "4.1.0"
+ ]
+ },
+ "runtime.any.System.Text.Encoding": {
+ "StableVersions": [
+ "4.0.11"
+ ]
+ },
+ "runtime.any.System.Text.Encoding.Extensions": {
+ "StableVersions": [
+ "4.0.11"
+ ]
+ },
+ "runtime.any.System.Threading.Tasks": {
+ "StableVersions": [
+ "4.0.11"
+ ]
+ },
+ "runtime.any.System.Threading.Timer": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.aot.System.Collections": {
+ "StableVersions": [
+ "4.0.10"
+ ]
+ },
+ "runtime.aot.System.Diagnostics.Tools": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.aot.System.Diagnostics.Tracing": {
+ "StableVersions": [
+ "4.0.20"
+ ]
+ },
+ "runtime.aot.System.Globalization": {
+ "StableVersions": [
+ "4.0.11"
+ ]
+ },
+ "runtime.aot.System.Globalization.Calendars": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.aot.System.IO": {
+ "StableVersions": [
+ "4.1.0"
+ ]
+ },
+ "runtime.aot.System.Reflection": {
+ "StableVersions": [
+ "4.0.10"
+ ]
+ },
+ "runtime.aot.System.Reflection.Extensions": {
+ "StableVersions": [
+ "4.0.0"
+ ]
+ },
+ "runtime.aot.System.Reflection.Primitives": {
+ "StableVersions": [
+ "4.0.0"
+ ]
+ },
+ "runtime.aot.System.Resources.ResourceManager": {
+ "StableVersions": [
+ "4.0.0"
+ ]
+ },
+ "runtime.aot.System.Runtime": {
+ "StableVersions": [
+ "4.0.20"
+ ]
+ },
+ "runtime.aot.System.Runtime.Handles": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.aot.System.Runtime.InteropServices": {
+ "StableVersions": [
+ "4.0.20"
+ ]
+ },
+ "runtime.aot.System.Text.Encoding": {
+ "StableVersions": [
+ "4.0.11"
+ ]
+ },
+ "runtime.aot.System.Text.Encoding.Extensions": {
+ "StableVersions": [
+ "4.0.11"
+ ]
+ },
+ "runtime.aot.System.Threading.Tasks": {
+ "StableVersions": [
+ "4.0.11"
+ ]
+ },
+ "runtime.aot.System.Threading.Timer": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.debian.8-x64.Microsoft.NETCore.TestHost": {},
+ "runtime.debian.8-x64.runtime.native.System": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.debian.8-x64.runtime.native.System.IO.Compression": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.debian.8-x64.runtime.native.System.Net.Http": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.debian.8-x64.runtime.native.System.Net.Security": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.debian.8-x64.runtime.native.System.Security.Cryptography": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.fedora.23-x64.Microsoft.NETCore.TestHost": {},
+ "runtime.fedora.23-x64.runtime.native.System": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.fedora.23-x64.runtime.native.System.IO.Compression": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.fedora.23-x64.runtime.native.System.Net.Http": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.fedora.23-x64.runtime.native.System.Net.Security": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.native.System": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.3.0"
+ },
+ "runtime.native.System.Data.SqlClient.sni": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.3.0"
+ },
+ "runtime.native.System.IO.Compression": {
+ "StableVersions": [
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.3.0"
+ },
+ "runtime.native.System.Net.Http": {
+ "StableVersions": [
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.3.0"
+ },
+ "runtime.native.System.Net.Security": {
+ "StableVersions": [
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.3.0"
+ },
+ "runtime.native.System.Security.Cryptography": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.3.0"
+ },
+ "runtime.opensuse.13.2-x64.Microsoft.NETCore.TestHost": {},
+ "runtime.opensuse.13.2-x64.runtime.native.System": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.opensuse.13.2-x64.runtime.native.System.IO.Compression": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.opensuse.13.2-x64.runtime.native.System.Net.Http": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.opensuse.13.2-x64.runtime.native.System.Net.Security": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.osx.10.10-x64.Microsoft.NETCore.TestHost": {},
+ "runtime.osx.10.10-x64.runtime.native.System": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.osx.10.10-x64.runtime.native.System.IO.Compression": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.osx.10.10-x64.runtime.native.System.Net.Http": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.osx.10.10-x64.runtime.native.System.Net.Security": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.rhel.7-x64.Microsoft.NETCore.TestHost": {},
+ "runtime.rhel.7-x64.runtime.native.System": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.rhel.7-x64.runtime.native.System.IO.Compression": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.rhel.7-x64.runtime.native.System.Net.Http": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.rhel.7-x64.runtime.native.System.Net.Security": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.ubuntu.14.04-x64.Microsoft.NETCore.TestHost": {},
+ "runtime.ubuntu.14.04-x64.runtime.native.System": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.ubuntu.14.04-x64.runtime.native.System.IO.Compression": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.ubuntu.14.04-x64.runtime.native.System.Net.Http": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.ubuntu.14.04-x64.runtime.native.System.Net.Security": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.ubuntu.16.04-x64.Microsoft.NETCore.TestHost": {},
+ "runtime.ubuntu.16.04-x64.runtime.native.System": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.ubuntu.16.04-x64.runtime.native.System.IO.Compression": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.ubuntu.16.04-x64.runtime.native.System.Net.Http": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.ubuntu.16.04-x64.runtime.native.System.Net.Security": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.unix.Microsoft.Win32.Primitives": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.unix.System.Console": {
+ "StableVersions": [
+ "4.0.0"
+ ]
+ },
+ "runtime.unix.System.Diagnostics.Debug": {
+ "StableVersions": [
+ "4.0.11"
+ ]
+ },
+ "runtime.unix.System.IO.FileSystem": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.unix.System.Net.Primitives": {
+ "StableVersions": [
+ "4.0.11"
+ ]
+ },
+ "runtime.unix.System.Net.Sockets": {
+ "StableVersions": [
+ "4.1.0"
+ ]
+ },
+ "runtime.unix.System.Private.Uri": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.unix.System.Runtime.Extensions": {
+ "StableVersions": [
+ "4.1.0"
+ ]
+ },
+ "runtime.win.Microsoft.Win32.Primitives": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.win.System.Console": {
+ "StableVersions": [
+ "4.0.0"
+ ]
+ },
+ "runtime.win.System.Diagnostics.Debug": {
+ "StableVersions": [
+ "4.0.11"
+ ]
+ },
+ "runtime.win.System.IO.FileSystem": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.win.System.Net.Primitives": {
+ "StableVersions": [
+ "4.0.11"
+ ]
+ },
+ "runtime.win.System.Net.Sockets": {
+ "StableVersions": [
+ "4.1.0"
+ ]
+ },
+ "runtime.win.System.Runtime.Extensions": {
+ "StableVersions": [
+ "4.1.0"
+ ]
+ },
+ "runtime.win10-x86-aot.runtime.native.System.IO.Compression": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR": {
+ "StableVersions": [
+ "1.0.1",
+ "1.0.2"
+ ]
+ },
+ "runtime.win7-x64.Microsoft.NETCore.TestHost": {
+ "StableVersions": [
+ "1.0.0"
+ ]
+ },
+ "runtime.win7-x64.Microsoft.NETCore.Windows.ApiSets": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.win7-x64.runtime.native.System.Data.SqlClient.sni": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.win7-x64.runtime.native.System.IO.Compression": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.win7-x86.Microsoft.NETCore.Runtime.CoreCLR": {
+ "StableVersions": [
+ "1.0.1",
+ "1.0.2"
+ ]
+ },
+ "runtime.win7-x86.Microsoft.NETCore.TestHost": {
+ "StableVersions": [
+ "1.0.0"
+ ]
+ },
+ "runtime.win7-x86.Microsoft.NETCore.Windows.ApiSets": {
+ "StableVersions": [
+ "1.0.1"
+ ]
+ },
+ "runtime.win7-x86.runtime.native.System.Data.SqlClient.sni": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.win7-x86.runtime.native.System.IO.Compression": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.win7.System.Private.Uri": {
+ "StableVersions": [
+ "4.0.1",
+ "4.0.2"
+ ]
+ },
+ "runtime.win8-arm.runtime.native.System.IO.Compression": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "System.AppContext": {
+ "StableVersions": [
+ "4.0.0",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Buffers": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Collections": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.0.11"
+ ],
+ "BaselineVersion": "4.0.11",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.1.0.0": "4.1.0",
+ "4.0.11.0": "4.0.11"
+ }
+ },
+ "System.Collections.Concurrent": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.0.12"
+ ],
+ "BaselineVersion": "4.0.12",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.0.11.0": "4.0.11",
+ "4.0.12.0": "4.0.12"
+ }
+ },
+ "System.Collections.Immutable": {
+ "StableVersions": [
+ "1.1.37",
+ "1.2.0",
+ "1.1.36"
+ ],
+ "BaselineVersion": "1.2.0",
+ "AssemblyVersionInPackageVersion": {
+ "1.1.37.0": "1.1.37",
+ "1.2.0.0": "1.2.0",
+ "1.2.1.0": "1.2.1",
+ "1.1.33.0": "1.1.33",
+ "1.1.36.0": "1.1.36",
+ "1.1.38.0": "1.1.38"
+ }
+ },
+ "System.Collections.NonGeneric": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.0.2",
+ "4.1.0.0": "4.1.0"
+ }
+ },
+ "System.Collections.Specialized": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.0.2"
+ }
+ },
+ "System.ComponentModel": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.ComponentModel.Annotations": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1"
+ }
+ },
+ "System.ComponentModel.EventBasedAsync": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.11",
+ "4.0.10"
+ ],
+ "BaselineVersion": "4.0.11",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.0.11.0": "4.0.11"
+ }
+ },
+ "System.ComponentModel.Primitives": {
+ "StableVersions": [
+ "4.0.0",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.ComponentModel.TypeConverter": {
+ "StableVersions": [
+ "4.0.0",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Console": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Data.Common": {
+ "StableVersions": [
+ "4.0.0",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Data.SqlClient": {
+ "StableVersions": [
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1",
+ "4.0.10.0": "4.0.10"
+ }
+ },
+ "System.Diagnostics.Contracts": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Diagnostics.Debug": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.0.11"
+ ],
+ "BaselineVersion": "4.0.11",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.0.11.0": "4.0.11"
+ }
+ },
+ "System.Diagnostics.DiagnosticSource": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Diagnostics.FileVersionInfo": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Diagnostics.Process": {
+ "StableVersions": [
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1"
+ }
+ },
+ "System.Diagnostics.StackTrace": {
+ "StableVersions": [
+ "4.0.1",
+ "4.0.0",
+ "4.0.2"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.1.0": "4.0.1",
+ "4.0.3.0": "4.3.0",
+ "4.0.0.0": "4.0.0",
+ "4.0.2.0": "4.0.2"
+ }
+ },
+ "System.Diagnostics.TextWriterTraceListener": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Diagnostics.Tools": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Diagnostics.TraceSource": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Diagnostics.Tracing": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.0.20",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.0.20.0": "4.0.20",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1",
+ "4.0.21.0": "4.0.21"
+ }
+ },
+ "System.Drawing.Primitives": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "System.Dynamic.Runtime": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.0.11"
+ ],
+ "BaselineVersion": "4.0.11",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.0.11.0": "4.0.11"
+ }
+ },
+ "System.Globalization": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.0.11"
+ ],
+ "BaselineVersion": "4.0.11",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.1.0.0": "4.0.12",
+ "4.0.11.0": "4.0.11"
+ }
+ },
+ "System.Globalization.Calendars": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.0.2"
+ }
+ },
+ "System.Globalization.Extensions": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.0.2"
+ }
+ },
+ "System.IO": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1",
+ "4.2.0.0": "4.2.0",
+ "4.0.11.0": "4.0.11"
+ }
+ },
+ "System.IO.Compression": {
+ "StableVersions": [
+ "4.0.0",
+ "4.1.0",
+ "4.1.1"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.1.0.0": "4.1.0",
+ "4.1.2.0": "4.1.2",
+ "4.2.0.0": "4.2.0",
+ "4.1.1.0": "4.1.1"
+ }
+ },
+ "System.IO.Compression.ZipFile": {
+ "StableVersions": [
+ "4.0.1",
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.0.2",
+ "4.0.0.0": "4.0.0"
+ }
+ },
+ "System.IO.FileSystem": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.0.2"
+ }
+ },
+ "System.IO.FileSystem.AccessControl": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.IO.FileSystem.DriveInfo": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "System.IO.FileSystem.Primitives": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.0.2"
+ }
+ },
+ "System.IO.FileSystem.Watcher": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "System.IO.IsolatedStorage": {
+ "StableVersions": [
+ "4.0.1",
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.3.0",
+ "4.0.0.0": "4.0.0"
+ }
+ },
+ "System.IO.MemoryMappedFiles": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.IO.Packaging": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "System.IO.Pipes": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.IO.UnmanagedMemoryStream": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.0.2"
+ }
+ },
+ "System.Linq": {
+ "StableVersions": [
+ "4.0.0",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Linq.Expressions": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1",
+ "4.0.11.0": "4.0.11"
+ }
+ },
+ "System.Linq.Parallel": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Linq.Queryable": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Net.Http": {
+ "StableVersions": [
+ "4.0.0",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Net.Http.Rtc": {
+ "StableVersions": [
+ "4.0.1",
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.3.0",
+ "4.0.0.0": "4.0.0"
+ }
+ },
+ "System.Net.Http.WinHttpHandler": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "System.Net.NameResolution": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Net.NetworkInformation": {
+ "StableVersions": [
+ "4.0.0",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1",
+ "4.0.10.0": "4.0.10"
+ }
+ },
+ "System.Net.Ping": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "System.Net.Primitives": {
+ "StableVersions": [
+ "3.9.0",
+ "4.0.0",
+ "4.0.10",
+ "4.0.11"
+ ],
+ "BaselineVersion": "4.0.11",
+ "AssemblyVersionInPackageVersion": {
+ "3.9.0.0": "3.9.0",
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.0.11.0": "4.0.11"
+ }
+ },
+ "System.Net.Requests": {
+ "StableVersions": [
+ "3.9.0",
+ "4.0.0",
+ "4.0.11",
+ "4.0.10"
+ ],
+ "BaselineVersion": "4.0.11",
+ "AssemblyVersionInPackageVersion": {
+ "3.9.0.0": "3.9.0",
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.0.11.0": "4.0.11"
+ }
+ },
+ "System.Net.Security": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Net.Sockets": {
+ "StableVersions": [
+ "4.1.0",
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1",
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.1.0",
+ "4.0.10.0": "4.0.10"
+ }
+ },
+ "System.Net.WebHeaderCollection": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Net.WebSockets": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Net.WebSockets.Client": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Numerics.Vectors": {
+ "StableVersions": [
+ "4.0.0",
+ "4.1.0",
+ "4.1.1"
+ ],
+ "BaselineVersion": "4.1.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1",
+ "4.1.2.0": "4.3.0"
+ }
+ },
+ "System.Numerics.Vectors.WindowsRuntime": {
+ "StableVersions": [
+ "4.0.1",
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.3.0",
+ "4.0.0.0": "4.0.0"
+ }
+ },
+ "System.ObjectModel": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.0.12"
+ ],
+ "BaselineVersion": "4.0.12",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.0.11.0": "4.0.11",
+ "4.0.12.0": "4.0.12"
+ }
+ },
+ "System.Private.DataContractSerialization": {
+ "StableVersions": [
+ "4.1.1",
+ "4.0.0",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.3.0"
+ },
+ "System.Private.Networking": {
+ "StableVersions": [
+ "4.0.0"
+ ]
+ },
+ "System.Private.ServiceModel": {
+ "StableVersions": [
+ "4.0.0",
+ "4.1.0"
+ ]
+ },
+ "System.Private.Uri": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.3.0"
+ },
+ "System.Reflection": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1"
+ }
+ },
+ "System.Reflection.Context": {
+ "StableVersions": [
+ "4.0.1",
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0"
+ }
+ },
+ "System.Reflection.DispatchProxy": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.3.0"
+ }
+ },
+ "System.Reflection.Emit": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Reflection.Emit.ILGeneration": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Reflection.Emit.Lightweight": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Reflection.Extensions": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Reflection.Metadata": {
+ "StableVersions": [
+ "1.0.22",
+ "1.3.0",
+ "1.1.0",
+ "1.2.0"
+ ],
+ "BaselineVersion": "1.4.0",
+ "AssemblyVersionInPackageVersion": {
+ "1.0.22.0": "1.0.22",
+ "1.3.0.0": "1.3.0",
+ "1.4.0.0": "1.4.0",
+ "1.4.1.0": "1.4.1",
+ "1.1.0.0": "1.1.0",
+ "1.2.0.0": "1.2.0",
+ "1.2.1.0": "1.2.1"
+ }
+ },
+ "System.Reflection.Primitives": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Reflection.TypeExtensions": {
+ "StableVersions": [
+ "4.0.0",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Resources.Reader": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "System.Resources.ResourceManager": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Resources.Writer": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "System.Runtime": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.0.20",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.0.20.0": "4.0.20",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1",
+ "4.2.0.0": "4.2.0",
+ "4.0.21.0": "4.0.21"
+ }
+ },
+ "System.Runtime.CompilerServices.Unsafe": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.2.0": "4.3.0"
+ }
+ },
+ "System.Runtime.CompilerServices.VisualC": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "System.Runtime.Extensions": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1",
+ "4.2.0.0": "4.2.0",
+ "4.0.11.0": "4.0.11"
+ }
+ },
+ "System.Runtime.Handles": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Runtime.InteropServices": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.0.20",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.0.20.0": "4.0.20",
+ "4.1.0.0": "4.1.0",
+ "4.2.0.0": "4.2.0",
+ "4.0.21.0": "4.0.21"
+ }
+ },
+ "System.Runtime.InteropServices.RuntimeInformation": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Runtime.InteropServices.WindowsRuntime": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0"
+ }
+ },
+ "System.Runtime.Loader": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Runtime.Numerics": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Runtime.Serialization.Json": {
+ "StableVersions": [
+ "4.0.2",
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.2",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.0.2"
+ }
+ },
+ "System.Runtime.Serialization.Primitives": {
+ "StableVersions": [
+ "4.0.0",
+ "4.1.1",
+ "4.0.10",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.1.1.0": "4.1.1",
+ "4.2.0.0": "4.2.0",
+ "4.1.2.0": "4.3.0",
+ "4.0.10.0": "4.0.10",
+ "4.1.0.0": "4.1.0"
+ }
+ },
+ "System.Runtime.Serialization.Xml": {
+ "StableVersions": [
+ "4.0.0",
+ "4.1.1",
+ "4.0.10",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.1.1.0": "4.1.1",
+ "4.1.2.0": "4.1.2",
+ "4.0.10.0": "4.0.10",
+ "4.1.0.0": "4.1.0"
+ }
+ },
+ "System.Runtime.WindowsRuntime": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.0.11"
+ ],
+ "BaselineVersion": "4.0.11",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.0.11.0": "4.0.11",
+ "4.0.12.0": "4.3.0"
+ }
+ },
+ "System.Runtime.WindowsRuntime.UI.Xaml": {
+ "StableVersions": [
+ "4.0.1",
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.3.0",
+ "4.0.0.0": "4.0.0"
+ }
+ },
+ "System.Security.AccessControl": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Security.Claims": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.0.2"
+ }
+ },
+ "System.Security.Cryptography.Algorithms": {
+ "StableVersions": [
+ "4.2.0"
+ ],
+ "BaselineVersion": "4.2.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.1.0.0": "4.1.0",
+ "4.2.0.0": "4.2.0",
+ "4.2.1.0": "4.2.1"
+ }
+ },
+ "System.Security.Cryptography.Cng": {
+ "StableVersions": [
+ "4.2.0"
+ ],
+ "BaselineVersion": "4.2.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.1.0.0": "4.1.0",
+ "4.2.0.0": "4.2.0",
+ "4.2.1.0": "4.2.1"
+ }
+ },
+ "System.Security.Cryptography.Csp": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "System.Security.Cryptography.Encoding": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Security.Cryptography.OpenSsl": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "System.Security.Cryptography.Pkcs": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "System.Security.Cryptography.Primitives": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Security.Cryptography.ProtectedData": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "System.Security.Cryptography.X509Certificates": {
+ "StableVersions": [
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.1.1"
+ }
+ },
+ "System.Security.Principal": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Security.Principal.Windows": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Security.SecureString": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "System.ServiceModel.Duplex": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "AssemblyVersionInPackageVersion": {
+ "4.0.1.0": "4.0.1",
+ "4.0.0.0": "4.0.0"
+ }
+ },
+ "System.ServiceModel.Http": {
+ "StableVersions": [
+ "4.0.10",
+ "4.1.0",
+ "3.9.0",
+ "4.0.0"
+ ],
+ "AssemblyVersionInPackageVersion": {
+ "4.1.0.0": "4.1.0",
+ "3.9.0.0": "3.9.0",
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10"
+ }
+ },
+ "System.ServiceModel.NetTcp": {
+ "StableVersions": [
+ "4.0.0",
+ "4.1.0"
+ ],
+ "AssemblyVersionInPackageVersion": {
+ "4.1.0.0": "4.1.0",
+ "4.0.0.0": "4.0.0"
+ }
+ },
+ "System.ServiceModel.Primitives": {
+ "StableVersions": [
+ "4.0.0",
+ "4.1.0",
+ "3.9.0"
+ ],
+ "AssemblyVersionInPackageVersion": {
+ "4.1.0.0": "4.1.0",
+ "3.9.0.0": "3.9.0",
+ "4.0.0.0": "4.0.0"
+ }
+ },
+ "System.ServiceModel.Security": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1",
+ "3.9.0"
+ ],
+ "AssemblyVersionInPackageVersion": {
+ "4.0.1.0": "4.0.1",
+ "3.9.0.0": "3.9.0",
+ "4.0.0.0": "4.0.0"
+ }
+ },
+ "System.ServiceProcess.ServiceController": {
+ "StableVersions": [
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.1.0.0": "4.1.0",
+ "4.1.1.0": "4.3.0",
+ "4.0.0.0": "4.0.0"
+ }
+ },
+ "System.Text.Encoding": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.0.11"
+ ],
+ "BaselineVersion": "4.0.11",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.0.11.0": "4.0.11"
+ }
+ },
+ "System.Text.Encoding.CodePages": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.0.2"
+ }
+ },
+ "System.Text.Encoding.Extensions": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.0.11"
+ ],
+ "BaselineVersion": "4.0.11",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.0.11.0": "4.0.11"
+ }
+ },
+ "System.Text.Encodings.Web": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "System.Text.RegularExpressions": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.1.0"
+ ],
+ "BaselineVersion": "4.1.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.1.0.0": "4.0.12",
+ "4.2.0.0": "4.2.0",
+ "4.0.11.0": "4.0.11",
+ "4.0.12.0": "4.0.12"
+ }
+ },
+ "System.Threading": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.0.11"
+ ],
+ "BaselineVersion": "4.0.11",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.0.11.0": "4.0.11"
+ }
+ },
+ "System.Threading.AccessControl": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "System.Threading.Overlapped": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.0.2"
+ }
+ },
+ "System.Threading.Tasks": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.0.11"
+ ],
+ "BaselineVersion": "4.0.11",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.0.11.0": "4.0.11"
+ }
+ },
+ "System.Threading.Tasks.Dataflow": {
+ "StableVersions": [
+ "4.6.0",
+ "4.5.25"
+ ],
+ "BaselineVersion": "4.6.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.6.0.0": "4.6.0",
+ "4.6.1.0": "4.6.1",
+ "4.5.25.0": "4.5.25",
+ "4.5.26.0": "4.5.26"
+ }
+ },
+ "System.Threading.Tasks.Extensions": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.1.0.0": "4.1.0"
+ }
+ },
+ "System.Threading.Tasks.Parallel": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Threading.Thread": {
+ "StableVersions": [
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.0",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Threading.ThreadPool": {
+ "StableVersions": [
+ "4.0.10"
+ ],
+ "BaselineVersion": "4.0.10",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.10.0": "4.0.10",
+ "4.0.11.0": "4.0.11"
+ }
+ },
+ "System.Threading.Timer": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1"
+ }
+ },
+ "System.Xml.ReaderWriter": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.0.11"
+ ],
+ "BaselineVersion": "4.0.11",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.1.0.0": "4.0.11",
+ "4.0.11.0": "4.0.11"
+ }
+ },
+ "System.Xml.XDocument": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.0.11"
+ ],
+ "BaselineVersion": "4.0.11",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.0.11.0": "4.0.11"
+ }
+ },
+ "System.Xml.XmlDocument": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.0.2"
+ }
+ },
+ "System.Xml.XmlSerializer": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.10",
+ "4.0.11"
+ ],
+ "BaselineVersion": "4.0.11",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.10.0": "4.0.10",
+ "4.0.11.0": "4.0.11"
+ }
+ },
+ "System.Xml.XPath": {
+ "StableVersions": [
+ "4.0.0",
+ "4.0.1"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.0.0": "4.0.0",
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.0.2"
+ }
+ },
+ "System.Xml.XPath.XDocument": {
+ "StableVersions": [
+ "4.0.1",
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.1.0": "4.0.1",
+ "4.0.0.0": "4.0.0",
+ "4.0.2.0": "4.3.0"
+ }
+ },
+ "System.Xml.XPath.XmlDocument": {
+ "StableVersions": [
+ "4.0.1",
+ "4.0.0"
+ ],
+ "BaselineVersion": "4.0.1",
+ "AssemblyVersionInPackageVersion": {
+ "4.0.1.0": "4.0.1",
+ "4.0.2.0": "4.3.0",
+ "4.0.0.0": "4.0.0"
+ }
+ },
+ "Microsoft.Private.PackageBaseline": {},
+ "Microsoft.NETCore.ConsoleHost": {},
+ "Microsoft.NETCore.Runtime.CoreCLR-arm": {
+ "StableVersions": [
+ "1.0.0"
+ ]
+ },
+ "Microsoft.NETCore.Runtime.CoreCLR-x64": {
+ "StableVersions": [
+ "1.0.0"
+ ]
+ },
+ "Microsoft.NETCore.Runtime.CoreCLR-x86": {
+ "StableVersions": [
+ "1.0.0"
+ ]
+ },
+ "Microsoft.NETCore.Targets.DNXCore": {
+ "StableVersions": [
+ "4.9.0"
+ ]
+ },
+ "Microsoft.NETCore.Windows.ApiSets-x64": {
+ "StableVersions": [
+ "1.0.0"
+ ]
+ },
+ "Microsoft.NETCore.Windows.ApiSets-x86": {
+ "StableVersions": [
+ "1.0.0"
+ ]
+ },
+ "runtime.any.System.Private.DataContractSerialization": {
+ "StableVersions": [
+ "4.1.0"
+ ]
+ },
+ "runtime.aot.System.Private.DataContractSerialization": {
+ "StableVersions": [
+ "4.1.0"
+ ]
+ },
+ "runtime.debian.8-x64.Microsoft.NETCore.ConsoleHost": {},
+ "runtime.fedora.23-x64.Microsoft.NETCore.ConsoleHost": {},
+ "runtime.opensuse.13.2-x64.Microsoft.NETCore.ConsoleHost": {},
+ "runtime.osx.10.10-x64.Microsoft.NETCore.ConsoleHost": {},
+ "runtime.rhel.7-x64.Microsoft.NETCore.ConsoleHost": {},
+ "runtime.ubuntu.14.04-x64.Microsoft.NETCore.ConsoleHost": {},
+ "runtime.ubuntu.16.04-x64.Microsoft.NETCore.ConsoleHost": {},
+ "runtime.win10-arm-aot.runtime.native.System.IO.Compression": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.win10-x64-aot.runtime.native.System.IO.Compression": {
+ "StableVersions": [
+ "4.0.1"
+ ]
+ },
+ "runtime.win7-x64.Microsoft.NETCore.ConsoleHost": {},
+ "runtime.win7-x86.Microsoft.NETCore.ConsoleHost": {},
+ "runtime.win8-arm.Microsoft.NETCore.Runtime.CoreCLR": {
+ "StableVersions": [
+ "1.0.1",
+ "1.0.2"
+ ]
+ },
+ "System.IO.Compression.clrcompression-arm": {
+ "StableVersions": [
+ "4.0.0"
+ ]
+ },
+ "System.IO.Compression.clrcompression-x64": {
+ "StableVersions": [
+ "4.0.0"
+ ]
+ },
+ "System.IO.Compression.clrcompression-x86": {
+ "StableVersions": [
+ "4.0.0"
+ ]
+ },
+ "System.Composition.AttributedModel": {
+ "AssemblyVersionInPackageVersion": {
+ "1.0.31.0": "1.0.31"
+ }
+ },
+ "System.Composition.Convention": {
+ "AssemblyVersionInPackageVersion": {
+ "1.0.31.0": "1.0.31"
+ }
+ },
+ "System.Composition.Hosting": {
+ "AssemblyVersionInPackageVersion": {
+ "1.0.31.0": "1.0.31"
+ }
+ },
+ "System.Composition.Runtime": {
+ "AssemblyVersionInPackageVersion": {
+ "1.0.31.0": "1.0.31"
+ }
+ },
+ "System.Composition.TypedParts": {
+ "AssemblyVersionInPackageVersion": {
+ "1.0.31.0": "1.0.31"
+ }
+ },
+ "System.Composition": {},
+ "System.Diagnostics.Debug.SymbolReader": {
+ "AssemblyVersionInPackageVersion": {
+ "1.0.0.0": "4.3.0"
+ }
+ },
+ "System.IO.Pipes.AccessControl": {
+ "AssemblyVersionInPackageVersion": {
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "System.Runtime.Serialization.Formatters": {
+ "AssemblyVersionInPackageVersion": {
+ "4.0.1.0": "4.3.0"
+ }
+ },
+ "System.ValueTuple": {
+ "AssemblyVersionInPackageVersion": {
+ "4.0.1.0": "4.3.0"
+ }
+ }
+ },
+ "ModulesToPackages": {
+ "System.Native": "runtime.native.System",
+ "sni.dll": "runtime.native.System.Data.SqlClient.sni",
+ "clrcompression.dll": "runtime.native.System.IO.Compression",
+ "System.IO.Compression.Native": "runtime.native.System.IO.Compression",
+ "System.Net.Http.Native": "runtime.native.System.Net.Http",
+ "System.Net.Security.Native": "runtime.native.System.Net.Security",
+ "System.Security.Cryptography.Native": "runtime.native.System.Security.Cryptography",
+ "System.Security.Cryptography.Native.Apple": "runtime.native.System.Security.Cryptography.Apple",
+ "System.Security.Cryptography.Native.OpenSsl": "runtime.native.System.Security.Cryptography.OpenSsl"
+ }
+} \ No newline at end of file
diff --git a/pkg/Microsoft.Private.PackageBaseline/stable.packages.props b/pkg/Microsoft.Private.PackageBaseline/stable.packages.props
deleted file mode 100644
index a703497cd4..0000000000
--- a/pkg/Microsoft.Private.PackageBaseline/stable.packages.props
+++ /dev/null
@@ -1,1321 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <!-- Metadata stable release 1.2 -->
- <StablePackage Include="System.Reflection.Metadata">
- <Version>1.2.0</Version>
- </StablePackage>
-
- <!-- Packages shipped stable at VS 2015 Update 2 for UWP 5.1.0 meta-package -->
- <StablePackage Include="Microsoft.NETCore.UniversalWindowsPlatform">
- <Version>5.1.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Runtime">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Runtime.CoreCLR">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win8-arm.Microsoft.NETCore.Runtime.CoreCLR">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win7-x86.Microsoft.NETCore.Runtime.CoreCLR">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Runtime.Native">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Serialization.Json">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Serialization.Primitives">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Serialization.Xml">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Private.DataContractSerialization">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.any.System.Private.DataContractSerialization">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.aot.System.Private.DataContractSerialization">
- <Version>4.1.0</Version>
- </StablePackage>
-
- <!-- Packages shipped stable at Dev14 RTM -->
- <StablePackage Include="Microsoft.CSharp">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.VisualBasic">
- <Version>10.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.Win32.Primitives">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.AppContext">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Collections.Concurrent">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Collections">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Collections.NonGeneric">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Collections.Specialized">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.ComponentModel">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.ComponentModel.Annotations">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.ComponentModel.EventBasedAsync">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.ComponentModel.Primitives">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.ComponentModel.TypeConverter">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Data.Common">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Diagnostics.Contracts">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Diagnostics.Debug">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Diagnostics.StackTrace">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Diagnostics.Tools">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Diagnostics.Tracing">
- <Version>4.0.20</Version>
- </StablePackage>
- <StablePackage Include="System.Dynamic.Runtime">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Globalization">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Globalization.Calendars">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Globalization.Extensions">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.IO.Compression">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.IO.Compression.ZipFile">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.IO">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.IO.FileSystem.Primitives">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.IO.FileSystem">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.IO.UnmanagedMemoryStream">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Linq">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Linq.Expressions">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Linq.Queryable">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Linq.Parallel">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Net.Http">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Net.Http.Rtc">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Net.NetworkInformation">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Net.Primitives">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Net.Requests">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Net.Sockets">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Net.WebHeaderCollection">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Numerics.Vectors">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.ObjectModel">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.Context">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.DispatchProxy">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.Extensions">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.Primitives">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.TypeExtensions">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Resources.ResourceManager">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime">
- <Version>4.0.20</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Extensions">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.InteropServices">
- <Version>4.0.20</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.InteropServices.WindowsRuntime">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Handles">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Numerics">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Serialization.Json">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Serialization.Primitives">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Serialization.Xml">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.WindowsRuntime">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.WindowsRuntime.UI.Xaml">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Security.Claims">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Security.Principal">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Text.Encoding">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Text.Encoding.CodePages">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Text.Encoding.Extensions">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Text.RegularExpressions">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Threading">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Threading.Tasks">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Threading.Tasks.Parallel">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Threading.Timer">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Threading.Overlapped">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Xml.ReaderWriter">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Xml.XDocument">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Xml.XmlDocument">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Xml.XmlSerializer">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Xml.XPath">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Xml.XPath.XDocument">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Xml.XPath.XmlDocument">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.IO.IsolatedStorage">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore">
- <Version>5.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Platforms">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Portable.Compatibility">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Runtime">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Runtime.CoreCLR-arm">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Runtime.CoreCLR-x64">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Runtime.CoreCLR-x86">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Runtime.Native">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Targets">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Targets.DNXCore">
- <Version>4.9.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Targets.NETFramework">
- <Version>4.6.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Targets.UniversalWindowsPlatform">
- <Version>5.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.UniversalWindowsPlatform">
- <Version>5.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Windows.ApiSets-x86">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Windows.ApiSets-x64">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Collections.Immutable">
- <Version>1.1.37</Version>
- </StablePackage>
- <StablePackage Include="System.IO.Compression.clrcompression-arm">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.IO.Compression.clrcompression-x64">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.IO.Compression.clrcompression-x86">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Numerics.Vectors.WindowsRuntime">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Private.Uri">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Private.Networking">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Private.DataContractSerialization">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.Emit">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.Emit.ILGeneration">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.Emit.Lightweight">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.Metadata">
- <Version>1.0.22</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.Metadata">
- <Version>1.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Threading.Tasks.Dataflow">
- <Version>4.5.25</Version>
- </StablePackage>
- <StablePackage Include="System.Numerics.Vectors.WindowsRuntime">
- <Version>4.0.0</Version>
- </StablePackage>
-
- <!-- Dowlevel packages that shipped in a previous release -->
- <StablePackage Include="System.Collections.Concurrent">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Collections">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.ComponentModel.Annotations">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.ComponentModel.EventBasedAsync">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Diagnostics.Debug">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Diagnostics.Tracing">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Diagnostics.Tracing">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Dynamic.Runtime">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Globalization">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.IO">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Linq.Expressions">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Net.Primitives">
- <Version>3.9.0</Version>
- </StablePackage>
- <StablePackage Include="System.Net.Primitives">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Net.Requests">
- <Version>3.9.0</Version>
- </StablePackage>
- <StablePackage Include="System.Net.Requests">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.ObjectModel">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Extensions">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.InteropServices">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.InteropServices">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Serialization.Primitives">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Serialization.Xml">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.WindowsRuntime">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Text.Encoding.Extensions">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Text.Encoding">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Text.RegularExpressions">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Threading.Tasks">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Threading">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Xml.ReaderWriter">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Xml.XDocument">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Xml.XmlSerializer">
- <Version>4.0.0</Version>
- </StablePackage>
-
-
- <!-- NETCore 1.0 -->
- <StablePackage Include="Microsoft.CSharp">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Platforms">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Targets">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.Private.PackageBaseline">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.VisualBasic">
- <Version>10.0.1</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.Win32.Primitives">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.Win32.Registry">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.Win32.Registry.AccessControl">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="NETStandard.Library">
- <Version>1.6.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.any.System.Collections">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="runtime.any.System.Diagnostics.Tools">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.any.System.Diagnostics.Tracing">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.any.System.Globalization">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="runtime.any.System.Globalization.Calendars">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.any.System.IO">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.any.System.Reflection">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.any.System.Reflection.Extensions">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.any.System.Reflection.Primitives">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.any.System.Resources.ResourceManager">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.any.System.Runtime">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.any.System.Runtime.Handles">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.any.System.Runtime.InteropServices">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.any.System.Text.Encoding">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="runtime.any.System.Text.Encoding.Extensions">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="runtime.any.System.Threading.Tasks">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="runtime.any.System.Threading.Timer">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.aot.System.Collections">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="runtime.aot.System.Diagnostics.Tools">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.aot.System.Diagnostics.Tracing">
- <Version>4.0.20</Version>
- </StablePackage>
- <StablePackage Include="runtime.aot.System.Globalization">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="runtime.aot.System.Globalization.Calendars">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.aot.System.IO">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.aot.System.Reflection">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="runtime.aot.System.Reflection.Extensions">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.aot.System.Reflection.Primitives">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.aot.System.Resources.ResourceManager">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.aot.System.Runtime">
- <Version>4.0.20</Version>
- </StablePackage>
- <StablePackage Include="runtime.aot.System.Runtime.Handles">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.aot.System.Runtime.InteropServices">
- <Version>4.0.20</Version>
- </StablePackage>
- <StablePackage Include="runtime.aot.System.Text.Encoding">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="runtime.aot.System.Text.Encoding.Extensions">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="runtime.aot.System.Threading.Tasks">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="runtime.aot.System.Threading.Timer">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.debian.8-x64.runtime.native.System">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.debian.8-x64.runtime.native.System.IO.Compression">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.debian.8-x64.runtime.native.System.Net.Http">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.debian.8-x64.runtime.native.System.Net.Security">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.debian.8-x64.runtime.native.System.Security.Cryptography">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.fedora.23-x64.runtime.native.System">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.fedora.23-x64.runtime.native.System.IO.Compression">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.fedora.23-x64.runtime.native.System.Net.Http">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.fedora.23-x64.runtime.native.System.Net.Security">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.fedora.23-x64.runtime.native.System.Security.Cryptography">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.native.System">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.native.System.Data.SqlClient.sni">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.native.System.IO.Compression">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.native.System.Net.Http">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.native.System.Net.Security">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.native.System.Security.Cryptography">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.opensuse.13.2-x64.runtime.native.System">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.opensuse.13.2-x64.runtime.native.System.IO.Compression">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.opensuse.13.2-x64.runtime.native.System.Net.Http">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.opensuse.13.2-x64.runtime.native.System.Net.Security">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.osx.10.10-x64.runtime.native.System">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.osx.10.10-x64.runtime.native.System.IO.Compression">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.osx.10.10-x64.runtime.native.System.Net.Http">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.osx.10.10-x64.runtime.native.System.Net.Security">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.rhel.7-x64.runtime.native.System">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.rhel.7-x64.runtime.native.System.IO.Compression">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.rhel.7-x64.runtime.native.System.Net.Http">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.rhel.7-x64.runtime.native.System.Net.Security">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.rhel.7-x64.runtime.native.System.Security.Cryptography">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.ubuntu.14.04-x64.runtime.native.System">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.ubuntu.14.04-x64.runtime.native.System.IO.Compression">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.ubuntu.14.04-x64.runtime.native.System.Net.Http">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.ubuntu.14.04-x64.runtime.native.System.Net.Security">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.ubuntu.16.04-x64.runtime.native.System">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.ubuntu.16.04-x64.runtime.native.System.IO.Compression">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.ubuntu.16.04-x64.runtime.native.System.Net.Http">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.ubuntu.16.04-x64.runtime.native.System.Net.Security">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.unix.Microsoft.Win32.Primitives">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.unix.System.Console">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.unix.System.Diagnostics.Debug">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="runtime.unix.System.IO.FileSystem">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.unix.System.Net.Primitives">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="runtime.unix.System.Net.Sockets">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.unix.System.Private.Uri">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.unix.System.Runtime.Extensions">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.win.Microsoft.Win32.Primitives">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win.System.Console">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.win.System.Diagnostics.Debug">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="runtime.win.System.IO.FileSystem">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win.System.Net.Primitives">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="runtime.win.System.Net.Sockets">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.win.System.Runtime.Extensions">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.win7.System.Private.Uri">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win7-arm.runtime.native.System.IO.Compression">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win7-x64.runtime.native.System.Data.SqlClient.sni">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win7-x64.runtime.native.System.IO.Compression">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win7-x86.runtime.native.System.Data.SqlClient.sni">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win7-x86.runtime.native.System.IO.Compression">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win8-arm.runtime.native.System.IO.Compression">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win8-x64.runtime.native.System.IO.Compression">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win8-x86.runtime.native.System.IO.Compression">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.AppContext">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Buffers">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Collections">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="System.Collections.Concurrent">
- <Version>4.0.12</Version>
- </StablePackage>
- <StablePackage Include="System.Collections.Immutable">
- <Version>1.2.0</Version>
- </StablePackage>
- <StablePackage Include="System.Collections.NonGeneric">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Collections.Specialized">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.ComponentModel">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.ComponentModel.Annotations">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.ComponentModel.EventBasedAsync">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="System.ComponentModel.Primitives">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.ComponentModel.TypeConverter">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Console">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Data.Common">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Data.SqlClient">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Diagnostics.Contracts">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Diagnostics.Debug">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="System.Diagnostics.DiagnosticSource">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Diagnostics.FileVersionInfo">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Diagnostics.Process">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Diagnostics.StackTrace">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Diagnostics.TextWriterTraceListener">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Diagnostics.Tools">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Diagnostics.TraceSource">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Diagnostics.Tracing">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Drawing.Primitives">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Dynamic.Runtime">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="System.Globalization">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="System.Globalization.Calendars">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Globalization.Extensions">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.IO">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.IO.Compression">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.IO.Compression.ZipFile">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.IO.FileSystem">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.IO.FileSystem.AccessControl">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.IO.FileSystem.DriveInfo">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.IO.FileSystem.Primitives">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.IO.FileSystem.Watcher">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.IO.IsolatedStorage">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.IO.MemoryMappedFiles">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.IO.Packaging">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.IO.Pipes">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.IO.UnmanagedMemoryStream">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Linq">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Linq.Expressions">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Linq.Parallel">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Linq.Queryable">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Net.Http">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Net.Http.Rtc">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Net.Http.WinHttpHandler">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Net.NameResolution">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Net.NetworkInformation">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Net.Ping">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Net.Primitives">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="System.Net.Requests">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="System.Net.Security">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Net.Sockets">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Net.WebHeaderCollection">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Net.WebSockets">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Net.WebSockets.Client">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Numerics.Vectors">
- <Version>4.1.1</Version>
- </StablePackage>
- <StablePackage Include="System.Numerics.Vectors.WindowsRuntime">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.ObjectModel">
- <Version>4.0.12</Version>
- </StablePackage>
- <StablePackage Include="System.Private.DataContractSerialization">
- <Version>4.1.1</Version>
- </StablePackage>
- <StablePackage Include="System.Private.Uri">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.Context">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.DispatchProxy">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.Emit">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.Emit.ILGeneration">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.Emit.Lightweight">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.Extensions">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.Metadata">
- <Version>1.3.0</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.Primitives">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Reflection.TypeExtensions">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Resources.Reader">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Resources.ResourceManager">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Resources.Writer">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.CompilerServices.Unsafe">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.CompilerServices.VisualC">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Extensions">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Handles">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.InteropServices">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.InteropServices.RuntimeInformation">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.InteropServices.WindowsRuntime">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Loader">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Numerics">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Serialization.Json">
- <Version>4.0.2</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Serialization.Primitives">
- <Version>4.1.1</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.Serialization.Xml">
- <Version>4.1.1</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.WindowsRuntime">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="System.Runtime.WindowsRuntime.UI.Xaml">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Security.AccessControl">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Security.Claims">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Security.Cryptography.Algorithms">
- <Version>4.2.0</Version>
- </StablePackage>
- <StablePackage Include="System.Security.Cryptography.Cng">
- <Version>4.2.0</Version>
- </StablePackage>
- <StablePackage Include="System.Security.Cryptography.Csp">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Security.Cryptography.Encoding">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Security.Cryptography.OpenSsl">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Security.Cryptography.Pkcs">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Security.Cryptography.Primitives">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Security.Cryptography.ProtectedData">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Security.Cryptography.X509Certificates">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Security.Principal">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Security.Principal.Windows">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Security.SecureString">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.ServiceProcess.ServiceController">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Text.Encoding">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="System.Text.Encoding.CodePages">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Text.Encoding.Extensions">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="System.Text.Encodings.Web">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Text.RegularExpressions">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.Threading">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="System.Threading.AccessControl">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Threading.Overlapped">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Threading.Tasks">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="System.Threading.Tasks.Dataflow">
- <Version>4.6.0</Version>
- </StablePackage>
- <StablePackage Include="System.Threading.Tasks.Extensions">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Threading.Tasks.Parallel">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Threading.Thread">
- <Version>4.0.0</Version>
- </StablePackage>
- <StablePackage Include="System.Threading.ThreadPool">
- <Version>4.0.10</Version>
- </StablePackage>
- <StablePackage Include="System.Threading.Timer">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Xml.ReaderWriter">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="System.Xml.XDocument">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="System.Xml.XmlDocument">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Xml.XmlSerializer">
- <Version>4.0.11</Version>
- </StablePackage>
- <StablePackage Include="System.Xml.XPath">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Xml.XPath.XDocument">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.Xml.XPath.XmlDocument">
- <Version>4.0.1</Version>
- </StablePackage>
-
- <!-- NETCore 1.0 TFS -->
- <StablePackage Include="Microsoft.NETCore.ConsoleHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.debian.8-x64.Microsoft.NETCore.ConsoleHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.fedora.23-x64.Microsoft.NETCore.ConsoleHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.opensuse.13.2-x64.Microsoft.NETCore.ConsoleHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.osx.10.10-x64.Microsoft.NETCore.ConsoleHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.rhel.7-x64.Microsoft.NETCore.ConsoleHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.ubuntu.14.04-x64.Microsoft.NETCore.ConsoleHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.ubuntu.16.04-x64.Microsoft.NETCore.ConsoleHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.win7-arm.Microsoft.NETCore.ConsoleHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.win7-x64.Microsoft.NETCore.ConsoleHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.win7-x86.Microsoft.NETCore.ConsoleHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Portable.Compatibility">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.TestHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.debian.8-x64.Microsoft.NETCore.TestHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.fedora.23-x64.Microsoft.NETCore.TestHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.opensuse.13.2-x64.Microsoft.NETCore.TestHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.osx.10.10-x64.Microsoft.NETCore.TestHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.rhel.7-x64.Microsoft.NETCore.TestHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.ubuntu.14.04-x64.Microsoft.NETCore.TestHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.ubuntu.16.04-x64.Microsoft.NETCore.TestHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.win7-arm.Microsoft.NETCore.TestHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.win7-x64.Microsoft.NETCore.TestHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="runtime.win7-x86.Microsoft.NETCore.TestHost">
- <Version>1.0.0</Version>
- </StablePackage>
- <StablePackage Include="Microsoft.NETCore.Windows.ApiSets">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win7-x64.Microsoft.NETCore.Windows.ApiSets">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win7-x86.Microsoft.NETCore.Windows.ApiSets">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win8-x64.Microsoft.NETCore.Windows.ApiSets">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win8-x86.Microsoft.NETCore.Windows.ApiSets">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win81-x64.Microsoft.NETCore.Windows.ApiSets">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win81-x86.Microsoft.NETCore.Windows.ApiSets">
- <Version>1.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win10-arm-aot.runtime.native.System.IO.Compression">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win10-x64-aot.runtime.native.System.IO.Compression">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win10-x86-aot.runtime.native.System.IO.Compression">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="runtime.win8-arm.Microsoft.NETCore.Runtime.CoreCLR">
- <Version>1.0.2</Version>
- </StablePackage>
-
- <!-- NETCore 1.0 WCF -->
- <StablePackage Include="System.Private.ServiceModel">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.ServiceModel.Duplex">
- <Version>4.0.1</Version>
- </StablePackage>
- <StablePackage Include="System.ServiceModel.Http">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.ServiceModel.NetTcp">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.ServiceModel.Primitives">
- <Version>4.1.0</Version>
- </StablePackage>
- <StablePackage Include="System.ServiceModel.Security">
- <Version>4.0.1</Version>
- </StablePackage>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/pkg/baseline/baseline.props b/pkg/baseline/baseline.props
index 13110d4d31..1596d8ebed 100644
--- a/pkg/baseline/baseline.props
+++ b/pkg/baseline/baseline.props
@@ -1,3 +1,9 @@
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\Microsoft.Private.PackageBaseline\Microsoft.Private.PackageBaseline.props" />
+
+ <PropertyGroup>
+ <!-- Set PackageIndexFile to point to our local repo's index. This tells the packaging targets
+ which index should be used for updates -->
+ <PackageIndexFile>$(MSBuildThisFileDirectory)..\Microsoft.Private.PackageBaseline\packageIndex.json</PackageIndexFile>
+ </PropertyGroup>
</Project>
diff --git a/run-test.sh b/run-test.sh
index c8a50fd6ad..15829cad7c 100755
--- a/run-test.sh
+++ b/run-test.sh
@@ -44,6 +44,10 @@ usage()
echo " --restrict-proj <regex> Run test projects that match regex"
echo " default: .* (all projects)"
echo " --useServerGC Enable Server GC for this test run"
+ echo " --test-dir <path> Run tests only in the specified directory. Path is relative to the directory"
+ echo " specified by --corefx-tests"
+ echo " --test-dir-file <path> Run tests only in the directories specified by the file at <path>. Paths are"
+ echo " listed one line, relative to the directory specified by --corefx-tests"
echo
echo "Runtime Code Coverage options:"
echo " --coreclr-coverage Optional argument to get coreclr code coverage reports"
@@ -152,10 +156,36 @@ link_files_in_directory()
done
}
+# $1 is the path of list file
+read_array()
+{
+ local theArray=()
+
+ while IFS='' read -r line || [ -n "$line" ]; do
+ theArray[${#theArray[@]}]=$line
+ done < "$1"
+ echo ${theArray[@]}
+}
+
+run_selected_tests()
+{
+ local selectedTests=()
+
+ if [ -n "$TestDirFile" ]; then
+ selectedTests=($(read_array "$TestDirFile"))
+ fi
+
+ if [ -n "$TestDir" ]; then
+ selectedTests[${#selectedTests[@]}]="$TestDir"
+ fi
+
+ run_all_tests ${selectedTests[@]/#/$CoreFxTests/}
+}
+
# $1 is the name of the platform folder (e.g Unix.AnyCPU.Debug)
run_all_tests()
{
- for testFolder in "$CoreFxTests/$1/"*
+ for testFolder in $@
do
run_test $testFolder &
pids="$pids $!"
@@ -310,6 +340,12 @@ do
--useServerGC)
((serverGC = 1))
;;
+ --test-dir)
+ TestDir=$2
+ ;;
+ --test-dir-file)
+ TestDirFile=$2
+ ;;
--outerloop)
OuterLoop=""
;;
@@ -408,9 +444,14 @@ else
fi
fi
-run_all_tests "AnyOS.AnyCPU.$ConfigurationGroup"
-run_all_tests "Unix.AnyCPU.$ConfigurationGroup"
-run_all_tests "$OS.AnyCPU.$ConfigurationGroup"
+if [ -n "$TestDirFile" ] || [ -n "$TestDir" ]
+then
+ run_selected_tests
+else
+ run_all_tests "$CoreFxTests/AnyOS.AnyCPU.$ConfigurationGroup/"*
+ run_all_tests "$CoreFxTests/Unix.AnyCPU.$ConfigurationGroup/"*
+ run_all_tests "$CoreFxTests/$OS.AnyCPU.$ConfigurationGroup/"*
+fi
if [ "$CoreClrCoverage" == "ON" ]
then
diff --git a/run.cmd b/run.cmd
index b532968157..a0ddf00d9d 100644
--- a/run.cmd
+++ b/run.cmd
@@ -23,6 +23,5 @@ if NOT [%ERRORLEVEL%]==[0] exit /b 1
set _toolRuntime=%~dp0Tools
set _dotnet=%_toolRuntime%\dotnetcli\dotnet.exe
-echo Running: %_dotnet% %_toolRuntime%\run.exe %*
call %_dotnet% %_toolRuntime%\run.exe %*
exit /b %ERRORLEVEL% \ No newline at end of file
diff --git a/run.sh b/run.sh
index 64354936ff..cd70f8bcf8 100755
--- a/run.sh
+++ b/run.sh
@@ -9,6 +9,5 @@ fi
__toolRuntime=$__scriptpath/Tools
__dotnet=$__toolRuntime/dotnetcli/dotnet
-echo Running: $__dotnet $__toolRuntime/run.exe $*
$__dotnet $__toolRuntime/run.exe $*
exit $?
diff --git a/scripts/arm32_ci_script.sh b/scripts/arm32_ci_script.sh
index 2c8cef9bb3..0fbafd6eb0 100755
--- a/scripts/arm32_ci_script.sh
+++ b/scripts/arm32_ci_script.sh
@@ -78,7 +78,15 @@ function check_git_head {
function unmount_rootfs {
local rootfsFolder="$1"
- if grep -qs "$rootfsFolder" /proc/mounts; then
+ #Check if there are any open files in this directory.
+ if [ -d $rootfsFolder ]; then
+ #If we find information about the file
+ if sudo lsof +D $rootfsFolder; then
+ (set +x; echo 'See above for lsof information. Continuing with the build.')
+ fi
+ fi
+
+ if mountpoint -q -- "$rootfsFolder"; then
sudo umount "$rootfsFolder"
fi
}
@@ -98,9 +106,6 @@ function unmount_emulator {
#Clean the changes made to the environment by the script
function clean_env {
- #Unmount the emulator
- unmount_emulator
-
#Check for revert of git changes
check_git_head
}
@@ -111,12 +116,35 @@ function handle_ctrl_c {
echo 'ERROR: Ctrl-C handled. Script aborted before complete execution.'
- clean_env
-
exit 1
}
trap handle_ctrl_c INT
+#Trap Exit and handle it
+ function handle_exit {
+ set +x
+
+ echo 'The script is exited. Cleaning environment..'
+
+ clean_env
+ }
+trap handle_exit EXIT
+
+#Mount with checking to be already existed
+function mount_with_checking {
+ set +x
+ local options="$1"
+ local from="$2"
+ local rootfsFolder="$3"
+
+ if mountpoint -q -- "$rootfsFolder"; then
+ (set +x; echo "$rootfsFolder is already mounted.")
+ else {
+ (set -x; sudo mount $options "$from" "$rootfsFolder")
+ }
+ fi
+}
+
#Mount emulator to the target mount path
function mount_emulator {
#Check if the mount path exists and create if neccessary
@@ -124,15 +152,13 @@ function mount_emulator {
sudo mkdir "$__ARMRootfsMountPath"
fi
- #Unmount the emulator if already mounted at the mount path and mount again
- unmount_emulator
-
- sudo mount "$__ARMEmulPath"/platform/rootfs-t30.ext4 "$__ARMRootfsMountPath"
- sudo mount -t proc /proc "$__ARMRootfsMountPath"/proc
- sudo mount -o bind /dev/ "$__ARMRootfsMountPath"/dev
- sudo mount -o bind /dev/pts "$__ARMRootfsMountPath"/dev/pts
- sudo mount -t tmpfs shm "$__ARMRootfsMountPath"/run/shm
- sudo mount -o bind /sys "$__ARMRootfsMountPath"/sys
+ set +x
+ mount_with_checking "" "$__ARMEmulPath/platform/rootfs-t30.ext4" "$__ARMRootfsMountPath"
+ mount_with_checking "-t proc" "/proc" "$__ARMRootfsMountPath/proc"
+ mount_with_checking "-o bind" "/dev/" "$__ARMRootfsMountPath/dev"
+ mount_with_checking "-o bind" "/dev/pts" "$__ARMRootfsMountPath/dev/pts"
+ mount_with_checking "-t tmpfs" "shm" "$__ARMRootfsMountPath/run/shm"
+ mount_with_checking "-o bind" "/sys" "$__ARMRootfsMountPath/sys"
}
#Cross builds corefx
diff --git a/src/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.cs b/src/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.cs
index 57266ba3c9..98662b34a0 100644
--- a/src/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.cs
+++ b/src/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.cs
@@ -54,7 +54,7 @@ internal static partial class Interop
internal ulong rsslim;
//internal ulong startcode;
//internal ulong endcode;
- internal ulong startstack;
+ //internal ulong startstack;
//internal ulong kstkesp;
//internal ulong kstkeip;
//internal ulong signal;
@@ -254,9 +254,6 @@ internal static partial class Interop
results.vsize = parser.ParseNextUInt64();
results.rss = parser.ParseNextInt64();
results.rsslim = parser.ParseNextUInt64();
- parser.MoveNextOrFail(); // startcode
- parser.MoveNextOrFail(); // endcode
- results.startstack = parser.ParseNextUInt64();
// The following lines are commented out as there's no need to parse through
// the rest of the entry (we've gotten all of the data we need). Should any
@@ -264,6 +261,9 @@ internal static partial class Interop
// through and including the one that's needed. For now, these are being left
// commented to document what's available in the remainder of the entry.
+ //parser.MoveNextOrFail(); // startcode
+ //parser.MoveNextOrFail(); // endcode
+ //parser.MoveNextOrFail(); // startstack
//parser.MoveNextOrFail(); // kstkesp
//parser.MoveNextOrFail(); // kstkeip
//parser.MoveNextOrFail(); // signal
diff --git a/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Digest.cs b/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Digest.cs
new file mode 100644
index 0000000000..ff3857a603
--- /dev/null
+++ b/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Digest.cs
@@ -0,0 +1,45 @@
+// 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.Runtime.InteropServices;
+using System.Security.Cryptography.Apple;
+
+internal static partial class Interop
+{
+ internal static partial class AppleCrypto
+ {
+ [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_DigestFree")]
+ internal static extern void DigestFree(IntPtr handle);
+
+ [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_DigestCreate")]
+ internal static extern SafeDigestCtxHandle DigestCreate(PAL_HashAlgorithm algorithm, out int cbDigest);
+
+ [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_DigestUpdate")]
+ internal static extern unsafe int DigestUpdate(SafeDigestCtxHandle ctx, byte* pbData, int cbData);
+
+ [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_DigestFinal")]
+ internal static extern unsafe int DigestFinal(SafeDigestCtxHandle ctx, byte* pbOutput, int cbOutput);
+ }
+}
+
+namespace System.Security.Cryptography.Apple
+{
+ internal sealed class SafeDigestCtxHandle : SafeHandle
+ {
+ internal SafeDigestCtxHandle()
+ : base(IntPtr.Zero, ownsHandle: true)
+ {
+ }
+
+ protected override bool ReleaseHandle()
+ {
+ Interop.AppleCrypto.DigestFree(handle);
+ SetHandle(IntPtr.Zero);
+ return true;
+ }
+
+ public override bool IsInvalid => handle == IntPtr.Zero;
+ }
+}
diff --git a/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Err.cs b/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Err.cs
index 297bca7c99..a6ffb436c5 100644
--- a/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Err.cs
+++ b/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Err.cs
@@ -9,6 +9,7 @@ internal static partial class Interop
{
internal static partial class AppleCrypto
{
+ internal const string CCCryptorStatus = "CCCryptorStatus";
internal const string CCRNGStatus = "CCRNGStatus";
internal static Exception CreateExceptionForCCError(int errorCode, string errorType)
diff --git a/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs b/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs
new file mode 100644
index 0000000000..117d3b4bcf
--- /dev/null
+++ b/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs
@@ -0,0 +1,48 @@
+// 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.Runtime.InteropServices;
+using System.Security.Cryptography.Apple;
+
+internal static partial class Interop
+{
+ internal static partial class AppleCrypto
+ {
+ [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_HmacFree")]
+ internal static extern void HmacFree(IntPtr handle);
+
+ [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_HmacCreate")]
+ internal static extern SafeHmacHandle HmacCreate(PAL_HashAlgorithm algorithm, ref int cbDigest);
+
+ [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_HmacInit")]
+ internal static extern unsafe int HmacInit(SafeHmacHandle ctx, byte* pbKey, int cbKey);
+
+ [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_HmacUpdate")]
+ internal static extern unsafe int HmacUpdate(SafeHmacHandle ctx, byte* pbData, int cbData);
+
+ [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_HmacFinal")]
+ internal static extern unsafe int HmacFinal(SafeHmacHandle ctx, byte* pbOutput, int cbOutput);
+ }
+}
+
+namespace System.Security.Cryptography.Apple
+{
+ internal sealed class SafeHmacHandle : SafeHandle
+ {
+ internal SafeHmacHandle()
+ : base(IntPtr.Zero, ownsHandle: true)
+ {
+ }
+
+ protected override bool ReleaseHandle()
+ {
+ Interop.AppleCrypto.HmacFree(handle);
+ SetHandle(IntPtr.Zero);
+ return true;
+ }
+
+ public override bool IsInvalid => handle == IntPtr.Zero;
+ }
+}
diff --git a/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.PAL_HashAlgorithm.cs b/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.PAL_HashAlgorithm.cs
new file mode 100644
index 0000000000..5931e3b63a
--- /dev/null
+++ b/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.PAL_HashAlgorithm.cs
@@ -0,0 +1,19 @@
+// 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 AppleCrypto
+ {
+ internal enum PAL_HashAlgorithm
+ {
+ Unknown = 0,
+ Md5,
+ Sha1,
+ Sha256,
+ Sha384,
+ Sha512,
+ }
+ }
+}
diff --git a/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Symmetric.cs b/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Symmetric.cs
new file mode 100644
index 0000000000..2ce6c6b616
--- /dev/null
+++ b/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Symmetric.cs
@@ -0,0 +1,99 @@
+// 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.Runtime.InteropServices;
+using System.Security.Cryptography;
+
+internal static partial class Interop
+{
+ internal static partial class AppleCrypto
+ {
+ internal enum PAL_SymmetricAlgorithm
+ {
+ AES = 0,
+ TripleDES = 2,
+ }
+
+ internal enum PAL_SymmetricOperation
+ {
+ Encrypt = 0,
+ Decrypt = 1,
+ }
+
+ internal enum PAL_PaddingMode
+ {
+ None = 0,
+ Pkcs7 = 1,
+ }
+
+ internal enum PAL_ChainingMode
+ {
+ ECB = 1,
+ CBC = 2,
+ }
+
+ internal enum PAL_SymmetricOptions
+ {
+ None = 0,
+ }
+
+ [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_CryptorFree")]
+ internal static extern void CryptorFree(IntPtr handle);
+
+ [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_CryptorCreate")]
+ internal static extern unsafe int CryptorCreate(
+ PAL_SymmetricOperation operation,
+ PAL_SymmetricAlgorithm algorithm,
+ PAL_ChainingMode chainingMode,
+ PAL_PaddingMode paddingMode,
+ byte* pbKey,
+ int cbKey,
+ byte* pbIv,
+ PAL_SymmetricOptions options,
+ out SafeAppleCryptorHandle cryptor,
+ out int ccStatus);
+
+ [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_CryptorUpdate")]
+ internal static extern unsafe int CryptorUpdate(
+ SafeAppleCryptorHandle cryptor,
+ byte* pbData,
+ int cbData,
+ byte* pbOutput,
+ int cbOutput,
+ out int cbWritten,
+ out int ccStatus);
+
+ [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_CryptorFinal")]
+ internal static extern unsafe int CryptorFinal(
+ SafeAppleCryptorHandle cryptor,
+ byte* pbOutput,
+ int cbOutput,
+ out int cbWritten,
+ out int ccStatus);
+
+ [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_CryptorReset")]
+ internal static extern unsafe int CryptorReset(SafeAppleCryptorHandle cryptor, byte* pbIv, out int ccStatus);
+ }
+}
+
+namespace System.Security.Cryptography
+{
+ internal class SafeAppleCryptorHandle : SafeHandle
+ {
+ public SafeAppleCryptorHandle()
+ : base(IntPtr.Zero, ownsHandle: true)
+ {
+ }
+
+ protected override bool ReleaseHandle()
+ {
+ Interop.AppleCrypto.CryptorFree(handle);
+ SetHandle(IntPtr.Zero);
+ return true;
+ }
+
+ public override bool IsInvalid => handle == IntPtr.Zero;
+ }
+}
diff --git a/src/Common/src/Interop/Unix/Interop.Libraries.cs b/src/Common/src/Interop/Unix/Interop.Libraries.cs
index cbe8fc1f5a..e6d9078450 100644
--- a/src/Common/src/Interop/Unix/Interop.Libraries.cs
+++ b/src/Common/src/Interop/Unix/Interop.Libraries.cs
@@ -10,7 +10,7 @@ internal static partial class Interop
internal const string SystemNative = "System.Native";
internal const string HttpNative = "System.Net.Http.Native";
internal const string NetSecurityNative = "System.Net.Security.Native";
- internal const string CryptoNative = "System.Security.Cryptography.Native";
+ internal const string CryptoNative = "System.Security.Cryptography.Native.OpenSsl";
internal const string GlobalizationNative = "System.Globalization.Native";
internal const string CompressionNative = "System.IO.Compression.Native";
}
diff --git a/src/Common/src/Interop/Windows/Crypt32/Interop.FindOidInfo.cs b/src/Common/src/Interop/Windows/Crypt32/Interop.FindOidInfo.cs
index cd8e400733..586045ffea 100644
--- a/src/Common/src/Interop/Windows/Crypt32/Interop.FindOidInfo.cs
+++ b/src/Common/src/Interop/Windows/Crypt32/Interop.FindOidInfo.cs
@@ -97,7 +97,7 @@ internal static partial class Interop
IntPtr allGroupOidInfo = CryptFindOIDInfo(keyType, rawKey, OidGroup.All);
if (allGroupOidInfo != IntPtr.Zero)
{
- return Marshal.PtrToStructure<CRYPT_OID_INFO>(fullOidInfo);
+ return Marshal.PtrToStructure<CRYPT_OID_INFO>(allGroupOidInfo);
}
}
diff --git a/src/Common/src/Interop/Windows/sspicli/Interop.LSAStructs.cs b/src/Common/src/Interop/Windows/sspicli/Interop.LSAStructs.cs
index 4e03677b1d..3d0d6a6658 100644
--- a/src/Common/src/Interop/Windows/sspicli/Interop.LSAStructs.cs
+++ b/src/Common/src/Interop/Windows/sspicli/Interop.LSAStructs.cs
@@ -54,40 +54,6 @@ internal static partial class Interop
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal struct UNICODE_INTPTR_STRING
{
- /// <remarks>
- /// Note - this constructor extracts the raw pointer from the safe handle, so any
- /// strings created with this version of the constructor will be unsafe to use after the buffer
- /// has been freed.
- /// </remarks>
- [System.Security.SecurityCritical] // auto-generated
- internal UNICODE_INTPTR_STRING(int stringBytes, SafeLocalAllocHandle buffer)
- {
- Debug.Assert(buffer == null || (stringBytes >= 0 && (ulong)stringBytes <= buffer.ByteLength),
- "buffer == null || (stringBytes >= 0 && stringBytes <= buffer.ByteLength)");
-
- this.Length = (ushort)stringBytes;
- this.MaxLength = (ushort)buffer.ByteLength;
-
- // Marshaling with a SafePointer does not work correctly, so unfortunately we need to extract
- // the raw handle here.
- this.Buffer = buffer.DangerousGetHandle();
- }
-
- /// <remarks>
- /// This constructor should be used for constructing UNICODE_STRING structures with pointers
- /// into a block of memory managed by a SafeHandle or the GC. It shouldn't be used to own
- /// any memory on its own.
- /// </remarks>
- internal UNICODE_INTPTR_STRING(int stringBytes, IntPtr buffer)
- {
- Debug.Assert((stringBytes == 0 && buffer == IntPtr.Zero) || (stringBytes > 0 && stringBytes <= UInt16.MaxValue && buffer != IntPtr.Zero),
- "(stringBytes == 0 && buffer == IntPtr.Zero) || (stringBytes > 0 && stringBytes <= UInt16.MaxValue && buffer != IntPtr.Zero)");
-
- this.Length = (ushort)stringBytes;
- this.MaxLength = (ushort)stringBytes;
- this.Buffer = buffer;
- }
-
internal ushort Length;
internal ushort MaxLength;
internal IntPtr Buffer;
diff --git a/src/Common/src/Interop/Windows/sspicli/SecuritySafeHandles.cs b/src/Common/src/Interop/Windows/sspicli/SecuritySafeHandles.cs
index fce6b20cd7..9c71157836 100644
--- a/src/Common/src/Interop/Windows/sspicli/SecuritySafeHandles.cs
+++ b/src/Common/src/Interop/Windows/sspicli/SecuritySafeHandles.cs
@@ -872,7 +872,7 @@ namespace System.Net.Security
GlobalLog.Assert("SafeDeleteContext::AcceptSecurityContext()|inSecBuffer == null || inSecBuffers == null");
}
- Debug.Fail("SafeDeleteContext::AcceptSecurityContext()|outSecBuffer != null");
+ Debug.Fail("SafeDeleteContext::AcceptSecurityContext()|inSecBuffer == null || inSecBuffers == null");
}
if (inCredentials == null)
diff --git a/src/Common/src/Interop/Windows/winhttp/Interop.winhttp.cs b/src/Common/src/Interop/Windows/winhttp/Interop.winhttp.cs
index 34ab141142..4230bf7fd1 100644
--- a/src/Common/src/Interop/Windows/winhttp/Interop.winhttp.cs
+++ b/src/Common/src/Interop/Windows/winhttp/Interop.winhttp.cs
@@ -165,6 +165,14 @@ internal partial class Interop
[DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
+ public static extern bool WinHttpQueryOption(
+ SafeWinHttpHandle handle,
+ uint option,
+ ref uint buffer,
+ ref uint bufferSize);
+
+ [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
public static extern bool WinHttpWriteData(
SafeWinHttpHandle requestHandle,
IntPtr buffer,
diff --git a/src/Common/src/Interop/Windows/winhttp/Interop.winhttp_types.cs b/src/Common/src/Interop/Windows/winhttp/Interop.winhttp_types.cs
index d154a58507..34bea12145 100644
--- a/src/Common/src/Interop/Windows/winhttp/Interop.winhttp_types.cs
+++ b/src/Common/src/Interop/Windows/winhttp/Interop.winhttp_types.cs
@@ -61,6 +61,7 @@ internal partial class Interop
public const ushort INTERNET_DEFAULT_HTTPS_PORT = 443;
public const uint WINHTTP_FLAG_SECURE = 0x00800000;
+ public const uint WINHTTP_FLAG_ESCAPE_DISABLE = 0x00000040;
public const StringBuilder WINHTTP_NO_ADDITIONAL_HEADERS = null;
@@ -149,6 +150,10 @@ internal partial class Interop
public const uint WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS = 111;
+ public const uint WINHTTP_OPTION_ENABLE_HTTP_PROTOCOL = 133;
+ public const uint WINHTTP_OPTION_HTTP_PROTOCOL_USED = 134;
+ public const uint WINHTTP_PROTOCOL_FLAG_HTTP2 = 0x1;
+
public const uint WINHTTP_OPTION_UPGRADE_TO_WEB_SOCKET = 114;
public const uint WINHTTP_OPTION_WEB_SOCKET_CLOSE_TIMEOUT = 115;
public const uint WINHTTP_OPTION_WEB_SOCKET_KEEPALIVE_INTERVAL = 116;
diff --git a/src/Common/src/System/Dynamic/Utils/Error.cs b/src/Common/src/System/Dynamic/Utils/Error.cs
index a898afd706..6479c3d027 100644
--- a/src/Common/src/System/Dynamic/Utils/Error.cs
+++ b/src/Common/src/System/Dynamic/Utils/Error.cs
@@ -74,17 +74,17 @@ namespace System.Dynamic.Utils
/// <summary>
/// ArgumentException with message like "Incorrect number of arguments supplied for call to method '{0}'"
/// </summary>
- internal static Exception IncorrectNumberOfMethodCallArguments(object p0)
+ internal static Exception IncorrectNumberOfMethodCallArguments(object p0, string paramName)
{
- return new ArgumentException(Strings.IncorrectNumberOfMethodCallArguments(p0));
+ return new ArgumentException(Strings.IncorrectNumberOfMethodCallArguments(p0), paramName);
}
/// <summary>
/// ArgumentException with message like "Expression of type '{0}' cannot be used for constructor parameter of type '{1}'"
/// </summary>
- internal static Exception ExpressionTypeDoesNotMatchConstructorParameter(object p0, object p1)
+ internal static Exception ExpressionTypeDoesNotMatchConstructorParameter(object p0, object p1, string paramName)
{
- return new ArgumentException(Strings.ExpressionTypeDoesNotMatchConstructorParameter(p0, p1));
+ return new ArgumentException(Strings.ExpressionTypeDoesNotMatchConstructorParameter(p0, p1), paramName);
}
}
}
diff --git a/src/Common/src/System/Dynamic/Utils/ExpressionUtils.cs b/src/Common/src/System/Dynamic/Utils/ExpressionUtils.cs
index cf7a27b21b..98dc81b6d7 100644
--- a/src/Common/src/System/Dynamic/Utils/ExpressionUtils.cs
+++ b/src/Common/src/System/Dynamic/Utils/ExpressionUtils.cs
@@ -87,7 +87,7 @@ namespace System.Dynamic.Utils
return ((ReadOnlyCollection<T>)collectionOrT)[0];
}
- public static void ValidateArgumentTypes(MethodBase method, ExpressionType nodeKind, ref ReadOnlyCollection<Expression> arguments)
+ public static void ValidateArgumentTypes(MethodBase method, ExpressionType nodeKind, ref ReadOnlyCollection<Expression> arguments, string methodParamName)
{
Debug.Assert(nodeKind == ExpressionType.Invoke || nodeKind == ExpressionType.Call || nodeKind == ExpressionType.Dynamic || nodeKind == ExpressionType.New);
@@ -100,7 +100,7 @@ namespace System.Dynamic.Utils
{
Expression arg = arguments[i];
ParameterInfo pi = pis[i];
- arg = ValidateOneArgument(method, nodeKind, arg, pi);
+ arg = ValidateOneArgument(method, nodeKind, arg, pi, methodParamName, nameof(arguments));
if (newArgs == null && arg != arguments[i])
{
@@ -134,22 +134,22 @@ namespace System.Dynamic.Utils
throw Error.IncorrectNumberOfLambdaArguments();
case ExpressionType.Dynamic:
case ExpressionType.Call:
- throw Error.IncorrectNumberOfMethodCallArguments(method);
+ throw Error.IncorrectNumberOfMethodCallArguments(method, nameof(method));
default:
throw ContractUtils.Unreachable;
}
}
}
- public static Expression ValidateOneArgument(MethodBase method, ExpressionType nodeKind, Expression arguments, ParameterInfo pi)
+ public static Expression ValidateOneArgument(MethodBase method, ExpressionType nodeKind, Expression arguments, ParameterInfo pi, string methodParamName, string argumentParamName)
{
- RequiresCanRead(arguments, nameof(arguments));
+ RequiresCanRead(arguments, argumentParamName);
Type pType = pi.ParameterType;
if (pType.IsByRef)
{
pType = pType.GetElementType();
}
- TypeUtils.ValidateType(pType, nameof(pi));
+ TypeUtils.ValidateType(pType, methodParamName);
if (!TypeUtils.AreReferenceAssignable(pType, arguments.Type))
{
if (!TryQuote(pType, ref arguments))
@@ -158,7 +158,7 @@ namespace System.Dynamic.Utils
switch (nodeKind)
{
case ExpressionType.New:
- throw Error.ExpressionTypeDoesNotMatchConstructorParameter(arguments.Type, pType);
+ throw Error.ExpressionTypeDoesNotMatchConstructorParameter(arguments.Type, pType, argumentParamName);
case ExpressionType.Invoke:
throw Error.ExpressionTypeDoesNotMatchParameter(arguments.Type, pType);
case ExpressionType.Dynamic:
diff --git a/src/Common/src/System/IO/PathInternal.Windows.cs b/src/Common/src/System/IO/PathInternal.Windows.cs
index 4dda1cfce9..3a0ea05fac 100644
--- a/src/Common/src/System/IO/PathInternal.Windows.cs
+++ b/src/Common/src/System/IO/PathInternal.Windows.cs
@@ -188,9 +188,36 @@ namespace System.IO
/// NUL, or any ASCII char whose integer representation is in the range of 1 through 31).
/// Does not check for wild card characters ? and *.
/// </summary>
- internal static bool HasIllegalCharacters(string path, bool checkAdditional = false)
+ internal static bool HasIllegalCharacters(string path)
{
- return path.IndexOfAny(InvalidPathChars) >= 0;
+ // This is equivalent to IndexOfAny(InvalidPathChars) >= 0,
+ // except faster since IndexOfAny grows slower as the input
+ // array grows larger.
+ // Since we know that some of the characters we're looking
+ // for are contiguous in the alphabet-- the path cannot contain
+ // characters 0-31-- we can optimize this for our specific use
+ // case and use simple comparison operations.
+
+ for (int i = 0; i < path.Length; i++)
+ {
+ char c = path[i];
+
+ if (c <= '\u001f')
+ {
+ return true;
+ }
+
+ switch (c)
+ {
+ case '"':
+ case '<':
+ case '>':
+ case '|':
+ return true;
+ }
+ }
+
+ return false;
}
/// <summary>
diff --git a/src/Common/src/System/Net/HttpKnownHeaderNames.TryGetHeaderName.cs b/src/Common/src/System/Net/HttpKnownHeaderNames.TryGetHeaderName.cs
index 9aec21fc73..83baf1695a 100644
--- a/src/Common/src/System/Net/HttpKnownHeaderNames.TryGetHeaderName.cs
+++ b/src/Common/src/System/Net/HttpKnownHeaderNames.TryGetHeaderName.cs
@@ -9,8 +9,8 @@ namespace System.Net
internal static partial class HttpKnownHeaderNames
{
/// <summary>
- /// Gets a known header name string from a matching char[] array segment, using an ordinal comparison.
- /// Used to avoid allocating new strings for known header names.
+ /// Gets a known header name string from a matching char[] array segment, using a case-sensitive
+ /// ordinal comparison. Used to avoid allocating new strings for known header names.
/// </summary>
public static bool TryGetHeaderName(char[] array, int startIndex, int length, out string name)
{
@@ -24,8 +24,8 @@ namespace System.Net
}
/// <summary>
- /// Gets a known header name string from a matching IntPtr buffer, using an ordinal comparison.
- /// Used to avoid allocating new strings for known header names.
+ /// Gets a known header name string from a matching IntPtr buffer, using a case-sensitive
+ /// ordinal comparison. Used to avoid allocating new strings for known header names.
/// </summary>
public unsafe static bool TryGetHeaderName(IntPtr buffer, int length, out string name)
{
@@ -63,187 +63,196 @@ namespace System.Net
// The lookup works as follows: first switch on the length of the passed-in key.
//
- // - If there is only one known header of that length and the key matches that
- // known header, set it as the out param and return true.
+ // - If there is only one known header of that length, set potentialHeader to that known header
+ // and goto TryMatch to see if the key fully matches potentialHeader.
//
// - If there are more than one known headers of that length, switch on a unique char from that
// set of same-length known headers. Typically this will be the first char, but some sets of
// same-length known headers do not have unique chars in the first position, so a char in a
- // position further in the strings is used. If the key matches one of the known headers,
- // set it as the out param and return true.
+ // position further in the strings is used. If the char from the key matches one of the
+ // known headers, set potentialHeader to that known header and goto TryMatch to see if the key
+ // fully matches potentialHeader.
//
- // - Otherwise, set the out param to null and return false.
+ // - Otherwise, there is no match, so set the out param to null and return false.
+ //
+ // Matching is case-sensitive: we only want to return a known header that exactly matches the key.
+
+ string potentialHeader = null;
switch (length)
{
case 2:
- return TryMatch(TE, key, startIndex, length, equals, out name); // TE
+ potentialHeader = TE; goto TryMatch; // TE
case 3:
switch (charAt(key, startIndex))
{
- case 'A': return TryMatch(Age, key, startIndex, length, equals, out name); // [A]ge
- case 'P': return TryMatch(P3P, key, startIndex, length, equals, out name); // [P]3P
- case 'V': return TryMatch(Via, key, startIndex, length, equals, out name); // [V]ia
+ case 'A': potentialHeader = Age; goto TryMatch; // [A]ge
+ case 'P': potentialHeader = P3P; goto TryMatch; // [P]3P
+ case 'V': potentialHeader = Via; goto TryMatch; // [V]ia
}
break;
case 4:
switch (charAt(key, startIndex))
{
- case 'D': return TryMatch(Date, key, startIndex, length, equals, out name); // [D]ate
- case 'E': return TryMatch(ETag, key, startIndex, length, equals, out name); // [E]Tag
- case 'F': return TryMatch(From, key, startIndex, length, equals, out name); // [F]rom
- case 'H': return TryMatch(Host, key, startIndex, length, equals, out name); // [H]ost
- case 'V': return TryMatch(Vary, key, startIndex, length, equals, out name); // [V]ary
+ case 'D': potentialHeader = Date; goto TryMatch; // [D]ate
+ case 'E': potentialHeader = ETag; goto TryMatch; // [E]Tag
+ case 'F': potentialHeader = From; goto TryMatch; // [F]rom
+ case 'H': potentialHeader = Host; goto TryMatch; // [H]ost
+ case 'V': potentialHeader = Vary; goto TryMatch; // [V]ary
}
break;
case 5:
switch (charAt(key, startIndex))
{
- case 'A': return TryMatch(Allow, key, startIndex, length, equals, out name); // [A]llow
- case 'R': return TryMatch(Range, key, startIndex, length, equals, out name); // [R]ange
+ case 'A': potentialHeader = Allow; goto TryMatch; // [A]llow
+ case 'R': potentialHeader = Range; goto TryMatch; // [R]ange
}
break;
case 6:
switch (charAt(key, startIndex))
{
- case 'A': return TryMatch(Accept, key, startIndex, length, equals, out name); // [A]ccept
- case 'C': return TryMatch(Cookie, key, startIndex, length, equals, out name); // [C]ookie
- case 'E': return TryMatch(Expect, key, startIndex, length, equals, out name); // [E]xpect
- case 'O': return TryMatch(Origin, key, startIndex, length, equals, out name); // [O]rigin
- case 'P': return TryMatch(Pragma, key, startIndex, length, equals, out name); // [P]ragma
- case 'S': return TryMatch(Server, key, startIndex, length, equals, out name); // [S]erver
+ case 'A': potentialHeader = Accept; goto TryMatch; // [A]ccept
+ case 'C': potentialHeader = Cookie; goto TryMatch; // [C]ookie
+ case 'E': potentialHeader = Expect; goto TryMatch; // [E]xpect
+ case 'O': potentialHeader = Origin; goto TryMatch; // [O]rigin
+ case 'P': potentialHeader = Pragma; goto TryMatch; // [P]ragma
+ case 'S': potentialHeader = Server; goto TryMatch; // [S]erver
}
break;
case 7:
switch (charAt(key, startIndex))
{
- case 'C': return TryMatch(Cookie2, key, startIndex, length, equals, out name); // [C]ookie2
- case 'E': return TryMatch(Expires, key, startIndex, length, equals, out name); // [E]xpires
- case 'R': return TryMatch(Referer, key, startIndex, length, equals, out name); // [R]eferer
- case 'T': return TryMatch(Trailer, key, startIndex, length, equals, out name); // [T]railer
- case 'U': return TryMatch(Upgrade, key, startIndex, length, equals, out name); // [U]pgrade
- case 'W': return TryMatch(Warning, key, startIndex, length, equals, out name); // [W]arning
+ case 'C': potentialHeader = Cookie2; goto TryMatch; // [C]ookie2
+ case 'E': potentialHeader = Expires; goto TryMatch; // [E]xpires
+ case 'R': potentialHeader = Referer; goto TryMatch; // [R]eferer
+ case 'T': potentialHeader = Trailer; goto TryMatch; // [T]railer
+ case 'U': potentialHeader = Upgrade; goto TryMatch; // [U]pgrade
+ case 'W': potentialHeader = Warning; goto TryMatch; // [W]arning
}
break;
case 8:
switch (charAt(key, startIndex + 3))
{
- case 'M': return TryMatch(IfMatch, key, startIndex, length, equals, out name); // If-[M]atch
- case 'R': return TryMatch(IfRange, key, startIndex, length, equals, out name); // If-[R]ange
- case 'a': return TryMatch(Location, key, startIndex, length, equals, out name); // Loc[a]tion
+ case 'M': potentialHeader = IfMatch; goto TryMatch; // If-[M]atch
+ case 'R': potentialHeader = IfRange; goto TryMatch; // If-[R]ange
+ case 'a': potentialHeader = Location; goto TryMatch; // Loc[a]tion
}
break;
case 10:
switch (charAt(key, startIndex))
{
- case 'C': return TryMatch(Connection, key, startIndex, length, equals, out name); // [C]onnection
- case 'K': return TryMatch(KeepAlive, key, startIndex, length, equals, out name); // [K]eep-Alive
- case 'S': return TryMatch(SetCookie, key, startIndex, length, equals, out name); // [S]et-Cookie
- case 'U': return TryMatch(UserAgent, key, startIndex, length, equals, out name); // [U]ser-Agent
+ case 'C': potentialHeader = Connection; goto TryMatch; // [C]onnection
+ case 'K': potentialHeader = KeepAlive; goto TryMatch; // [K]eep-Alive
+ case 'S': potentialHeader = SetCookie; goto TryMatch; // [S]et-Cookie
+ case 'U': potentialHeader = UserAgent; goto TryMatch; // [U]ser-Agent
}
break;
case 11:
switch (charAt(key, startIndex))
{
- case 'C': return TryMatch(ContentMD5, key, startIndex, length, equals, out name); // [C]ontent-MD5
- case 'R': return TryMatch(RetryAfter, key, startIndex, length, equals, out name); // [R]etry-After
- case 'S': return TryMatch(SetCookie2, key, startIndex, length, equals, out name); // [S]et-Cookie2
+ case 'C': potentialHeader = ContentMD5; goto TryMatch; // [C]ontent-MD5
+ case 'R': potentialHeader = RetryAfter; goto TryMatch; // [R]etry-After
+ case 'S': potentialHeader = SetCookie2; goto TryMatch; // [S]et-Cookie2
}
break;
case 12:
switch (charAt(key, startIndex))
{
- case 'C': return TryMatch(ContentType, key, startIndex, length, equals, out name); // [C]ontent-Type
- case 'M': return TryMatch(MaxForwards, key, startIndex, length, equals, out name); // [M]ax-Forwards
- case 'X': return TryMatch(XPoweredBy, key, startIndex, length, equals, out name); // [X]-Powered-By
+ case 'C': potentialHeader = ContentType; goto TryMatch; // [C]ontent-Type
+ case 'M': potentialHeader = MaxForwards; goto TryMatch; // [M]ax-Forwards
+ case 'X': potentialHeader = XPoweredBy; goto TryMatch; // [X]-Powered-By
}
break;
case 13:
switch (charAt(key, startIndex + 6))
{
- case '-': return TryMatch(AcceptRanges, key, startIndex, length, equals, out name); // Accept[-]Ranges
- case 'i': return TryMatch(Authorization, key, startIndex, length, equals, out name); // Author[i]zation
- case 'C': return TryMatch(CacheControl, key, startIndex, length, equals, out name); // Cache-[C]ontrol
- case 't': return TryMatch(ContentRange, key, startIndex, length, equals, out name); // Conten[t]-Range
- case 'e': return TryMatch(IfNoneMatch, key, startIndex, length, equals, out name); // If-Non[e]-Match
- case 'o': return TryMatch(LastModified, key, startIndex, length, equals, out name); // Last-M[o]dified
+ case '-': potentialHeader = AcceptRanges; goto TryMatch; // Accept[-]Ranges
+ case 'i': potentialHeader = Authorization; goto TryMatch; // Author[i]zation
+ case 'C': potentialHeader = CacheControl; goto TryMatch; // Cache-[C]ontrol
+ case 't': potentialHeader = ContentRange; goto TryMatch; // Conten[t]-Range
+ case 'e': potentialHeader = IfNoneMatch; goto TryMatch; // If-Non[e]-Match
+ case 'o': potentialHeader = LastModified; goto TryMatch; // Last-M[o]dified
}
break;
case 14:
switch (charAt(key, startIndex))
{
- case 'A': return TryMatch(AcceptCharset, key, startIndex, length, equals, out name); // [A]ccept-Charset
- case 'C': return TryMatch(ContentLength, key, startIndex, length, equals, out name); // [C]ontent-Length
+ case 'A': potentialHeader = AcceptCharset; goto TryMatch; // [A]ccept-Charset
+ case 'C': potentialHeader = ContentLength; goto TryMatch; // [C]ontent-Length
}
break;
case 15:
switch (charAt(key, startIndex + 7))
{
- case 'E': return TryMatch(AcceptEncoding, key, startIndex, length, equals, out name); // Accept-[E]ncoding
- case 'L': return TryMatch(AcceptLanguage, key, startIndex, length, equals, out name); // Accept-[L]anguage
+ case 'E': potentialHeader = AcceptEncoding; goto TryMatch; // Accept-[E]ncoding
+ case 'L': potentialHeader = AcceptLanguage; goto TryMatch; // Accept-[L]anguage
}
break;
case 16:
switch (charAt(key, startIndex + 11))
{
- case 'o': return TryMatch(ContentEncoding, key, startIndex, length, equals, out name); // Content-Enc[o]ding
- case 'g': return TryMatch(ContentLanguage, key, startIndex, length, equals, out name); // Content-Lan[g]uage
- case 'a': return TryMatch(ContentLocation, key, startIndex, length, equals, out name); // Content-Loc[a]tion
- case 'c': return TryMatch(ProxyConnection, key, startIndex, length, equals, out name); // Proxy-Conne[c]tion
- case 'i': return TryMatch(WWWAuthenticate, key, startIndex, length, equals, out name); // WWW-Authent[i]cate
- case 'r': return TryMatch(XAspNetVersion, key, startIndex, length, equals, out name); // X-AspNet-Ve[r]sion
+ case 'o': potentialHeader = ContentEncoding; goto TryMatch; // Content-Enc[o]ding
+ case 'g': potentialHeader = ContentLanguage; goto TryMatch; // Content-Lan[g]uage
+ case 'a': potentialHeader = ContentLocation; goto TryMatch; // Content-Loc[a]tion
+ case 'c': potentialHeader = ProxyConnection; goto TryMatch; // Proxy-Conne[c]tion
+ case 'i': potentialHeader = WWWAuthenticate; goto TryMatch; // WWW-Authent[i]cate
+ case 'r': potentialHeader = XAspNetVersion; goto TryMatch; // X-AspNet-Ve[r]sion
}
break;
case 17:
switch (charAt(key, startIndex))
{
- case 'I': return TryMatch(IfModifiedSince, key, startIndex, length, equals, out name); // [I]f-Modified-Since
- case 'S': return TryMatch(SecWebSocketKey, key, startIndex, length, equals, out name); // [S]ec-WebSocket-Key
- case 'T': return TryMatch(TransferEncoding, key, startIndex, length, equals, out name); // [T]ransfer-Encoding
+ case 'I': potentialHeader = IfModifiedSince; goto TryMatch; // [I]f-Modified-Since
+ case 'S': potentialHeader = SecWebSocketKey; goto TryMatch; // [S]ec-WebSocket-Key
+ case 'T': potentialHeader = TransferEncoding; goto TryMatch; // [T]ransfer-Encoding
}
break;
case 18:
- return TryMatch(ProxyAuthenticate, key, startIndex, length, equals, out name); // Proxy-Authenticate
+ potentialHeader = ProxyAuthenticate; goto TryMatch; // Proxy-Authenticate
case 19:
switch (charAt(key, startIndex))
{
- case 'C': return TryMatch(ContentDisposition, key, startIndex, length, equals, out name); // [C]ontent-Disposition
- case 'I': return TryMatch(IfUnmodifiedSince, key, startIndex, length, equals, out name); // [I]f-Unmodified-Since
- case 'P': return TryMatch(ProxyAuthorization, key, startIndex, length, equals, out name); // [P]roxy-Authorization
+ case 'C': potentialHeader = ContentDisposition; goto TryMatch; // [C]ontent-Disposition
+ case 'I': potentialHeader = IfUnmodifiedSince; goto TryMatch; // [I]f-Unmodified-Since
+ case 'P': potentialHeader = ProxyAuthorization; goto TryMatch; // [P]roxy-Authorization
}
break;
case 20:
- return TryMatch(SecWebSocketAccept, key, startIndex, length, equals, out name); // Sec-WebSocket-Accept
+ potentialHeader = SecWebSocketAccept; goto TryMatch; // Sec-WebSocket-Accept
case 21:
- return TryMatch(SecWebSocketVersion, key, startIndex, length, equals, out name); // Sec-WebSocket-Version
+ potentialHeader = SecWebSocketVersion; goto TryMatch; // Sec-WebSocket-Version
case 22:
- return TryMatch(SecWebSocketProtocol, key, startIndex, length, equals, out name); // Sec-WebSocket-Protocol
+ potentialHeader = SecWebSocketProtocol; goto TryMatch; // Sec-WebSocket-Protocol
case 24:
- return TryMatch(SecWebSocketExtensions, key, startIndex, length, equals, out name); // Sec-WebSocket-Extensions
+ potentialHeader = SecWebSocketExtensions; goto TryMatch; // Sec-WebSocket-Extensions
}
name = null;
return false;
+
+ TryMatch:
+ Debug.Assert(potentialHeader != null);
+ return TryMatch(potentialHeader, key, startIndex, length, equals, out name);
}
/// <summary>
diff --git a/src/Common/src/System/Xml/XmlCharType.cs b/src/Common/src/System/Xml/XmlCharType.cs
index 9046183ddb..11ce7b498e 100644
--- a/src/Common/src/System/Xml/XmlCharType.cs
+++ b/src/Common/src/System/Xml/XmlCharType.cs
@@ -19,7 +19,6 @@ using System.Diagnostics;
namespace System.Xml
{
- /// <include file='doc\XmlCharType.uex' path='docs/doc[@for="XmlCharType"]/*' />
/// <internalonly/>
/// <devdoc>
/// The XmlCharType class is used for quick character type recognition
diff --git a/src/Common/test-runtime/project.json b/src/Common/test-runtime/project.json
index d24fa012d9..f2e3c36139 100644
--- a/src/Common/test-runtime/project.json
+++ b/src/Common/test-runtime/project.json
@@ -23,6 +23,82 @@
"netstandard1.3": {},
"uap10.0": {
"dependencies": {
+ "Microsoft.NETCore.Runtime": "1.0.1",
+ "Microsoft.CSharp": "4.0.1",
+ "Microsoft.VisualBasic": "10.0.1",
+ "System.AppContext": "4.1.0",
+ "System.Collections": "4.0.11",
+ "System.Collections.Concurrent": "4.0.12",
+ "System.Collections.Immutable": "1.2.0",
+ "System.ComponentModel": "4.0.1",
+ "System.ComponentModel.Annotations": "4.1.0",
+ "System.Diagnostics.Debug": "4.0.11",
+ "System.Diagnostics.Tools": "4.0.1",
+ "System.Diagnostics.Tracing": "4.1.0",
+ "System.Dynamic.Runtime": "4.0.11",
+ "System.Globalization": "4.0.11",
+ "System.Globalization.Calendars": "4.0.1",
+ "System.Globalization.Extensions": "4.0.1",
+ "System.IO": "4.1.0",
+ "System.IO.Compression.ZipFile": "4.0.1",
+ "System.IO.FileSystem": "4.0.1",
+ "System.IO.FileSystem.Primitives": "4.0.1",
+ "System.IO.UnmanagedMemoryStream": "4.0.1",
+ "System.Linq": "4.1.0",
+ "System.Linq.Expressions": "4.1.0",
+ "System.Linq.Queryable": "4.0.1",
+ "System.Net.Http": "4.1.0",
+ "System.Net.NetworkInformation": "4.1.0",
+ "System.Net.Primitives": "4.0.11",
+ "System.Numerics.Vectors": "4.1.1",
+ "System.ObjectModel": "4.0.12",
+ "System.Reflection": "4.1.0",
+ "System.Reflection.DispatchProxy": "4.0.1",
+ "System.Reflection.Extensions": "4.0.1",
+ "System.Reflection.Metadata": "1.3.0",
+ "System.Reflection.Primitives": "4.0.1",
+ "System.Reflection.TypeExtensions": "4.1.0",
+ "System.Resources.ResourceManager": "4.0.1",
+ "System.Runtime": "4.1.0",
+ "System.Runtime.Extensions": "4.1.0",
+ "System.Runtime.Handles": "4.0.1",
+ "System.Runtime.InteropServices": "4.1.0",
+ "System.Runtime.Numerics": "4.0.1",
+ "System.Security.Claims": "4.0.1",
+ "System.Security.Principal": "4.0.1",
+ "System.Text.Encoding": "4.0.11",
+ "System.Text.Encoding.Extensions": "4.0.11",
+ "System.Text.RegularExpressions": "4.1.0",
+ "System.Threading": "4.0.11",
+ "System.Threading.Tasks": "4.0.11",
+ "System.Threading.Tasks.Dataflow": "4.6.0",
+ "System.Threading.Tasks.Parallel": "4.0.1",
+ "System.Threading.Timer": "4.0.1",
+ "System.Xml.ReaderWriter": "4.0.11",
+ "System.Xml.XDocument": "4.0.11",
+ "Microsoft.NETCore.Portable.Compatibility": "1.0.2",
+ "Microsoft.Win32.Primitives": "4.0.1",
+ "System.ComponentModel.EventBasedAsync": "4.0.11",
+ "System.Data.Common": "4.1.0",
+ "System.Diagnostics.StackTrace": "4.0.2",
+ "System.IO.IsolatedStorage": "4.0.1",
+ "System.Net.Http.Rtc": "4.0.1",
+ "System.Net.NameResolution": "4.0.0",
+ "System.Net.Requests": "4.0.11",
+ "System.Net.Sockets": "4.1.0",
+ "System.Net.WebHeaderCollection": "4.0.1",
+ "System.Net.WebSockets": "4.0.0",
+ "System.Net.WebSockets.Client": "4.0.0",
+ "System.Numerics.Vectors.WindowsRuntime": "4.0.1",
+ "System.Reflection.Context": "4.0.1",
+ "System.Runtime.InteropServices.WindowsRuntime": "4.0.1",
+ "System.Runtime.Serialization.Json": "4.0.2",
+ "System.Runtime.Serialization.Primitives": "4.1.1",
+ "System.Runtime.Serialization.Xml": "4.1.1",
+ "System.Runtime.WindowsRuntime": "4.0.11",
+ "System.Runtime.WindowsRuntime.UI.Xaml": "4.0.1",
+ "System.Text.Encoding.CodePages": "4.0.1",
+ "System.Xml.XmlSerializer": "4.0.11",
"Microsoft.NETCore.UniversalWindowsPlatform": "5.2.1-beta-000547-00",
"System.Console": "4.1.0-beta-devapi-24424-01",
"microsoft.xunit.runner.uwp": "1.0.3-prerelease-00614-01",
diff --git a/src/Common/tests/System/Collections/ICollection.NonGeneric.Tests.cs b/src/Common/tests/System/Collections/ICollection.NonGeneric.Tests.cs
index 39fec38c11..4fc4ecf580 100644
--- a/src/Common/tests/System/Collections/ICollection.NonGeneric.Tests.cs
+++ b/src/Common/tests/System/Collections/ICollection.NonGeneric.Tests.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
+using System.Collections.Specialized;
using System.Text;
using Xunit;
@@ -287,7 +288,7 @@ namespace System.Collections.Tests
[Theory]
[MemberData(nameof(ValidCollectionSizes))]
- public void ICollection_NonGeneric_CopyTo_IndexEqualToArrayCount_ThrowsArgumentException(int count)
+ public virtual void ICollection_NonGeneric_CopyTo_IndexEqualToArrayCount_ThrowsArgumentException(int count)
{
ICollection collection = NonGenericICollectionFactory(count);
object[] array = new object[count];
@@ -299,16 +300,17 @@ namespace System.Collections.Tests
[Theory]
[MemberData(nameof(ValidCollectionSizes))]
- public void ICollection_NonGeneric_CopyTo_IndexLargerThanArrayCount_ThrowsAnyArgumentException(int count)
+ public virtual void ICollection_NonGeneric_CopyTo_IndexLargerThanArrayCount_ThrowsAnyArgumentException(int count)
{
ICollection collection = NonGenericICollectionFactory(count);
+
object[] array = new object[count];
Assert.Throws(ICollection_NonGeneric_CopyTo_IndexLargerThanArrayCount_ThrowType, () => collection.CopyTo(array, count + 1));
}
[Theory]
[MemberData(nameof(ValidCollectionSizes))]
- public void ICollection_NonGeneric_CopyTo_NotEnoughSpaceInOffsettedArray_ThrowsArgumentException(int count)
+ public virtual void ICollection_NonGeneric_CopyTo_NotEnoughSpaceInOffsettedArray_ThrowsArgumentException(int count)
{
if (count > 0) // Want the T array to have at least 1 element
{
diff --git a/src/Common/tests/System/Collections/TestingTypes.cs b/src/Common/tests/System/Collections/TestingTypes.cs
index 7d672a0bea..e4a5e68522 100644
--- a/src/Common/tests/System/Collections/TestingTypes.cs
+++ b/src/Common/tests/System/Collections/TestingTypes.cs
@@ -232,6 +232,85 @@ namespace System.Collections.Tests
return StructuralComparisons.StructuralEqualityComparer.GetHashCode(obj);
}
}
+
+ public enum SByteEnum : sbyte { }
+ public enum ByteEnum : byte { }
+ public enum ShortEnum : short { }
+ public enum UShortEnum : ushort { }
+ public enum IntEnum : int { }
+ public enum UIntEnum : uint { }
+ public enum LongEnum : long { }
+ public enum ULongEnum : ulong { }
+
+ public class GenericComparable : IComparable<GenericComparable>
+ {
+ private readonly int _value;
+
+ public GenericComparable(int value)
+ {
+ _value = value;
+ }
+
+ public int CompareTo(GenericComparable other) => _value.CompareTo(other._value);
+ }
+
+ public class NonGenericComparable : IComparable
+ {
+ private readonly GenericComparable _inner;
+
+ public NonGenericComparable(int value)
+ {
+ _inner = new GenericComparable(value);
+ }
+
+ public int CompareTo(object other) =>
+ _inner.CompareTo(((NonGenericComparable)other)._inner);
+ }
+
+ public class BadlyBehavingComparable : IComparable<BadlyBehavingComparable>, IComparable
+ {
+ public int CompareTo(BadlyBehavingComparable other) => 1;
+
+ public int CompareTo(object other) => -1;
+ }
+
+ public class MutatingComparable : IComparable<MutatingComparable>, IComparable
+ {
+ private int _state;
+
+ public MutatingComparable(int initialState)
+ {
+ _state = initialState;
+ }
+
+ public int State => _state;
+
+ public int CompareTo(object other) => _state++;
+
+ public int CompareTo(MutatingComparable other) => _state++;
+ }
+
+ public static class ValueComparable
+ {
+ // Convenience method so the compiler can work its type inference magic.
+ public static ValueComparable<T> Create<T>(T value) where T : IComparable<T>
+ {
+ return new ValueComparable<T>(value);
+ }
+ }
+
+ public struct ValueComparable<T> : IComparable<ValueComparable<T>> where T : IComparable<T>
+ {
+ public ValueComparable(T value)
+ {
+ Value = value;
+ }
+
+ public T Value { get; }
+
+ public int CompareTo(ValueComparable<T> other) =>
+ Value.CompareTo(other.Value);
+ }
#endregion
}
diff --git a/src/Common/tests/System/Net/Configuration.Http.cs b/src/Common/tests/System/Net/Configuration.Http.cs
index b7005adb30..e76d5c6e56 100644
--- a/src/Common/tests/System/Net/Configuration.Http.cs
+++ b/src/Common/tests/System/Net/Configuration.Http.cs
@@ -15,6 +15,10 @@ namespace System.Net.Test.Common
public static string SecureHost => GetValue("COREFX_SECUREHTTPHOST", DefaultAzureServer);
public static string Http2Host => GetValue("COREFX_HTTP2HOST", "http2.akamai.com");
+
+ // This server doesn't use HTTP/2 server push (push promise) feature. Some HttpClient implementations
+ // don't support servers that use push right now.
+ public static string Http2NoPushHost => GetValue("COREFX_HTTP2NOPUSHHOST", "www.microsoft.com");
public static string DomainJoinedHttpHost => GetValue("COREFX_DOMAINJOINED_HTTPHOST");
@@ -60,6 +64,7 @@ namespace System.Net.Test.Common
public readonly static object[][] VerifyUploadServers = { new object[] { RemoteVerifyUploadServer }, new object[] { SecureRemoteVerifyUploadServer } };
public readonly static object[][] CompressedServers = { new object[] { RemoteDeflateServer }, new object[] { RemoteGZipServer } };
public readonly static object[][] Http2Servers = { new object[] { new Uri("https://" + Http2Host) } };
+ public readonly static object[][] Http2NoPushServers = { new object[] { new Uri("https://" + Http2NoPushHost) } };
public static Uri NegotiateAuthUriForDefaultCreds(bool secure)
{
diff --git a/src/Common/tests/System/Net/Http/LoopbackServer.cs b/src/Common/tests/System/Net/Http/LoopbackServer.cs
index 976a5ca1d1..56ede643fb 100644
--- a/src/Common/tests/System/Net/Http/LoopbackServer.cs
+++ b/src/Common/tests/System/Net/Http/LoopbackServer.cs
@@ -2,6 +2,7 @@
// 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.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
@@ -73,19 +74,28 @@ namespace System.Net.Test.Common
.Where(a => a.IsIPv6LinkLocal)
.FirstOrDefault();
- public static Task ReadRequestAndSendResponseAsync(Socket server, string response = null, Options options = null)
+ public static Task<List<string>> ReadRequestAndSendResponseAsync(Socket server, string response = null, Options options = null)
{
return AcceptSocketAsync(server, (s, stream, reader, writer) => ReadWriteAcceptedAsync(s, reader, writer, response), options);
}
- public static async Task ReadWriteAcceptedAsync(Socket s, StreamReader reader, StreamWriter writer, string response = null)
+ public static async Task<List<string>> ReadWriteAcceptedAsync(Socket s, StreamReader reader, StreamWriter writer, string response = null)
{
- while (!string.IsNullOrEmpty(await reader.ReadLineAsync().ConfigureAwait(false))) ;
+ // Read request line and headers. Skip any request body.
+ var lines = new List<string>();
+ string line;
+ while (!string.IsNullOrEmpty(line = await reader.ReadLineAsync().ConfigureAwait(false)))
+ {
+ lines.Add(line);
+ }
+
await writer.WriteAsync(response ?? DefaultHttpResponse).ConfigureAwait(false);
s.Shutdown(SocketShutdown.Send);
+
+ return lines;
}
- public static async Task AcceptSocketAsync(Socket server, Func<Socket, Stream, StreamReader, StreamWriter, Task> funcAsync, Options options = null)
+ public static async Task<List<string>> AcceptSocketAsync(Socket server, Func<Socket, Stream, StreamReader, StreamWriter, Task<List<string>>> funcAsync, Options options = null)
{
options = options ?? new Options();
using (Socket s = await server.AcceptAsync().ConfigureAwait(false))
@@ -108,7 +118,7 @@ namespace System.Net.Test.Common
using (var reader = new StreamReader(stream, Encoding.ASCII))
using (var writer = new StreamWriter(stream, Encoding.ASCII) { AutoFlush = true })
{
- await funcAsync(s, stream, reader, writer).ConfigureAwait(false);
+ return await funcAsync(s, stream, reader, writer).ConfigureAwait(false);
}
}
}
@@ -182,6 +192,8 @@ namespace System.Net.Test.Common
}
client.Shutdown(SocketShutdown.Both);
+
+ return null;
}), out localEndPoint);
}
}
diff --git a/src/Common/tests/System/ObjectCloner.cs b/src/Common/tests/System/ObjectCloner.cs
new file mode 100644
index 0000000000..1aa1f2f4fa
--- /dev/null
+++ b/src/Common/tests/System/ObjectCloner.cs
@@ -0,0 +1,31 @@
+// 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.Diagnostics;
+using System.Reflection;
+
+namespace System
+{
+ // Provides methods for making shallow/deep clones of objects.
+
+ public static class ObjectCloner
+ {
+ // This should only be used for reference types.
+ // Simply doing T copied = value will give you the same effect with a value type.
+ public static T MemberwiseClone<T>(T obj) where T : class
+ {
+ Debug.Assert(obj != null);
+
+ // Invoke MemberwiseClone() via reflection to create a shallow copy of the object
+ MethodInfo memberwiseClone = typeof(object)
+ .GetTypeInfo()
+ .GetDeclaredMethod("MemberwiseClone");
+ object cloned = memberwiseClone.Invoke(obj, parameters: Array.Empty<object>());
+
+ Debug.Assert(cloned != null && !object.ReferenceEquals(obj, cloned));
+ Debug.Assert(obj.GetType() == cloned.GetType());
+ return (T)cloned;
+ }
+ }
+}
diff --git a/src/Common/tests/System/PlatformDetection.cs b/src/Common/tests/System/PlatformDetection.cs
index f343dd9d9b..fcb5d40576 100644
--- a/src/Common/tests/System/PlatformDetection.cs
+++ b/src/Common/tests/System/PlatformDetection.cs
@@ -17,7 +17,9 @@ namespace System
public static bool IsOSX { get; } = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
public static bool IsNetBSD { get; } = RuntimeInformation.IsOSPlatform(OSPlatform.Create("NETBSD"));
public static bool IsNotWindowsNanoServer { get; } = (IsWindows &&
- File.Exists(Path.Combine(Environment.GetEnvironmentVariable("windir"), "regedit.exe")));
+ File.Exists(Path.Combine(Environment.GetEnvironmentVariable("windir"), "regedit.exe")));
+ public static bool IsWindows10Version1607OrGreater { get; } = IsWindows &&
+ GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildNumber() >= 14393;
public static int WindowsVersion { get; } = GetWindowsVersion();
@@ -107,6 +109,19 @@ namespace System
return -1;
}
+ private static int GetWindowsBuildNumber()
+ {
+ if (IsWindows)
+ {
+ RTL_OSVERSIONINFOEX osvi = new RTL_OSVERSIONINFOEX();
+ osvi.dwOSVersionInfoSize = (uint)Marshal.SizeOf(osvi);
+ Assert.Equal(0, RtlGetVersion(out osvi));
+ return (int)osvi.dwBuildNumber;
+ }
+
+ return -1;
+ }
+
private static Version GetOSXKernelVersion()
{
if (IsOSX)
diff --git a/src/Common/tests/System/RuntimeDetection.cs b/src/Common/tests/System/RuntimeDetection.cs
new file mode 100644
index 0000000000..28cd49557c
--- /dev/null
+++ b/src/Common/tests/System/RuntimeDetection.cs
@@ -0,0 +1,19 @@
+// 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.Reflection;
+using System.Runtime.InteropServices;
+
+namespace System
+{
+ public static class RuntimeDetection
+ {
+ private static readonly string s_frameworkDescription = RuntimeInformation.FrameworkDescription;
+
+ // public static bool IsMono { get; } = Type.GetType("Mono.Runtime") != null;
+ // public static bool IsNetFramework { get; } = s_frameworkDescription.StartsWith(".NET Framework");
+ // public static bool IsCoreclr { get; } = s_frameworkDescription.StartsWith(".NET Core");
+ public static bool IsNetNative { get; } = s_frameworkDescription.StartsWith(".NET Native");
+ }
+}
diff --git a/src/Microsoft.CSharp/dir.props b/src/Microsoft.CSharp/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/Microsoft.CSharp/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/Microsoft.CSharp/pkg/Microsoft.CSharp.pkgproj b/src/Microsoft.CSharp/pkg/Microsoft.CSharp.pkgproj
index 787456346a..f6ce63b7b9 100644
--- a/src/Microsoft.CSharp/pkg/Microsoft.CSharp.pkgproj
+++ b/src/Microsoft.CSharp/pkg/Microsoft.CSharp.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\Microsoft.CSharp.csproj">
diff --git a/src/Microsoft.CSharp/pkg/ValidationSuppression.txt b/src/Microsoft.CSharp/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/Microsoft.CSharp/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/Microsoft.CSharp/ref/Microsoft.CSharp.csproj b/src/Microsoft.CSharp/ref/Microsoft.CSharp.csproj
index 49dc99cb84..5011aa37e7 100644
--- a/src/Microsoft.CSharp/ref/Microsoft.CSharp.csproj
+++ b/src/Microsoft.CSharp/ref/Microsoft.CSharp.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/Microsoft.CSharp/src/Microsoft.CSharp.csproj b/src/Microsoft.CSharp/src/Microsoft.CSharp.csproj
index 0eec4ada6f..6ab881d842 100644
--- a/src/Microsoft.CSharp/src/Microsoft.CSharp.csproj
+++ b/src/Microsoft.CSharp/src/Microsoft.CSharp.csproj
@@ -4,9 +4,7 @@
<PropertyGroup>
<ProjectGuid>{96AA2060-C846-4E56-9509-E8CB9C114C8F}</ProjectGuid>
<AssemblyName>Microsoft.CSharp</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<RootNamespace>Microsoft.CSharp</RootNamespace>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<!-- dotnet/corefx#3128 tracks removing this exclusion -->
<ExcludeLocalizationImport Condition="'$(TargetsWindows)' != 'true'">true</ExcludeLocalizationImport>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/PredefinedMembers.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/PredefinedMembers.cs
index 2ce7bce42f..0d41c26b35 100644
--- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/PredefinedMembers.cs
+++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/PredefinedMembers.cs
@@ -421,7 +421,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics
private CType LoadTypeFromSignature(int[] signature, ref int indexIntoSignatures, TypeArray classTyVars)
{
- Debug.Assert(signature != null && signature != null);
+ Debug.Assert(signature != null);
MethodSignatureEnum current = (MethodSignatureEnum)signature[indexIntoSignatures];
indexIntoSignatures++;
diff --git a/src/Microsoft.VisualBasic/dir.props b/src/Microsoft.VisualBasic/dir.props
new file mode 100644
index 0000000000..aec8addf14
--- /dev/null
+++ b/src/Microsoft.VisualBasic/dir.props
@@ -0,0 +1,8 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <PackageVersion>10.1.0</PackageVersion>
+ <AssemblyVersion>10.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/Microsoft.VisualBasic/pkg/Microsoft.VisualBasic.pkgproj b/src/Microsoft.VisualBasic/pkg/Microsoft.VisualBasic.pkgproj
index 203a2f7c3e..bc30f4b6fd 100644
--- a/src/Microsoft.VisualBasic/pkg/Microsoft.VisualBasic.pkgproj
+++ b/src/Microsoft.VisualBasic/pkg/Microsoft.VisualBasic.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>10.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\Microsoft.VisualBasic.csproj">
diff --git a/src/Microsoft.VisualBasic/pkg/ValidationSuppression.txt b/src/Microsoft.VisualBasic/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/Microsoft.VisualBasic/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/Microsoft.VisualBasic/ref/Microsoft.VisualBasic.csproj b/src/Microsoft.VisualBasic/ref/Microsoft.VisualBasic.csproj
index ac66168b96..cce1758e4b 100644
--- a/src/Microsoft.VisualBasic/ref/Microsoft.VisualBasic.csproj
+++ b/src/Microsoft.VisualBasic/ref/Microsoft.VisualBasic.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/Microsoft.VisualBasic/src/Microsoft.VisualBasic.vbproj b/src/Microsoft.VisualBasic/src/Microsoft.VisualBasic.vbproj
index 72c1032f1c..c9eeae2272 100644
--- a/src/Microsoft.VisualBasic/src/Microsoft.VisualBasic.vbproj
+++ b/src/Microsoft.VisualBasic/src/Microsoft.VisualBasic.vbproj
@@ -13,9 +13,7 @@
<WarningsNotAsErrors>42025</WarningsNotAsErrors>
<DefineConstants>$(DefineConstants),LATEBINDING=True</DefineConstants>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
- <AssemblyVersion>10.0.2.0</AssemblyVersion>
<NoStdLib>true</NoStdLib>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/Microsoft.Win32.Primitives/dir.props b/src/Microsoft.Win32.Primitives/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/Microsoft.Win32.Primitives/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/Microsoft.Win32.Primitives/ref/Microsoft.Win32.Primitives.csproj b/src/Microsoft.Win32.Primitives/ref/Microsoft.Win32.Primitives.csproj
index 779cc7b521..05fe095e25 100644
--- a/src/Microsoft.Win32.Primitives/ref/Microsoft.Win32.Primitives.csproj
+++ b/src/Microsoft.Win32.Primitives/ref/Microsoft.Win32.Primitives.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/Microsoft.Win32.Primitives/src/Microsoft.Win32.Primitives.csproj b/src/Microsoft.Win32.Primitives/src/Microsoft.Win32.Primitives.csproj
index 179fba60ca..057f92929b 100644
--- a/src/Microsoft.Win32.Primitives/src/Microsoft.Win32.Primitives.csproj
+++ b/src/Microsoft.Win32.Primitives/src/Microsoft.Win32.Primitives.csproj
@@ -8,10 +8,8 @@
<ProjectGuid>{8FFE99C0-22F8-4462-B839-970EAC1B3472}</ProjectGuid>
<RootNamespace>Microsoft.Win32.Primitives</RootNamespace>
<AssemblyName>Microsoft.Win32.Primitives</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/Microsoft.Win32.Registry.AccessControl/dir.props b/src/Microsoft.Win32.Registry.AccessControl/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/Microsoft.Win32.Registry.AccessControl/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/Microsoft.Win32.Registry.AccessControl/ref/Microsoft.Win32.Registry.AccessControl.csproj b/src/Microsoft.Win32.Registry.AccessControl/ref/Microsoft.Win32.Registry.AccessControl.csproj
index 7819360913..145afcc319 100644
--- a/src/Microsoft.Win32.Registry.AccessControl/ref/Microsoft.Win32.Registry.AccessControl.csproj
+++ b/src/Microsoft.Win32.Registry.AccessControl/ref/Microsoft.Win32.Registry.AccessControl.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/Microsoft.Win32.Registry.AccessControl/src/Microsoft.Win32.Registry.AccessControl.csproj b/src/Microsoft.Win32.Registry.AccessControl/src/Microsoft.Win32.Registry.AccessControl.csproj
index 48ae460180..ffc36ff0aa 100644
--- a/src/Microsoft.Win32.Registry.AccessControl/src/Microsoft.Win32.Registry.AccessControl.csproj
+++ b/src/Microsoft.Win32.Registry.AccessControl/src/Microsoft.Win32.Registry.AccessControl.csproj
@@ -6,10 +6,8 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>Microsoft.Win32.Registry.AccessControl</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<GeneratePlatformNotSupportedAssembly Condition="'$(TargetsUnix)' == 'true'">true</GeneratePlatformNotSupportedAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/Microsoft.Win32.Registry/dir.props b/src/Microsoft.Win32.Registry/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/Microsoft.Win32.Registry/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/Microsoft.Win32.Registry/ref/Microsoft.Win32.Registry.csproj b/src/Microsoft.Win32.Registry/ref/Microsoft.Win32.Registry.csproj
index 94e728976a..4405800fbd 100644
--- a/src/Microsoft.Win32.Registry/ref/Microsoft.Win32.Registry.csproj
+++ b/src/Microsoft.Win32.Registry/ref/Microsoft.Win32.Registry.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/Microsoft.Win32.Registry/src/Microsoft.Win32.Registry.csproj b/src/Microsoft.Win32.Registry/src/Microsoft.Win32.Registry.csproj
index 53db340f10..29b389a13b 100644
--- a/src/Microsoft.Win32.Registry/src/Microsoft.Win32.Registry.csproj
+++ b/src/Microsoft.Win32.Registry/src/Microsoft.Win32.Registry.csproj
@@ -8,10 +8,8 @@
<ProjectGuid>{D3F18ACC-D327-4ABB-BA6C-E9C34A041B2F}</ProjectGuid>
<RootNamespace>Microsoft.Win32.Registry</RootNamespace>
<AssemblyName>Microsoft.Win32.Registry</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);REGISTRY_ASSEMBLY</DefineConstants>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.cs b/src/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.cs
index d74d16797c..38ec306d90 100644
--- a/src/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.cs
+++ b/src/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.cs
@@ -322,10 +322,8 @@ namespace Microsoft.Win32
/// read-only access.
/// </summary>
/// <returns>the Subkey requested, or <b>null</b> if the operation failed.</returns>
- public RegistryKey OpenSubKey(string name, bool writable)
- {
- return InternalOpenSubKey(name, writable);
- }
+ public RegistryKey OpenSubKey(string name, bool writable) =>
+ OpenSubKey(name, GetRegistryKeyRights(writable));
public RegistryKey OpenSubKey(string name, RegistryRights rights)
{
diff --git a/src/Microsoft.Win32.Registry/tests/Microsoft.Win32.Registry.Tests.csproj b/src/Microsoft.Win32.Registry/tests/Microsoft.Win32.Registry.Tests.csproj
index 41c32566bc..5b17782319 100644
--- a/src/Microsoft.Win32.Registry/tests/Microsoft.Win32.Registry.Tests.csproj
+++ b/src/Microsoft.Win32.Registry/tests/Microsoft.Win32.Registry.Tests.csproj
@@ -52,6 +52,10 @@
<Compile Include="RegistryKey\RegistryKey_OpenSubKey_str_rkpc.cs" />
<Compile Include="RegistryKey\RegistryKey_SetValueKind_str_obj_valueKind.cs" />
<Compile Include="RegistryKey\RegistryKey_SetValue_str_obj.cs" />
+ <Compile Include="RegistryKey\RegistryKeyCreateSubKeyTestsBase.cs" />
+ <Compile Include="RegistryKey\RegistryKeyDeleteSubKeyTestsBase.cs" />
+ <Compile Include="RegistryKey\RegistryKeyDeleteSubKeyTreeTestsBase.cs" />
+ <Compile Include="RegistryKey\RegistryKeyOpenSubKeyTestsBase.cs" />
<Compile Include="RegistryKey\SafeRegistryHandle.cs" />
<Compile Include="RegistryTestsBase.cs" />
<Compile Include="TestData.cs" />
diff --git a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKeyCreateSubKeyTestsBase.cs b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKeyCreateSubKeyTestsBase.cs
new file mode 100644
index 0000000000..27739eb8e4
--- /dev/null
+++ b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKeyCreateSubKeyTestsBase.cs
@@ -0,0 +1,37 @@
+// 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 Xunit;
+
+namespace Microsoft.Win32.RegistryTests
+{
+ public abstract class RegistryKeyCreateSubKeyTestsBase : RegistryTestsBase
+ {
+ protected void Verify_CreateSubKey_KeyExists_OpensKeyWithFixedUpName(string expected, Func<RegistryKey> createSubKey)
+ {
+ CreateTestRegistrySubKey(expected);
+
+ using (RegistryKey key = createSubKey())
+ {
+ Assert.NotNull(key);
+ Assert.Equal(1, TestRegistryKey.SubKeyCount);
+ Assert.Equal(TestRegistryKey.Name + @"\" + expected, key.Name);
+ }
+ }
+
+ protected void Verify_CreateSubKey_KeyDoesNotExist_CreatesKeyWithFixedUpName(string expected, Func<RegistryKey> createSubKey)
+ {
+ Assert.Null(TestRegistryKey.OpenSubKey(expected));
+ Assert.Equal(0, TestRegistryKey.SubKeyCount);
+
+ using (RegistryKey key = createSubKey())
+ {
+ Assert.NotNull(key);
+ Assert.Equal(1, TestRegistryKey.SubKeyCount);
+ Assert.Equal(TestRegistryKey.Name + @"\" + expected, key.Name);
+ }
+ }
+ }
+}
diff --git a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKeyDeleteSubKeyTestsBase.cs b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKeyDeleteSubKeyTestsBase.cs
new file mode 100644
index 0000000000..9ed116f3ce
--- /dev/null
+++ b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKeyDeleteSubKeyTestsBase.cs
@@ -0,0 +1,36 @@
+// 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 Xunit;
+
+namespace Microsoft.Win32.RegistryTests
+{
+ public abstract class RegistryKeyDeleteSubKeyTestsBase : RegistryTestsBase
+ {
+ protected void Verify_DeleteSubKey_KeyExists_KeyDeleted(string expected, Action deleteSubKey)
+ {
+ CreateTestRegistrySubKey(expected);
+
+ deleteSubKey();
+ Assert.Null(TestRegistryKey.OpenSubKey(expected));
+ }
+
+ protected void Verify_DeleteSubKey_KeyDoesNotExists_Throws(string expected, Action deleteSubKey)
+ {
+ Assert.Null(TestRegistryKey.OpenSubKey(expected));
+ Assert.Equal(0, TestRegistryKey.SubKeyCount);
+
+ Assert.Throws<ArgumentException>(() => deleteSubKey());
+ }
+
+ protected void Verify_DeleteSubKey_KeyDoesNotExists_DoesNotThrow(string expected, Action deleteSubKey)
+ {
+ Assert.Null(TestRegistryKey.OpenSubKey(expected));
+ Assert.Equal(0, TestRegistryKey.SubKeyCount);
+
+ deleteSubKey();
+ }
+ }
+}
diff --git a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKeyDeleteSubKeyTreeTestsBase.cs b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKeyDeleteSubKeyTreeTestsBase.cs
new file mode 100644
index 0000000000..5741ea1feb
--- /dev/null
+++ b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKeyDeleteSubKeyTreeTestsBase.cs
@@ -0,0 +1,36 @@
+// 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 Xunit;
+
+namespace Microsoft.Win32.RegistryTests
+{
+ public abstract class RegistryKeyDeleteSubKeyTreeTestsBase : RegistryTestsBase
+ {
+ protected void Verify_DeleteSubKeyTree_KeyExists_KeyDeleted(string expected, Action deleteSubKeyTree)
+ {
+ CreateTestRegistrySubKey(expected);
+
+ deleteSubKeyTree();
+ Assert.Null(TestRegistryKey.OpenSubKey(expected));
+ }
+
+ protected void Verify_DeleteSubKeyTree_KeyDoesNotExists_Throws(string expected, Action deleteSubKeyTree)
+ {
+ Assert.Null(TestRegistryKey.OpenSubKey(expected));
+ Assert.Equal(0, TestRegistryKey.SubKeyCount);
+
+ Assert.Throws<ArgumentException>(() => deleteSubKeyTree());
+ }
+
+ protected void Verify_DeleteSubKeyTree_KeyDoesNotExists_DoesNotThrow(string expected, Action deleteSubKeyTree)
+ {
+ Assert.Null(TestRegistryKey.OpenSubKey(expected));
+ Assert.Equal(0, TestRegistryKey.SubKeyCount);
+
+ deleteSubKeyTree();
+ }
+ }
+}
diff --git a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKeyOpenSubKeyTestsBase.cs b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKeyOpenSubKeyTestsBase.cs
new file mode 100644
index 0000000000..9dfdcf94cf
--- /dev/null
+++ b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKeyOpenSubKeyTestsBase.cs
@@ -0,0 +1,32 @@
+// 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 Xunit;
+
+namespace Microsoft.Win32.RegistryTests
+{
+ public abstract class RegistryKeyOpenSubKeyTestsBase : RegistryTestsBase
+ {
+ protected void Verify_OpenSubKey_KeyExists_OpensWithFixedUpName(string expected, Func<RegistryKey> openSubKey)
+ {
+ CreateTestRegistrySubKey(expected);
+
+ using (RegistryKey key = openSubKey())
+ {
+ Assert.NotNull(key);
+ Assert.Equal(1, TestRegistryKey.SubKeyCount);
+ Assert.Equal(TestRegistryKey.Name + @"\" + expected, key.Name);
+ }
+ }
+
+ protected void Verify_OpenSubKey_KeyDoesNotExist_ReturnsNull(string expected, Func<RegistryKey> openSubKey)
+ {
+ Assert.Null(TestRegistryKey.OpenSubKey(expected));
+ Assert.Equal(0, TestRegistryKey.SubKeyCount);
+
+ Assert.Null(openSubKey());
+ }
+ }
+}
diff --git a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_CreateSubKey_str.cs b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_CreateSubKey_str.cs
index 4896ba74f0..5f048fe7e1 100644
--- a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_CreateSubKey_str.cs
+++ b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_CreateSubKey_str.cs
@@ -9,7 +9,7 @@ using Xunit;
namespace Microsoft.Win32.RegistryTests
{
- public class RegistryKey_CreateSubKey_str : RegistryTestsBase
+ public class RegistryKey_CreateSubKey_str : RegistryKeyCreateSubKeyTestsBase
{
[Fact]
public void NegativeTests()
@@ -114,5 +114,15 @@ namespace Microsoft.Win32.RegistryTests
rk.CreateSubKey(subkeyName);
}
}
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void CreateSubKey_KeyExists_OpensKeyWithFixedUpName(string expected, string subKeyName) =>
+ Verify_CreateSubKey_KeyExists_OpensKeyWithFixedUpName(expected, () => TestRegistryKey.CreateSubKey(subKeyName));
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void CreateSubKey_KeyDoesNotExist_CreatesKeyWithFixedUpName(string expected, string subKeyName) =>
+ Verify_CreateSubKey_KeyDoesNotExist_CreatesKeyWithFixedUpName(expected, () => TestRegistryKey.CreateSubKey(subKeyName));
}
}
diff --git a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_CreateSubKey_str_rkpc.cs b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_CreateSubKey_str_rkpc.cs
index 9d532acfc6..80b2bd23ec 100644
--- a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_CreateSubKey_str_rkpc.cs
+++ b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_CreateSubKey_str_rkpc.cs
@@ -9,7 +9,7 @@ using Xunit;
namespace Microsoft.Win32.RegistryTests
{
- public class RegistryKey_CreateSubKey_str_rkpc : RegistryTestsBase
+ public class RegistryKey_CreateSubKey_str_rkpc : RegistryKeyCreateSubKeyTestsBase
{
[Fact]
public void CreateWriteableSubkeyAndWrite()
@@ -100,5 +100,25 @@ namespace Microsoft.Win32.RegistryTests
Assert.NotNull(TestRegistryKey.CreateSubKey(subkey));
}
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void CreateSubKey_Writable_KeyExists_OpensKeyWithFixedUpName(string expected, string subKeyName) =>
+ Verify_CreateSubKey_KeyExists_OpensKeyWithFixedUpName(expected, () => TestRegistryKey.CreateSubKey(subKeyName, writable: true));
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void CreateSubKey_NonWritable_KeyExists_OpensKeyWithFixedUpName(string expected, string subKeyName) =>
+ Verify_CreateSubKey_KeyExists_OpensKeyWithFixedUpName(expected, () => TestRegistryKey.CreateSubKey(subKeyName, writable: false));
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void CreateSubKey_Writable_KeyDoesNotExist_CreatesKeyWithFixedUpName(string expected, string subKeyName) =>
+ Verify_CreateSubKey_KeyDoesNotExist_CreatesKeyWithFixedUpName(expected, () => TestRegistryKey.CreateSubKey(subKeyName, writable: true));
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void CreateSubKey_NonWritable_KeyDoesNotExist_CreatesKeyWithFixedUpName(string expected, string subKeyName) =>
+ Verify_CreateSubKey_KeyDoesNotExist_CreatesKeyWithFixedUpName(expected, () => TestRegistryKey.CreateSubKey(subKeyName, writable: false));
}
}
diff --git a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKeyTree.cs b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKeyTree.cs
index b52ff41f8f..70880552c4 100644
--- a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKeyTree.cs
+++ b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKeyTree.cs
@@ -7,7 +7,7 @@ using Xunit;
namespace Microsoft.Win32.RegistryTests
{
- public class RegistryKey_DeleteSubKeyTree : RegistryTestsBase
+ public class RegistryKey_DeleteSubKeyTree : RegistryKeyDeleteSubKeyTreeTestsBase
{
[Fact]
public void NegativeTests()
@@ -67,5 +67,25 @@ namespace Microsoft.Win32.RegistryTests
TestRegistryKey.DeleteSubKeyTree(subKeyExists2, true);
}
}
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void DeleteSubKeyTree_ThrowOnMissing_KeyExists_KeyDeleted(string expected, string subKeyName) =>
+ Verify_DeleteSubKeyTree_KeyExists_KeyDeleted(expected, () => TestRegistryKey.DeleteSubKeyTree(subKeyName, throwOnMissingSubKey: true));
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void DeleteSubKeyTree_DoNotThrow_KeyExists_KeyDeleted(string expected, string subKeyName) =>
+ Verify_DeleteSubKeyTree_KeyExists_KeyDeleted(expected, () => TestRegistryKey.DeleteSubKeyTree(subKeyName, throwOnMissingSubKey: false));
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void DeleteSubKeyTree_ThrowOnMissing_KeyDoesNotExists_Throws(string expected, string subKeyName) =>
+ Verify_DeleteSubKeyTree_KeyDoesNotExists_Throws(expected, () => TestRegistryKey.DeleteSubKeyTree(subKeyName, throwOnMissingSubKey: true));
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void DeleteSubKeyTree_DoNotThrow_KeyDoesNotExists_DoesNotThrow(string expected, string subKeyName) =>
+ Verify_DeleteSubKeyTree_KeyDoesNotExists_DoesNotThrow(expected, () => TestRegistryKey.DeleteSubKeyTree(subKeyName, throwOnMissingSubKey: false));
}
}
diff --git a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKeyTree_str.cs b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKeyTree_str.cs
index 4367b72310..292a327108 100644
--- a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKeyTree_str.cs
+++ b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKeyTree_str.cs
@@ -9,7 +9,7 @@ using Xunit;
namespace Microsoft.Win32.RegistryTests
{
- public class RegistryKey_DeleteSubKeyTree_str : RegistryTestsBase
+ public class RegistryKey_DeleteSubKeyTree_str : RegistryKeyDeleteSubKeyTreeTestsBase
{
[Fact]
public void NegativeTests()
@@ -83,5 +83,16 @@ namespace Microsoft.Win32.RegistryTests
TestRegistryKey.DeleteSubKeyTree(TestRegistryKeyName);
Assert.Null(TestRegistryKey.OpenSubKey(TestRegistryKeyName));
}
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void DeleteSubKeyTree_KeyExists_KeyDeleted(string expected, string subKeyName) =>
+ Verify_DeleteSubKeyTree_KeyExists_KeyDeleted(expected, () => TestRegistryKey.DeleteSubKeyTree(subKeyName));
+
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void Verify_DeleteSubKeyTree_KeyDoesNotExists_Throws(string expected, string subKeyName) =>
+ Verify_DeleteSubKeyTree_KeyDoesNotExists_Throws(expected, () => TestRegistryKey.DeleteSubKeyTree(subKeyName));
}
}
diff --git a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKey_Str_Bln.cs b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKey_Str_Bln.cs
index 50eaff8e82..ddf9a94650 100644
--- a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKey_Str_Bln.cs
+++ b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKey_Str_Bln.cs
@@ -8,7 +8,7 @@ using Xunit;
namespace Microsoft.Win32.RegistryTests
{
- public class RegistryKey_DeleteSubKey_Str_Bln : RegistryTestsBase
+ public class RegistryKey_DeleteSubKey_Str_Bln : RegistryKeyDeleteSubKeyTestsBase
{
[Fact]
public void NegativeTests()
@@ -71,5 +71,25 @@ namespace Microsoft.Win32.RegistryTests
Assert.Null(TestRegistryKey.OpenSubKey(subKeyName));
}
}
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void DeleteSubKey_KeyExists_ThrowOnMissing_KeyDeleted(string expected, string subkeyName) =>
+ Verify_DeleteSubKey_KeyExists_KeyDeleted(expected, () => TestRegistryKey.DeleteSubKey(subkeyName, throwOnMissingSubKey: true));
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void DeleteSubKey_KeyExists_DoNotThrow_KeyDeleted(string expected, string subkeyName) =>
+ Verify_DeleteSubKey_KeyExists_KeyDeleted(expected, () => TestRegistryKey.DeleteSubKey(subkeyName, throwOnMissingSubKey: false));
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void DeleteSubKey_KeyDoesNotExists_ThrowOnMissing_Throws(string expected, string subkeyName) =>
+ Verify_DeleteSubKey_KeyDoesNotExists_Throws(expected, () => TestRegistryKey.DeleteSubKey(subkeyName, throwOnMissingSubKey: true));
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void DeleteSubKey_KeyDoesNotExists_DoNotThrow_DoesNotThrow(string expected, string subkeyName) =>
+ Verify_DeleteSubKey_KeyDoesNotExists_DoesNotThrow(expected, () => TestRegistryKey.DeleteSubKey(subkeyName, throwOnMissingSubKey: false));
}
}
diff --git a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKey_str.cs b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKey_str.cs
index 217ea87a09..635b8aa59f 100644
--- a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKey_str.cs
+++ b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_DeleteSubKey_str.cs
@@ -7,7 +7,7 @@ using System;
namespace Microsoft.Win32.RegistryTests
{
- public class RegistryKey_DeleteSubKey_str : RegistryTestsBase
+ public class RegistryKey_DeleteSubKey_str : RegistryKeyDeleteSubKeyTestsBase
{
[Fact]
public void NegativeTests()
@@ -52,5 +52,15 @@ namespace Microsoft.Win32.RegistryTests
Assert.Null(TestRegistryKey.OpenSubKey(TestRegistryKeyName));
Assert.Equal(expected: 0, actual: TestRegistryKey.SubKeyCount);
}
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void DeleteSubKey_KeyExists_KeyDeleted(string expected, string subkeyName) =>
+ Verify_DeleteSubKey_KeyExists_KeyDeleted(expected, () => TestRegistryKey.DeleteSubKey(subkeyName));
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void DeleteSubKey_KeyDoesNotExists_Throws(string expected, string subkeyName) =>
+ Verify_DeleteSubKey_KeyDoesNotExists_Throws(expected, () => TestRegistryKey.DeleteSubKey(subkeyName));
}
}
diff --git a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_OpenSubKey_str.cs b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_OpenSubKey_str.cs
index f4639789f8..93393b6884 100644
--- a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_OpenSubKey_str.cs
+++ b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_OpenSubKey_str.cs
@@ -8,7 +8,7 @@ using Xunit;
namespace Microsoft.Win32.RegistryTests
{
- public class RegistryKey_OpenSubKey_str : RegistryTestsBase
+ public class RegistryKey_OpenSubKey_str : RegistryKeyOpenSubKeyTestsBase
{
[Fact]
public void NegativeTests()
@@ -63,5 +63,15 @@ namespace Microsoft.Win32.RegistryTests
Assert.Equal(subKeyNames.Length, TestRegistryKey.SubKeyCount);
Assert.Equal(subKeyNames, TestRegistryKey.GetSubKeyNames());
}
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void OpenSubKey_KeyExists_OpensWithFixedUpName(string expected, string subKeyName) =>
+ Verify_OpenSubKey_KeyExists_OpensWithFixedUpName(expected, () => TestRegistryKey.OpenSubKey(subKeyName));
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void OpenSubKey_KeyDoesNotExist_ReturnsNull(string expected, string subKeyName) =>
+ Verify_OpenSubKey_KeyDoesNotExist_ReturnsNull(expected, () => TestRegistryKey.OpenSubKey(subKeyName));
}
}
diff --git a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_OpenSubKey_str_b.cs b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_OpenSubKey_str_b.cs
index b72bbae20d..103f1373a0 100644
--- a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_OpenSubKey_str_b.cs
+++ b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_OpenSubKey_str_b.cs
@@ -7,7 +7,7 @@ using Xunit;
namespace Microsoft.Win32.RegistryTests
{
- public class RegistryKey_OpenSubKey_str_b : RegistryTestsBase
+ public class RegistryKey_OpenSubKey_str_b : RegistryKeyOpenSubKeyTestsBase
{
[Fact]
public void NegativeTests()
@@ -53,5 +53,25 @@ namespace Microsoft.Win32.RegistryTests
Assert.Equal(testValue, (int)rk.GetValue(TestRegistryKeyName));
}
}
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void OpenSubKey_Writable_KeyExists_OpensWithFixedUpName(string expected, string subKeyName) =>
+ Verify_OpenSubKey_KeyExists_OpensWithFixedUpName(expected, () => TestRegistryKey.OpenSubKey(subKeyName, writable: true));
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void OpenSubKey_NonWritable_KeyExists_OpensWithFixedUpName(string expected, string subKeyName) =>
+ Verify_OpenSubKey_KeyExists_OpensWithFixedUpName(expected, () => TestRegistryKey.OpenSubKey(subKeyName, writable: false));
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void OpenSubKey_Writable_KeyDoesNotExist_ReturnsNull(string expected, string subKeyName) =>
+ Verify_OpenSubKey_KeyDoesNotExist_ReturnsNull(expected, () => TestRegistryKey.OpenSubKey(subKeyName, writable: true));
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void OpenSubKey_NonWritable_KeyDoesNotExist_ReturnsNull(string expected, string subKeyName) =>
+ Verify_OpenSubKey_KeyDoesNotExist_ReturnsNull(expected, () => TestRegistryKey.OpenSubKey(subKeyName, writable: false));
}
}
diff --git a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_OpenSubKey_str_rkpc.cs b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_OpenSubKey_str_rkpc.cs
index eb2a1122cb..357a28bc09 100644
--- a/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_OpenSubKey_str_rkpc.cs
+++ b/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKey_OpenSubKey_str_rkpc.cs
@@ -8,7 +8,7 @@ using Xunit;
namespace Microsoft.Win32.RegistryTests
{
- public class RegistryKey_OpenSubKey_str_rkpc : RegistryTestsBase
+ public class RegistryKey_OpenSubKey_str_rkpc : RegistryKeyOpenSubKeyTestsBase
{
[Fact]
public void NegativeTests()
@@ -58,5 +58,28 @@ namespace Microsoft.Win32.RegistryTests
Assert.NotNull(rk.OpenSubKey(valueName));
}
}
+
+ private const RegistryRights Writable = RegistryRights.ReadKey | RegistryRights.WriteKey;
+ private const RegistryRights NonWritable = RegistryRights.ReadKey;
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void OpenSubKey_Writable_KeyExists_OpensWithFixedUpName(string expected, string subKeyName) =>
+ Verify_OpenSubKey_KeyExists_OpensWithFixedUpName(expected, () => TestRegistryKey.OpenSubKey(subKeyName, Writable));
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void OpenSubKey_NonWritable_KeyExists_OpensWithFixedUpName(string expected, string subKeyName) =>
+ Verify_OpenSubKey_KeyExists_OpensWithFixedUpName(expected, () => TestRegistryKey.OpenSubKey(subKeyName, NonWritable));
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void OpenSubKey_Writable_KeyDoesNotExist_ReturnsNull(string expected, string subKeyName) =>
+ Verify_OpenSubKey_KeyDoesNotExist_ReturnsNull(expected, () => TestRegistryKey.OpenSubKey(subKeyName, Writable));
+
+ [Theory]
+ [MemberData(nameof(TestRegistrySubKeyNames))]
+ public void OpenSubKey_NonWritable_KeyDoesNotExist_ReturnsNull(string expected, string subKeyName) =>
+ Verify_OpenSubKey_KeyDoesNotExist_ReturnsNull(expected, () => TestRegistryKey.OpenSubKey(subKeyName, NonWritable));
}
}
diff --git a/src/Microsoft.Win32.Registry/tests/RegistryTestsBase.cs b/src/Microsoft.Win32.Registry/tests/RegistryTestsBase.cs
index 4d185d691c..acf8d54856 100644
--- a/src/Microsoft.Win32.Registry/tests/RegistryTestsBase.cs
+++ b/src/Microsoft.Win32.Registry/tests/RegistryTestsBase.cs
@@ -54,5 +54,119 @@ namespace Microsoft.Win32.RegistryTests
// classes running concurrently
return "corefxtest_" + GetType().Name;
}
+
+ public static readonly object[][] TestRegistrySubKeyNames =
+ {
+ new object[] { @"Foo", @"Foo" },
+ new object[] { @"Foo\Bar", @"Foo\Bar" },
+
+ // Multiple/trailing slashes should be removed.
+ new object[] { @"Foo", @"Foo\" },
+ new object[] { @"Foo", @"Foo\\" },
+ new object[] { @"Foo", @"Foo\\\" },
+ new object[] { @"Foo", @"Foo\\\\" },
+ new object[] { @"Foo\Bar", @"Foo\\Bar" },
+ new object[] { @"Foo\Bar", @"Foo\\\Bar" },
+ new object[] { @"Foo\Bar", @"Foo\\\\Bar" },
+ new object[] { @"Foo\Bar", @"Foo\Bar\" },
+ new object[] { @"Foo\Bar", @"Foo\Bar\\" },
+ new object[] { @"Foo\Bar", @"Foo\Bar\\\" },
+ new object[] { @"Foo\Bar", @"Foo\\Bar\" },
+ new object[] { @"Foo\Bar", @"Foo\\Bar\\" },
+ new object[] { @"Foo\Bar", @"Foo\\Bar\\\" },
+ new object[] { @"Foo\Bar", @"Foo\\\Bar\\\" },
+ new object[] { @"Foo\Bar", @"Foo\\\\Bar\\\\" },
+
+ // The name fix-up implementation uses a mark-and-sweep approach.
+ // If there are multiple slashes, any extra slash chars will be
+ // replaced with a marker char ('\uffff'), and then all '\uffff'
+ // chars will be removed, including any pre-existing '\uffff' chars.
+ InsertMarkerChar(@"Foo", @"{0}Foo\\"),
+ InsertMarkerChar(@"Foo", @"Foo{0}\\"),
+ InsertMarkerChar(@"Foo", @"Foo\\{0}"),
+ InsertMarkerChar(@"Foo", @"Fo{0}o\\"),
+ InsertMarkerChar(@"Foo", @"{0}Fo{0}o{0}\\{0}"),
+ InsertMarkerChar(@"Foo", @"{0}Foo\\\"),
+ InsertMarkerChar(@"Foo", @"Foo{0}\\\"),
+ InsertMarkerChar(@"Foo", @"Foo\\\{0}"),
+ InsertMarkerChar(@"Foo", @"Fo{0}o\\\"),
+ InsertMarkerChar(@"Foo", @"{0}Fo{0}o{0}\\\{0}"),
+ InsertMarkerChar(@"Foo\Bar", @"{0}Foo\\Bar"),
+ InsertMarkerChar(@"Foo\Bar", @"Foo{0}\\Bar"),
+ InsertMarkerChar(@"Foo\Bar", @"Foo\\{0}Bar"),
+ InsertMarkerChar(@"Foo\Bar", @"Foo\\Bar{0}"),
+ InsertMarkerChar(@"Foo\Bar", @"Fo{0}o\\Bar"),
+ InsertMarkerChar(@"Foo\Bar", @"Foo\\B{0}ar"),
+ InsertMarkerChar(@"Foo\Bar", @"Fo{0}o\\B{0}ar"),
+ InsertMarkerChar(@"Foo\Bar", @"{0}Fo{0}o{0}\\{0}B{0}ar{0}"),
+ InsertMarkerChar(@"Foo\Bar", @"{0}Foo\\\Bar"),
+ InsertMarkerChar(@"Foo\Bar", @"Foo{0}\\\Bar"),
+ InsertMarkerChar(@"Foo\Bar", @"Foo\\\{0}Bar"),
+ InsertMarkerChar(@"Foo\Bar", @"Foo\\\Bar{0}"),
+ InsertMarkerChar(@"Foo\Bar", @"Fo{0}o\\\Bar"),
+ InsertMarkerChar(@"Foo\Bar", @"Foo\\\B{0}ar"),
+ InsertMarkerChar(@"Foo\Bar", @"Fo{0}o\\\B{0}ar"),
+ InsertMarkerChar(@"Foo\Bar", @"{0}Fo{0}o{0}\\\{0}B{0}ar{0}"),
+ InsertMarkerChar(@"Foo\Bar", @"{0}Foo\Bar\\"),
+ InsertMarkerChar(@"Foo\Bar", @"Foo{0}\Bar\\"),
+ InsertMarkerChar(@"Foo\Bar", @"Foo\{0}Bar\\"),
+ InsertMarkerChar(@"Foo\Bar", @"Foo\Bar{0}\\"),
+ InsertMarkerChar(@"Foo\Bar", @"Foo\Bar\\{0}"),
+ InsertMarkerChar(@"Foo\Bar", @"Fo{0}o\B{0}ar\\"),
+ InsertMarkerChar(@"Foo\Bar", @"{0}Fo{0}o{0}\{0}B{0}ar{0}\\{0}"),
+
+ // If there aren't multiple slashes, any '\uffff' chars should remain.
+ InsertMarkerChar(@"{0}Foo"),
+ InsertMarkerChar(@"Foo{0}"),
+ InsertMarkerChar(@"Fo{0}o"),
+ InsertMarkerChar(@"{0}Fo{0}o{0}"),
+ InsertMarkerChar(@"{0}Foo\"),
+ InsertMarkerChar(@"Foo{0}\"),
+ InsertMarkerChar(@"Fo{0}o\"),
+ InsertMarkerChar(@"{0}Fo{0}o{0}\"),
+ InsertMarkerChar(@"{0}Foo\Bar"),
+ InsertMarkerChar(@"Foo{0}\Bar"),
+ InsertMarkerChar(@"Foo\{0}Bar"),
+ InsertMarkerChar(@"Foo\Bar{0}"),
+ InsertMarkerChar(@"Fo{0}o\Bar"),
+ InsertMarkerChar(@"Foo\B{0}ar"),
+ InsertMarkerChar(@"Fo{0}o\B{0}ar"),
+ InsertMarkerChar(@"{0}Fo{0}o{0}\{0}B{0}ar{0}"),
+ InsertMarkerChar(@"{0}Foo\Bar\"),
+ InsertMarkerChar(@"Foo{0}\Bar\"),
+ InsertMarkerChar(@"Foo\{0}Bar\"),
+ InsertMarkerChar(@"Foo\Bar{0}\"),
+ InsertMarkerChar(@"Fo{0}o\Bar\"),
+ InsertMarkerChar(@"Foo\B{0}ar\"),
+ InsertMarkerChar(@"Fo{0}o\B{0}ar\"),
+ InsertMarkerChar(@"{0}Fo{0}o{0}\{0}B{0}ar{0}\"),
+ };
+
+ private const char MarkerChar = '\uffff';
+
+ private static object[] InsertMarkerChar(string expected, string format)
+ {
+ string result = string.Format(format, MarkerChar);
+ return new object[] { expected, result };
+ }
+
+ private static object[] InsertMarkerChar(string format)
+ {
+ string result = string.Format(format, MarkerChar);
+ string expected = result.TrimEnd('\\');
+ return new object[] { expected, result };
+ }
+
+ protected void CreateTestRegistrySubKey(string expected)
+ {
+ Assert.Equal(0, TestRegistryKey.SubKeyCount);
+
+ using (RegistryKey key = TestRegistryKey.CreateSubKey(expected))
+ {
+ Assert.NotNull(key);
+ Assert.Equal(1, TestRegistryKey.SubKeyCount);
+ Assert.Equal(TestRegistryKey.Name + @"\" + expected, key.Name);
+ }
+ }
}
}
diff --git a/src/Native/Unix/Common/pal_config.h.in b/src/Native/Unix/Common/pal_config.h.in
index 25a94af52a..7e0539bb79 100644
--- a/src/Native/Unix/Common/pal_config.h.in
+++ b/src/Native/Unix/Common/pal_config.h.in
@@ -5,6 +5,7 @@
#cmakedefine01 HAVE_PIPE2
#cmakedefine01 HAVE_STAT_BIRTHTIME
#cmakedefine01 HAVE_GNU_STRERROR_R
+#cmakedefine01 HAVE_READDIR_R
#cmakedefine01 HAVE_DIRENT_NAME_LEN
#cmakedefine01 HAVE_MNTINFO
#cmakedefine01 HAVE_STATFS_FSTYPENAME
diff --git a/src/Native/Unix/System.Native/pal_interfaceaddresses.cpp b/src/Native/Unix/System.Native/pal_interfaceaddresses.cpp
index 81bc818248..b14fbd7d3d 100644
--- a/src/Native/Unix/System.Native/pal_interfaceaddresses.cpp
+++ b/src/Native/Unix/System.Native/pal_interfaceaddresses.cpp
@@ -44,6 +44,17 @@ extern "C" int32_t SystemNative_EnumerateInterfaceAddresses(IPv4AddressFound onI
for (ifaddrs* current = headAddr; current != nullptr; current = current->ifa_next)
{
uint32_t interfaceIndex = if_nametoindex(current->ifa_name);
+ // ifa_name may be an aliased interface name.
+ // Use if_indextoname to map back to the true device name.
+ char actualName[IF_NAMESIZE];
+ char* result = if_indextoname(interfaceIndex, actualName);
+ if (result == nullptr)
+ {
+ freeifaddrs(headAddr);
+ return -1;
+ }
+
+ assert(result == actualName);
int family = current->ifa_addr->sa_family;
if (family == AF_INET)
{
@@ -67,7 +78,7 @@ extern "C" int32_t SystemNative_EnumerateInterfaceAddresses(IPv4AddressFound onI
sockaddr_in* mask_sain = reinterpret_cast<sockaddr_in*>(current->ifa_netmask);
memcpy(maskInfo.AddressBytes, &mask_sain->sin_addr.s_addr, sizeof(mask_sain->sin_addr.s_addr));
- onIpv4Found(current->ifa_name, &iai, &maskInfo);
+ onIpv4Found(actualName, &iai, &maskInfo);
}
}
else if (family == AF_INET6)
@@ -82,7 +93,7 @@ extern "C" int32_t SystemNative_EnumerateInterfaceAddresses(IPv4AddressFound onI
sockaddr_in6* sain6 = reinterpret_cast<sockaddr_in6*>(current->ifa_addr);
memcpy(iai.AddressBytes, sain6->sin6_addr.s6_addr, sizeof(sain6->sin6_addr.s6_addr));
uint32_t scopeId = sain6->sin6_scope_id;
- onIpv6Found(current->ifa_name, &iai, &scopeId);
+ onIpv6Found(actualName, &iai, &scopeId);
}
}
diff --git a/src/Native/Unix/System.Native/pal_io.cpp b/src/Native/Unix/System.Native/pal_io.cpp
index d7446fc409..142c684390 100644
--- a/src/Native/Unix/System.Native/pal_io.cpp
+++ b/src/Native/Unix/System.Native/pal_io.cpp
@@ -321,11 +321,13 @@ extern "C" int32_t SystemNative_GetDirentSize()
// size of the dirent struct.
// 2) The managed code creates a byte[] buffer of the size of the native dirent
// and passes a pointer to this buffer to this function.
-// 3) This function passes input byte[] buffer to the OS to fill with dirent data
-// which makes the 1st strcpy.
-// 4) The ConvertDirent function will set a pointer to the start of the inode name
-// in the byte[] buffer so the managed code and find it and copy it out of the
-// buffer into a managed string that the caller of the framework can use, making
+// 3) This function passes input byte[] buffer to the OS to fill with dirent
+// data which makes the 1st strcpy.
+// 4) The ConvertDirent function will fill DirectoryEntry outputEntry with
+// pointers from byte[] buffer.
+// 5) The managed code uses DirectoryEntry outputEntry to find start of d_name
+// and the value of d_namelen, if avalable, to copy the name from
+// byte[] buffer into a managed string that the caller can use; this makes
// the 2nd and final strcpy.
extern "C" int32_t SystemNative_ReadDirR(DIR* dir, void* buffer, int32_t bufferSize, DirectoryEntry* outputEntry)
{
@@ -341,6 +343,7 @@ extern "C" int32_t SystemNative_ReadDirR(DIR* dir, void* buffer, int32_t bufferS
dirent* result = nullptr;
dirent* entry = static_cast<dirent*>(buffer);
+#if HAVE_READDIR_R
int error = readdir_r(dir, entry, &result);
// positive error number returned -> failure
@@ -360,6 +363,27 @@ extern "C" int32_t SystemNative_ReadDirR(DIR* dir, void* buffer, int32_t bufferS
// 0 returned with non-null result (guaranteed to be set to entry arg) -> success
assert(result == entry);
+#else
+ errno = 0;
+ result = readdir(dir);
+
+ // 0 returned with null result -> end-of-stream
+ if (result == nullptr)
+ {
+ *outputEntry = {}; // managed out param must be initialized
+
+ // kernel set errno -> failure
+ if (errno != 0)
+ {
+ assert(errno == EBADF); // Invalid directory stream descriptor dir.
+ return errno;
+ }
+ return -1;
+ }
+
+ assert(result->d_reclen <= bufferSize);
+ memcpy(entry, result, static_cast<size_t>(result->d_reclen));
+#endif
ConvertDirent(*entry, outputEntry);
return 0;
}
diff --git a/src/Native/Unix/System.Net.Http.Native/pal_multi.cpp b/src/Native/Unix/System.Net.Http.Native/pal_multi.cpp
index 051f381891..f4b5c8464f 100644
--- a/src/Native/Unix/System.Net.Http.Native/pal_multi.cpp
+++ b/src/Native/Unix/System.Net.Http.Native/pal_multi.cpp
@@ -7,6 +7,7 @@
#include "pal_utilities.h"
#include <assert.h>
+#include <poll.h>
static_assert(PAL_CURLM_CALL_MULTI_PERFORM == CURLM_CALL_MULTI_PERFORM, "");
static_assert(PAL_CURLM_OK == CURLM_OK, "");
@@ -69,8 +70,36 @@ extern "C" int32_t HttpNative_MultiWait(CURLM* multiHandle,
int numFds;
CURLMcode result = curl_multi_wait(multiHandle, &extraFds, 1, FailsafeTimeoutMilliseconds, &numFds);
- *isExtraFileDescriptorActive = (extraFds.revents & CURL_WAIT_POLLIN) != 0;
- *isTimeout = numFds == 0;
+ if (numFds == 0)
+ {
+ *isTimeout = true;
+ *isExtraFileDescriptorActive = false;
+ }
+ else
+ {
+ *isTimeout = false;
+
+ //
+ // Prior to libcurl version 7.32.0, the revents field was not returned properly for "extra" file descriptors
+ // passed to curl_multi_wait. See https://github.com/dotnet/corefx/issues/9751. So if we have a libcurl
+ // prior to that version, we need to do our own poll to get the status of the extra file descriptor.
+ //
+ if (curl_version_info(CURLVERSION_NOW)->version_num >= 0x073200)
+ {
+ *isExtraFileDescriptorActive = (extraFds.revents & CURL_WAIT_POLLIN) != 0;
+ }
+ else
+ {
+ pollfd pfd = { .fd = ToFileDescriptor(extraFileDescriptor),.events = POLLIN,.revents = 0 };
+ poll(&pfd, 1, 0);
+
+ //
+ // We ignore any failure in poll(), to preserve the result from curl_multi_wait. If poll() fails, it should
+ // leave revents cleared.
+ //
+ *isExtraFileDescriptorActive = (pfd.revents & POLLIN) != 0;
+ }
+ }
return result;
}
diff --git a/src/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt b/src/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt
index 907b11b975..8bdca85e48 100644
--- a/src/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt
+++ b/src/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt
@@ -6,7 +6,10 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_definitions(-DPIC=1)
set(NATIVECRYPTO_SOURCES
+ pal_digest.cpp
+ pal_hmac.cpp
pal_random.cpp
+ pal_symmetric.cpp
)
add_library(System.Security.Cryptography.Native.Apple
diff --git a/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_digest.cpp b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_digest.cpp
new file mode 100644
index 0000000000..54354b21fe
--- /dev/null
+++ b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_digest.cpp
@@ -0,0 +1,150 @@
+// 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.
+
+#include "pal_digest.h"
+
+#include <CommonCrypto/CommonCrypto.h>
+#include <CommonCrypto/CommonDigest.h>
+#include <assert.h>
+
+struct digest_ctx_st
+{
+ PAL_HashAlgorithm algorithm;
+ // This 32-bit field is required for alignment,
+ // but it's also handy for remembering how big the final buffer is.
+ int32_t cbDigest;
+ union {
+ CC_MD5_CTX md5;
+ CC_SHA1_CTX sha1;
+ CC_SHA256_CTX sha256;
+ CC_SHA512_CTX sha384;
+ CC_SHA512_CTX sha512;
+ } d;
+};
+
+extern "C" void AppleCryptoNative_DigestFree(DigestCtx* pDigest)
+{
+ if (pDigest != nullptr)
+ {
+ free(pDigest);
+ }
+}
+
+extern "C" DigestCtx* AppleCryptoNative_DigestCreate(PAL_HashAlgorithm algorithm, int32_t* pcbDigest)
+{
+ if (pcbDigest == nullptr)
+ return nullptr;
+
+ DigestCtx* digestCtx = reinterpret_cast<DigestCtx*>(malloc(sizeof(DigestCtx)));
+ digestCtx->algorithm = algorithm;
+
+ switch (algorithm)
+ {
+ case PAL_MD5:
+ *pcbDigest = CC_MD5_DIGEST_LENGTH;
+ CC_MD5_Init(&digestCtx->d.md5);
+ break;
+ case PAL_SHA1:
+ *pcbDigest = CC_SHA1_DIGEST_LENGTH;
+ CC_SHA1_Init(&digestCtx->d.sha1);
+ break;
+ case PAL_SHA256:
+ *pcbDigest = CC_SHA256_DIGEST_LENGTH;
+ CC_SHA256_Init(&digestCtx->d.sha256);
+ break;
+ case PAL_SHA384:
+ *pcbDigest = CC_SHA384_DIGEST_LENGTH;
+ CC_SHA384_Init(&digestCtx->d.sha384);
+ break;
+ case PAL_SHA512:
+ *pcbDigest = CC_SHA512_DIGEST_LENGTH;
+ CC_SHA512_Init(&digestCtx->d.sha512);
+ break;
+ default:
+ *pcbDigest = -1;
+ free(digestCtx);
+ return nullptr;
+ }
+
+ digestCtx->cbDigest = *pcbDigest;
+ return digestCtx;
+}
+
+extern "C" int AppleCryptoNative_DigestUpdate(DigestCtx* ctx, uint8_t* pBuf, int32_t cbBuf)
+{
+ if (cbBuf == 0)
+ return 1;
+ if (ctx == nullptr || pBuf == nullptr)
+ return -1;
+
+ CC_LONG bufSize = static_cast<CC_LONG>(cbBuf);
+
+ switch (ctx->algorithm)
+ {
+ case PAL_MD5:
+ return CC_MD5_Update(&ctx->d.md5, pBuf, bufSize);
+ case PAL_SHA1:
+ return CC_SHA1_Update(&ctx->d.sha1, pBuf, bufSize);
+ case PAL_SHA256:
+ return CC_SHA256_Update(&ctx->d.sha256, pBuf, bufSize);
+ case PAL_SHA384:
+ return CC_SHA384_Update(&ctx->d.sha384, pBuf, bufSize);
+ case PAL_SHA512:
+ return CC_SHA512_Update(&ctx->d.sha512, pBuf, bufSize);
+ default:
+ return -1;
+ }
+}
+
+extern "C" int AppleCryptoNative_DigestFinal(DigestCtx* ctx, uint8_t* pOutput, int32_t cbOutput)
+{
+ if (ctx == nullptr || pOutput == nullptr || cbOutput < ctx->cbDigest)
+ return -1;
+
+ int ret = 0;
+
+ switch (ctx->algorithm)
+ {
+ case PAL_MD5:
+ ret = CC_MD5_Final(pOutput, &ctx->d.md5);
+ break;
+ case PAL_SHA1:
+ ret = CC_SHA1_Final(pOutput, &ctx->d.sha1);
+ break;
+ case PAL_SHA256:
+ ret = CC_SHA256_Final(pOutput, &ctx->d.sha256);
+ break;
+ case PAL_SHA384:
+ ret = CC_SHA384_Final(pOutput, &ctx->d.sha384);
+ break;
+ case PAL_SHA512:
+ ret = CC_SHA512_Final(pOutput, &ctx->d.sha512);
+ break;
+ default:
+ ret = -1;
+ break;
+ }
+
+ if (ret != 1)
+ {
+ return ret;
+ }
+
+ switch (ctx->algorithm)
+ {
+ case PAL_MD5:
+ return CC_MD5_Init(&ctx->d.md5);
+ case PAL_SHA1:
+ return CC_SHA1_Init(&ctx->d.sha1);
+ case PAL_SHA256:
+ return CC_SHA256_Init(&ctx->d.sha256);
+ case PAL_SHA384:
+ return CC_SHA384_Init(&ctx->d.sha384);
+ case PAL_SHA512:
+ return CC_SHA512_Init(&ctx->d.sha512);
+ default:
+ assert(false);
+ return -2;
+ }
+}
diff --git a/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_digest.h b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_digest.h
new file mode 100644
index 0000000000..04b45cd19a
--- /dev/null
+++ b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_digest.h
@@ -0,0 +1,51 @@
+// 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.
+
+#pragma once
+
+#include "pal_types.h"
+
+#include <CommonCrypto/CommonCrypto.h>
+#include <CommonCrypto/CommonHMAC.h>
+
+enum
+{
+ PAL_Unknown = 0,
+ PAL_MD5,
+ PAL_SHA1,
+ PAL_SHA256,
+ PAL_SHA384,
+ PAL_SHA512,
+};
+typedef uint32_t PAL_HashAlgorithm;
+
+typedef struct digest_ctx_st DigestCtx;
+
+/*
+Free the resources held by a DigestCtx
+*/
+extern "C" void AppleCryptoNative_DigestFree(DigestCtx* pDigest);
+
+/*
+Create a digest handle for the specified algorithm.
+
+Returns NULL when the algorithm is unknown, or pcbDigest is NULL; otherwise returns a pointer
+to a digest context suitable for calling DigestUpdate and DigestFinal on and sets pcbDigest to
+the size of the digest output.
+*/
+extern "C" DigestCtx* AppleCryptoNative_DigestCreate(PAL_HashAlgorithm algorithm, int32_t* pcbDigest);
+
+/*
+Apply cbBuf bytes of data from pBuf to the ongoing digest represented in ctx.
+
+Returns 1 on success, 0 on failure, any other value on invalid inputs/state.
+*/
+extern "C" int AppleCryptoNative_DigestUpdate(DigestCtx* ctx, uint8_t* pBuf, int32_t cbBuf);
+
+/*
+Complete the digest in ctx, copying the results to pOutput, and reset ctx for a new digest.
+
+Returns 1 on success, 0 on failure, any other value on invalid inputs/state.
+*/
+extern "C" int AppleCryptoNative_DigestFinal(DigestCtx* ctx, uint8_t* pOutput, int32_t cbOutput);
diff --git a/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_hmac.cpp b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_hmac.cpp
new file mode 100644
index 0000000000..83fc5717ef
--- /dev/null
+++ b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_hmac.cpp
@@ -0,0 +1,111 @@
+// 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.
+
+#include "pal_hmac.h"
+
+struct hmac_ctx_st
+{
+ CCHmacAlgorithm appleAlgId;
+ CCHmacContext hmac;
+};
+
+extern "C" void AppleCryptoNative_HmacFree(HmacCtx* pHmac)
+{
+ if (pHmac != nullptr)
+ {
+ free(pHmac);
+ }
+}
+
+static CCHmacAlgorithm PalAlgorithmToAppleAlgorithm(PAL_HashAlgorithm algorithm)
+{
+ switch (algorithm)
+ {
+ case PAL_MD5:
+ return kCCHmacAlgMD5;
+ case PAL_SHA1:
+ return kCCHmacAlgSHA1;
+ case PAL_SHA256:
+ return kCCHmacAlgSHA256;
+ case PAL_SHA384:
+ return kCCHmacAlgSHA384;
+ case PAL_SHA512:
+ return kCCHmacAlgSHA512;
+ default:
+ // 0 is a defined value (SHA1) so "unknown" has to be something else
+ return UINT_MAX;
+ }
+}
+
+static int GetHmacOutputSize(PAL_HashAlgorithm algorithm)
+{
+ switch (algorithm)
+ {
+ case PAL_MD5:
+ return CC_MD5_DIGEST_LENGTH;
+ case PAL_SHA1:
+ return CC_SHA1_DIGEST_LENGTH;
+ case PAL_SHA256:
+ return CC_SHA256_DIGEST_LENGTH;
+ case PAL_SHA384:
+ return CC_SHA384_DIGEST_LENGTH;
+ case PAL_SHA512:
+ return CC_SHA512_DIGEST_LENGTH;
+ default:
+ return -1;
+ }
+}
+
+extern "C" HmacCtx* AppleCryptoNative_HmacCreate(PAL_HashAlgorithm algorithm, int32_t* pcbHmac)
+{
+ if (pcbHmac == nullptr)
+ return nullptr;
+
+ CCHmacAlgorithm appleAlgId = PalAlgorithmToAppleAlgorithm(algorithm);
+
+ if (appleAlgId == UINT_MAX)
+ {
+ *pcbHmac = -1;
+ return nullptr;
+ }
+
+ HmacCtx* hmacCtx = reinterpret_cast<HmacCtx*>(malloc(sizeof(HmacCtx)));
+ hmacCtx->appleAlgId = appleAlgId;
+ *pcbHmac = GetHmacOutputSize(algorithm);
+ return hmacCtx;
+}
+
+extern "C" int AppleCryptoNative_HmacInit(HmacCtx* ctx, uint8_t* pbKey, int32_t cbKey)
+{
+ if (ctx == nullptr || cbKey < 0)
+ return 0;
+ if (cbKey != 0 && pbKey == nullptr)
+ return 0;
+
+ // No return value
+ CCHmacInit(&ctx->hmac, ctx->appleAlgId, pbKey, static_cast<size_t>(cbKey));
+ return 1;
+}
+
+extern "C" int AppleCryptoNative_HmacUpdate(HmacCtx* ctx, uint8_t* pbData, int32_t cbData)
+{
+ if (cbData == 0)
+ return 1;
+ if (ctx == nullptr || pbData == nullptr)
+ return 0;
+
+ // No return value
+ CCHmacUpdate(&ctx->hmac, pbData, static_cast<size_t>(cbData));
+ return 1;
+}
+
+extern "C" int AppleCryptoNative_HmacFinal(HmacCtx* ctx, uint8_t* pbOutput)
+{
+ if (ctx == nullptr || pbOutput == nullptr)
+ return 0;
+
+ // No return value
+ CCHmacFinal(&ctx->hmac, pbOutput);
+ return 1;
+}
diff --git a/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_hmac.h b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_hmac.h
new file mode 100644
index 0000000000..e3fe201f2d
--- /dev/null
+++ b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_hmac.h
@@ -0,0 +1,46 @@
+// 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.
+
+#pragma once
+
+#include "pal_digest.h"
+#include "pal_types.h"
+
+typedef struct hmac_ctx_st HmacCtx;
+
+/*
+Free a HmacCtx created by AppleCryptoNative_HmacCreate
+*/
+extern "C" void AppleCryptoNative_HmacFree(HmacCtx* pHmac);
+
+/*
+Create an HmacCtx for the specified algorithm, receiving the hash output size in pcbHmac.
+
+If *pcbHmac is negative the algorithm is unknown or not supported. If a non-NULL value is returned
+it should be freed via AppleCryptoNative_HmacFree regardless of a negative pbHmac value.
+
+Returns NULL on error, an unkeyed HmacCtx otherwise.
+*/
+extern "C" HmacCtx* AppleCryptoNative_HmacCreate(PAL_HashAlgorithm algorithm, int32_t* pcbHmac);
+
+/*
+Initialize an HMAC to the correct key and start state.
+
+Returns 1 on success, 0 on error.
+*/
+extern "C" int AppleCryptoNative_HmacInit(HmacCtx* ctx, uint8_t* pbKey, int32_t cbKey);
+
+/*
+Add data into the HMAC
+
+Returns 1 on success, 0 on error.
+*/
+extern "C" int AppleCryptoNative_HmacUpdate(HmacCtx* ctx, uint8_t* pbData, int32_t cbData);
+
+/*
+Complete the HMAC and copy the result into pbOutput.
+
+Returns 1 on success, 0 on error.
+*/
+extern "C" int AppleCryptoNative_HmacFinal(HmacCtx* ctx, uint8_t* pbOutput);
diff --git a/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_secimportexport.cpp b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_secimportexport.cpp
new file mode 100644
index 0000000000..aab94032ad
--- /dev/null
+++ b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_secimportexport.cpp
@@ -0,0 +1,5 @@
+// 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.
+
+#include "pal_secimportexport.h"
diff --git a/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_secimportexport.h b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_secimportexport.h
new file mode 100644
index 0000000000..b3ff016e7b
--- /dev/null
+++ b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_secimportexport.h
@@ -0,0 +1,9 @@
+// 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.
+
+#pragma once
+
+#include "pal_types.h"
+
+#include <Security/Security.h>
diff --git a/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_symmetric.cpp b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_symmetric.cpp
new file mode 100644
index 0000000000..7716213d00
--- /dev/null
+++ b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_symmetric.cpp
@@ -0,0 +1,134 @@
+// 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.
+
+#include "pal_symmetric.h"
+
+#include <assert.h>
+
+static_assert(PAL_OperationEncrypt == kCCEncrypt, "");
+static_assert(PAL_OperationDecrypt == kCCDecrypt, "");
+
+static_assert(PAL_AlgorithmAES == kCCAlgorithmAES128, "");
+static_assert(PAL_Algorithm3DES == kCCAlgorithm3DES, "");
+
+static_assert(PAL_ChainingModeECB == kCCModeECB, "");
+static_assert(PAL_ChainingModeCBC == kCCModeCBC, "");
+
+static_assert(PAL_PaddingModeNone == ccNoPadding, "");
+static_assert(PAL_PaddingModePkcs7 == ccPKCS7Padding, "");
+
+// No PAL_SymmetricOptions are currently mapped, so no asserts required.
+
+extern "C" void AppleCryptoNative_CryptorFree(CCCryptorRef cryptor)
+{
+ if (cryptor != nullptr)
+ {
+ CCCryptorRelease(cryptor);
+ }
+}
+
+extern "C" int AppleCryptoNative_CryptorCreate(PAL_SymmetricOperation operation,
+ PAL_SymmetricAlgorithm algorithm,
+ PAL_ChainingMode chainingMode,
+ PAL_PaddingMode paddingMode,
+ const uint8_t* pbKey,
+ int32_t cbKey,
+ const uint8_t* pbIv,
+ PAL_SymmetricOptions options,
+ CCCryptorRef* ppCryptorOut,
+ int32_t* pccStatus)
+{
+ if (pccStatus == nullptr)
+ return -1;
+
+ *pccStatus = 0;
+
+ if (pbKey == nullptr || cbKey < 1 || ppCryptorOut == nullptr)
+ return -1;
+ if (pbIv == nullptr && chainingMode != PAL_ChainingModeECB)
+ return -1;
+
+ // Ensure we aren't passing through things we don't understand
+ assert(operation == PAL_OperationEncrypt || operation == PAL_OperationDecrypt);
+ assert(algorithm == PAL_AlgorithmAES || algorithm == PAL_Algorithm3DES);
+ assert(chainingMode == PAL_ChainingModeECB || chainingMode == PAL_ChainingModeCBC);
+ assert(paddingMode == PAL_PaddingModeNone || paddingMode == PAL_PaddingModePkcs7);
+ assert(options == 0);
+
+ CCStatus status = CCCryptorCreateWithMode(operation,
+ chainingMode,
+ algorithm,
+ paddingMode,
+ pbIv,
+ pbKey,
+ static_cast<size_t>(cbKey),
+ /* tweak is not supported */ nullptr,
+ 0,
+ /* numRounds is not supported */ 0,
+ options,
+ ppCryptorOut);
+
+ *pccStatus = status;
+ return status == kCCSuccess;
+}
+
+extern "C" int AppleCryptoNative_CryptorUpdate(CCCryptorRef cryptor,
+ const uint8_t* pbData,
+ int32_t cbData,
+ uint32_t* pbOutput,
+ int32_t cbOutput,
+ int32_t* pcbWritten,
+ int32_t* pccStatus)
+{
+ if (pccStatus == nullptr)
+ return -1;
+
+ *pccStatus = 0;
+
+ if (pbData == nullptr || cbData < 0 || pbOutput == nullptr || cbOutput < cbData || pcbWritten == nullptr)
+ return -1;
+
+ CCStatus status = CCCryptorUpdate(cryptor,
+ pbData,
+ static_cast<size_t>(cbData),
+ pbOutput,
+ static_cast<size_t>(cbOutput),
+ reinterpret_cast<size_t*>(pcbWritten));
+
+ *pccStatus = status;
+ return status == kCCSuccess;
+}
+
+extern "C" int AppleCryptoNative_CryptorFinal(
+ CCCryptorRef cryptor, uint8_t* pbOutput, int32_t cbOutput, int32_t* pcbWritten, int32_t* pccStatus)
+{
+ if (pccStatus == nullptr)
+ return -1;
+
+ *pccStatus = 0;
+
+ if (pbOutput == nullptr || cbOutput < 0 || pcbWritten == nullptr)
+ return -1;
+
+ CCStatus status =
+ CCCryptorFinal(cryptor, pbOutput, static_cast<size_t>(cbOutput), reinterpret_cast<size_t*>(pcbWritten));
+
+ *pccStatus = status;
+ return status == kCCSuccess;
+}
+
+extern "C" int AppleCryptoNative_CryptorReset(CCCryptorRef cryptor, const uint8_t* pbIv, int32_t* pccStatus)
+{
+ if (pccStatus == nullptr)
+ return -1;
+
+ *pccStatus = 0;
+
+ if (cryptor == nullptr)
+ return -1;
+
+ CCStatus status = CCCryptorReset(cryptor, pbIv);
+ *pccStatus = status;
+ return status == kCCSuccess;
+}
diff --git a/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_symmetric.h b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_symmetric.h
new file mode 100644
index 0000000000..db976f7885
--- /dev/null
+++ b/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_symmetric.h
@@ -0,0 +1,103 @@
+// 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.
+
+#pragma once
+
+#include "pal_types.h"
+
+#include <CommonCrypto/CommonCrypto.h>
+#include <CommonCrypto/CommonCryptor.h>
+
+enum
+{
+ PAL_OperationEncrypt = 0,
+ PAL_OperationDecrypt = 1,
+};
+typedef uint32_t PAL_SymmetricOperation;
+
+enum
+{
+ PAL_AlgorithmAES = 0,
+ PAL_Algorithm3DES = 2,
+};
+typedef uint32_t PAL_SymmetricAlgorithm;
+
+enum
+{
+ PAL_ChainingModeECB = 1,
+ PAL_ChainingModeCBC = 2,
+};
+typedef uint32_t PAL_ChainingMode;
+
+enum
+{
+ PAL_PaddingModeNone = 0,
+ PAL_PaddingModePkcs7 = 1,
+};
+typedef uint32_t PAL_PaddingMode;
+
+// Pre-defined for future expansion.
+// CryptorCreateWithMode accepts an option to define CTR mode as little-endian or big-endian,
+// and may in the future define other options.
+// So as to avoid changing the function signature in the future, the enum shell is being
+// declared now.
+enum
+{
+ PAL_SymmetricOptions_None = 0,
+};
+typedef uint32_t PAL_SymmetricOptions;
+
+/*
+Free a CCCryptor created by AppleCryptoNative_CryptorCreate.
+*/
+extern "C" void AppleCryptoNative_CryptorFree(CCCryptorRef cryptor);
+
+/*
+Create a CCCryptor for the described symmetric algorithm with a chosen operation, chainingMode,
+paddingMode, key, iv, and options. The CCCryptorRef, if created, is assigned to *ppCryptorOut,
+and in the event of a system error *pkCCStatus is updated.
+
+Note that there is no validation on the length of pbIv. cbIv is calculated based upon the chosen
+algorithm and assumed valid. pbIv is only allowed to be NULL for PAL_ChainingModeECB.
+
+Returns 1 on success, 0 on system error, -1 on input error.
+*/
+extern "C" int AppleCryptoNative_CryptorCreate(PAL_SymmetricOperation operation,
+ PAL_SymmetricAlgorithm algorithm,
+ PAL_ChainingMode chainingMode,
+ PAL_PaddingMode paddingMode,
+ const uint8_t* pbKey,
+ int32_t cbKey,
+ const uint8_t* pbIv,
+ PAL_SymmetricOptions options,
+ CCCryptorRef* ppCryptorOut,
+ int32_t* pkCCStatus);
+
+/*
+Shims CCCryptorUpdate, updating *pkCCStatus as its output.
+
+Returns 1 on success, 0 on system error, -1 on input error.
+*/
+extern "C" int AppleCryptoNative_CryptorUpdate(CCCryptorRef cryptor,
+ const uint8_t* pbData,
+ int32_t cbData,
+ uint32_t* pbOutput,
+ int32_t cbOutput,
+ int32_t* pcbWritten,
+ int32_t* pkCCStatus);
+
+/*
+Shims CCCryptorFinal, updating *pkCCStatus as its output.
+
+Returns 1 on success, 0 on system error, -1 on input error.
+*/
+extern "C" int AppleCryptoNative_CryptorFinal(
+ CCCryptorRef cryptor, uint8_t* pbOutput, int32_t cbOutput, int32_t* pcbWritten, int32_t* pkCCStatus);
+
+/*
+Shims CCCryptorReset, updating *pkCCStatus as its output.
+
+Returns 1 on success, 0 on system error, -1 on input error.
+*/
+extern "C" int AppleCryptoNative_CryptorReset(CCCryptorRef cryptor, const uint8_t* pbIv, int32_t* pkCCStatus);
diff --git a/src/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt b/src/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt
index 3e4d561c43..7397f2deb2 100644
--- a/src/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt
+++ b/src/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt
@@ -45,20 +45,32 @@ set(NATIVECRYPTO_SOURCES
pal_x509ext.cpp
)
+add_library(objlib OBJECT ${NATIVECRYPTO_SOURCES} ${VERSION_FILE_PATH})
+
add_library(System.Security.Cryptography.Native
SHARED
- ${NATIVECRYPTO_SOURCES}
- ${VERSION_FILE_PATH}
+ $<TARGET_OBJECTS:objlib>
+)
+
+add_library(System.Security.Cryptography.Native.OpenSsl
+ SHARED
+ $<TARGET_OBJECTS:objlib>
)
# Disable the "lib" prefix.
set_target_properties(System.Security.Cryptography.Native PROPERTIES PREFIX "")
+set_target_properties(System.Security.Cryptography.Native.OpenSsl PROPERTIES PREFIX "")
target_link_libraries(System.Security.Cryptography.Native
${OPENSSL_CRYPTO_LIBRARY}
${OPENSSL_SSL_LIBRARY}
)
+target_link_libraries(System.Security.Cryptography.Native.OpenSsl
+ ${OPENSSL_CRYPTO_LIBRARY}
+ ${OPENSSL_SSL_LIBRARY}
+)
+
# On OS X every library emits the manner in which it should be referenced.
# All of our libraries are referenced via @rpath, which is similar to how Linux and Windows
# libraries are loaded. The homebrew installation of OpenSSL (libcrypto, libssl) uses the
@@ -73,8 +85,15 @@ if (APPLE)
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change /usr/local/opt/openssl/lib/libssl.1.0.0.dylib @rpath/libssl.1.0.0.dylib $<TARGET_FILE:System.Security.Cryptography.Native>
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @loader_path $<TARGET_FILE:System.Security.Cryptography.Native>
)
+
+ add_custom_command(TARGET System.Security.Cryptography.Native.OpenSsl POST_BUILD
+ COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib @rpath/libcrypto.1.0.0.dylib $<TARGET_FILE:System.Security.Cryptography.Native.OpenSsl>
+ COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change /usr/local/opt/openssl/lib/libssl.1.0.0.dylib @rpath/libssl.1.0.0.dylib $<TARGET_FILE:System.Security.Cryptography.Native.OpenSsl>
+ COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @loader_path $<TARGET_FILE:System.Security.Cryptography.Native.OpenSsl>
+ )
endif()
include(configure.cmake)
install_library_and_symbols (System.Security.Cryptography.Native)
+install_library_and_symbols (System.Security.Cryptography.Native.OpenSsl)
diff --git a/src/Native/Unix/System.Security.Cryptography.Native/pal_pkcs12.cpp b/src/Native/Unix/System.Security.Cryptography.Native/pal_pkcs12.cpp
index c84f6be7dd..6b455f4daa 100644
--- a/src/Native/Unix/System.Security.Cryptography.Native/pal_pkcs12.cpp
+++ b/src/Native/Unix/System.Security.Cryptography.Native/pal_pkcs12.cpp
@@ -55,6 +55,16 @@ extern "C" int32_t CryptoNative_Pkcs12Parse(PKCS12* p12, const char* pass, EVP_P
// error queue. If we're returning success, clear the error queue.
ERR_clear_error();
}
+ else
+ {
+ // If PKCS12_parse encounters an error it will free the handles it
+ // created, but it does not clear the output parameters they were
+ // placed in.
+ // If those handles make it back into managed code they will crash
+ // the coreclr when Disposed.
+ *pkey = nullptr;
+ *cert = nullptr;
+ }
return ret;
}
diff --git a/src/Native/Unix/configure.cmake b/src/Native/Unix/configure.cmake
index d7d4baf619..1f3d3bdb8f 100644
--- a/src/Native/Unix/configure.cmake
+++ b/src/Native/Unix/configure.cmake
@@ -24,6 +24,9 @@ else ()
message(FATAL_ERROR "Unknown platform. Cannot define PAL_UNIX_NAME, used by RuntimeInformation.")
endif ()
+# We compile with -Werror, so we need to make sure these code fragments compile without warnings.
+set(CMAKE_REQUIRED_FLAGS -Werror)
+
# in_pktinfo: Find whether this struct exists
check_include_files(
linux/in.h
@@ -168,12 +171,30 @@ check_struct_has_member(
check_cxx_source_compiles(
"
#include <string.h>
- int main() { char* c = strerror_r(0, 0, 0); }
+ int main()
+ {
+ char buffer[1];
+ char* c = strerror_r(0, buffer, 0);
+ }
"
HAVE_GNU_STRERROR_R)
check_cxx_source_compiles(
"
+ #include <dirent.h>
+ int main(void)
+ {
+ DIR* dir;
+ struct dirent* entry;
+ struct dirent* result;
+ readdir_r(dir, entry, &result);
+ return 0;
+ }
+ "
+ HAVE_READDIR_R)
+
+check_cxx_source_compiles(
+ "
#include <sys/types.h>
#include <sys/event.h>
int main(void)
@@ -274,12 +295,12 @@ check_cxx_source_runs(
#include <sys/time.h>
int main()
{
- int ret;
+ int ret;
struct timespec ts;
ret = clock_gettime(CLOCK_MONOTONIC, &ts);
exit(ret);
}
- "
+ "
HAVE_CLOCK_MONOTONIC)
check_function_exists(
@@ -399,9 +420,9 @@ check_function_exists(
set (HAVE_INOTIFY 0)
if (HAVE_INOTIFY_INIT AND HAVE_INOTIFY_ADD_WATCH AND HAVE_INOTIFY_RM_WATCH)
- set (HAVE_INOTIFY 1)
+ set (HAVE_INOTIFY 1)
elseif (CMAKE_SYSTEM_NAME STREQUAL Linux)
- message(FATAL_ERROR "Cannot find inotify functions on a Linux platform.")
+ message(FATAL_ERROR "Cannot find inotify functions on a Linux platform.")
endif()
check_cxx_source_compiles(
@@ -428,8 +449,8 @@ check_cxx_source_compiles(
check_cxx_source_compiles(
"
#include <curl/curl.h>
- int main()
- {
+ int main()
+ {
int i = CURL_SSLVERSION_TLSv1_0;
i = CURL_SSLVERSION_TLSv1_1;
i = CURL_SSLVERSION_TLSv1_2;
diff --git a/src/Native/build-native.sh b/src/Native/build-native.sh
index dbfb167b45..120c39df16 100755
--- a/src/Native/build-native.sh
+++ b/src/Native/build-native.sh
@@ -187,6 +187,10 @@ while :; do
__ClangMajorVersion=3
__ClangMinorVersion=8
;;
+ clang3.9)
+ __ClangMajorVersion=3
+ __ClangMinorVersion=9
+ ;;
cross)
__CrossBuild=1
;;
@@ -218,6 +222,27 @@ while :; do
shift
done
+# Set cross build
+CPUName=$(uname -p)
+# Some Linux platforms report unknown for platform, but the arch for machine.
+if [ $CPUName == "unknown" ]; then
+ CPUName=$(uname -m)
+fi
+case $CPUName in
+ i686)
+ if [ $__BuildArch != x86 ]; then
+ __CrossBuild=1
+ echo "Set CrossBuild for $__BuildArch build"
+ fi
+ ;;
+ x86_64)
+ if [ $__BuildArch != x64 ]; then
+ __CrossBuild=1
+ echo "Set CrossBuild for $__BuildArch build"
+ fi
+ ;;
+esac
+
# Set the remaining variables based upon the determined build configuration
__IntermediatesDir="$__rootbinpath/obj/$__BuildOS.$__BuildArch.$__BuildType/Native"
__BinDir="$__rootbinpath/$__BuildOS.$__BuildArch.$__BuildType/Native"
diff --git a/src/Native/pkg/dir.props b/src/Native/pkg/dir.props
index 453856a83d..aa0d5447f0 100644
--- a/src/Native/pkg/dir.props
+++ b/src/Native/pkg/dir.props
@@ -30,10 +30,13 @@
<RHELNativePath Condition="'$(RHELNativePath)' == ''">$(BuildNativePath)</RHELNativePath>
<DebianNativePath Condition="'$(DebianNativePath)' == ''">$(BuildNativePath)</DebianNativePath>
<Fedora23NativePath Condition="'$(Fedora23NativePath)' == ''">$(BuildNativePath)</Fedora23NativePath>
+ <Fedora24NativePath Condition="'$(Fedora24NativePath)' == ''">$(BuildNativePath)</Fedora24NativePath>
<OSXNativePath Condition="'$(OSXNativePath)' == ''">$(BuildNativePath)</OSXNativePath>
<OpenSuse132NativePath Condition="'$(OpenSuse132NativePath)' == ''">$(BuildNativePath)</OpenSuse132NativePath>
+ <OpenSuse421NativePath Condition="'$(OpenSuse421NativePath)' == ''">$(BuildNativePath)</OpenSuse421NativePath>
<Ubuntu1404NativePath Condition="'$(Ubuntu1404NativePath)' == ''">$(BuildNativePath)</Ubuntu1404NativePath>
<Ubuntu1604NativePath Condition="'$(Ubuntu1604NativePath)' == ''">$(BuildNativePath)</Ubuntu1604NativePath>
+ <Ubuntu1610NativePath Condition="'$(Ubuntu1610NativePath)' == ''">$(BuildNativePath)</Ubuntu1610NativePath>
<SkipPackageFileCheck>true</SkipPackageFileCheck>
</PropertyGroup>
diff --git a/src/Native/pkg/runtime.native.System.Data.SqlClient.sni/runtime.native.System.Data.SqlClient.sni.pkgproj b/src/Native/pkg/runtime.native.System.Data.SqlClient.sni/runtime.native.System.Data.SqlClient.sni.pkgproj
index f7103674a6..88a2c46aaa 100644
--- a/src/Native/pkg/runtime.native.System.Data.SqlClient.sni/runtime.native.System.Data.SqlClient.sni.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Data.SqlClient.sni/runtime.native.System.Data.SqlClient.sni.pkgproj
@@ -2,20 +2,18 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <!-- TODO: Get this from the file version -->
- <Version>4.0.2</Version>
<SkipPackageFileCheck>true</SkipPackageFileCheck>
<SkipValidatePackage>true</SkipValidatePackage>
</PropertyGroup>
<ItemGroup>
<Dependency Include="runtime.win7-x64.runtime.native.System.Data.SqlClient.sni">
- <Version>4.0.2-$(ExternalExpectedPrerelease)</Version>
+ <Version>$(PackageVersion)-$(ExternalExpectedPrerelease)</Version>
</Dependency>
<Dependency Include="runtime.win7-x86.runtime.native.System.Data.SqlClient.sni">
- <Version>4.0.2-$(ExternalExpectedPrerelease)</Version>
+ <Version>$(PackageVersion)-$(ExternalExpectedPrerelease)</Version>
</Dependency>
<Dependency Include="runtime.win10-arm64.runtime.native.System.Data.SqlClient.sni">
- <Version>4.0.2-$(ExternalExpectedPrerelease)</Version>
+ <Version>$(PackageVersion)-$(ExternalExpectedPrerelease)</Version>
</Dependency>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
diff --git a/src/Native/pkg/runtime.native.System.Data.SqlClient.sni/win/runtime.native.System.Data.SqlClient.sni.pkgproj b/src/Native/pkg/runtime.native.System.Data.SqlClient.sni/win/runtime.native.System.Data.SqlClient.sni.pkgproj
index eed728f9cc..955f16353a 100644
--- a/src/Native/pkg/runtime.native.System.Data.SqlClient.sni/win/runtime.native.System.Data.SqlClient.sni.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Data.SqlClient.sni/win/runtime.native.System.Data.SqlClient.sni.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2</Version>
<WinVersion Condition="'$(PackagePlatform)'=='arm64'">win10</WinVersion>
<WinVersion Condition="'$(PackagePlatform)'=='x86' OR '$(PackagePlatform)'=='x64'">win7</WinVersion>
<!-- use the same naming convention as a runtime package, but don't treat as a runtime dependency -->
diff --git a/src/Native/pkg/runtime.native.System.IO.Compression/debian/runtime.native.System.IO.Compression.pkgproj b/src/Native/pkg/runtime.native.System.IO.Compression/debian/runtime.native.System.IO.Compression.pkgproj
index 050f036dcf..6447b8259f 100644
--- a/src/Native/pkg/runtime.native.System.IO.Compression/debian/runtime.native.System.IO.Compression.pkgproj
+++ b/src/Native/pkg/runtime.native.System.IO.Compression/debian/runtime.native.System.IO.Compression.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.1.1</Version>
<PackageTargetRuntime>debian.8-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.IO.Compression/fedora/23/runtime.native.System.IO.Compression.pkgproj b/src/Native/pkg/runtime.native.System.IO.Compression/fedora/23/runtime.native.System.IO.Compression.pkgproj
index ce6d68a111..1f7f04f236 100644
--- a/src/Native/pkg/runtime.native.System.IO.Compression/fedora/23/runtime.native.System.IO.Compression.pkgproj
+++ b/src/Native/pkg/runtime.native.System.IO.Compression/fedora/23/runtime.native.System.IO.Compression.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.1.1</Version>
<PackageTargetRuntime>fedora.23-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.IO.Compression/fedora/24/runtime.native.System.IO.Compression.pkgproj b/src/Native/pkg/runtime.native.System.IO.Compression/fedora/24/runtime.native.System.IO.Compression.pkgproj
new file mode 100644
index 0000000000..1bbd5b4752
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.IO.Compression/fedora/24/runtime.native.System.IO.Compression.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>fedora.24-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(Fedora24NativePath)System.IO.Compression.Native.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/Native/pkg/runtime.native.System.IO.Compression/opensuse/13.2/runtime.native.System.IO.Compression.pkgproj b/src/Native/pkg/runtime.native.System.IO.Compression/opensuse/13.2/runtime.native.System.IO.Compression.pkgproj
index 042dff76f2..d6835cb2e2 100644
--- a/src/Native/pkg/runtime.native.System.IO.Compression/opensuse/13.2/runtime.native.System.IO.Compression.pkgproj
+++ b/src/Native/pkg/runtime.native.System.IO.Compression/opensuse/13.2/runtime.native.System.IO.Compression.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.1.1</Version>
<PackageTargetRuntime>opensuse.13.2-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.IO.Compression/opensuse/42.1/runtime.native.System.IO.Compression.pkgproj b/src/Native/pkg/runtime.native.System.IO.Compression/opensuse/42.1/runtime.native.System.IO.Compression.pkgproj
new file mode 100644
index 0000000000..bc065df97f
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.IO.Compression/opensuse/42.1/runtime.native.System.IO.Compression.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>opensuse.42.1-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(OpenSuse421NativePath)System.IO.Compression.Native.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/Native/pkg/runtime.native.System.IO.Compression/osx/runtime.native.System.IO.Compression.pkgproj b/src/Native/pkg/runtime.native.System.IO.Compression/osx/runtime.native.System.IO.Compression.pkgproj
index 35aa7f7def..f993da6150 100644
--- a/src/Native/pkg/runtime.native.System.IO.Compression/osx/runtime.native.System.IO.Compression.pkgproj
+++ b/src/Native/pkg/runtime.native.System.IO.Compression/osx/runtime.native.System.IO.Compression.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.1.1</Version>
<PackageTargetRuntime>osx.10.10-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.IO.Compression/rhel/runtime.native.System.IO.Compression.pkgproj b/src/Native/pkg/runtime.native.System.IO.Compression/rhel/runtime.native.System.IO.Compression.pkgproj
index 0e00165193..34d24f599b 100644
--- a/src/Native/pkg/runtime.native.System.IO.Compression/rhel/runtime.native.System.IO.Compression.pkgproj
+++ b/src/Native/pkg/runtime.native.System.IO.Compression/rhel/runtime.native.System.IO.Compression.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.1.1</Version>
<PackageTargetRuntime>rhel.7-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.IO.Compression/runtime.native.System.IO.Compression.builds b/src/Native/pkg/runtime.native.System.IO.Compression/runtime.native.System.IO.Compression.builds
index d607b04db9..0f1cff0e0e 100644
--- a/src/Native/pkg/runtime.native.System.IO.Compression/runtime.native.System.IO.Compression.builds
+++ b/src/Native/pkg/runtime.native.System.IO.Compression/runtime.native.System.IO.Compression.builds
@@ -15,6 +15,10 @@
<OSGroup>fedora.23</OSGroup>
<Platform>amd64</Platform>
</Project>
+ <Project Include="fedora\24\runtime.native.System.IO.Compression.pkgproj">
+ <OSGroup>fedora.24</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
<Project Include="ubuntu\14.04\runtime.native.System.IO.Compression.pkgproj">
<OSGroup>ubuntu.14.04</OSGroup>
<Platform>amd64</Platform>
@@ -23,6 +27,10 @@
<OSGroup>ubuntu.16.04</OSGroup>
<Platform>amd64</Platform>
</Project>
+ <Project Include="ubuntu\16.10\runtime.native.System.IO.Compression.pkgproj">
+ <OSGroup>ubuntu.16.10</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
<Project Include="osx\runtime.native.System.IO.Compression.pkgproj">
<OSGroup>osx.10</OSGroup>
<Platform>amd64</Platform>
@@ -31,6 +39,10 @@
<OSGroup>opensuse.13.2</OSGroup>
<Platform>amd64</Platform>
</Project>
+ <Project Include="opensuse\42.1\runtime.native.System.IO.Compression.pkgproj">
+ <OSGroup>opensuse.42.1</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
<Project Include="win\runtime.native.System.IO.Compression.pkgproj">
<OSGroup>Windows_NT</OSGroup>
<Platform>x86</Platform>
diff --git a/src/Native/pkg/runtime.native.System.IO.Compression/runtime.native.System.IO.Compression.pkgproj b/src/Native/pkg/runtime.native.System.IO.Compression/runtime.native.System.IO.Compression.pkgproj
index 7d1b275673..9aa4de25dc 100644
--- a/src/Native/pkg/runtime.native.System.IO.Compression/runtime.native.System.IO.Compression.pkgproj
+++ b/src/Native/pkg/runtime.native.System.IO.Compression/runtime.native.System.IO.Compression.pkgproj
@@ -2,11 +2,12 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.1.1</Version>
<SkipPackageFileCheck>true</SkipPackageFileCheck>
<SkipValidatePackage>true</SkipValidatePackage>
</PropertyGroup>
<ItemGroup>
+ <!-- When updating ExternalExpectedPrerelease with a version that
+ below should be updated to $(PackageVersion)-$(ExternalExpectedPrerelease) -->
<RuntimeDependency Include="runtime.win10-x64-aot.runtime.native.System.IO.Compression">
<TargetRuntime>win10-amd64-aot</TargetRuntime>
<Version>4.1.1-$(ExternalExpectedPrerelease)</Version>
@@ -35,18 +36,27 @@
<ProjectReference Include="fedora\23\runtime.native.System.IO.Compression.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
+ <ProjectReference Include="fedora\24\runtime.native.System.IO.Compression.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
<ProjectReference Include="osx\runtime.native.System.IO.Compression.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
<ProjectReference Include="opensuse\13.2\runtime.native.System.IO.Compression.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
+ <ProjectReference Include="opensuse\42.1\runtime.native.System.IO.Compression.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
<ProjectReference Include="ubuntu\14.04\runtime.native.System.IO.Compression.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
<ProjectReference Include="ubuntu\16.04\runtime.native.System.IO.Compression.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
+ <ProjectReference Include="ubuntu\16.10\runtime.native.System.IO.Compression.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
<ProjectReference Include="win\runtime.native.System.IO.Compression.pkgproj">
<Platform>x86</Platform>
</ProjectReference>
diff --git a/src/Native/pkg/runtime.native.System.IO.Compression/ubuntu/14.04/runtime.native.System.IO.Compression.pkgproj b/src/Native/pkg/runtime.native.System.IO.Compression/ubuntu/14.04/runtime.native.System.IO.Compression.pkgproj
index ccd9a3e30c..49e9b822d1 100644
--- a/src/Native/pkg/runtime.native.System.IO.Compression/ubuntu/14.04/runtime.native.System.IO.Compression.pkgproj
+++ b/src/Native/pkg/runtime.native.System.IO.Compression/ubuntu/14.04/runtime.native.System.IO.Compression.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.1.1</Version>
<PackageTargetRuntime>ubuntu.14.04-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.IO.Compression/ubuntu/16.04/runtime.native.System.IO.Compression.pkgproj b/src/Native/pkg/runtime.native.System.IO.Compression/ubuntu/16.04/runtime.native.System.IO.Compression.pkgproj
index 2bbc1e9992..d228b5a1d3 100644
--- a/src/Native/pkg/runtime.native.System.IO.Compression/ubuntu/16.04/runtime.native.System.IO.Compression.pkgproj
+++ b/src/Native/pkg/runtime.native.System.IO.Compression/ubuntu/16.04/runtime.native.System.IO.Compression.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.1.1</Version>
<PackageTargetRuntime>ubuntu.16.04-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.IO.Compression/ubuntu/16.10/runtime.native.System.IO.Compression.pkgproj b/src/Native/pkg/runtime.native.System.IO.Compression/ubuntu/16.10/runtime.native.System.IO.Compression.pkgproj
new file mode 100644
index 0000000000..8b9e39fe29
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.IO.Compression/ubuntu/16.10/runtime.native.System.IO.Compression.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>ubuntu.16.10-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(Ubuntu1610NativePath)System.IO.Compression.Native.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/Native/pkg/runtime.native.System.IO.Compression/win/runtime.native.System.IO.Compression.pkgproj b/src/Native/pkg/runtime.native.System.IO.Compression/win/runtime.native.System.IO.Compression.pkgproj
index 6ea47ed2d1..5e85b5c135 100644
--- a/src/Native/pkg/runtime.native.System.IO.Compression/win/runtime.native.System.IO.Compression.pkgproj
+++ b/src/Native/pkg/runtime.native.System.IO.Compression/win/runtime.native.System.IO.Compression.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.1.1</Version>
<WinVersion Condition="'$(PackagePlatform)'=='arm'">win8</WinVersion>
<WinVersion Condition="'$(PackagePlatform)'=='arm64'">win10</WinVersion>
<WinVersion Condition="'$(PackagePlatform)'=='x86' OR '$(PackagePlatform)'=='x64'">win7</WinVersion>
diff --git a/src/Native/pkg/runtime.native.System.IO.Compression/win10/runtime.native.System.IO.Compression.pkgproj b/src/Native/pkg/runtime.native.System.IO.Compression/win10/runtime.native.System.IO.Compression.pkgproj
index 180879b55f..810daa5085 100644
--- a/src/Native/pkg/runtime.native.System.IO.Compression/win10/runtime.native.System.IO.Compression.pkgproj
+++ b/src/Native/pkg/runtime.native.System.IO.Compression/win10/runtime.native.System.IO.Compression.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.1.1</Version>
<PackageTargetRuntime>win10-$(PackagePlatform)-aot</PackageTargetRuntime>
</PropertyGroup>
<ItemGroup>
diff --git a/src/Native/pkg/runtime.native.System.Net.Http/debian/runtime.native.System.Net.Http.pkgproj b/src/Native/pkg/runtime.native.System.Net.Http/debian/runtime.native.System.Net.Http.pkgproj
index f528722f86..0de25ecd38 100644
--- a/src/Native/pkg/runtime.native.System.Net.Http/debian/runtime.native.System.Net.Http.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Net.Http/debian/runtime.native.System.Net.Http.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2</Version>
<PackageTargetRuntime>debian.8-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Net.Http/fedora/23/runtime.native.System.Net.Http.pkgproj b/src/Native/pkg/runtime.native.System.Net.Http/fedora/23/runtime.native.System.Net.Http.pkgproj
index ed7ab4ddd0..c7eef4220f 100644
--- a/src/Native/pkg/runtime.native.System.Net.Http/fedora/23/runtime.native.System.Net.Http.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Net.Http/fedora/23/runtime.native.System.Net.Http.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2</Version>
<PackageTargetRuntime>fedora.23-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/System.Diagnostics.Debug.SymbolReader/pkg/System.Diagnostics.Debug.SymbolReader.pkgproj b/src/Native/pkg/runtime.native.System.Net.Http/fedora/24/runtime.native.System.Net.Http.pkgproj
index 62cee3e1c7..30d6f38132 100644
--- a/src/System.Diagnostics.Debug.SymbolReader/pkg/System.Diagnostics.Debug.SymbolReader.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Net.Http/fedora/24/runtime.native.System.Net.Http.pkgproj
@@ -1,10 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>fedora.24-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
<ItemGroup>
- <ProjectReference Include="..\src\System.Diagnostics.Debug.SymbolReader.csproj">
- <SupportedFramework>net46;netcore50;netcoreapp1.0;$(AllXamarinFrameworks)</SupportedFramework>
- </ProjectReference>
+ <NativeFile Include="$(Fedora24NativePath)System.Net.Http.Native.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project> \ No newline at end of file
diff --git a/src/Native/pkg/runtime.native.System.Net.Http/opensuse/13.2/runtime.native.System.Net.Http.pkgproj b/src/Native/pkg/runtime.native.System.Net.Http/opensuse/13.2/runtime.native.System.Net.Http.pkgproj
index c774a8152b..54134042cc 100644
--- a/src/Native/pkg/runtime.native.System.Net.Http/opensuse/13.2/runtime.native.System.Net.Http.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Net.Http/opensuse/13.2/runtime.native.System.Net.Http.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2</Version>
<PackageTargetRuntime>opensuse.13.2-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Net.Http/opensuse/42.1/runtime.native.System.Net.Http.pkgproj b/src/Native/pkg/runtime.native.System.Net.Http/opensuse/42.1/runtime.native.System.Net.Http.pkgproj
new file mode 100644
index 0000000000..9f988d513d
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Net.Http/opensuse/42.1/runtime.native.System.Net.Http.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>opensuse.42.1-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(OpenSuse421NativePath)System.Net.Http.Native.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/Native/pkg/runtime.native.System.Net.Http/osx/runtime.native.System.Net.Http.pkgproj b/src/Native/pkg/runtime.native.System.Net.Http/osx/runtime.native.System.Net.Http.pkgproj
index ad3042eb57..eaccd037aa 100644
--- a/src/Native/pkg/runtime.native.System.Net.Http/osx/runtime.native.System.Net.Http.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Net.Http/osx/runtime.native.System.Net.Http.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2</Version>
<PackageTargetRuntime>osx.10.10-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Net.Http/rhel/runtime.native.System.Net.Http.pkgproj b/src/Native/pkg/runtime.native.System.Net.Http/rhel/runtime.native.System.Net.Http.pkgproj
index 8cdd4c2124..7938cedaa0 100644
--- a/src/Native/pkg/runtime.native.System.Net.Http/rhel/runtime.native.System.Net.Http.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Net.Http/rhel/runtime.native.System.Net.Http.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2</Version>
<PackageTargetRuntime>rhel.7-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Net.Http/runtime.native.System.Net.Http.builds b/src/Native/pkg/runtime.native.System.Net.Http/runtime.native.System.Net.Http.builds
index 3dbd0a2f67..7b0a7dac54 100644
--- a/src/Native/pkg/runtime.native.System.Net.Http/runtime.native.System.Net.Http.builds
+++ b/src/Native/pkg/runtime.native.System.Net.Http/runtime.native.System.Net.Http.builds
@@ -15,6 +15,10 @@
<OSGroup>fedora.23</OSGroup>
<Platform>amd64</Platform>
</Project>
+ <Project Include="fedora\24\runtime.native.System.Net.Http.pkgproj">
+ <OSGroup>fedora.24</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
<Project Include="ubuntu\14.04\runtime.native.System.Net.Http.pkgproj">
<OSGroup>ubuntu.14.04</OSGroup>
<Platform>amd64</Platform>
@@ -23,6 +27,10 @@
<OSGroup>ubuntu.16.04</OSGroup>
<Platform>amd64</Platform>
</Project>
+ <Project Include="ubuntu\16.10\runtime.native.System.Net.Http.pkgproj">
+ <OSGroup>ubuntu.16.10</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
<Project Include="osx\runtime.native.System.Net.Http.pkgproj">
<OSGroup>osx.10</OSGroup>
<Platform>amd64</Platform>
@@ -31,6 +39,10 @@
<OSGroup>opensuse.13.2</OSGroup>
<Platform>amd64</Platform>
</Project>
+ <Project Include="opensuse\42.1\runtime.native.System.Net.Http.pkgproj">
+ <OSGroup>opensuse.42.1</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
</Project>
diff --git a/src/Native/pkg/runtime.native.System.Net.Http/runtime.native.System.Net.Http.pkgproj b/src/Native/pkg/runtime.native.System.Net.Http/runtime.native.System.Net.Http.pkgproj
index fd5b5ce6a1..ec58118ed2 100644
--- a/src/Native/pkg/runtime.native.System.Net.Http/runtime.native.System.Net.Http.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Net.Http/runtime.native.System.Net.Http.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2</Version>
<SkipPackageFileCheck>true</SkipPackageFileCheck>
<SkipValidatePackage>true</SkipValidatePackage>
</PropertyGroup>
@@ -20,18 +19,27 @@
<ProjectReference Include="fedora\23\runtime.native.System.Net.Http.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
+ <ProjectReference Include="fedora\24\runtime.native.System.Net.Http.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
<ProjectReference Include="osx\runtime.native.System.Net.Http.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
<ProjectReference Include="opensuse\13.2\runtime.native.System.Net.Http.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
+ <ProjectReference Include="opensuse\42.1\runtime.native.System.Net.Http.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
<ProjectReference Include="ubuntu\14.04\runtime.native.System.Net.Http.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
<ProjectReference Include="ubuntu\16.04\runtime.native.System.Net.Http.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
+ <ProjectReference Include="ubuntu\16.10\runtime.native.System.Net.Http.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project> \ No newline at end of file
diff --git a/src/Native/pkg/runtime.native.System.Net.Http/ubuntu/14.04/runtime.native.System.Net.Http.pkgproj b/src/Native/pkg/runtime.native.System.Net.Http/ubuntu/14.04/runtime.native.System.Net.Http.pkgproj
index 9ea0f4ac98..e8b75cfd60 100644
--- a/src/Native/pkg/runtime.native.System.Net.Http/ubuntu/14.04/runtime.native.System.Net.Http.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Net.Http/ubuntu/14.04/runtime.native.System.Net.Http.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2</Version>
<PackageTargetRuntime>ubuntu.14.04-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Net.Http/ubuntu/16.04/runtime.native.System.Net.Http.pkgproj b/src/Native/pkg/runtime.native.System.Net.Http/ubuntu/16.04/runtime.native.System.Net.Http.pkgproj
index 3b154138f8..5d9bed6fc8 100644
--- a/src/Native/pkg/runtime.native.System.Net.Http/ubuntu/16.04/runtime.native.System.Net.Http.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Net.Http/ubuntu/16.04/runtime.native.System.Net.Http.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2</Version>
<PackageTargetRuntime>ubuntu.16.04-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Net.Http/ubuntu/16.10/runtime.native.System.Net.Http.pkgproj b/src/Native/pkg/runtime.native.System.Net.Http/ubuntu/16.10/runtime.native.System.Net.Http.pkgproj
new file mode 100644
index 0000000000..eea026c095
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Net.Http/ubuntu/16.10/runtime.native.System.Net.Http.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>ubuntu.16.10-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(Ubuntu1610NativePath)System.Net.Http.Native.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/Native/pkg/runtime.native.System.Net.Security/debian/runtime.native.System.Net.Security.pkgproj b/src/Native/pkg/runtime.native.System.Net.Security/debian/runtime.native.System.Net.Security.pkgproj
index bbd61e8910..2dbe5c84fb 100644
--- a/src/Native/pkg/runtime.native.System.Net.Security/debian/runtime.native.System.Net.Security.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Net.Security/debian/runtime.native.System.Net.Security.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2</Version>
<PackageTargetRuntime>debian.8-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Net.Security/fedora/23/runtime.native.System.Net.Security.pkgproj b/src/Native/pkg/runtime.native.System.Net.Security/fedora/23/runtime.native.System.Net.Security.pkgproj
index 890118cb0b..2b207cf9fb 100644
--- a/src/Native/pkg/runtime.native.System.Net.Security/fedora/23/runtime.native.System.Net.Security.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Net.Security/fedora/23/runtime.native.System.Net.Security.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2</Version>
<PackageTargetRuntime>fedora.23-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Net.Security/fedora/24/runtime.native.System.Net.Security.pkgproj b/src/Native/pkg/runtime.native.System.Net.Security/fedora/24/runtime.native.System.Net.Security.pkgproj
new file mode 100644
index 0000000000..bd3d14baca
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Net.Security/fedora/24/runtime.native.System.Net.Security.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>fedora.24-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(Fedora24NativePath)\System.Net.Security.Native.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/Native/pkg/runtime.native.System.Net.Security/opensuse/13.2/runtime.native.System.Net.Security.pkgproj b/src/Native/pkg/runtime.native.System.Net.Security/opensuse/13.2/runtime.native.System.Net.Security.pkgproj
index 9334d79a18..0d70bc2a83 100644
--- a/src/Native/pkg/runtime.native.System.Net.Security/opensuse/13.2/runtime.native.System.Net.Security.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Net.Security/opensuse/13.2/runtime.native.System.Net.Security.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2</Version>
<PackageTargetRuntime>opensuse.13.2-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Net.Security/opensuse/42.1/runtime.native.System.Net.Security.pkgproj b/src/Native/pkg/runtime.native.System.Net.Security/opensuse/42.1/runtime.native.System.Net.Security.pkgproj
new file mode 100644
index 0000000000..04f61997e2
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Net.Security/opensuse/42.1/runtime.native.System.Net.Security.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>opensuse.42.1-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(OpenSuse421NativePath)\System.Net.Security.Native.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/Native/pkg/runtime.native.System.Net.Security/osx/runtime.native.System.Net.Security.pkgproj b/src/Native/pkg/runtime.native.System.Net.Security/osx/runtime.native.System.Net.Security.pkgproj
index db9146f3d5..862578f006 100644
--- a/src/Native/pkg/runtime.native.System.Net.Security/osx/runtime.native.System.Net.Security.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Net.Security/osx/runtime.native.System.Net.Security.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2</Version>
<PackageTargetRuntime>osx.10.10-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Net.Security/rhel/runtime.native.System.Net.Security.pkgproj b/src/Native/pkg/runtime.native.System.Net.Security/rhel/runtime.native.System.Net.Security.pkgproj
index 50da476ecb..ec2258abc8 100644
--- a/src/Native/pkg/runtime.native.System.Net.Security/rhel/runtime.native.System.Net.Security.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Net.Security/rhel/runtime.native.System.Net.Security.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2</Version>
<PackageTargetRuntime>rhel.7-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Net.Security/runtime.native.System.Net.Security.builds b/src/Native/pkg/runtime.native.System.Net.Security/runtime.native.System.Net.Security.builds
index 48040c9823..ec532e0703 100644
--- a/src/Native/pkg/runtime.native.System.Net.Security/runtime.native.System.Net.Security.builds
+++ b/src/Native/pkg/runtime.native.System.Net.Security/runtime.native.System.Net.Security.builds
@@ -15,6 +15,10 @@
<OSGroup>fedora.23</OSGroup>
<Platform>amd64</Platform>
</Project>
+ <Project Include="fedora\24\runtime.native.System.Net.Security.pkgproj">
+ <OSGroup>fedora.24</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
<Project Include="ubuntu\14.04\runtime.native.System.Net.Security.pkgproj">
<OSGroup>ubuntu.14.04</OSGroup>
<Platform>amd64</Platform>
@@ -23,6 +27,10 @@
<OSGroup>ubuntu.16.04</OSGroup>
<Platform>amd64</Platform>
</Project>
+ <Project Include="ubuntu\16.10\runtime.native.System.Net.Security.pkgproj">
+ <OSGroup>ubuntu.16.10</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
<Project Include="osx\runtime.native.System.Net.Security.pkgproj">
<OSGroup>osx.10</OSGroup>
<Platform>amd64</Platform>
@@ -31,6 +39,10 @@
<OSGroup>opensuse.13.2</OSGroup>
<Platform>amd64</Platform>
</Project>
+ <Project Include="opensuse\42.1\runtime.native.System.Net.Security.pkgproj">
+ <OSGroup>opensuse.42.1</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
</Project>
diff --git a/src/Native/pkg/runtime.native.System.Net.Security/runtime.native.System.Net.Security.pkgproj b/src/Native/pkg/runtime.native.System.Net.Security/runtime.native.System.Net.Security.pkgproj
index f43c111357..495241a5ca 100644
--- a/src/Native/pkg/runtime.native.System.Net.Security/runtime.native.System.Net.Security.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Net.Security/runtime.native.System.Net.Security.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2</Version>
<SkipPackageFileCheck>true</SkipPackageFileCheck>
<SkipValidatePackage>true</SkipValidatePackage>
</PropertyGroup>
@@ -20,18 +19,27 @@
<ProjectReference Include="fedora\23\runtime.native.System.Net.Security.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
+ <ProjectReference Include="fedora\24\runtime.native.System.Net.Security.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
<ProjectReference Include="osx\runtime.native.System.Net.Security.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
<ProjectReference Include="opensuse\13.2\runtime.native.System.Net.Security.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
+ <ProjectReference Include="opensuse\42.1\runtime.native.System.Net.Security.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
<ProjectReference Include="ubuntu\14.04\runtime.native.System.Net.Security.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
<ProjectReference Include="ubuntu\16.04\runtime.native.System.Net.Security.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
+ <ProjectReference Include="ubuntu\16.10\runtime.native.System.Net.Security.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project> \ No newline at end of file
diff --git a/src/Native/pkg/runtime.native.System.Net.Security/ubuntu/14.04/runtime.native.System.Net.Security.pkgproj b/src/Native/pkg/runtime.native.System.Net.Security/ubuntu/14.04/runtime.native.System.Net.Security.pkgproj
index 648de75326..aa41244b42 100644
--- a/src/Native/pkg/runtime.native.System.Net.Security/ubuntu/14.04/runtime.native.System.Net.Security.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Net.Security/ubuntu/14.04/runtime.native.System.Net.Security.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2</Version>
<PackageTargetRuntime>ubuntu.14.04-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Net.Security/ubuntu/16.04/runtime.native.System.Net.Security.pkgproj b/src/Native/pkg/runtime.native.System.Net.Security/ubuntu/16.04/runtime.native.System.Net.Security.pkgproj
index fd34a1ea68..017495feb5 100644
--- a/src/Native/pkg/runtime.native.System.Net.Security/ubuntu/16.04/runtime.native.System.Net.Security.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Net.Security/ubuntu/16.04/runtime.native.System.Net.Security.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2</Version>
<PackageTargetRuntime>ubuntu.16.04-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Net.Security/ubuntu/16.10/runtime.native.System.Net.Security.pkgproj b/src/Native/pkg/runtime.native.System.Net.Security/ubuntu/16.10/runtime.native.System.Net.Security.pkgproj
new file mode 100644
index 0000000000..9ee6c76c29
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Net.Security/ubuntu/16.10/runtime.native.System.Net.Security.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>ubuntu.16.10-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(Ubuntu1610NativePath)\System.Net.Security.Native.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography.Apple/osx/runtime.native.System.Security.Cryptography.Apple.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography.Apple/osx/runtime.native.System.Security.Cryptography.Apple.pkgproj
index 191e7060b9..b9e5823527 100644
--- a/src/Native/pkg/runtime.native.System.Security.Cryptography.Apple/osx/runtime.native.System.Security.Cryptography.Apple.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography.Apple/osx/runtime.native.System.Security.Cryptography.Apple.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.1</Version>
<PackageTargetRuntime>osx.10.10-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography.Apple/runtime.native.System.Security.Cryptography.Apple.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography.Apple/runtime.native.System.Security.Cryptography.Apple.pkgproj
index e0dec8687a..c366e5664e 100644
--- a/src/Native/pkg/runtime.native.System.Security.Cryptography.Apple/runtime.native.System.Security.Cryptography.Apple.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography.Apple/runtime.native.System.Security.Cryptography.Apple.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.1</Version>
<SkipPackageFileCheck>true</SkipPackageFileCheck>
<SkipValidatePackage>true</SkipValidatePackage>
</PropertyGroup>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/debian/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/debian/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
new file mode 100644
index 0000000000..54b420b46b
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/debian/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>debian.8-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(DebianNativePath)System.Security.Cryptography.Native.OpenSsl.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/fedora/23/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/fedora/23/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
new file mode 100644
index 0000000000..9d09a8b4f3
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/fedora/23/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>fedora.23-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(Fedora23NativePath)System.Security.Cryptography.Native.OpenSsl.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/fedora/24/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/fedora/24/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
new file mode 100644
index 0000000000..9da8dd43e8
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/fedora/24/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>fedora.24-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(Fedora24NativePath)System.Security.Cryptography.Native.OpenSsl.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/opensuse/13.2/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/opensuse/13.2/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
new file mode 100644
index 0000000000..1b9fbc1cb1
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/opensuse/13.2/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>opensuse.13.2-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(OpenSuse132NativePath)System.Security.Cryptography.Native.OpenSsl.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/opensuse/42.1/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/opensuse/42.1/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
new file mode 100644
index 0000000000..069d629113
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/opensuse/42.1/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>opensuse.42.1-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(OpenSuse421NativePath)System.Security.Cryptography.Native.OpenSsl.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/osx/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/osx/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
new file mode 100644
index 0000000000..eae2b75d52
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/osx/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>osx.10.10-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(OSXNativePath)System.Security.Cryptography.Native.OpenSsl.dylib">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/rhel/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/rhel/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
new file mode 100644
index 0000000000..61e0df00e3
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/rhel/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>rhel.7-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(RHELNativePath)System.Security.Cryptography.Native.OpenSsl.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/runtime.native.System.Security.Cryptography.OpenSsl.builds b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/runtime.native.System.Security.Cryptography.OpenSsl.builds
new file mode 100644
index 0000000000..569aea87c2
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/runtime.native.System.Security.Cryptography.OpenSsl.builds
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <ItemGroup>
+ <Project Include="runtime.native.System.Security.Cryptography.OpenSsl.pkgproj"/>
+ <Project Include="rhel\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <OSGroup>rhel.7</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
+ <Project Include="debian\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <OSGroup>debian.8</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
+ <Project Include="fedora\23\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <OSGroup>fedora.23</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
+ <Project Include="fedora\24\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <OSGroup>fedora.24</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
+ <Project Include="ubuntu\14.04\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <OSGroup>ubuntu.14.04</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
+ <Project Include="ubuntu\16.04\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <OSGroup>ubuntu.16.04</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
+ <Project Include="ubuntu\16.10\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <OSGroup>ubuntu.16.10</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
+ <Project Include="osx\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <OSGroup>osx.10</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
+ <Project Include="opensuse\13.2\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <OSGroup>opensuse.13.2</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
+ <Project Include="opensuse\42.1\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <OSGroup>opensuse.42.1</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
+</Project>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
new file mode 100644
index 0000000000..dc2a7a3d72
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <SkipPackageFileCheck>true</SkipPackageFileCheck>
+ <SkipValidatePackage>true</SkipValidatePackage>
+ </PropertyGroup>
+ <ItemGroup>
+ <!-- make this package installable and noop in a packages.config-based project -->
+ <File Include="$(PlaceHolderFile)">
+ <TargetPath>lib/netstandard1.0</TargetPath>
+ </File>
+ <ProjectReference Include="rhel\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
+ <ProjectReference Include="debian\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
+ <ProjectReference Include="fedora\23\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
+ <ProjectReference Include="fedora\24\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
+ <ProjectReference Include="osx\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
+ <ProjectReference Include="opensuse\13.2\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
+ <ProjectReference Include="opensuse\42.1\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
+ <ProjectReference Include="ubuntu\14.04\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
+ <ProjectReference Include="ubuntu\16.04\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
+ <ProjectReference Include="ubuntu\16.10\runtime.native.System.Security.Cryptography.OpenSsl.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/ubuntu/14.04/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/ubuntu/14.04/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
new file mode 100644
index 0000000000..029f825ce4
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/ubuntu/14.04/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>ubuntu.14.04-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(Ubuntu1404NativePath)System.Security.Cryptography.Native.OpenSsl.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/ubuntu/16.04/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/ubuntu/16.04/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
new file mode 100644
index 0000000000..228569b335
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/ubuntu/16.04/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>ubuntu.16.04-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(Ubuntu1604NativePath)System.Security.Cryptography.Native.OpenSsl.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/ubuntu/16.10/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/ubuntu/16.10/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
new file mode 100644
index 0000000000..68067f18f8
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography.OpenSsl/ubuntu/16.10/runtime.native.System.Security.Cryptography.OpenSsl.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>ubuntu.16.10-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(Ubuntu1610NativePath)System.Security.Cryptography.Native.OpenSsl.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography/debian/runtime.native.System.Security.Cryptography.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography/debian/runtime.native.System.Security.Cryptography.pkgproj
index 9e87df0985..8886b46b22 100644
--- a/src/Native/pkg/runtime.native.System.Security.Cryptography/debian/runtime.native.System.Security.Cryptography.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography/debian/runtime.native.System.Security.Cryptography.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.1</Version>
<PackageTargetRuntime>debian.8-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography/fedora/23/runtime.native.System.Security.Cryptography.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography/fedora/23/runtime.native.System.Security.Cryptography.pkgproj
index 7ea3756266..5f476e442e 100644
--- a/src/Native/pkg/runtime.native.System.Security.Cryptography/fedora/23/runtime.native.System.Security.Cryptography.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography/fedora/23/runtime.native.System.Security.Cryptography.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.1</Version>
<PackageTargetRuntime>fedora.23-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography/fedora/24/runtime.native.System.Security.Cryptography.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography/fedora/24/runtime.native.System.Security.Cryptography.pkgproj
new file mode 100644
index 0000000000..18251fbbae
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography/fedora/24/runtime.native.System.Security.Cryptography.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>fedora.24-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(Fedora24NativePath)System.Security.Cryptography.Native.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography/opensuse/13.2/runtime.native.System.Security.Cryptography.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography/opensuse/13.2/runtime.native.System.Security.Cryptography.pkgproj
index 3b486a4ab7..31eda706bb 100644
--- a/src/Native/pkg/runtime.native.System.Security.Cryptography/opensuse/13.2/runtime.native.System.Security.Cryptography.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography/opensuse/13.2/runtime.native.System.Security.Cryptography.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.1</Version>
<PackageTargetRuntime>opensuse.13.2-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography/opensuse/42.1/runtime.native.System.Security.Cryptography.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography/opensuse/42.1/runtime.native.System.Security.Cryptography.pkgproj
new file mode 100644
index 0000000000..feba5ff702
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography/opensuse/42.1/runtime.native.System.Security.Cryptography.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>opensuse.42.1-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(OpenSuse421NativePath)System.Security.Cryptography.Native.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography/osx/runtime.native.System.Security.Cryptography.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography/osx/runtime.native.System.Security.Cryptography.pkgproj
index e35112d8a3..3beb2c7ad3 100644
--- a/src/Native/pkg/runtime.native.System.Security.Cryptography/osx/runtime.native.System.Security.Cryptography.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography/osx/runtime.native.System.Security.Cryptography.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.1</Version>
<PackageTargetRuntime>osx.10.10-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography/rhel/runtime.native.System.Security.Cryptography.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography/rhel/runtime.native.System.Security.Cryptography.pkgproj
index 27e44ea6fd..13d8008e83 100644
--- a/src/Native/pkg/runtime.native.System.Security.Cryptography/rhel/runtime.native.System.Security.Cryptography.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography/rhel/runtime.native.System.Security.Cryptography.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.1</Version>
<PackageTargetRuntime>rhel.7-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography/runtime.native.System.Security.Cryptography.builds b/src/Native/pkg/runtime.native.System.Security.Cryptography/runtime.native.System.Security.Cryptography.builds
index 06f09a9ff0..5997a2e03e 100644
--- a/src/Native/pkg/runtime.native.System.Security.Cryptography/runtime.native.System.Security.Cryptography.builds
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography/runtime.native.System.Security.Cryptography.builds
@@ -15,6 +15,10 @@
<OSGroup>fedora.23</OSGroup>
<Platform>amd64</Platform>
</Project>
+ <Project Include="fedora\24\runtime.native.System.Security.Cryptography.pkgproj">
+ <OSGroup>fedora.24</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
<Project Include="ubuntu\14.04\runtime.native.System.Security.Cryptography.pkgproj">
<OSGroup>ubuntu.14.04</OSGroup>
<Platform>amd64</Platform>
@@ -23,6 +27,10 @@
<OSGroup>ubuntu.16.04</OSGroup>
<Platform>amd64</Platform>
</Project>
+ <Project Include="ubuntu\16.10\runtime.native.System.Security.Cryptography.pkgproj">
+ <OSGroup>ubuntu.16.10</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
<Project Include="osx\runtime.native.System.Security.Cryptography.pkgproj">
<OSGroup>osx.10</OSGroup>
<Platform>amd64</Platform>
@@ -31,6 +39,10 @@
<OSGroup>opensuse.13.2</OSGroup>
<Platform>amd64</Platform>
</Project>
+ <Project Include="opensuse\42.1\runtime.native.System.Security.Cryptography.pkgproj">
+ <OSGroup>opensuse.42.1</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
</Project>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography/runtime.native.System.Security.Cryptography.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography/runtime.native.System.Security.Cryptography.pkgproj
index 4bbc47b0a2..e8a78d80c2 100644
--- a/src/Native/pkg/runtime.native.System.Security.Cryptography/runtime.native.System.Security.Cryptography.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography/runtime.native.System.Security.Cryptography.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.1</Version>
<SkipPackageFileCheck>true</SkipPackageFileCheck>
<SkipValidatePackage>true</SkipValidatePackage>
</PropertyGroup>
@@ -20,18 +19,27 @@
<ProjectReference Include="fedora\23\runtime.native.System.Security.Cryptography.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
+ <ProjectReference Include="fedora\24\runtime.native.System.Security.Cryptography.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
<ProjectReference Include="osx\runtime.native.System.Security.Cryptography.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
<ProjectReference Include="opensuse\13.2\runtime.native.System.Security.Cryptography.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
+ <ProjectReference Include="opensuse\42.1\runtime.native.System.Security.Cryptography.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
<ProjectReference Include="ubuntu\14.04\runtime.native.System.Security.Cryptography.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
<ProjectReference Include="ubuntu\16.04\runtime.native.System.Security.Cryptography.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
+ <ProjectReference Include="ubuntu\16.10\runtime.native.System.Security.Cryptography.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project> \ No newline at end of file
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography/ubuntu/14.04/runtime.native.System.Security.Cryptography.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography/ubuntu/14.04/runtime.native.System.Security.Cryptography.pkgproj
index 9dfd788fa5..b5a6c83e4a 100644
--- a/src/Native/pkg/runtime.native.System.Security.Cryptography/ubuntu/14.04/runtime.native.System.Security.Cryptography.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography/ubuntu/14.04/runtime.native.System.Security.Cryptography.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.1</Version>
<PackageTargetRuntime>ubuntu.14.04-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography/ubuntu/16.04/runtime.native.System.Security.Cryptography.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography/ubuntu/16.04/runtime.native.System.Security.Cryptography.pkgproj
index 99148951e9..a4ab2ed218 100644
--- a/src/Native/pkg/runtime.native.System.Security.Cryptography/ubuntu/16.04/runtime.native.System.Security.Cryptography.pkgproj
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography/ubuntu/16.04/runtime.native.System.Security.Cryptography.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.1</Version>
<PackageTargetRuntime>ubuntu.16.04-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System.Security.Cryptography/ubuntu/16.10/runtime.native.System.Security.Cryptography.pkgproj b/src/Native/pkg/runtime.native.System.Security.Cryptography/ubuntu/16.10/runtime.native.System.Security.Cryptography.pkgproj
new file mode 100644
index 0000000000..174858b731
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System.Security.Cryptography/ubuntu/16.10/runtime.native.System.Security.Cryptography.pkgproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>ubuntu.16.10-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(Ubuntu1610NativePath)System.Security.Cryptography.Native.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/Native/pkg/runtime.native.System/debian/runtime.native.System.pkgproj b/src/Native/pkg/runtime.native.System/debian/runtime.native.System.pkgproj
index bacd5e88ff..5bc19a4208 100644
--- a/src/Native/pkg/runtime.native.System/debian/runtime.native.System.pkgproj
+++ b/src/Native/pkg/runtime.native.System/debian/runtime.native.System.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.1</Version>
<PackageTargetRuntime>debian.8-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System/fedora/23/runtime.native.System.pkgproj b/src/Native/pkg/runtime.native.System/fedora/23/runtime.native.System.pkgproj
index 2656126d4f..fbed290bbf 100644
--- a/src/Native/pkg/runtime.native.System/fedora/23/runtime.native.System.pkgproj
+++ b/src/Native/pkg/runtime.native.System/fedora/23/runtime.native.System.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.1</Version>
<PackageTargetRuntime>fedora.23-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System/fedora/24/runtime.native.System.pkgproj b/src/Native/pkg/runtime.native.System/fedora/24/runtime.native.System.pkgproj
new file mode 100644
index 0000000000..b42eeca837
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System/fedora/24/runtime.native.System.pkgproj
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>fedora.24-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(Fedora24NativePath)System.Native.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ <File Include="$(Fedora24NativePath)System.Native.a">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </File>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/Native/pkg/runtime.native.System/opensuse/13.2/runtime.native.System.pkgproj b/src/Native/pkg/runtime.native.System/opensuse/13.2/runtime.native.System.pkgproj
index 3f45eff713..dd6891e5bc 100644
--- a/src/Native/pkg/runtime.native.System/opensuse/13.2/runtime.native.System.pkgproj
+++ b/src/Native/pkg/runtime.native.System/opensuse/13.2/runtime.native.System.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.1</Version>
<PackageTargetRuntime>opensuse.13.2-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System/opensuse/42.1/runtime.native.System.pkgproj b/src/Native/pkg/runtime.native.System/opensuse/42.1/runtime.native.System.pkgproj
new file mode 100644
index 0000000000..43379f0ad2
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System/opensuse/42.1/runtime.native.System.pkgproj
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>opensuse.42.1-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(OpenSuse421NativePath)System.Native.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ <File Include="$(OpenSuse421NativePath)System.Native.a">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </File>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/Native/pkg/runtime.native.System/osx/runtime.native.System.pkgproj b/src/Native/pkg/runtime.native.System/osx/runtime.native.System.pkgproj
index 905be8e093..842fa9242a 100644
--- a/src/Native/pkg/runtime.native.System/osx/runtime.native.System.pkgproj
+++ b/src/Native/pkg/runtime.native.System/osx/runtime.native.System.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.1</Version>
<PackageTargetRuntime>osx.10.10-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System/rhel/runtime.native.System.pkgproj b/src/Native/pkg/runtime.native.System/rhel/runtime.native.System.pkgproj
index e376d9db4a..09df6e06d4 100644
--- a/src/Native/pkg/runtime.native.System/rhel/runtime.native.System.pkgproj
+++ b/src/Native/pkg/runtime.native.System/rhel/runtime.native.System.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.1</Version>
<PackageTargetRuntime>rhel.7-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System/runtime.native.System.builds b/src/Native/pkg/runtime.native.System/runtime.native.System.builds
index 8d64949715..07f486f962 100644
--- a/src/Native/pkg/runtime.native.System/runtime.native.System.builds
+++ b/src/Native/pkg/runtime.native.System/runtime.native.System.builds
@@ -15,6 +15,10 @@
<OSGroup>fedora.23</OSGroup>
<Platform>amd64</Platform>
</Project>
+ <Project Include="fedora\24\runtime.native.System.pkgproj">
+ <OSGroup>fedora.24</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
<Project Include="ubuntu\14.04\runtime.native.System.pkgproj">
<OSGroup>ubuntu.14.04</OSGroup>
<Platform>amd64</Platform>
@@ -23,6 +27,10 @@
<OSGroup>ubuntu.16.04</OSGroup>
<Platform>amd64</Platform>
</Project>
+ <Project Include="ubuntu\16.10\runtime.native.System.pkgproj">
+ <OSGroup>ubuntu.16.10</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
<Project Include="osx\runtime.native.System.pkgproj">
<OSGroup>osx.10</OSGroup>
<Platform>amd64</Platform>
@@ -31,6 +39,10 @@
<OSGroup>opensuse.13.2</OSGroup>
<Platform>amd64</Platform>
</Project>
+ <Project Include="opensuse\42.1\runtime.native.System.pkgproj">
+ <OSGroup>opensuse.42.1</OSGroup>
+ <Platform>amd64</Platform>
+ </Project>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
</Project>
diff --git a/src/Native/pkg/runtime.native.System/runtime.native.System.pkgproj b/src/Native/pkg/runtime.native.System/runtime.native.System.pkgproj
index 6313de77fe..6dc55a9eac 100644
--- a/src/Native/pkg/runtime.native.System/runtime.native.System.pkgproj
+++ b/src/Native/pkg/runtime.native.System/runtime.native.System.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.1</Version>
<SkipPackageFileCheck>true</SkipPackageFileCheck>
<SkipValidatePackage>true</SkipValidatePackage>
</PropertyGroup>
@@ -20,18 +19,27 @@
<ProjectReference Include="fedora\23\runtime.native.System.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
+ <ProjectReference Include="fedora\24\runtime.native.System.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
<ProjectReference Include="osx\runtime.native.System.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
<ProjectReference Include="opensuse\13.2\runtime.native.System.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
+ <ProjectReference Include="opensuse\42.1\runtime.native.System.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
<ProjectReference Include="ubuntu\14.04\runtime.native.System.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
<ProjectReference Include="ubuntu\16.04\runtime.native.System.pkgproj">
<Platform>amd64</Platform>
</ProjectReference>
+ <ProjectReference Include="ubuntu\16.10\runtime.native.System.pkgproj">
+ <Platform>amd64</Platform>
+ </ProjectReference>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project> \ No newline at end of file
diff --git a/src/Native/pkg/runtime.native.System/ubuntu/14.04/runtime.native.System.pkgproj b/src/Native/pkg/runtime.native.System/ubuntu/14.04/runtime.native.System.pkgproj
index 2f6887628e..ee9fc586a6 100644
--- a/src/Native/pkg/runtime.native.System/ubuntu/14.04/runtime.native.System.pkgproj
+++ b/src/Native/pkg/runtime.native.System/ubuntu/14.04/runtime.native.System.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.1</Version>
<PackageTargetRuntime>ubuntu.14.04-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System/ubuntu/16.04/runtime.native.System.pkgproj b/src/Native/pkg/runtime.native.System/ubuntu/16.04/runtime.native.System.pkgproj
index 1d9a5319c4..2c1d25377d 100644
--- a/src/Native/pkg/runtime.native.System/ubuntu/16.04/runtime.native.System.pkgproj
+++ b/src/Native/pkg/runtime.native.System/ubuntu/16.04/runtime.native.System.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.1</Version>
<PackageTargetRuntime>ubuntu.16.04-$(PackagePlatform)</PackageTargetRuntime>
<!-- only build for x64 -->
<PackagePlatforms>x64;</PackagePlatforms>
diff --git a/src/Native/pkg/runtime.native.System/ubuntu/16.10/runtime.native.System.pkgproj b/src/Native/pkg/runtime.native.System/ubuntu/16.10/runtime.native.System.pkgproj
new file mode 100644
index 0000000000..a3605bcf78
--- /dev/null
+++ b/src/Native/pkg/runtime.native.System/ubuntu/16.10/runtime.native.System.pkgproj
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <PackageTargetRuntime>ubuntu.16.10-$(PackagePlatform)</PackageTargetRuntime>
+ <!-- only build for x64 -->
+ <PackagePlatforms>x64;</PackagePlatforms>
+ </PropertyGroup>
+ <ItemGroup>
+ <NativeFile Include="$(Ubuntu1610NativePath)System.Native.so">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </NativeFile>
+ <File Include="$(Ubuntu1610NativePath)System.Native.a">
+ <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath>
+ </File>
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/System.AppContext/dir.props b/src/System.AppContext/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.AppContext/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.AppContext/ref/4.0.0/System.AppContext.depproj b/src/System.AppContext/ref/4.0.0/System.AppContext.depproj
index 936df44f24..1681b96d7d 100644
--- a/src/System.AppContext/ref/4.0.0/System.AppContext.depproj
+++ b/src/System.AppContext/ref/4.0.0/System.AppContext.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.AppContext/ref/System.AppContext.csproj b/src/System.AppContext/ref/System.AppContext.csproj
index 2c43309501..e0448ee40e 100644
--- a/src/System.AppContext/ref/System.AppContext.csproj
+++ b/src/System.AppContext/ref/System.AppContext.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.6</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.6</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.AppContext/src/System.AppContext.csproj b/src/System.AppContext/src/System.AppContext.csproj
index ef0e772a95..92669338d1 100644
--- a/src/System.AppContext/src/System.AppContext.csproj
+++ b/src/System.AppContext/src/System.AppContext.csproj
@@ -5,13 +5,11 @@
<AssemblyName>System.AppContext</AssemblyName>
<ProjectGuid>{5522BAFC-E2FF-4896-993A-401DDEDFD85F}</ProjectGuid>
<ClsCompliant>true</ClsCompliant>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)'=='netcore50' OR '$(TargetGroup)'=='netcore50aot'">4.0.0.0</AssemblyVersion>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'!='netcore50aot'">true</IsPartialFacadeAssembly>
<ContractProject Condition="'$(TargetGroup)'=='netcore50'">..\ref\4.0.0\System.AppContext.depproj</ContractProject>
<!-- The following line needs to be removed once we have a targeting pack for 4.6.3 -->
<TargetingPackNugetPackageId Condition="'$(TargetGroup)'=='net463'">Microsoft.TargetingPack.NETFramework.v4.6.2</TargetingPackNugetPackageId>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.6</PackageTargetFramework>
<ExcludeResourcesImport Condition="'$(IsPartialFacadeAssembly)'=='true'">true</ExcludeResourcesImport>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.6</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.Buffers/dir.props b/src/System.Buffers/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Buffers/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Buffers/src/System.Buffers.csproj b/src/System.Buffers/src/System.Buffers.csproj
index 448b1583f1..0811460361 100644
--- a/src/System.Buffers/src/System.Buffers.csproj
+++ b/src/System.Buffers/src/System.Buffers.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<ProjectGuid>{2ADDB484-6F57-4D71-A3FE-A57EC6329A2B}</ProjectGuid>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile>
<UseOpenKey Condition="'$(UseOpenKey)'==''">true</UseOpenKey>
diff --git a/src/System.Collections.Concurrent/dir.props b/src/System.Collections.Concurrent/dir.props
new file mode 100644
index 0000000000..5fb0f02455
--- /dev/null
+++ b/src/System.Collections.Concurrent/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.13.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Collections.Concurrent/pkg/System.Collections.Concurrent.pkgproj b/src/System.Collections.Concurrent/pkg/System.Collections.Concurrent.pkgproj
index 0b9de80915..1d26dbd14a 100644
--- a/src/System.Collections.Concurrent/pkg/System.Collections.Concurrent.pkgproj
+++ b/src/System.Collections.Concurrent/pkg/System.Collections.Concurrent.pkgproj
@@ -1,12 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.12.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Version>4.0.13</Version>
- </PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ref\4.0.0\System.Collections.Concurrent.depproj">
<SupportedFramework>net45;netcore45;wpa81</SupportedFramework>
diff --git a/src/System.Collections.Concurrent/pkg/ValidationSuppression.txt b/src/System.Collections.Concurrent/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Collections.Concurrent/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Collections.Concurrent/ref/4.0.0/System.Collections.Concurrent.depproj b/src/System.Collections.Concurrent/ref/4.0.0/System.Collections.Concurrent.depproj
index 29f2b6abda..5df1469c14 100644
--- a/src/System.Collections.Concurrent/ref/4.0.0/System.Collections.Concurrent.depproj
+++ b/src/System.Collections.Concurrent/ref/4.0.0/System.Collections.Concurrent.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Collections.Concurrent/ref/System.Collections.Concurrent.csproj b/src/System.Collections.Concurrent/ref/System.Collections.Concurrent.csproj
index bf8c7f02c4..ad421c86b0 100644
--- a/src/System.Collections.Concurrent/ref/System.Collections.Concurrent.csproj
+++ b/src/System.Collections.Concurrent/ref/System.Collections.Concurrent.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Collections.Concurrent/src/System.Collections.Concurrent.csproj b/src/System.Collections.Concurrent/src/System.Collections.Concurrent.csproj
index 2f15f32105..f57169d4b7 100644
--- a/src/System.Collections.Concurrent/src/System.Collections.Concurrent.csproj
+++ b/src/System.Collections.Concurrent/src/System.Collections.Concurrent.csproj
@@ -4,11 +4,9 @@
<PropertyGroup>
<ProjectGuid>{96AA2060-C846-4E56-9509-E8CB9C114C8F}</ProjectGuid>
<AssemblyName>System.Collections.Concurrent</AssemblyName>
- <AssemblyVersion>4.0.13.0</AssemblyVersion>
<RootNamespace>System.Collections.Concurrent</RootNamespace>
<DefineConstants>FEATURE_TRACING</DefineConstants>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Collections.Concurrent/tests/ConcurrentDicionary/ConcurrentDictionaryTests.cs b/src/System.Collections.Concurrent/tests/ConcurrentDicionary/ConcurrentDictionaryTests.cs
index e6a698b46e..6ec53d85f4 100644
--- a/src/System.Collections.Concurrent/tests/ConcurrentDicionary/ConcurrentDictionaryTests.cs
+++ b/src/System.Collections.Concurrent/tests/ConcurrentDicionary/ConcurrentDictionaryTests.cs
@@ -168,7 +168,7 @@ namespace System.Collections.Concurrent.Tests
var rem = pair.Value % pair.Key;
Assert.Equal(0, rem);
- Assert.True(div > 1 && div <= threads+1,
+ Assert.True(div > 1 && div <= threads + 1,
String.Format("* Invalid value={3}! TestUpdate1(cLevel={0}, threads={1}, updatesPerThread={2})", cLevel, threads, updatesPerThread, div));
}
@@ -362,7 +362,7 @@ namespace System.Collections.Concurrent.Tests
for (int i = 0; i < removesPerThread; i++)
{
- Assert.False(seen[0][i] == seen[1][i],
+ Assert.False(seen[0][i] == seen[1][i],
String.Format("> FAILED. Two threads appear to have removed the same element. TestRemove2(removesPerThread={0})", removesPerThread)
);
}
@@ -487,9 +487,9 @@ namespace System.Collections.Concurrent.Tests
for (int i = 0; i < expectKeys.Count; i++)
{
- Assert.True(expectKeys[i].Equals(gotKeys[i]),
- String.Format("* Test '{4}': Level={0}, initSize={1}, threads={2}, addsPerThread={3})" + Environment.NewLine +
- "> FAILED. The set of keys in the dictionary is are not the same as the expected.",
+ Assert.True(expectKeys[i].Equals(gotKeys[i]),
+ String.Format("* Test '{4}': Level={0}, initSize={1}, threads={2}, addsPerThread={3})" + Environment.NewLine +
+ "> FAILED. The set of keys in the dictionary is are not the same as the expected.",
cLevel, initSize, threads, addsPerThread, isAdd ? "GetOrAdd" : "GetOrUpdate"));
}
@@ -739,7 +739,7 @@ namespace System.Collections.Concurrent.Tests
public static void IDicionary_Remove_NullKeyInKeyValuePair_ThrowsArgumentNullException()
{
IDictionary<string, int> dictionary = new ConcurrentDictionary<string, int>();
- Assert.Throws<ArgumentNullException>("keyValuePair", () => dictionary.Remove(new KeyValuePair<string, int>(null, 0)));
+ Assert.Throws<ArgumentNullException>(() => dictionary.Remove(new KeyValuePair<string, int>(null, 0)));
}
[Fact]
diff --git a/src/System.Collections.Immutable/dir.props b/src/System.Collections.Immutable/dir.props
new file mode 100644
index 0000000000..c994d109fb
--- /dev/null
+++ b/src/System.Collections.Immutable/dir.props
@@ -0,0 +1,8 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <PackageVersion>1.3.0</PackageVersion>
+ <AssemblyVersion>1.2.1</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Collections.Immutable/src/System.Collections.Immutable.csproj b/src/System.Collections.Immutable/src/System.Collections.Immutable.csproj
index 28d9f255b7..7d0452dfae 100644
--- a/src/System.Collections.Immutable/src/System.Collections.Immutable.csproj
+++ b/src/System.Collections.Immutable/src/System.Collections.Immutable.csproj
@@ -10,18 +10,9 @@
<FileAlignment>512</FileAlignment>
<DocumentationFile>$(OutputPath)System.Collections.Immutable.xml</DocumentationFile>
<GenerateAppxPackageOnBuild>False</GenerateAppxPackageOnBuild>
- <AssemblyVersion>1.2.1</AssemblyVersion>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
+ <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.0;portable-net45+win8+wp8+wpa81</PackageTargetFramework>
</PropertyGroup>
- <ItemGroup>
- <PackageDestination Include="lib/netstandard1.0">
- <TargetFramework>netstandard1.0</TargetFramework>
- </PackageDestination>
- <!-- Support targets that were supported in previous package versions -->
- <PackageDestination Include="lib/portable-net45+win8+wp8+wpa81">
- <TargetFramework>portable-net45+win8+wp8+wpa81</TargetFramework>
- </PackageDestination>
- </ItemGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<Optimize>false</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
diff --git a/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Builder.cs b/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Builder.cs
index f2e83840a3..464feb32f8 100644
--- a/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Builder.cs
+++ b/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Builder.cs
@@ -651,7 +651,11 @@ namespace System.Collections.Immutable
if (Count > 1)
{
- Array.Sort(_elements, comparison);
+ // Array.Sort does not have an overload that takes both bounds and a Comparison.
+ // We could special case _count == _elements.Length in order to try to avoid
+ // the IComparer allocation, but the Array.Sort overload that takes a Comparison
+ // allocates such an IComparer internally, anyway.
+ Array.Sort(_elements, 0, _count, Comparer<T>.Create(comparison));
}
}
diff --git a/src/System.Collections.Immutable/tests/ImmutableArrayBuilderTest.cs b/src/System.Collections.Immutable/tests/ImmutableArrayBuilderTest.cs
index 37d8ad4059..8b9fec0efa 100644
--- a/src/System.Collections.Immutable/tests/ImmutableArrayBuilderTest.cs
+++ b/src/System.Collections.Immutable/tests/ImmutableArrayBuilderTest.cs
@@ -288,10 +288,18 @@ namespace System.Collections.Immutable.Tests
[Fact]
public void Sort_Comparison()
{
- var builder = new ImmutableArray<int>.Builder();
+ var builder = new ImmutableArray<int>.Builder(4);
+
+ builder.Sort((x, y) => y.CompareTo(x));
+ Assert.Equal(Array.Empty<int>(), builder);
+
builder.AddRange(2, 4, 1, 3);
builder.Sort((x, y) => y.CompareTo(x));
Assert.Equal(new[] { 4, 3, 2, 1 }, builder);
+
+ builder.Add(5);
+ builder.Sort((x, y) => x.CompareTo(y));
+ Assert.Equal(new[] { 1, 2, 3, 4, 5 }, builder);
}
[Fact]
diff --git a/src/System.Collections.NonGeneric/dir.props b/src/System.Collections.NonGeneric/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Collections.NonGeneric/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Collections.NonGeneric/ref/System.Collections.NonGeneric.csproj b/src/System.Collections.NonGeneric/ref/System.Collections.NonGeneric.csproj
index 08fe738ea9..2f0a6597f8 100644
--- a/src/System.Collections.NonGeneric/ref/System.Collections.NonGeneric.csproj
+++ b/src/System.Collections.NonGeneric/ref/System.Collections.NonGeneric.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Collections.NonGeneric/src/System.Collections.NonGeneric.csproj b/src/System.Collections.NonGeneric/src/System.Collections.NonGeneric.csproj
index 1515c58f6d..6354f7e95a 100644
--- a/src/System.Collections.NonGeneric/src/System.Collections.NonGeneric.csproj
+++ b/src/System.Collections.NonGeneric/src/System.Collections.NonGeneric.csproj
@@ -5,8 +5,6 @@
<ProjectGuid>{585E3764-534B-4A12-8BD5-8578CB826A45}</ProjectGuid>
<RootNamespace>System.Collections.NonGeneric</RootNamespace>
<AssemblyName>System.Collections.NonGeneric</AssemblyName>
- <AssemblyVersion>4.1.0.0</AssemblyVersion>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.7</PackageTargetFramework>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net463'">true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.Collections.NonGeneric/tests/ArrayListTests.cs b/src/System.Collections.NonGeneric/tests/ArrayListTests.cs
index a093501e87..62c4758566 100644
--- a/src/System.Collections.NonGeneric/tests/ArrayListTests.cs
+++ b/src/System.Collections.NonGeneric/tests/ArrayListTests.cs
@@ -813,7 +813,7 @@ namespace System.Collections.Tests
var arrCopy = new int[arrList2.Count];
Assert.Throws<ArgumentNullException>(() => arrList2.CopyTo(null)); // Array is null
- Assert.Throws<ArgumentException>("array", () => arrList2.CopyTo(new object[10, 10])); // Array is multidimensional
+ Assert.Throws<ArgumentException>(() => arrList2.CopyTo(new object[10, 10])); // Array is multidimensional
Assert.Throws<ArgumentOutOfRangeException>(() => arrList2.CopyTo(arrCopy, -1)); // Index < 0
Assert.Throws<ArgumentException>(() => arrList2.CopyTo(new object[11], 2)); // Invalid index and length
@@ -877,7 +877,7 @@ namespace System.Collections.Tests
});
Assert.Throws<ArgumentNullException>(() => arrList2.CopyTo(0, null, 3, 3)); // Array is null
- Assert.Throws<ArgumentException>("array", () => arrList2.CopyTo(0, new object[arrList2.Count, arrList2.Count], 0, arrList2.Count)); // Array is multidimensional
+ Assert.Throws<ArgumentException>(() => arrList2.CopyTo(0, new object[arrList2.Count, arrList2.Count], 0, arrList2.Count)); // Array is multidimensional
// Array index and count is out of bounds
Assert.Throws<ArgumentException>(() =>
diff --git a/src/System.Collections.NonGeneric/tests/DictionaryBaseTests.cs b/src/System.Collections.NonGeneric/tests/DictionaryBaseTests.cs
index c94dd26760..5b5d36c0be 100644
--- a/src/System.Collections.NonGeneric/tests/DictionaryBaseTests.cs
+++ b/src/System.Collections.NonGeneric/tests/DictionaryBaseTests.cs
@@ -183,7 +183,8 @@ namespace System.Collections.Tests
{
MyDictionary dictBase = CreateDictionary(100);
Assert.Throws<ArgumentNullException>("array", () => dictBase.CopyTo(null, 0)); // Array is null
- Assert.Throws<ArgumentException>("array", () => dictBase.CopyTo(new object[100, 100], 0)); // Array is multidimensional
+
+ Assert.Throws<ArgumentException>(() => dictBase.CopyTo(new object[100, 100], 0)); // Array is multidimensional
Assert.Throws<ArgumentOutOfRangeException>("arrayIndex", () => dictBase.CopyTo(new DictionaryEntry[100], -1)); // Index < 0
diff --git a/src/System.Collections.NonGeneric/tests/HashtableTests.cs b/src/System.Collections.NonGeneric/tests/HashtableTests.cs
index e0d1d051bb..c4e7baaee3 100644
--- a/src/System.Collections.NonGeneric/tests/HashtableTests.cs
+++ b/src/System.Collections.NonGeneric/tests/HashtableTests.cs
@@ -132,7 +132,7 @@ namespace System.Collections.Tests
public static void Ctor_Int_Invalid()
{
Assert.Throws<ArgumentOutOfRangeException>("capacity", () => new Hashtable(-1)); // Capacity < 0
- Assert.Throws<ArgumentException>("capacity", () => new Hashtable(int.MaxValue)); // Capacity / load factor > int.MaxValue
+ Assert.Throws<ArgumentException>(() => new Hashtable(int.MaxValue)); // Capacity / load factor > int.MaxValue
}
#if netstandard17
@@ -262,7 +262,7 @@ namespace System.Collections.Tests
public static void Ctor_Int_Int_Invalid()
{
Assert.Throws<ArgumentOutOfRangeException>("capacity", () => new Hashtable(-1, 1f)); // Capacity < 0
- Assert.Throws<ArgumentException>("capacity", () => new Hashtable(int.MaxValue, 0.1f)); // Capacity / load factor > int.MaxValue
+ Assert.Throws<ArgumentException>(() => new Hashtable(int.MaxValue, 0.1f)); // Capacity / load factor > int.MaxValue
Assert.Throws<ArgumentOutOfRangeException>("loadFactor", () => new Hashtable(100, 0.09f)); // Load factor < 0.1f
Assert.Throws<ArgumentOutOfRangeException>("loadFactor", () => new Hashtable(100, 1.01f)); // Load factor > 1f
@@ -296,7 +296,7 @@ namespace System.Collections.Tests
public static void Ctor_Int_IEqualityComparer_Invalid()
{
Assert.Throws<ArgumentOutOfRangeException>("capacity", () => new Hashtable(-1, null)); // Capacity < 0
- Assert.Throws<ArgumentException>("capacity", () => new Hashtable(int.MaxValue, null)); // Capacity / load factor > int.MaxValue
+ Assert.Throws<ArgumentException>(() => new Hashtable(int.MaxValue, null)); // Capacity / load factor > int.MaxValue
}
[Fact]
@@ -363,7 +363,7 @@ namespace System.Collections.Tests
public static void Ctor_Capacity_LoadFactor_IEqualityComparer_Invalid()
{
Assert.Throws<ArgumentOutOfRangeException>("capacity", () => new Hashtable(-1, 1f, null)); // Capacity < 0
- Assert.Throws<ArgumentException>("capacity", () => new Hashtable(int.MaxValue, 0.1f, null)); // Capacity / load factor > int.MaxValue
+ Assert.Throws<ArgumentException>(() => new Hashtable(int.MaxValue, 0.1f, null)); // Capacity / load factor > int.MaxValue
Assert.Throws<ArgumentOutOfRangeException>("loadFactor", () => new Hashtable(100, 0.09f, null)); // Load factor < 0.1f
Assert.Throws<ArgumentOutOfRangeException>("loadFactor", () => new Hashtable(100, 1.01f, null)); // Load factor > 1f
diff --git a/src/System.Collections.NonGeneric/tests/QueueTests.cs b/src/System.Collections.NonGeneric/tests/QueueTests.cs
index 85e156c4c2..adb3bbdfd8 100644
--- a/src/System.Collections.NonGeneric/tests/QueueTests.cs
+++ b/src/System.Collections.NonGeneric/tests/QueueTests.cs
@@ -367,7 +367,7 @@ namespace System.Collections.Tests
Helpers.PerformActionOnAllQueueWrappers(queue1, queue2 =>
{
Assert.Throws<ArgumentNullException>("array", () => queue2.CopyTo(null, 0)); // Array is null
- Assert.Throws<ArgumentException>("array", () => queue2.CopyTo(new object[150, 150], 0)); // Array is multidimensional
+ Assert.Throws<ArgumentException>(() => queue2.CopyTo(new object[150, 150], 0)); // Array is multidimensional
Assert.Throws<ArgumentOutOfRangeException>("index", () => queue2.CopyTo(new object[150], -1)); // Index < 0
diff --git a/src/System.Collections.NonGeneric/tests/SortedListTests.cs b/src/System.Collections.NonGeneric/tests/SortedListTests.cs
index 5cc64e32af..e02424ba3c 100644
--- a/src/System.Collections.NonGeneric/tests/SortedListTests.cs
+++ b/src/System.Collections.NonGeneric/tests/SortedListTests.cs
@@ -440,7 +440,7 @@ namespace System.Collections.Tests
Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 =>
{
Assert.Throws<ArgumentNullException>("array", () => sortList2.CopyTo(null, 0)); // Array is null
- Assert.Throws<ArgumentException>("array", () => sortList2.CopyTo(new object[10, 10], 0)); // Array is multidimensional
+ Assert.Throws<ArgumentException>(() => sortList2.CopyTo(new object[10, 10], 0)); // Array is multidimensional
Assert.Throws<ArgumentOutOfRangeException>("arrayIndex", () => sortList2.CopyTo(new object[100], -1)); // Index < 0
Assert.Throws<ArgumentException>(null, () => sortList2.CopyTo(new object[150], 51)); // Index + list.Count > array.Count
@@ -756,7 +756,7 @@ namespace System.Collections.Tests
{
IList keys = sortList2.GetKeyList();
Assert.Throws<ArgumentNullException>("dest", () => keys.CopyTo(null, 0)); // Array is null
- Assert.Throws<ArgumentException>("array", () => keys.CopyTo(new object[10, 10], 0)); // Array is multidimensional
+ Assert.Throws<ArgumentException>(() => keys.CopyTo(new object[10, 10], 0)); // Array is multidimensional
Assert.Throws<ArgumentOutOfRangeException>("dstIndex", () => keys.CopyTo(new object[100], -1)); // Index < 0
Assert.Throws<ArgumentException>(string.Empty, () => keys.CopyTo(new object[150], 51)); // Index + list.Count > array.Count
@@ -996,7 +996,7 @@ namespace System.Collections.Tests
{
IList values = sortList2.GetValueList();
Assert.Throws<ArgumentNullException>("dest", () => values.CopyTo(null, 0)); // Array is null
- Assert.Throws<ArgumentException>("array", () => values.CopyTo(new object[10, 10], 0)); // Array is multidimensional
+ Assert.Throws<ArgumentException>(() => values.CopyTo(new object[10, 10], 0)); // Array is multidimensional
Assert.Throws<ArgumentOutOfRangeException>("dstIndex", () => values.CopyTo(new object[100], -1)); // Index < 0
Assert.Throws<ArgumentException>(string.Empty, () => values.CopyTo(new object[150], 51)); // Index + list.Count > array.Count
diff --git a/src/System.Collections.NonGeneric/tests/StackTests.cs b/src/System.Collections.NonGeneric/tests/StackTests.cs
index b7192085c9..d5e7e6eac5 100644
--- a/src/System.Collections.NonGeneric/tests/StackTests.cs
+++ b/src/System.Collections.NonGeneric/tests/StackTests.cs
@@ -225,7 +225,7 @@ namespace System.Collections.Tests
Helpers.PerformActionOnAllStackWrappers(stack1, stack2 =>
{
Assert.Throws<ArgumentNullException>("array", () => stack2.CopyTo(null, 0)); // Array is null
- Assert.Throws<ArgumentException>("array", () => stack2.CopyTo(new object[10, 10], 0)); // Array is multidimensional
+ Assert.Throws<ArgumentException>(() => stack2.CopyTo(new object[10, 10], 0)); // Array is multidimensional
Assert.Throws<ArgumentOutOfRangeException>("index", () => stack2.CopyTo(new object[100], -1)); // Index < 0
Assert.Throws<ArgumentException>(null, () => stack2.CopyTo(new object[0], 0)); // Index >= array.Count
diff --git a/src/System.Collections.Specialized/dir.props b/src/System.Collections.Specialized/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Collections.Specialized/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Collections.Specialized/ref/System.Collections.Specialized.csproj b/src/System.Collections.Specialized/ref/System.Collections.Specialized.csproj
index 955fae78a0..c9ba1c5464 100644
--- a/src/System.Collections.Specialized/ref/System.Collections.Specialized.csproj
+++ b/src/System.Collections.Specialized/ref/System.Collections.Specialized.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Collections.Specialized/src/System.Collections.Specialized.csproj b/src/System.Collections.Specialized/src/System.Collections.Specialized.csproj
index 94f54b2ecb..6ce9659131 100644
--- a/src/System.Collections.Specialized/src/System.Collections.Specialized.csproj
+++ b/src/System.Collections.Specialized/src/System.Collections.Specialized.csproj
@@ -5,8 +5,6 @@
<ProjectGuid>{63634289-90D7-4947-8BF3-DBBE98D76C85}</ProjectGuid>
<RootNamespace>System.Collections.Specialized</RootNamespace>
<AssemblyName>System.Collections.Specialized</AssemblyName>
- <AssemblyVersion>4.1.0.0</AssemblyVersion>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.7</PackageTargetFramework>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net463'">true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.Collections.Specialized/src/System/Collections/Specialized/ListDictionary.cs b/src/System.Collections.Specialized/src/System/Collections/Specialized/ListDictionary.cs
index 4e28973f74..f7770e6eff 100644
--- a/src/System.Collections.Specialized/src/System/Collections/Specialized/ListDictionary.cs
+++ b/src/System.Collections.Specialized/src/System/Collections/Specialized/ListDictionary.cs
@@ -228,10 +228,6 @@ namespace System.Collections.Specialized
throw new ArgumentNullException(nameof(array));
if (index < 0)
throw new ArgumentOutOfRangeException(nameof(index), index, SR.ArgumentOutOfRange_NeedNonNegNum);
- if (array.Rank != 1)
- throw new ArgumentException(SR.Arg_MultiRank, nameof(array));
- if (array.GetLowerBound(0) != 0)
- throw new ArgumentException(SR.Arg_NonZeroLowerBound, nameof(array));
if (array.Length - index < _count)
throw new ArgumentException(SR.Arg_InsufficientSpace);
@@ -393,13 +389,6 @@ namespace System.Collections.Specialized
throw new ArgumentNullException(nameof(array));
if (index < 0)
throw new ArgumentOutOfRangeException(nameof(index), index, SR.ArgumentOutOfRange_NeedNonNegNum);
- if (array.Rank != 1)
- throw new ArgumentException(SR.Arg_MultiRank, nameof(array));
- if (array.GetLowerBound(0) != 0)
- throw new ArgumentException(SR.Arg_NonZeroLowerBound, nameof(array));
-
- if (array.Length - index < _list.Count)
- throw new ArgumentException(SR.Arg_InsufficientSpace);
for (DictionaryNode node = _list._head; node != null; node = node.next)
{
diff --git a/src/System.Collections.Specialized/tests/HybridDictionary/HybridDictionary.KeysTests.cs b/src/System.Collections.Specialized/tests/HybridDictionary/HybridDictionary.KeysTests.cs
index cc84fa7b45..da61509642 100644
--- a/src/System.Collections.Specialized/tests/HybridDictionary/HybridDictionary.KeysTests.cs
+++ b/src/System.Collections.Specialized/tests/HybridDictionary/HybridDictionary.KeysTests.cs
@@ -51,17 +51,54 @@ namespace System.Collections.Specialized.Tests
Array arr = Array.CreateInstance(typeof(object), new int[] { count }, new int[] { 2 });
Assert.Equal(1, arr.Rank);
Assert.Equal(2, arr.GetLowerBound(0));
-
- // A bug in Hashtable.Keys.CopyTo (the underlying collection) means we don't check
- // the lower bounds of the destination array for count > 10
- if (count < 10)
+ if (count == 0)
{
- Assert.Throws<ArgumentException>("array", () => collection.CopyTo(arr, 0));
+ collection.CopyTo(arr, count);
+ Assert.Equal(0, arr.Length);
+ return;
}
+
+ Assert.Throws<IndexOutOfRangeException>(() => collection.CopyTo(arr, 0));
+ }
+
+ [Theory]
+ [MemberData(nameof(ValidCollectionSizes))]
+ public override void ICollection_NonGeneric_CopyTo_IndexEqualToArrayCount_ThrowsArgumentException(int count)
+ {
+ ICollection collection = NonGenericICollectionFactory(count);
+ object[] array = new object[count];
+ if (count > 0)
+ Assert.Throws(count < 10 ? typeof(IndexOutOfRangeException) : typeof(ArgumentException), () => collection.CopyTo(array, count));
else
+ collection.CopyTo(array, count); // does nothing since the array is empty
+ }
+
+ [Theory]
+ [MemberData(nameof(ValidCollectionSizes))]
+ public override void ICollection_NonGeneric_CopyTo_NotEnoughSpaceInOffsettedArray_ThrowsArgumentException(int count)
+ {
+ if (count > 0) // Want the T array to have at least 1 element
{
- Assert.Throws<IndexOutOfRangeException>(() => collection.CopyTo(arr, 0));
+ ICollection collection = NonGenericICollectionFactory(count);
+ object[] array = new object[count];
+ Assert.Throws(count < 10 ? typeof(IndexOutOfRangeException) : typeof(ArgumentException), () => collection.CopyTo(array, 1));
}
}
+
+ [Theory]
+ [MemberData(nameof(ValidCollectionSizes))]
+ public override void ICollection_NonGeneric_CopyTo_IndexLargerThanArrayCount_ThrowsAnyArgumentException(int count)
+ {
+ ICollection collection = NonGenericICollectionFactory(count);
+ object[] array = new object[count];
+ if (count == 0)
+ {
+ collection.CopyTo(array, count + 1);
+ Assert.Equal(count, array.Length);
+ return;
+ }
+
+ Assert.Throws(count < 10 ? typeof(IndexOutOfRangeException) : typeof(ArgumentException), () => collection.CopyTo(array, count + 1));
+ }
}
}
diff --git a/src/System.Collections.Specialized/tests/HybridDictionary/HybridDictionary.ValuesTests.cs b/src/System.Collections.Specialized/tests/HybridDictionary/HybridDictionary.ValuesTests.cs
index 4176995088..9141fdeb55 100644
--- a/src/System.Collections.Specialized/tests/HybridDictionary/HybridDictionary.ValuesTests.cs
+++ b/src/System.Collections.Specialized/tests/HybridDictionary/HybridDictionary.ValuesTests.cs
@@ -51,17 +51,54 @@ namespace System.Collections.Specialized.Tests
Array arr = Array.CreateInstance(typeof(object), new int[] { count }, new int[] { 2 });
Assert.Equal(1, arr.Rank);
Assert.Equal(2, arr.GetLowerBound(0));
-
- // A bug in Hashtable.Values.CopyTo (the underlying collection) means we don't check
- // the lower bounds of the destination array for count > 10
- if (count < 10)
+ if (count == 0)
{
- Assert.Throws<ArgumentException>("array", () => collection.CopyTo(arr, 0));
+ collection.CopyTo(arr, count);
+ Assert.Equal(0, arr.Length);
+ return;
}
+
+ Assert.Throws(count < 10 ? typeof(IndexOutOfRangeException) : typeof(ArgumentException), () => collection.CopyTo(arr, count));
+ }
+
+ [Theory]
+ [MemberData(nameof(ValidCollectionSizes))]
+ public override void ICollection_NonGeneric_CopyTo_IndexEqualToArrayCount_ThrowsArgumentException(int count)
+ {
+ ICollection collection = NonGenericICollectionFactory(count);
+ object[] array = new object[count];
+ if (count > 0)
+ Assert.Throws(count < 10 ? typeof(IndexOutOfRangeException) : typeof(ArgumentException), () => collection.CopyTo(array, count));
else
+ collection.CopyTo(array, count); // does nothing since the array is empty
+ }
+
+ [Theory]
+ [MemberData(nameof(ValidCollectionSizes))]
+ public override void ICollection_NonGeneric_CopyTo_NotEnoughSpaceInOffsettedArray_ThrowsArgumentException(int count)
+ {
+ if (count > 0) // Want the T array to have at least 1 element
{
- Assert.Throws<IndexOutOfRangeException>(() => collection.CopyTo(arr, 0));
+ ICollection collection = NonGenericICollectionFactory(count);
+ object[] array = new object[count];
+ Assert.Throws(count < 10 ? typeof(IndexOutOfRangeException) : typeof(ArgumentException), () => collection.CopyTo(array, 1));
}
}
+
+ [Theory]
+ [MemberData(nameof(ValidCollectionSizes))]
+ public override void ICollection_NonGeneric_CopyTo_IndexLargerThanArrayCount_ThrowsAnyArgumentException(int count)
+ {
+ ICollection collection = NonGenericICollectionFactory(count);
+ object[] array = new object[count];
+ if (count == 0)
+ {
+ collection.CopyTo(array, count + 1);
+ Assert.Equal(count, array.Length);
+ return;
+ }
+
+ Assert.Throws(count < 10 ? typeof(IndexOutOfRangeException) : typeof(ArgumentException), () => collection.CopyTo(array, count + 1));
+ }
}
}
diff --git a/src/System.Collections.Specialized/tests/HybridDictionary/HybridDictionaryTests.cs b/src/System.Collections.Specialized/tests/HybridDictionary/HybridDictionaryTests.cs
index c3d90e9038..af35d4daa7 100644
--- a/src/System.Collections.Specialized/tests/HybridDictionary/HybridDictionaryTests.cs
+++ b/src/System.Collections.Specialized/tests/HybridDictionary/HybridDictionaryTests.cs
@@ -22,7 +22,7 @@ namespace System.Collections.Specialized.Tests
protected override Type ICollection_NonGeneric_CopyTo_ArrayOfEnumType_ThrowType => typeof(InvalidCastException);
protected override Type ICollection_NonGeneric_CopyTo_ArrayOfIncorrectReferenceType_ThrowType => typeof(InvalidCastException);
protected override Type ICollection_NonGeneric_CopyTo_ArrayOfIncorrectValueType_ThrowType => typeof(InvalidCastException);
-
+
protected override Type ICollection_NonGeneric_SyncRootType => typeof(HybridDictionary);
protected override object CreateTKey(int seed)
@@ -44,17 +44,14 @@ namespace System.Collections.Specialized.Tests
Array arr = Array.CreateInstance(typeof(object), new int[] { count }, new int[] { 2 });
Assert.Equal(1, arr.Rank);
Assert.Equal(2, arr.GetLowerBound(0));
-
- // A bug in Hashtable.CopyTo (the underlying collection) means we don't check
- // the lower bounds of the destination array for count > 10
- if (count < 10)
+ if (count == 0)
{
- Assert.Throws<ArgumentException>("array", () => collection.CopyTo(arr, 0));
- }
- else
- {
- Assert.Throws<IndexOutOfRangeException>(() => collection.CopyTo(arr, 0));
+ collection.CopyTo(arr, count);
+ Assert.Equal(0, arr.Length);
+ return;
}
+
+ Assert.Throws<IndexOutOfRangeException>(() => collection.CopyTo(arr, 0));
}
}
}
diff --git a/src/System.Collections.Specialized/tests/ListDictionary/ListDictionary.IDictionary.Tests.cs b/src/System.Collections.Specialized/tests/ListDictionary/ListDictionary.IDictionary.Tests.cs
index 99d0e5267e..76f1973b04 100644
--- a/src/System.Collections.Specialized/tests/ListDictionary/ListDictionary.IDictionary.Tests.cs
+++ b/src/System.Collections.Specialized/tests/ListDictionary/ListDictionary.IDictionary.Tests.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.Collections.Tests;
+using Xunit;
namespace System.Collections.Specialized.Tests
{
@@ -21,6 +22,7 @@ namespace System.Collections.Specialized.Tests
protected override Type ICollection_NonGeneric_CopyTo_ArrayOfEnumType_ThrowType => typeof(InvalidCastException);
protected override Type ICollection_NonGeneric_CopyTo_ArrayOfIncorrectReferenceType_ThrowType => typeof(InvalidCastException);
protected override Type ICollection_NonGeneric_CopyTo_ArrayOfIncorrectValueType_ThrowType => typeof(InvalidCastException);
+ protected override Type ICollection_NonGeneric_CopyTo_NonZeroLowerBound_ThrowType => typeof(IndexOutOfRangeException);
protected override object CreateTKey(int seed)
{
@@ -32,5 +34,34 @@ namespace System.Collections.Specialized.Tests
}
protected override object CreateTValue(int seed) => CreateTKey(seed);
+
+ [Theory]
+ [MemberData(nameof(ValidCollectionSizes))]
+ public override void ICollection_NonGeneric_CopyTo_IndexLargerThanArrayCount_ThrowsAnyArgumentException(int count)
+ {
+ ICollection collection = NonGenericICollectionFactory(count);
+ object[] array = new object[count];
+
+ Assert.Throws(ICollection_NonGeneric_CopyTo_IndexLargerThanArrayCount_ThrowType, () => collection.CopyTo(array, count + 1));
+ }
+
+ [Theory]
+ [MemberData(nameof(ValidCollectionSizes))]
+ public override void ICollection_NonGeneric_CopyTo_NonZeroLowerBound(int count)
+ {
+ ICollection collection = NonGenericICollectionFactory(count);
+
+ Array arr = Array.CreateInstance(typeof(object), new int[1] { count }, new int[1] { 2 });
+ Assert.Equal(1, arr.Rank);
+ Assert.Equal(2, arr.GetLowerBound(0));
+ if (count == 0)
+ {
+ collection.CopyTo(arr, count);
+ Assert.Equal(0, arr.Length);
+ return;
+ }
+
+ Assert.Throws(ICollection_NonGeneric_CopyTo_NonZeroLowerBound_ThrowType, () => collection.CopyTo(arr, 0));
+ }
}
}
diff --git a/src/System.Collections.Specialized/tests/ListDictionary/ListDictionary.Keys.Tests.cs b/src/System.Collections.Specialized/tests/ListDictionary/ListDictionary.Keys.Tests.cs
index 0b48d36180..f2657f2127 100644
--- a/src/System.Collections.Specialized/tests/ListDictionary/ListDictionary.Keys.Tests.cs
+++ b/src/System.Collections.Specialized/tests/ListDictionary/ListDictionary.Keys.Tests.cs
@@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Collections.Tests;
using System.Diagnostics;
+using Xunit;
namespace System.Collections.Specialized.Tests
{
@@ -13,6 +14,8 @@ namespace System.Collections.Specialized.Tests
protected override Type ICollection_NonGeneric_CopyTo_ArrayOfEnumType_ThrowType => typeof(InvalidCastException);
protected override Type ICollection_NonGeneric_CopyTo_ArrayOfIncorrectReferenceType_ThrowType => typeof(InvalidCastException);
protected override Type ICollection_NonGeneric_CopyTo_ArrayOfIncorrectValueType_ThrowType => typeof(InvalidCastException);
+ protected override Type ICollection_NonGeneric_CopyTo_IndexLargerThanArrayCount_ThrowType => typeof(IndexOutOfRangeException);
+ protected override Type ICollection_NonGeneric_CopyTo_NonZeroLowerBound_ThrowType => typeof(IndexOutOfRangeException);
protected override bool Enumerator_Current_UndefinedOperation_Throws => true;
@@ -41,5 +44,64 @@ namespace System.Collections.Specialized.Tests
protected override void AddToCollection(ICollection collection, int numberOfItemsToAdd) => Debug.Assert(false);
protected override IEnumerable<ModifyEnumerable> ModifyEnumerables => new List<ModifyEnumerable>();
+
+ [Theory]
+ [MemberData(nameof(ValidCollectionSizes))]
+ public override void ICollection_NonGeneric_CopyTo_IndexEqualToArrayCount_ThrowsArgumentException(int count)
+ {
+ ICollection collection = NonGenericICollectionFactory(count);
+ object[] array = new object[count];
+ if (count > 0)
+ Assert.Throws<IndexOutOfRangeException>(() => collection.CopyTo(array, count));
+ else
+ collection.CopyTo(array, count); // does nothing since the array is empty
+ }
+
+ [Theory]
+ [MemberData(nameof(ValidCollectionSizes))]
+ public override void ICollection_NonGeneric_CopyTo_NotEnoughSpaceInOffsettedArray_ThrowsArgumentException(int count)
+ {
+ if (count > 0) // Want the T array to have at least 1 element
+ {
+ ICollection collection = NonGenericICollectionFactory(count);
+ object[] array = new object[count];
+ Assert.Throws<IndexOutOfRangeException>(() => collection.CopyTo(array, 1));
+ }
+ }
+
+ [Theory]
+ [MemberData(nameof(ValidCollectionSizes))]
+ public override void ICollection_NonGeneric_CopyTo_IndexLargerThanArrayCount_ThrowsAnyArgumentException(int count)
+ {
+ ICollection collection = NonGenericICollectionFactory(count);
+ object[] array = new object[count];
+ if (count == 0)
+ {
+ collection.CopyTo(array, count + 1);
+ Assert.Equal(count, array.Length);
+ return;
+ }
+
+ Assert.Throws(ICollection_NonGeneric_CopyTo_IndexLargerThanArrayCount_ThrowType, () => collection.CopyTo(array, count + 1));
+ }
+
+ [Theory]
+ [MemberData(nameof(ValidCollectionSizes))]
+ public override void ICollection_NonGeneric_CopyTo_NonZeroLowerBound(int count)
+ {
+ ICollection collection = NonGenericICollectionFactory(count);
+
+ Array arr = Array.CreateInstance(typeof(object), new int[1] { count }, new int[1] { 2 });
+ Assert.Equal(1, arr.Rank);
+ Assert.Equal(2, arr.GetLowerBound(0));
+ if (count == 0)
+ {
+ collection.CopyTo(arr, count);
+ Assert.Equal(0, arr.Length);
+ return;
+ }
+
+ Assert.Throws(ICollection_NonGeneric_CopyTo_NonZeroLowerBound_ThrowType, () => collection.CopyTo(arr, 0));
+ }
}
}
diff --git a/src/System.Collections.Specialized/tests/ListDictionary/ListDictionary.Values.Tests.cs b/src/System.Collections.Specialized/tests/ListDictionary/ListDictionary.Values.Tests.cs
index 495904002c..cd92dfeaff 100644
--- a/src/System.Collections.Specialized/tests/ListDictionary/ListDictionary.Values.Tests.cs
+++ b/src/System.Collections.Specialized/tests/ListDictionary/ListDictionary.Values.Tests.cs
@@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Collections.Tests;
using System.Diagnostics;
+using Xunit;
namespace System.Collections.Specialized.Tests
{
@@ -13,6 +14,8 @@ namespace System.Collections.Specialized.Tests
protected override Type ICollection_NonGeneric_CopyTo_ArrayOfEnumType_ThrowType => typeof(InvalidCastException);
protected override Type ICollection_NonGeneric_CopyTo_ArrayOfIncorrectReferenceType_ThrowType => typeof(InvalidCastException);
protected override Type ICollection_NonGeneric_CopyTo_ArrayOfIncorrectValueType_ThrowType => typeof(InvalidCastException);
+ protected override Type ICollection_NonGeneric_CopyTo_IndexLargerThanArrayCount_ThrowType => typeof(IndexOutOfRangeException);
+ protected override Type ICollection_NonGeneric_CopyTo_NonZeroLowerBound_ThrowType => typeof(IndexOutOfRangeException);
protected override bool Enumerator_Current_UndefinedOperation_Throws => true;
@@ -41,5 +44,64 @@ namespace System.Collections.Specialized.Tests
protected override void AddToCollection(ICollection collection, int numberOfItemsToAdd) => Debug.Assert(false);
protected override IEnumerable<ModifyEnumerable> ModifyEnumerables => new List<ModifyEnumerable>();
+
+ [Theory]
+ [MemberData(nameof(ValidCollectionSizes))]
+ public override void ICollection_NonGeneric_CopyTo_IndexEqualToArrayCount_ThrowsArgumentException(int count)
+ {
+ ICollection collection = NonGenericICollectionFactory(count);
+ object[] array = new object[count];
+ if (count > 0)
+ Assert.Throws<IndexOutOfRangeException>(() => collection.CopyTo(array, count));
+ else
+ collection.CopyTo(array, count); // does nothing since the array is empty
+ }
+
+ [Theory]
+ [MemberData(nameof(ValidCollectionSizes))]
+ public override void ICollection_NonGeneric_CopyTo_NotEnoughSpaceInOffsettedArray_ThrowsArgumentException(int count)
+ {
+ if (count > 0) // Want the T array to have at least 1 element
+ {
+ ICollection collection = NonGenericICollectionFactory(count);
+ object[] array = new object[count];
+ Assert.Throws<IndexOutOfRangeException>(() => collection.CopyTo(array, 1));
+ }
+ }
+
+ [Theory]
+ [MemberData(nameof(ValidCollectionSizes))]
+ public override void ICollection_NonGeneric_CopyTo_IndexLargerThanArrayCount_ThrowsAnyArgumentException(int count)
+ {
+ ICollection collection = NonGenericICollectionFactory(count);
+ object[] array = new object[count];
+ if (count == 0)
+ {
+ collection.CopyTo(array, count + 1);
+ Assert.Equal(count, array.Length);
+ return;
+ }
+
+ Assert.Throws(ICollection_NonGeneric_CopyTo_IndexLargerThanArrayCount_ThrowType, () => collection.CopyTo(array, count + 1));
+ }
+
+ [Theory]
+ [MemberData(nameof(ValidCollectionSizes))]
+ public override void ICollection_NonGeneric_CopyTo_NonZeroLowerBound(int count)
+ {
+ ICollection collection = NonGenericICollectionFactory(count);
+
+ Array arr = Array.CreateInstance(typeof(object), new int[1] { count }, new int[1] { 2 });
+ Assert.Equal(1, arr.Rank);
+ Assert.Equal(2, arr.GetLowerBound(0));
+ if (count == 0)
+ {
+ collection.CopyTo(arr, count);
+ Assert.Equal(0, arr.Length);
+ return;
+ }
+
+ Assert.Throws(ICollection_NonGeneric_CopyTo_NonZeroLowerBound_ThrowType, () => collection.CopyTo(arr, 0));
+ }
}
}
diff --git a/src/System.Collections.Specialized/tests/NameObjectCollectionBase/NameObjectCollectionBase.CopyToTests.cs b/src/System.Collections.Specialized/tests/NameObjectCollectionBase/NameObjectCollectionBase.CopyToTests.cs
index 96a8ec12f2..1f0250d049 100644
--- a/src/System.Collections.Specialized/tests/NameObjectCollectionBase/NameObjectCollectionBase.CopyToTests.cs
+++ b/src/System.Collections.Specialized/tests/NameObjectCollectionBase/NameObjectCollectionBase.CopyToTests.cs
@@ -49,7 +49,7 @@ namespace System.Collections.Specialized.Tests
ICollection collection = nameObjectCollection;
Assert.Throws<ArgumentNullException>("array", () => collection.CopyTo(null, 0));
- Assert.Throws<ArgumentException>("array", () => collection.CopyTo(new string[count, count], 0));
+ Assert.Throws<ArgumentException>(() => collection.CopyTo(new string[count, count], 0));
if (count > 0)
{
diff --git a/src/System.Collections.Specialized/tests/NameObjectCollectionBase/NameObjectCollectionBase.KeysTests.cs b/src/System.Collections.Specialized/tests/NameObjectCollectionBase/NameObjectCollectionBase.KeysTests.cs
index c85c460b89..d5d78822fa 100644
--- a/src/System.Collections.Specialized/tests/NameObjectCollectionBase/NameObjectCollectionBase.KeysTests.cs
+++ b/src/System.Collections.Specialized/tests/NameObjectCollectionBase/NameObjectCollectionBase.KeysTests.cs
@@ -156,7 +156,7 @@ namespace System.Collections.Specialized.Tests
ICollection keysCollection = keys;
Assert.Throws<ArgumentNullException>("array", () => keysCollection.CopyTo(null, 0));
- Assert.Throws<ArgumentException>("array", () => keysCollection.CopyTo(new string[count, count], 0));
+ Assert.Throws<ArgumentException>(() => keysCollection.CopyTo(new string[count, count], 0));
if (count > 0)
{
diff --git a/src/System.Collections.Specialized/tests/NameValueCollection/NameValueCollection.CopyToTests.cs b/src/System.Collections.Specialized/tests/NameValueCollection/NameValueCollection.CopyToTests.cs
index dabe03a7e9..6cef4d711b 100644
--- a/src/System.Collections.Specialized/tests/NameValueCollection/NameValueCollection.CopyToTests.cs
+++ b/src/System.Collections.Specialized/tests/NameValueCollection/NameValueCollection.CopyToTests.cs
@@ -59,7 +59,7 @@ namespace System.Collections.Specialized.Tests
{
NameValueCollection nameValueCollection = Helpers.CreateNameValueCollection(count);
Assert.Throws<ArgumentNullException>("dest", () => nameValueCollection.CopyTo(null, 0));
- Assert.Throws<ArgumentException>("dest", () => nameValueCollection.CopyTo(new string[count, count], 0));
+ Assert.Throws<ArgumentException>(() => nameValueCollection.CopyTo(new string[count, count], 0));
Assert.Throws<ArgumentOutOfRangeException>("index", () => nameValueCollection.CopyTo(new string[count], -1));
diff --git a/src/System.Collections/dir.props b/src/System.Collections/dir.props
new file mode 100644
index 0000000000..d16ef39bdb
--- /dev/null
+++ b/src/System.Collections/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.12.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Collections/pkg/ValidationSuppression.txt b/src/System.Collections/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Collections/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Collections/ref/4.0.0/System.Collections.depproj b/src/System.Collections/ref/4.0.0/System.Collections.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Collections/ref/4.0.0/System.Collections.depproj
+++ b/src/System.Collections/ref/4.0.0/System.Collections.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Collections/ref/System.Collections.csproj b/src/System.Collections/ref/System.Collections.csproj
index 4144e5f6a4..f5872159fa 100644
--- a/src/System.Collections/ref/System.Collections.csproj
+++ b/src/System.Collections/ref/System.Collections.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Collections/src/System.Collections.csproj b/src/System.Collections/src/System.Collections.csproj
index 9ff4071487..e74b93964b 100644
--- a/src/System.Collections/src/System.Collections.csproj
+++ b/src/System.Collections/src/System.Collections.csproj
@@ -4,10 +4,8 @@
<PropertyGroup>
<ProjectGuid>{D5FF747F-7A0B-9003-885A-FE9A63E755E5}</ProjectGuid>
<AssemblyName>System.Collections</AssemblyName>
- <AssemblyVersion>4.1.0.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the options -->
diff --git a/src/System.Collections/src/System/Collections/Generic/Queue.cs b/src/System.Collections/src/System/Collections/Generic/Queue.cs
index 811fe8708b..9afe3c1c0f 100644
--- a/src/System.Collections/src/System/Collections/Generic/Queue.cs
+++ b/src/System.Collections/src/System/Collections/Generic/Queue.cs
@@ -37,7 +37,6 @@ namespace System.Collections.Generic
// Creates a queue with room for capacity objects. The default initial
// capacity and grow factor are used.
- /// <include file='doc\Queue.uex' path='docs/doc[@for="Queue.Queue"]/*' />
public Queue()
{
_array = Array.Empty<T>();
@@ -45,8 +44,6 @@ namespace System.Collections.Generic
// Creates a queue with room for capacity objects. The default grow factor
// is used.
- //
- /// <include file='doc\Queue.uex' path='docs/doc[@for="Queue.Queue1"]/*' />
public Queue(int capacity)
{
if (capacity < 0)
@@ -56,8 +53,6 @@ namespace System.Collections.Generic
// Fills a Queue with the elements of an ICollection. Uses the enumerator
// to get each of the elements.
- //
- /// <include file='doc\Queue.uex' path='docs/doc[@for="Queue.Queue3"]/*' />
public Queue(IEnumerable<T> collection)
{
if (collection == null)
@@ -67,13 +62,11 @@ namespace System.Collections.Generic
if (_size != _array.Length) _tail = _size;
}
- /// <include file='doc\Queue.uex' path='docs/doc[@for="Queue.Count"]/*' />
public int Count
{
get { return _size; }
}
- /// <include file='doc\Queue.uex' path='docs/doc[@for="Queue.IsSynchronized"]/*' />
bool ICollection.IsSynchronized
{
get { return false; }
@@ -92,7 +85,6 @@ namespace System.Collections.Generic
}
// Removes all Objects from the queue.
- /// <include file='doc\Queue.uex' path='docs/doc[@for="Queue.Clear"]/*' />
public void Clear()
{
if (_size != 0)
@@ -115,8 +107,6 @@ namespace System.Collections.Generic
// CopyTo copies a collection into an Array, starting at a particular
// index into the array.
- //
- /// <include file='doc\Queue.uex' path='docs/doc[@for="Queue.CopyTo"]/*' />
public void CopyTo(T[] array, int arrayIndex)
{
if (array == null)
@@ -196,8 +186,6 @@ namespace System.Collections.Generic
}
// Adds item to the tail of the queue.
- //
- /// <include file='doc\Queue.uex' path='docs/doc[@for="Queue.Enqueue"]/*' />
public void Enqueue(T item)
{
if (_size == _array.Length)
@@ -218,14 +206,11 @@ namespace System.Collections.Generic
// GetEnumerator returns an IEnumerator over this Queue. This
// Enumerator will support removing.
- //
- /// <include file='doc\Queue.uex' path='docs/doc[@for="Queue.GetEnumerator"]/*' />
public Enumerator GetEnumerator()
{
return new Enumerator(this);
}
- /// <include file='doc\Queue.uex' path='docs/doc[@for="Queue.IEnumerable.GetEnumerator"]/*' />
/// <internalonly/>
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
@@ -238,8 +223,8 @@ namespace System.Collections.Generic
}
// Removes the object at the head of the queue and returns it. If the queue
- // is empty, this method simply returns null.
- /// <include file='doc\Queue.uex' path='docs/doc[@for="Queue.Dequeue"]/*' />
+ // is empty, this method throws an
+ // InvalidOperationException.
public T Dequeue()
{
if (_size == 0)
@@ -256,7 +241,6 @@ namespace System.Collections.Generic
// Returns the object at the head of the queue. The object remains in the
// queue. If the queue is empty, this method throws an
// InvalidOperationException.
- /// <include file='doc\Queue.uex' path='docs/doc[@for="Queue.Peek"]/*' />
public T Peek()
{
if (_size == 0)
@@ -267,8 +251,6 @@ namespace System.Collections.Generic
// Returns true if the queue contains at least one object equal to item.
// Equality is determined using item.Equals().
- //
- /// <include file='doc\Queue.uex' path='docs/doc[@for="Queue.Contains"]/*' />
public bool Contains(T item)
{
int index = _head;
@@ -287,16 +269,10 @@ namespace System.Collections.Generic
return false;
}
- private T GetElement(int i)
- {
- return _array[(_head + i) % _array.Length];
- }
-
// Iterates over the objects in the queue, returning an array of the
// objects in the Queue, or an empty array if the queue is empty.
// The order of elements in the array is first in to last in, the same
// order produced by successive calls to Dequeue.
- /// <include file='doc\Queue.uex' path='docs/doc[@for="Queue.ToArray"]/*' />
public T[] ToArray()
{
if (_size == 0)
@@ -364,7 +340,6 @@ namespace System.Collections.Generic
// Implements an enumerator for a Queue. The enumerator uses the
// internal version number of the list to ensure that no modifications are
// made to the list while an enumeration is in progress.
- /// <include file='doc\Queue.uex' path='docs/doc[@for="QueueEnumerator"]/*' />
[SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes", Justification = "not an expected scenario")]
[Serializable]
public struct Enumerator : IEnumerator<T>,
@@ -383,14 +358,12 @@ namespace System.Collections.Generic
_currentElement = default(T);
}
- /// <include file='doc\Queue.uex' path='docs/doc[@for="QueueEnumerator.Dispose"]/*' />
public void Dispose()
{
_index = -2;
_currentElement = default(T);
}
- /// <include file='doc\Queue.uex' path='docs/doc[@for="QueueEnumerator.MoveNext"]/*' />
public bool MoveNext()
{
if (_version != _q._version) throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
@@ -402,16 +375,35 @@ namespace System.Collections.Generic
if (_index == _q._size)
{
+ // We've run past the last element
_index = -2;
_currentElement = default(T);
return false;
}
- _currentElement = _q.GetElement(_index);
+ // Cache some fields in locals to decrease code size
+ T[] array = _q._array;
+ int capacity = array.Length;
+
+ // _index represents the 0-based index into the queue, however the queue
+ // doesn't have to start from 0 and it may not even be stored contiguously in memory.
+
+ int arrayIndex = _q._head + _index; // this is the actual index into the queue's backing array
+ if (arrayIndex >= capacity)
+ {
+ // NOTE: Originally we were using the modulo operator here, however
+ // on Intel processors it has a very high instruction latency which
+ // was slowing down the loop quite a bit.
+ // Replacing it with simple comparison/subtraction operations sped up
+ // the average foreach loop by 2x.
+
+ arrayIndex -= capacity; // wrap around if needed
+ }
+
+ _currentElement = array[arrayIndex];
return true;
}
- /// <include file='doc\Queue.uex' path='docs/doc[@for="QueueEnumerator.Current"]/*' />
public T Current
{
get
diff --git a/src/System.Collections/src/System/Collections/Generic/SortedList.cs b/src/System.Collections/src/System/Collections/Generic/SortedList.cs
index f746ae270e..cb3efb2083 100644
--- a/src/System.Collections/src/System/Collections/Generic/SortedList.cs
+++ b/src/System.Collections/src/System/Collections/Generic/SortedList.cs
@@ -757,8 +757,7 @@ namespace System.Collections.Generic
return (key is TKey);
}
-
- /// <include file='doc\SortedList.uex' path='docs/doc[@for="SortedListEnumerator"]/*' />
+
[Serializable]
private struct Enumerator : IEnumerator<KeyValuePair<TKey, TValue>>, IDictionaryEnumerator
{
diff --git a/src/System.Collections/src/System/Collections/Generic/Stack.cs b/src/System.Collections/src/System/Collections/Generic/Stack.cs
index c4b0f897bb..2c9669e508 100644
--- a/src/System.Collections/src/System/Collections/Generic/Stack.cs
+++ b/src/System.Collections/src/System/Collections/Generic/Stack.cs
@@ -33,7 +33,6 @@ namespace System.Collections.Generic
private const int DefaultCapacity = 4;
- /// <include file='doc\Stack.uex' path='docs/doc[@for="Stack.Stack"]/*' />
public Stack()
{
_array = Array.Empty<T>();
@@ -41,7 +40,6 @@ namespace System.Collections.Generic
// Create a stack with a specific initial capacity. The initial capacity
// must be a non-negative number.
- /// <include file='doc\Stack.uex' path='docs/doc[@for="Stack.Stack1"]/*' />
public Stack(int capacity)
{
if (capacity < 0)
@@ -51,8 +49,6 @@ namespace System.Collections.Generic
// Fills a Stack with the contents of a particular collection. The items are
// pushed onto the stack in the same order they are read by the enumerator.
- //
- /// <include file='doc\Stack.uex' path='docs/doc[@for="Stack.Stack2"]/*' />
public Stack(IEnumerable<T> collection)
{
if (collection == null)
@@ -60,19 +56,16 @@ namespace System.Collections.Generic
_array = EnumerableHelpers.ToArray(collection, out _size);
}
- /// <include file='doc\Stack.uex' path='docs/doc[@for="Stack.Count"]/*' />
public int Count
{
get { return _size; }
}
- /// <include file='doc\Stack.uex' path='docs/doc[@for="Stack.IsSynchronized"]/*' />
bool ICollection.IsSynchronized
{
get { return false; }
}
- /// <include file='doc\Stack.uex' path='docs/doc[@for="Stack.SyncRoot"]/*' />
object ICollection.SyncRoot
{
get
@@ -86,7 +79,6 @@ namespace System.Collections.Generic
}
// Removes all Objects from the Stack.
- /// <include file='doc\Stack.uex' path='docs/doc[@for="Stack.Clear"]/*' />
public void Clear()
{
Array.Clear(_array, 0, _size); // Don't need to doc this but we clear the elements so that the gc can reclaim the references.
@@ -94,7 +86,6 @@ namespace System.Collections.Generic
_version++;
}
- /// <include file='doc\Stack.uex' path='docs/doc[@for="Stack.Contains"]/*' />
public bool Contains(T item)
{
int count = _size;
@@ -111,7 +102,6 @@ namespace System.Collections.Generic
}
// Copies the stack into an array.
- /// <include file='doc\Stack.uex' path='docs/doc[@for="Stack.CopyTo"]/*' />
public void CopyTo(T[] array, int arrayIndex)
{
if (array == null)
@@ -175,13 +165,11 @@ namespace System.Collections.Generic
}
// Returns an IEnumerator for this Stack.
- /// <include file='doc\Stack.uex' path='docs/doc[@for="Stack.GetEnumerator"]/*' />
public Enumerator GetEnumerator()
{
return new Enumerator(this);
}
- /// <include file='doc\Stack.uex' path='docs/doc[@for="Stack.IEnumerable.GetEnumerator"]/*' />
/// <internalonly/>
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
@@ -205,7 +193,6 @@ namespace System.Collections.Generic
// Returns the top object on the stack without removing it. If the stack
// is empty, Peek throws an InvalidOperationException.
- /// <include file='doc\Stack.uex' path='docs/doc[@for="Stack.Peek"]/*' />
public T Peek()
{
if (_size == 0)
@@ -215,7 +202,6 @@ namespace System.Collections.Generic
// Pops an item from the top of the stack. If the stack is empty, Pop
// throws an InvalidOperationException.
- /// <include file='doc\Stack.uex' path='docs/doc[@for="Stack.Pop"]/*' />
public T Pop()
{
if (_size == 0)
@@ -227,8 +213,6 @@ namespace System.Collections.Generic
}
// Pushes an item to the top of the stack.
- //
- /// <include file='doc\Stack.uex' path='docs/doc[@for="Stack.Push"]/*' />
public void Push(T item)
{
if (_size == _array.Length)
@@ -255,7 +239,6 @@ namespace System.Collections.Generic
return objArray;
}
- /// <include file='doc\Stack.uex' path='docs/doc[@for="StackEnumerator"]/*' />
[SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes", Justification = "not an expected scenario")]
[Serializable]
public struct Enumerator : IEnumerator<T>, System.Collections.IEnumerator
@@ -273,13 +256,11 @@ namespace System.Collections.Generic
_currentElement = default(T);
}
- /// <include file='doc\Stack.uex' path='docs/doc[@for="StackEnumerator.Dispose"]/*' />
public void Dispose()
{
_index = -1;
}
- /// <include file='doc\Stack.uex' path='docs/doc[@for="StackEnumerator.MoveNext"]/*' />
public bool MoveNext()
{
bool retval;
@@ -305,7 +286,6 @@ namespace System.Collections.Generic
return retval;
}
- /// <include file='doc\Stack.uex' path='docs/doc[@for="StackEnumerator.Current"]/*' />
public T Current
{
get
diff --git a/src/System.Collections/tests/Generic/Comparers/Comparer.Generic.Tests.cs b/src/System.Collections/tests/Generic/Comparers/Comparer.Generic.Tests.cs
new file mode 100644
index 0000000000..ca6b0aed69
--- /dev/null
+++ b/src/System.Collections/tests/Generic/Comparers/Comparer.Generic.Tests.cs
@@ -0,0 +1,137 @@
+// 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.Collections;
+using System.Diagnostics;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace System.Collections.Generic.Tests
+{
+ public abstract partial class ComparersGenericTests<T>
+ {
+ [Fact]
+ public void ComparerDefault()
+ {
+ var firstResult = Comparer<T>.Default;
+ Assert.NotNull(firstResult);
+ Assert.Same(firstResult, Comparer<T>.Default);
+ }
+
+ [Fact]
+ public void EqualsShouldBeOverriddenAndWorkForDifferentInstances()
+ {
+ var comparer = Comparer<T>.Default;
+
+ // Whether the comparer has overridden Object.Equals or not, all of these
+ // comparisons should be false
+ Assert.False(comparer.Equals(null));
+ Assert.False(comparer.Equals(3));
+ Assert.False(comparer.Equals("foo"));
+ Assert.False(comparer.Equals(Comparer<Task<T>>.Default));
+
+ // If we are running on full framework/CoreCLR, Comparer<T> additionally
+ // overrides the Equals(object) and GetHashCode() methods for itself,
+ // presumably to support serialization, so test that behavior as well.
+ // This is not done in .NET Native yet: dotnet/corert#1736
+ if (!RuntimeDetection.IsNetNative)
+ {
+ var cloned = ObjectCloner.MemberwiseClone(comparer); // calls MemberwiseClone() on the comparer via reflection, which returns a different instance
+
+ // Whatever the type of the comparer, it should have overridden Equals(object) so
+ // it can return true as long as the other object is the same type (not nec. the same instance)
+ Assert.True(cloned.Equals(comparer));
+ Assert.True(comparer.Equals(cloned));
+
+ // Equals() should not return true for null
+ // Prevent a faulty implementation like Equals(obj) => obj is FooComparer<T>, which will be true for null
+ Assert.False(cloned.Equals(null));
+ }
+ }
+
+ [Fact]
+ public void GetHashCodeShouldBeOverriddenAndBeTheSameAsLongAsTheTypeIsTheSame()
+ {
+ var comparer = Comparer<T>.Default;
+
+ // Multiple invocations should return the same result,
+ // whether GetHashCode() was overridden or not
+ Assert.Equal(comparer.GetHashCode(), comparer.GetHashCode());
+
+ // If we are running on full framework/CoreCLR, Comparer<T> additionally
+ // overrides the Equals(object) and GetHashCode() methods for itself,
+ // presumably to support serialization, so test that behavior as well.
+ // This is not done in .NET Native yet: dotnet/corert#1736
+ if (!RuntimeDetection.IsNetNative)
+ {
+ var cloned = ObjectCloner.MemberwiseClone(comparer);
+ Assert.Equal(cloned.GetHashCode(), cloned.GetHashCode());
+
+ // Since comparer and cloned should have the same type, they should have the same hash
+ Assert.Equal(comparer.GetHashCode(), cloned.GetHashCode());
+ }
+ }
+
+ [Fact]
+ public void IComparerCompareWithObjectsNotOfMatchingTypeShouldThrow()
+ {
+ // Comparer<T> implements IComparer for back-compat reasons.
+ // The explicit implementation of IComparer.Compare(object, object) should
+ // throw if both inputs are non-null and one of them is not of type T
+ IComparer comparer = Comparer<T>.Default;
+ Task<T> notOfTypeT = Task.FromResult(default(T));
+ if (default(T) != null) // if default(T) is null these asserts will fail as IComparer.Compare returns early if either side is null
+ {
+ Assert.Throws<ArgumentException>(() => comparer.Compare(notOfTypeT, default(T))); // lhs is the problem
+ Assert.Throws<ArgumentException>(() => comparer.Compare(default(T), notOfTypeT)); // rhs is the problem
+ }
+ if (!(notOfTypeT is T)) // catch cases where Task<T> actually is a T, like object or non-generic Task
+ {
+ Assert.Throws<ArgumentException>(() => comparer.Compare(notOfTypeT, notOfTypeT)); // The implementation should not attempt to short-circuit if both sides have reference equality
+ Assert.Throws<ArgumentException>(() => comparer.Compare(notOfTypeT, Task.FromResult(default(T)))); // And it should also work when they don't
+ }
+ }
+
+ [Fact]
+ public void ComparerCreate()
+ {
+ const int ExpectedValue = 0x77777777;
+
+ bool comparisonCalled = false;
+ Comparison<T> comparison = (left, right) =>
+ {
+ comparisonCalled = true;
+ return ExpectedValue;
+ };
+
+ var comparer = Comparer<T>.Create(comparison);
+ var comparer2 = Comparer<T>.Create(comparison);
+
+ Assert.NotNull(comparer);
+ Assert.NotNull(comparer2);
+ Assert.NotSame(comparer, comparer2);
+
+ // Test the functionality of the Comparer's Compare()
+ int result = comparer.Compare(default(T), default(T));
+ Assert.True(comparisonCalled);
+ Assert.Equal(ExpectedValue, result);
+
+ // Unlike the Default comparers, comparers created with Create
+ // should not override Equals() or GetHashCode()
+ Assert.False(comparer.Equals(comparer2));
+ Assert.False(comparer2.Equals(comparer));
+ // The default GetHashCode implementation is just a call to RuntimeHelpers.GetHashCode
+ Assert.Equal(RuntimeHelpers.GetHashCode(comparer), comparer.GetHashCode());
+ Assert.Equal(RuntimeHelpers.GetHashCode(comparer2), comparer2.GetHashCode());
+ }
+
+ [Fact]
+ public void ComparerCreateWithNullComparisonThrows()
+ {
+ Assert.Throws<ArgumentNullException>("comparison", () => Comparer<T>.Create(comparison: null));
+ }
+ }
+}
diff --git a/src/System.Collections/tests/Generic/Comparers/Comparer.Tests.cs b/src/System.Collections/tests/Generic/Comparers/Comparer.Tests.cs
new file mode 100644
index 0000000000..3db3288925
--- /dev/null
+++ b/src/System.Collections/tests/Generic/Comparers/Comparer.Tests.cs
@@ -0,0 +1,346 @@
+// 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.Collections;
+using System.Collections.Tests;
+using System.Diagnostics;
+using Xunit;
+
+namespace System.Collections.Generic.Tests
+{
+ public class ComparerTests
+ {
+ [Theory]
+ [MemberData(nameof(IComparableComparisonsData))]
+ [MemberData(nameof(ULongEnumComparisonsData))]
+ [MemberData(nameof(IntEnumComparisonsData))]
+ [MemberData(nameof(UIntEnumComparisonsData))]
+ [MemberData(nameof(LongEnumComparisonsData))]
+ [MemberData(nameof(PlainObjectComparisonsData))]
+ public void MostComparisons<T>(T left, T right, int expected)
+ {
+ var comparer = Comparer<T>.Default;
+ Assert.Equal(expected, Math.Sign(comparer.Compare(left, right)));
+
+ // Because of these asserts we don't need to explicitly add tests for
+ // 0 being an expected value, it is done automatically for every input
+ Assert.Equal(0, comparer.Compare(left, left));
+ Assert.Equal(0, comparer.Compare(right, right));
+
+ IComparer nonGenericComparer = comparer;
+ // If both sides are Ts then the explicit implementation of IComparer.Compare
+ // should also succeed, with the same results
+ Assert.Equal(expected, Math.Sign(nonGenericComparer.Compare(left, right)));
+ Assert.Equal(0, nonGenericComparer.Compare(left, left));
+ Assert.Equal(0, nonGenericComparer.Compare(right, right));
+
+ // All comparers returned by Comparer<T>.Default should be able
+ // to handle nulls before dispatching to IComparable<T>.CompareTo()
+ if (default(T) == null) // This will be true if T is a reference type or nullable
+ {
+ T nil = default(T);
+ Assert.Equal(0, comparer.Compare(nil, nil));
+
+ // null should be ordered before/equal to everything (never after)
+ // We assert that it's -1 or 0 in case left/right is null, as well
+ // We assert that it's -1 rather than any negative number since these
+ // values are hardcoded in the comparer logic, rather than being left
+ // to the object being compared
+ Assert.InRange(comparer.Compare(nil, left), -1, 0);
+ Assert.InRange(comparer.Compare(nil, right), -1, 0);
+
+ Assert.InRange(comparer.Compare(left, nil), 0, 1);
+ Assert.InRange(comparer.Compare(right, nil), 0, 1);
+
+ // Validate behavior for the IComparer.Compare implementation, as well
+ Assert.Equal(0, nonGenericComparer.Compare(nil, nil));
+
+ Assert.InRange(nonGenericComparer.Compare(nil, left), -1, 0);
+ Assert.InRange(nonGenericComparer.Compare(nil, right), -1, 0);
+
+ Assert.InRange(nonGenericComparer.Compare(left, nil), 0, 1);
+ Assert.InRange(nonGenericComparer.Compare(right, nil), 0, 1);
+ }
+ }
+
+ // NOTE: The test cases from the MemberData don't include 0 as the expected value,
+ // since for each case we automatically test that Compare(lhs, lhs) and Compare(rhs, rhs)
+ // are both 0.
+
+ public static IEnumerable<object[]> IComparableComparisonsData()
+ {
+ var testCases = new[]
+ {
+ Tuple.Create(new GenericComparable(3), new GenericComparable(4), -1),
+ Tuple.Create(new GenericComparable(5), new GenericComparable(2), 1),
+ // GenericComparable's CompareTo does not handle nulls intentionally, the Comparer should check both
+ // inputs for null before dispatching to CompareTo
+ Tuple.Create(new GenericComparable(int.MinValue), default(GenericComparable), 1)
+ };
+
+ foreach (var testCase in testCases)
+ {
+ yield return new object[] { testCase.Item1, testCase.Item2, testCase.Item3 };
+ yield return new object[] { testCase.Item2, testCase.Item1, -testCase.Item3 }; // Do the comparison in reverse as well
+ }
+ }
+
+ public static IEnumerable<object[]> ULongEnumComparisonsData()
+ {
+ var testCases = new[]
+ {
+ Tuple.Create(3UL, 5UL, -1),
+ // Catch any attempt to cast the enum value to a signed type,
+ // which may result in overflow and an incorrect comparison
+ Tuple.Create(ulong.MaxValue, (ulong)long.MaxValue, 1),
+ Tuple.Create(ulong.MaxValue - 3, ulong.MaxValue, -1)
+ };
+
+ foreach (var testCase in testCases)
+ {
+ yield return new object[] { (ULongEnum)testCase.Item1, (ULongEnum)testCase.Item2, testCase.Item3 };
+ yield return new object[] { (ULongEnum)testCase.Item2, (ULongEnum)testCase.Item1, -testCase.Item3 };
+ }
+ }
+
+ public static IEnumerable<object[]> IntEnumComparisonsData()
+ {
+ var testCases = new[]
+ {
+ Tuple.Create(-1, 4, -1),
+ Tuple.Create(-222, -375, 1),
+ // The same principle applies for overflow in signed types as above,
+ // the implementation should not cast to an unsigned type
+ Tuple.Create(int.MaxValue, int.MinValue, 1),
+ Tuple.Create(int.MinValue + 1, int.MinValue, 1)
+ };
+
+ foreach (var testCase in testCases)
+ {
+ yield return new object[] { (IntEnum)testCase.Item1, (IntEnum)testCase.Item2, testCase.Item3 };
+ yield return new object[] { (IntEnum)testCase.Item2, (IntEnum)testCase.Item1, -testCase.Item3 };
+ }
+ }
+
+ public static IEnumerable<object[]> UIntEnumComparisonsData()
+ {
+ var testCases = new[]
+ {
+ Tuple.Create(445u, 123u, 1),
+ Tuple.Create(uint.MaxValue, 111u, 1),
+ Tuple.Create(uint.MaxValue - 333, uint.MaxValue, -1)
+ };
+
+ foreach (var testCase in testCases)
+ {
+ yield return new object[] { (UIntEnum)testCase.Item1, (UIntEnum)testCase.Item2, testCase.Item3 };
+ yield return new object[] { (UIntEnum)testCase.Item2, (UIntEnum)testCase.Item1, -testCase.Item3 };
+ }
+ }
+
+ public static IEnumerable<object[]> LongEnumComparisonsData()
+ {
+ var testCases = new[]
+ {
+ Tuple.Create(182912398L, 33L, 1),
+ Tuple.Create(long.MinValue, long.MaxValue, -1),
+ Tuple.Create(long.MinValue + 9, long.MinValue, 1)
+ };
+
+ foreach (var testCase in testCases)
+ {
+ yield return new object[] { (LongEnum)testCase.Item1, (LongEnum)testCase.Item2, testCase.Item3 };
+ yield return new object[] { (LongEnum)testCase.Item2, (LongEnum)testCase.Item1, -testCase.Item3 };
+ }
+ }
+
+ public static IEnumerable<object[]> PlainObjectComparisonsData()
+ {
+ var obj = new object(); // this needs to be cached into a local so we can pass the same ref in twice
+
+ var testCases = new[]
+ {
+ Tuple.Create(obj, obj, 0), // even if it doesn't implement IComparable, if 2 refs are the same then the result should be 0
+ Tuple.Create(default(object), obj, -1) // even if it doesn't implement IComparable, if one side is null -1 or 1 should be returned
+ };
+
+ foreach (var testCase in testCases)
+ {
+ yield return new object[] { testCase.Item1, testCase.Item2, testCase.Item3 };
+ yield return new object[] { testCase.Item2, testCase.Item1, -testCase.Item3 };
+ }
+ }
+
+ [Fact]
+ public void IComparableComparisonsShouldTryToCallLeftHandCompareToFirst()
+ {
+ var left = new MutatingComparable(0);
+ var right = new MutatingComparable(0);
+
+ var comparer = Comparer<MutatingComparable>.Default;
+
+ // Every CompareTo() call yields the comparable's current
+ // state and then increments it
+ Assert.Equal(0, comparer.Compare(left, right));
+ Assert.Equal(1, comparer.Compare(left, right));
+ Assert.Equal(0, comparer.Compare(right, left));
+ }
+
+ [Fact]
+ public void NonGenericIComparableComparisonsShouldTryToCallLeftHandCompareToFirst()
+ {
+ var left = new MutatingComparable(0);
+ var right = new object();
+
+ var comparer = Comparer<object>.Default;
+
+ Assert.Equal(0, comparer.Compare(left, right));
+ Assert.Equal(1, comparer.Compare(left, right));
+ // If the lhs does not implement IComparable, the rhs should be checked
+ // Additionally the result from rhs.CompareTo should be negated
+ Assert.Equal(-2, comparer.Compare(right, left));
+ }
+
+ [Fact]
+ public void DifferentNonNullObjectsThatDoNotImplementIComparableShouldThrowWhenCompared()
+ {
+ var left = new object();
+ var right = new object();
+
+ var comparer = Comparer<object>.Default;
+ Assert.Throws<ArgumentException>(() => comparer.Compare(left, right));
+ }
+
+ [Fact]
+ public void ComparerDefaultShouldAttemptToUseTheGenericIComparableInterfaceFirst()
+ {
+ // IComparable<>.CompareTo returns 1 for this type,
+ // non-generic overload returns -1
+ var left = new BadlyBehavingComparable();
+ var right = new BadlyBehavingComparable();
+
+ var comparer = Comparer<BadlyBehavingComparable>.Default;
+ // The comparer should pick up on the generic implementation first
+ Assert.Equal(1, comparer.Compare(left, right));
+ Assert.Equal(1, comparer.Compare(right, left));
+ }
+
+ // The runtime treats nullables specially when they're boxed,
+ // for example `object o = new int?(3); o is int` is true.
+ // This messes with the xUnit type inference for generic theories,
+ // so we need to write another theory (accepting non-nullable parameters)
+ // just for nullables.
+
+ [Theory]
+ [MemberData(nameof(NullableOfIntComparisonsData))]
+ [MemberData(nameof(NullableOfIntEnumComparisonsData))]
+ public void NullableComparisons<T>(T leftValue, bool leftHasValue, T rightValue, bool rightHasValue, int expected) where T : struct
+ {
+ // Comparer<T> is specialized (for perf reasons) when T : U? where U : IComparable<U>
+ T? left = leftHasValue ? new T?(leftValue) : null;
+ T? right = rightHasValue ? new T?(rightValue) : null;
+
+ var comparer = Comparer<T?>.Default;
+ Assert.Equal(expected, Math.Sign(comparer.Compare(left, right)));
+ Assert.Equal(0, comparer.Compare(left, left));
+ Assert.Equal(0, comparer.Compare(right, right));
+
+ // Converting the comparer to a non-generic IComparer lets us
+ // test the explicit implementation of IComparer.Compare as well,
+ // which accepts 2 objects rather than nullables.
+ IComparer nonGenericComparer = comparer;
+
+ // The way this works is that, assuming two non-null nullables,
+ // T? will get boxed to a object with GetType() == typeof(T),
+ // (object is T?) will be true, and then it will get converted
+ // back to a T?.
+ // If one of the inputs is null, it will get boxed to a null object
+ // and then IComparer.Compare() should take care of it itself.
+ Assert.Equal(expected, Math.Sign(nonGenericComparer.Compare(left, right)));
+ Assert.Equal(0, nonGenericComparer.Compare(left, left));
+ Assert.Equal(0, nonGenericComparer.Compare(right, right));
+
+ // As above, the comparer should handle null inputs itself and only
+ // return -1, 0, or 1 in such circumstances
+ Assert.Equal(0, comparer.Compare(null, null)); // null and null should have the same sorting order
+ Assert.InRange(comparer.Compare(null, left), -1, 0); // "null" values should come before anything else
+ Assert.InRange(comparer.Compare(null, right), -1, 0);
+ Assert.InRange(comparer.Compare(left, null), 0, 1);
+ Assert.InRange(comparer.Compare(right, null), 0, 1);
+
+ Assert.Equal(0, nonGenericComparer.Compare(null, null));
+ Assert.InRange(nonGenericComparer.Compare(null, left), -1, 0);
+ Assert.InRange(nonGenericComparer.Compare(null, right), -1, 0);
+ Assert.InRange(nonGenericComparer.Compare(left, null), 0, 1);
+ Assert.InRange(nonGenericComparer.Compare(right, null), 0, 1);
+
+ // new T?() < new T?(default(T))
+ Assert.Equal(-1, comparer.Compare(null, default(T)));
+ Assert.Equal(1, comparer.Compare(default(T), null));
+ Assert.Equal(0, comparer.Compare(default(T), default(T)));
+
+ Assert.Equal(-1, nonGenericComparer.Compare(null, default(T)));
+ Assert.Equal(1, nonGenericComparer.Compare(default(T), null));
+ Assert.Equal(0, nonGenericComparer.Compare(default(T), default(T)));
+ }
+
+ public static IEnumerable<object[]> NullableOfIntComparisonsData()
+ {
+ var testCases = new[]
+ {
+ Tuple.Create(default(int), false, int.MinValue, true, -1), // "null" values should come before anything else
+ Tuple.Create(int.MaxValue, true, int.MinValue, true, 1) // Comparisons between two non-null nullables should work as normal
+ };
+
+ foreach (var testCase in testCases)
+ {
+ yield return new object[] { testCase.Item1, testCase.Item2, testCase.Item3, testCase.Item4, testCase.Item5 };
+ yield return new object[] { testCase.Item3, testCase.Item4, testCase.Item1, testCase.Item2, -testCase.Item5 };
+ }
+ }
+
+ public static IEnumerable<object[]> NullableOfIntEnumComparisonsData()
+ {
+ // Currently the default Comparer/EqualityComparer is optimized for when
+ // T : U? where U : IComparable<U> or T : enum, but not T : U? where
+ // U : enum (aka T is a nullable enum).
+ // So, let's cover that codepath in case that changes/regresses in the future.
+
+ var testCases = new[]
+ {
+ Tuple.Create(int.MinValue, true, default(int), false, 1), // "null" values should come first
+ Tuple.Create(-1, true, 4, true, -1)
+ };
+
+ foreach (var testCase in testCases)
+ {
+ yield return new object[] { testCase.Item1, testCase.Item2, testCase.Item3, testCase.Item4, testCase.Item5 };
+ yield return new object[] { testCase.Item3, testCase.Item4, testCase.Item1, testCase.Item2, -testCase.Item5 };
+ }
+ }
+
+ [Fact]
+ public void NullableOfIComparableComparisonsShouldTryToCallLeftHandCompareToFirst()
+ {
+ // If two non-null nullables are passed in, Default<T?>.Compare
+ // should try to call the left-hand side's CompareTo() first
+
+ // Would have liked to reuse MutatingComparable here, but it is
+ // a class and can't be nullable, so it's necessary to wrap it
+ // in a struct
+
+ var leftValue = new MutatingComparable(0);
+ var rightValue = new MutatingComparable(0);
+
+ var left = new ValueComparable<MutatingComparable>?(ValueComparable.Create(leftValue));
+ var right = new ValueComparable<MutatingComparable>?(ValueComparable.Create(rightValue));
+
+ var comparer = Comparer<ValueComparable<MutatingComparable>?>.Default;
+ Assert.Equal(0, comparer.Compare(left, right));
+ Assert.Equal(1, comparer.Compare(left, right));
+ Assert.Equal(0, comparer.Compare(right, left));
+ }
+ }
+}
diff --git a/src/System.Collections/tests/Generic/Comparers/Comparers.Generic.cs b/src/System.Collections/tests/Generic/Comparers/Comparers.Generic.cs
new file mode 100644
index 0000000000..70641a776b
--- /dev/null
+++ b/src/System.Collections/tests/Generic/Comparers/Comparers.Generic.cs
@@ -0,0 +1,64 @@
+// 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.Collections;
+using System.Collections.Tests;
+
+namespace System.Collections.Generic.Tests
+{
+ // On .NET Native EqualityComparer is specialized for all of the primitive
+ // types and a few more
+ // Cover all of those cases
+ public class SByteComparerTests : ComparersGenericTests<sbyte> { }
+ public class ByteComparerTests : ComparersGenericTests<byte> { }
+ public class ShortComparerTests : ComparersGenericTests<short> { }
+ public class UShortComparerTests : ComparersGenericTests<ushort> { }
+ public class IntComparerTests : ComparersGenericTests<int> { }
+ public class UIntComparerTests : ComparersGenericTests<uint> { }
+ public class LongComparerTests : ComparersGenericTests<long> { }
+ public class ULongComparerTests : ComparersGenericTests<ulong> { }
+ public class IntPtrComparerTests : ComparersGenericTests<IntPtr> { }
+ public class UIntPtrComparerTests : ComparersGenericTests<UIntPtr> { }
+ public class FloatComparerTests : ComparersGenericTests<float> { }
+ public class DoubleComparerTests : ComparersGenericTests<double> { }
+ public class DecimalComparerTests : ComparersGenericTests<decimal> { }
+ public class StringComparerTests : ComparersGenericTests<string> { }
+
+ // Nullables are handled specially
+ public class NullableIntComparerTests : ComparersGenericTests<int?> { }
+ public class NullableUIntComparerTests : ComparersGenericTests<uint?> { }
+
+ // Currently the Default properties are special-cased for enums depending
+ // on their underlying type (byte, short, ulong, etc.)
+ // We should cover all of those.
+ public class SByteEnumComparerTests : ComparersGenericTests<SByteEnum> { }
+ public class ByteEnumComparerTests : ComparersGenericTests<ByteEnum> { }
+ public class ShortEnumComparerTests : ComparersGenericTests<ShortEnum> { }
+ public class UShortEnumComparerTests : ComparersGenericTests<UShortEnum> { }
+ public class IntEnumComparerTests : ComparersGenericTests<IntEnum> { }
+ public class UIntEnumComparerTests : ComparersGenericTests<UIntEnum> { }
+ public class LongEnumComparerTests : ComparersGenericTests<LongEnum> { }
+ public class ULongEnumComparerTests : ComparersGenericTests<ULongEnum> { }
+
+ // Default properties currently will be special-cased for T : enum and
+ // T : U? where U : {IComparable,IEquatable}<U>, but not if T : U? where U : enum
+ // So let's cover those cases as well
+ public class NullableSByteEnumComparerTests : ComparersGenericTests<SByteEnum?> { }
+ public class NullableByteEnumComparerTests : ComparersGenericTests<ByteEnum?> { }
+ public class NullableShortEnumComparerTests : ComparersGenericTests<ShortEnum?> { }
+ public class NullableUShortEnumComparerTests : ComparersGenericTests<UShortEnum?> { }
+ public class NullableIntEnumComparerTests : ComparersGenericTests<IntEnum?> { }
+ public class NullableUIntEnumComparerTests : ComparersGenericTests<UIntEnum?> { }
+ public class NullableLongEnumComparerTests : ComparersGenericTests<LongEnum?> { }
+ public class NullableULongEnumComparerTests : ComparersGenericTests<ULongEnum?> { }
+
+ // Comparer<T>.Default should still work OK with non-IComparables
+ public class ObjectComparerTests : ComparersGenericTests<object> { }
+
+ // Other cases: IComparable<T>, IComparable, and both
+ public class GenericComparableComparerTests : ComparersGenericTests<GenericComparable> { }
+ public class NonGenericComparableComparerTests : ComparersGenericTests<NonGenericComparable> { }
+ public class BadlyBehavingComparableComparerTests : ComparersGenericTests<BadlyBehavingComparable> { }
+}
diff --git a/src/System.Collections/tests/System.Collections.Tests.csproj b/src/System.Collections/tests/System.Collections.Tests.csproj
index 2e1bc3ea35..1a1269c989 100644
--- a/src/System.Collections/tests/System.Collections.Tests.csproj
+++ b/src/System.Collections/tests/System.Collections.Tests.csproj
@@ -84,11 +84,20 @@
<Compile Include="$(CommonTestPath)\System\Collections\TestingTypes.cs" >
<Link>Common\System\Collections\TestingTypes.cs</Link>
</Compile>
+ <Compile Include="$(CommonTestPath)\System\ObjectCloner.cs" >
+ <Link>Common\System\ObjectCloner.cs</Link>
+ </Compile>
+ <Compile Include="$(CommonTestPath)\System\RuntimeDetection.cs" >
+ <Link>Common\System\RuntimeDetection.cs</Link>
+ </Compile>
<!-- Generic tests -->
<Compile Include="StructuralComparisonsTests.cs" />
<Compile Include="BitArray\BitArray_CtorTests.cs" />
<Compile Include="BitArray\BitArray_GetSetTests.cs" />
<Compile Include="BitArray\BitArray_OperatorsTests.cs" />
+ <Compile Include="Generic\Comparers\Comparer.Generic.Tests.cs" />
+ <Compile Include="Generic\Comparers\Comparer.Tests.cs" />
+ <Compile Include="Generic\Comparers\Comparers.Generic.cs" />
<Compile Include="Generic\Dictionary\Dictionary.Tests.cs" />
<Compile Include="Generic\Dictionary\HashCollisionScenarios\InputData.cs" />
<Compile Include="Generic\Dictionary\HashCollisionScenarios\OutOfBoundsRegression.cs" />
diff --git a/src/System.ComponentModel.Annotations/dir.props b/src/System.ComponentModel.Annotations/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.ComponentModel.Annotations/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.ComponentModel.Annotations/ref/4.0.0/System.ComponentModel.Annotations.depproj b/src/System.ComponentModel.Annotations/ref/4.0.0/System.ComponentModel.Annotations.depproj
index 29f2b6abda..5df1469c14 100644
--- a/src/System.ComponentModel.Annotations/ref/4.0.0/System.ComponentModel.Annotations.depproj
+++ b/src/System.ComponentModel.Annotations/ref/4.0.0/System.ComponentModel.Annotations.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.ComponentModel.Annotations/ref/4.0.10/System.ComponentModel.Annotations.depproj b/src/System.ComponentModel.Annotations/ref/4.0.10/System.ComponentModel.Annotations.depproj
index 61ed42e3a5..e67a3176b2 100644
--- a/src/System.ComponentModel.Annotations/ref/4.0.10/System.ComponentModel.Annotations.depproj
+++ b/src/System.ComponentModel.Annotations/ref/4.0.10/System.ComponentModel.Annotations.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.ComponentModel.Annotations/ref/System.ComponentModel.Annotations.csproj b/src/System.ComponentModel.Annotations/ref/System.ComponentModel.Annotations.csproj
index c7859b7c88..a970801d1e 100644
--- a/src/System.ComponentModel.Annotations/ref/System.ComponentModel.Annotations.csproj
+++ b/src/System.ComponentModel.Annotations/ref/System.ComponentModel.Annotations.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.4</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.4</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.ComponentModel.Annotations/src/System.ComponentModel.Annotations.csproj b/src/System.ComponentModel.Annotations/src/System.ComponentModel.Annotations.csproj
index 82a11660fa..e04451acc2 100644
--- a/src/System.ComponentModel.Annotations/src/System.ComponentModel.Annotations.csproj
+++ b/src/System.ComponentModel.Annotations/src/System.ComponentModel.Annotations.csproj
@@ -5,8 +5,6 @@
<ProjectGuid>{4266D58F-EB60-46C2-BA81-3ABDE759A7D5}</ProjectGuid>
<RootNamespace>System.ComponentModel.Annotations</RootNamespace>
<AssemblyName>System.ComponentModel.Annotations</AssemblyName>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)'==''">netstandard1.4</PackageTargetFramework>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net461'">true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.4</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EmailAddressAttribute.cs b/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EmailAddressAttribute.cs
index e458f8bf81..644ac842e2 100644
--- a/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EmailAddressAttribute.cs
+++ b/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EmailAddressAttribute.cs
@@ -29,7 +29,7 @@ namespace System.ComponentModel.DataAnnotations
return false;
}
- // only return true is there is only 1 '@' character
+ // only return true if there is only 1 '@' character
// and it is neither the first nor the last character
bool found = false;
for (int i = 0; i < valueAsString.Length; i++)
diff --git a/src/System.ComponentModel.Annotations/tests/AssociationAttributeTests.cs b/src/System.ComponentModel.Annotations/tests/AssociationAttributeTests.cs
index 0152908b88..75797d41ab 100644
--- a/src/System.ComponentModel.Annotations/tests/AssociationAttributeTests.cs
+++ b/src/System.ComponentModel.Annotations/tests/AssociationAttributeTests.cs
@@ -2,8 +2,6 @@
// 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.Collections.Generic;
-using System.Linq;
using Xunit;
namespace System.ComponentModel.DataAnnotations
@@ -11,46 +9,47 @@ namespace System.ComponentModel.DataAnnotations
public class AssociationAttributeTests
{
#pragma warning disable 618
- [Fact]
- public static void Can_construct_attribute_and_get_values()
+ [Theory]
+ [InlineData("TestName", "TestThisKey", "TestOtherKey", new string[] { "TestThisKey" }, new string[] { "TestOtherKey" })]
+ [InlineData(null, "", " \t \r \n", new string[] { "" }, new string[] { "\t\r\n" })]
+ [InlineData(null, null, null, new string[0], new string[0])]
+ [InlineData("Name", "ThisKey1, ThisKey2, ThisKey3", "OtherKey1, OtherKey2",new string[] { "ThisKey1", "ThisKey2", "ThisKey3" }, new string[] { "OtherKey1", "OtherKey2" })]
+ public static void Constructor(string name, string thisKey, string otherKey, string[] thisKeyMembers, string[] otherKeyMembers)
{
- var attribute =
- new AssociationAttribute("TestName", "TestThisKey", "TestOtherKey");
- Assert.Equal("TestName", attribute.Name);
- Assert.Equal("TestThisKey", attribute.ThisKey);
- Assert.Equal("TestOtherKey", attribute.OtherKey);
- }
+ var attribute = new AssociationAttribute(name, thisKey, otherKey);
+ Assert.Equal(name, attribute.Name);
+ Assert.Equal(thisKey, attribute.ThisKey);
+ Assert.Equal(otherKey, attribute.OtherKey);
- [Fact]
- public static void Can_construct_attribute_and_get_whitespace_values()
- {
- var attribute =
- new AssociationAttribute(null, string.Empty, " \t\r\n");
- Assert.Equal(null, attribute.Name);
- Assert.Equal(string.Empty, attribute.ThisKey);
- Assert.Equal(" \t\r\n", attribute.OtherKey);
+ if (thisKey == null)
+ {
+ Assert.Throws<NullReferenceException>(() => attribute.ThisKeyMembers);
+ }
+ else
+ {
+ Assert.Equal(thisKeyMembers, attribute.ThisKeyMembers);
+ }
+ if (otherKey == null)
+ {
+ Assert.Throws<NullReferenceException>(() => attribute.OtherKeyMembers);
+ }
+ else
+ {
+ Assert.Equal(otherKeyMembers, attribute.OtherKeyMembers);
+ }
}
[Fact]
- public static void Can_get_and_set_IsForeignKey()
+ public static void IsForeignKey_GetSet_ReturnsExpected()
{
var attribute = new AssociationAttribute("Name", "ThisKey", "OtherKey");
- Assert.Equal(false, attribute.IsForeignKey);
+ Assert.False(attribute.IsForeignKey);
+
attribute.IsForeignKey = true;
- Assert.Equal(true, attribute.IsForeignKey);
- attribute.IsForeignKey = false;
- Assert.Equal(false, attribute.IsForeignKey);
- }
+ Assert.True(attribute.IsForeignKey);
- [Fact]
- public static void Can_get_ThisKeyMembers_and_OtherKeyMembers()
- {
- var listOfThisKeys = new List<string>() { "ThisKey1", "ThisKey2", "ThisKey3" };
- var listOfOtherKeys = new List<string>() { "OtherKey1", "OtherKey2" };
- // doesn't matter how many spaces are between keys, but they must be separated by a comma
- var attribute = new AssociationAttribute("Name", "ThisKey1, ThisKey2, ThisKey3", "OtherKey1, OtherKey2");
- Assert.True(listOfThisKeys.SequenceEqual(attribute.ThisKeyMembers));
- Assert.True(listOfOtherKeys.SequenceEqual(attribute.OtherKeyMembers));
+ attribute.IsForeignKey = false;
+ Assert.False(attribute.IsForeignKey);
}
#pragma warning restore 618
}
diff --git a/src/System.ComponentModel.Annotations/tests/CompareAttributeTests.cs b/src/System.ComponentModel.Annotations/tests/CompareAttributeTests.cs
index bf4708c47d..8876a09f6e 100644
--- a/src/System.ComponentModel.Annotations/tests/CompareAttributeTests.cs
+++ b/src/System.ComponentModel.Annotations/tests/CompareAttributeTests.cs
@@ -2,6 +2,8 @@
// 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.Collections.Generic;
+using System.Reflection;
using Xunit;
namespace System.ComponentModel.DataAnnotations
@@ -9,107 +11,115 @@ namespace System.ComponentModel.DataAnnotations
public class CompareAttributeTests
{
[Fact]
- public static void Constructor_Null_OtherProperty()
+ public static void Constructor_NullOtherProperty_ThrowsArgumentNullException()
{
- Assert.Throws<ArgumentNullException>(() => new CompareAttribute(otherProperty: null));
+ Assert.Throws<ArgumentNullException>("otherProperty", () => new CompareAttribute(null));
}
- [Fact]
- public static void Constructor_NonNull_OtherProperty()
+ [Theory]
+ [InlineData("OtherProperty")]
+ [InlineData("")]
+ public static void Constructor(string otherProperty)
{
- AssertEx.DoesNotThrow(() => new CompareAttribute("OtherProperty"));
+ CompareAttribute attribute = new CompareAttribute(otherProperty);
+ Assert.Equal(otherProperty, attribute.OtherProperty);
+
+ Assert.True(attribute.RequiresValidationContext);
}
[Fact]
- public static void Validate_does_not_throw_when_compared_objects_are_equal()
+ public static void Validate_EqualObjects_DoesNotThrow()
{
var otherObject = new CompareObject("test");
var currentObject = new CompareObject("test");
var testContext = new ValidationContext(otherObject, null, null);
var attribute = new CompareAttribute("CompareProperty");
- AssertEx.DoesNotThrow(() => attribute.Validate(currentObject.CompareProperty, testContext));
+ attribute.Validate(currentObject.CompareProperty, testContext);
}
-
- [Fact]
- public static void Validate_throws_when_compared_objects_are_not_equal()
+
+ public static IEnumerable<object[]> Invalid_TestData()
{
- var currentObject = new CompareObject("a");
- var otherObject = new CompareObject("b");
+ ValidationContext context = new ValidationContext(new CompareObject("a")) { DisplayName = "CurrentProperty" };
- var testContext = new ValidationContext(otherObject, null, null);
- testContext.DisplayName = "CurrentProperty";
+ yield return new object[] { nameof(CompareObject.CompareProperty), context, nameof(CompareObject.CompareProperty), typeof(ValidationException) };
+ yield return new object[] { nameof(CompareObject.ComparePropertyWithDisplayName), context, "CustomDisplayName", typeof(ValidationException) };
+ yield return new object[] { "UnknownPropertyName", context, null, typeof(ValidationException) };
- var attribute = new CompareAttribute("CompareProperty");
- Assert.Throws<ValidationException>(
- () => attribute.Validate(currentObject.CompareProperty, testContext));
+ ValidationContext subClassContext = new ValidationContext(new CompareObjectSubClass("a"));
+ yield return new object[] { nameof(CompareObject.CompareProperty), subClassContext, "CompareProperty", typeof(ValidationException) };
+
+ yield return new object[] { "Item", context, null, typeof(TargetParameterCountException) };
+ yield return new object[] { nameof(CompareObject.SetOnlyProperty), context, null, typeof(ArgumentException) };
}
- [Fact]
- public static void Validate_throws_with_OtherProperty_DisplayName()
+ [Theory]
+ [MemberData(nameof(Invalid_TestData))]
+ public static void Validate_Invalid_Throws(string otherProperty, ValidationContext context, string otherPropertyDisplayName, Type exceptionType)
{
- var currentObject = new CompareObject("a");
- var otherObject = new CompareObject("b");
-
- var testContext = new ValidationContext(otherObject, null, null);
- testContext.DisplayName = "CurrentProperty";
-
- var attribute = new CompareAttribute("ComparePropertyWithDisplayName");
- Assert.Throws<ValidationException>(
- () => attribute.Validate(currentObject.CompareProperty, testContext));
+ var attribute = new CompareAttribute(otherProperty);
+
+ Assert.Throws(exceptionType, () => attribute.Validate("b", context));
+ Assert.Equal(otherPropertyDisplayName, attribute.OtherPropertyDisplayName);
+
+ // Make sure that we can run Validate twice
+ Assert.Throws(exceptionType, () => attribute.Validate("b", context));
+ Assert.Equal(otherPropertyDisplayName, attribute.OtherPropertyDisplayName);
}
[Fact]
- public static void Validate_throws_when_PropertyName_is_unknown()
+ public static void Validate_PropertyHasDisplayName_UpdatesFormatErrorMessageToContainDisplayName()
{
- var currentObject = new CompareObject("a");
- var otherObject = new CompareObject("b");
+ CompareAttribute attribute = new CompareAttribute(nameof(CompareObject.ComparePropertyWithDisplayName));
- var testContext = new ValidationContext(otherObject, null, null);
- testContext.DisplayName = "CurrentProperty";
+ string oldErrorMessage = attribute.FormatErrorMessage("name");
+ Assert.False(oldErrorMessage.Contains("CustomDisplayName"));
+
+ Assert.Throws<ValidationException>(() => attribute.Validate("test1", new ValidationContext(new CompareObject("test"))));
- var attribute = new CompareAttribute("UnknownPropertyName");
- Assert.Throws<ValidationException>(
- () => attribute.Validate(currentObject.CompareProperty, testContext));
- // cannot check error message - not defined on ret builds
+ string newErrorMessage = attribute.FormatErrorMessage("name");
+ Assert.NotEqual(oldErrorMessage, newErrorMessage);
+ Assert.True(newErrorMessage.Contains("CustomDisplayName"));
}
[Fact]
- public static void CompareAttribute_can_be_derived_from_and_override_is_valid()
+ public static void Validate_CustomDerivedClass_DoesNotThrow()
{
var otherObject = new CompareObject("a");
var currentObject = new CompareObject("b");
var testContext = new ValidationContext(otherObject, null, null);
var attribute = new DerivedCompareAttribute("CompareProperty");
- AssertEx.DoesNotThrow(() => attribute.Validate(currentObject.CompareProperty, testContext));
+ attribute.Validate(currentObject.CompareProperty, testContext);
}
-
+
private class DerivedCompareAttribute : CompareAttribute
{
- public DerivedCompareAttribute(string otherProperty)
- : base(otherProperty)
- {
- }
+ public DerivedCompareAttribute(string otherProperty) : base(otherProperty) { }
- protected override ValidationResult IsValid(object value, ValidationContext context)
- {
- return ValidationResult.Success;
- }
+ protected override ValidationResult IsValid(object value, ValidationContext context) => ValidationResult.Success;
}
private class CompareObject
{
public string CompareProperty { get; set; }
- [Display(Name = "DisplayName")]
+ [Display(Name = "CustomDisplayName")]
public string ComparePropertyWithDisplayName { get; set; }
+ public string this[int index] { get { return "abc"; } set { } }
+ public string SetOnlyProperty { set { } }
+
public CompareObject(string otherValue)
{
CompareProperty = otherValue;
ComparePropertyWithDisplayName = otherValue;
}
}
+
+ private class CompareObjectSubClass : CompareObject
+ {
+ public CompareObjectSubClass(string otherValue) : base(otherValue) { }
+ }
}
}
diff --git a/src/System.ComponentModel.Annotations/tests/CreditCardAttributeTests.cs b/src/System.ComponentModel.Annotations/tests/CreditCardAttributeTests.cs
index 41bded21ff..75ab29eaf5 100644
--- a/src/System.ComponentModel.Annotations/tests/CreditCardAttributeTests.cs
+++ b/src/System.ComponentModel.Annotations/tests/CreditCardAttributeTests.cs
@@ -11,115 +11,108 @@ namespace System.ComponentModel.DataAnnotations
private static readonly ValidationContext s_testValidationContext = new ValidationContext(new object());
[Fact]
- public static void CreditCardAttribute_creation_DataType_and_CustomDataType()
+ public static void DataType_CustomDataType()
{
var attribute = new CreditCardAttribute();
Assert.Equal(DataType.CreditCard, attribute.DataType);
Assert.Null(attribute.CustomDataType);
}
- [Fact]
- public static void Validate_successful_for_valid_values()
+ [Theory]
+ [InlineData(null)]
+ [InlineData("0000000000000000")]
+ [InlineData("1234567890123452")]
+ [InlineData(" 1 2 3 4 5 6 7 8 9 0 1 2 34 5 2 ")]
+ [InlineData("--1-2-3-4-5-6-7-8-9-0--1-2-34-5-2----")]
+ [InlineData(" - 1- - 2 3 --4 5 6 7 -8- -9- -0 - -1 -2 -3-4- --5-- 2 ")]
+ [InlineData("1234-5678-9012-3452")]
+ [InlineData("1234 5678 9012 3452")]
+ public static void Validate_ValidValue_DoesNotThrow(string value)
{
var attribute = new CreditCardAttribute();
-
- AssertEx.DoesNotThrow(() => attribute.Validate(null, s_testValidationContext)); // Null is valid
- AssertEx.DoesNotThrow(() => attribute.Validate("0000000000000000", s_testValidationContext)); // Simplest valid value
- AssertEx.DoesNotThrow(() => attribute.Validate("1234567890123452", s_testValidationContext)); // Good checksum
- AssertEx.DoesNotThrow(() => attribute.Validate("1234-5678-9012-3452", s_testValidationContext)); // Good checksum, with dashes
- AssertEx.DoesNotThrow(() => attribute.Validate("1234 5678 9012 3452", s_testValidationContext)); // Good checksum, with spaces
+ attribute.Validate(value, s_testValidationContext);
}
- [Fact]
- public static void Validate_throws_for_invalid_values()
+ [Theory]
+ [InlineData("0000000000000001")]
+ [InlineData(0)]
+ [InlineData("000%000000000001")]
+ [InlineData("1234567890123452a")]
+ [InlineData("1234567890123452\0")]
+ public static void Validate_InvalidValue_ThrowsValidationException(object value)
{
var attribute = new CreditCardAttribute();
-
- Assert.Throws<ValidationException>(() => attribute.Validate("0000000000000001", s_testValidationContext)); // Bad checksum
- Assert.Throws<ValidationException>(() => attribute.Validate(0, s_testValidationContext)); // Non-string
- Assert.Throws<ValidationException>(() => attribute.Validate("000%000000000001", s_testValidationContext)); // Non-digit
+ Assert.Throws<ValidationException>(() => attribute.Validate(value, s_testValidationContext));
}
[Fact]
- public static void Validate_throws_InvalidOperationException_if_ErrorMessage_is_null()
+ public static void Validate_ErrorMessageNotSet_ThrowsInvalidOperationException()
{
- var attribute = new CreditCardAttribute();
- attribute.ErrorMessage = null; // note: this overrides the default value
+ var attribute = new CreditCardAttribute() { ErrorMessage = null };
Assert.Throws<InvalidOperationException>(() => attribute.Validate("0000000000000001", s_testValidationContext));
}
[Fact]
- public static void Validate_throws_InvalidOperationException_if_ErrorMessage_and_ErrorMessageResourceName_are_set()
+ public static void Validate_ErrorMessageSet_ErrorMessageResourceNameSet_ThrowsInvalidOperationException()
{
- var attribute = new CreditCardAttribute();
- attribute.ErrorMessage = "SomeErrorMessage";
- attribute.ErrorMessageResourceName = "SomeErrorMessageResourceName";
+ var attribute = new CreditCardAttribute() { ErrorMessage = "Some", ErrorMessageResourceName = "Some" };
Assert.Throws<InvalidOperationException>(() => attribute.Validate("0000000000000001", s_testValidationContext));
}
[Fact]
- public static void Validate_throws_InvalidOperationException_if_ErrorMessageResourceName_set_but_ErrorMessageResourceType_not_set()
+ public static void Validate_ErrorMessageResourceNameSet_ErrorMessageResourceTypeNotSet_ThrowsInvalidOperationException()
{
- var attribute = new CreditCardAttribute();
- attribute.ErrorMessageResourceName = "SomeErrorMessageResourceName";
- attribute.ErrorMessageResourceType = null;
+ var attribute = new CreditCardAttribute() { ErrorMessageResourceName = "Some", ErrorMessageResourceType = null };
Assert.Throws<InvalidOperationException>(() => attribute.Validate("0000000000000001", s_testValidationContext));
}
[Fact]
- public static void Validate_throws_InvalidOperationException_if_ErrorMessageResourceType_set_but_ErrorMessageResourceName_not_set()
+ public static void Validate_ErrorMessageResourceNameNotSet_ErrorMessageResourceTypeSet_ThrowsInvalidOperationException()
{
- var attribute = new CreditCardAttribute();
- attribute.ErrorMessageResourceName = null;
- attribute.ErrorMessageResourceType = typeof(ErrorMessageResources);
+ var attribute = new CreditCardAttribute() { ErrorMessageResourceName = null, ErrorMessageResourceType = typeof(ErrorMessageResources) };
Assert.Throws<InvalidOperationException>(() => attribute.Validate("0000000000000001", s_testValidationContext));
}
[Fact]
- public static void GetValidationResult_returns_ErrorMessage_if_ErrorMessage_overrides_default()
+ public static void GetValidationResult_ErrorMessageSet_ReturnsOverridenValue()
{
var attribute = new CreditCardAttribute();
attribute.ErrorMessage = "SomeErrorMessage";
var toBeTested = new CreditCardClassToBeTested();
var validationContext = new ValidationContext(toBeTested);
- validationContext.MemberName = "CreditCardPropertyToBeTested";
+ validationContext.MemberName = nameof(CreditCardClassToBeTested.CreditCardPropertyToBeTested);
+
var validationResult = attribute.GetValidationResult(toBeTested, validationContext);
Assert.Equal("SomeErrorMessage", validationResult.ErrorMessage);
}
-
[Fact]
- public static void GetValidationResult_returns_DefaultErrorMessage_if_ErrorMessage_is_not_set()
+ public static void GetValidationResult_ErrorMessageNotSet_ReturnsDefaultValue()
{
var attribute = new CreditCardAttribute();
var toBeTested = new CreditCardClassToBeTested();
var validationContext = new ValidationContext(toBeTested);
- validationContext.MemberName = "CreditCardPropertyToBeTested";
- AssertEx.DoesNotThrow(() => attribute.GetValidationResult(toBeTested, validationContext));
+ validationContext.MemberName = nameof(CreditCardClassToBeTested.CreditCardPropertyToBeTested);
+ attribute.GetValidationResult(toBeTested, validationContext);
}
[Fact]
- public static void GetValidationResult_returns_ErrorMessage_from_resource_if_ErrorMessageResourceName_and_ErrorMessageResourceType_both_set()
+ public static void GetValidationResult_ErrorMessageSetFromResource_ReturnsExpectedValue()
{
var attribute = new CreditCardAttribute();
attribute.ErrorMessageResourceName = "InternalErrorMessageTestProperty";
attribute.ErrorMessageResourceType = typeof(ErrorMessageResources);
var toBeTested = new CreditCardClassToBeTested();
var validationContext = new ValidationContext(toBeTested);
- validationContext.MemberName = "CreditCardPropertyToBeTested";
+ validationContext.MemberName = nameof(CreditCardClassToBeTested.CreditCardPropertyToBeTested);
+
var validationResult = attribute.GetValidationResult(toBeTested, validationContext);
- Assert.Equal(
- "Error Message from ErrorMessageResources.InternalErrorMessageTestProperty",
- validationResult.ErrorMessage);
+ Assert.Equal("Error Message from ErrorMessageResources.InternalErrorMessageTestProperty", validationResult.ErrorMessage);
}
}
-
public class CreditCardClassToBeTested
{
- public string CreditCardPropertyToBeTested
- {
- get { return "0000000000000001"; }
- }
+ public string CreditCardPropertyToBeTested => "0000000000000001";
}
}
diff --git a/src/System.ComponentModel.Annotations/tests/CustomValidationAttributeTests.cs b/src/System.ComponentModel.Annotations/tests/CustomValidationAttributeTests.cs
index 953c2958ae..93ab6e9c57 100644
--- a/src/System.ComponentModel.Annotations/tests/CustomValidationAttributeTests.cs
+++ b/src/System.ComponentModel.Annotations/tests/CustomValidationAttributeTests.cs
@@ -2,6 +2,7 @@
// 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.Collections.Generic;
using Xunit;
namespace System.ComponentModel.DataAnnotations
@@ -10,253 +11,163 @@ namespace System.ComponentModel.DataAnnotations
{
private static readonly ValidationContext s_testValidationContext = new ValidationContext(new object());
- [Fact]
- public static void Can_construct_attribute_and_get_values()
+ [Theory]
+ [InlineData(typeof(CustomValidator), "SomeMethod")]
+ [InlineData(null, null)]
+ [InlineData(typeof(string), "")]
+ [InlineData(typeof(int), " \t\r\n")]
+ public static void Constructor(Type validatorType, string method)
{
- var attribute = new CustomValidationAttribute(typeof(CustomValidator), "SomeMethod");
- Assert.Equal(typeof(CustomValidator), attribute.ValidatorType);
- Assert.Equal("SomeMethod", attribute.Method);
+ CustomValidationAttribute attribute = new CustomValidationAttribute(validatorType, method);
+ Assert.Equal(validatorType, attribute.ValidatorType);
+ Assert.Equal(method, attribute.Method);
}
- [Fact]
- public static void Can_construct_attribute_and_get_invalid_values()
+ [Theory]
+ [InlineData(typeof(CustomValidator), nameof(CustomValidator.CorrectValidationMethodOneArg), false)]
+ [InlineData(typeof(CustomValidator), nameof(CustomValidator.CorrectValidationMethodOneArgStronglyTyped), false)]
+ [InlineData(typeof(CustomValidator), nameof(CustomValidator.CorrectValidationMethodTwoArgs), true)]
+ [InlineData(typeof(CustomValidator), nameof(CustomValidator.CorrectValidationMethodTwoArgsStronglyTyped), true)]
+ public static void RequiresValidationContext_Get_ReturnsExpected(Type validatorType, string method, bool expected)
{
- var attribute = new CustomValidationAttribute(null, null);
- Assert.Equal(null, attribute.ValidatorType);
- Assert.Equal(null, attribute.Method);
-
- attribute = new CustomValidationAttribute(typeof(string), string.Empty);
- Assert.Equal(typeof(string), attribute.ValidatorType);
- Assert.Equal(string.Empty, attribute.Method);
-
- attribute = new CustomValidationAttribute(typeof(int), " \t\r\n");
- Assert.Equal(typeof(int), attribute.ValidatorType);
- Assert.Equal(" \t\r\n", attribute.Method);
+ CustomValidationAttribute attribute = new CustomValidationAttribute(validatorType, method);
+ Assert.Equal(expected, attribute.RequiresValidationContext);
}
- [Fact]
- public static void RequiresValidationContext_return_false_for_valid_validation_type_and_one_arg_method() {
- var attribute = new CustomValidationAttribute(typeof(CustomValidator), "CorrectValidationMethodOneArg");
- Assert.False(attribute.RequiresValidationContext);
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "CorrectValidationMethodOneArgStronglyTyped");
- Assert.False(attribute.RequiresValidationContext);
- }
-
- [Fact]
- public static void RequiresValidationContext_return_true_for_valid_validation_type_and_two_arg_method() {
- var attribute = new CustomValidationAttribute(typeof(CustomValidator), "CorrectValidationMethodTwoArgs");
- Assert.True(attribute.RequiresValidationContext);
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "CorrectValidationMethodTwoArgsStronglyTyped");
- Assert.True(attribute.RequiresValidationContext);
+ public static IEnumerable<object[]> BadlyFormed_TestData()
+ {
+ yield return new object[] { null, "Does not matter" };
+ yield return new object[] { typeof(NonPublicCustomValidator), "Does not matter" };
+ yield return new object[] { typeof(CustomValidator), null };
+ yield return new object[] { typeof(CustomValidator), "" };
+ yield return new object[] { typeof(CustomValidator), "NonExistentMethod" };
+ yield return new object[] { typeof(CustomValidator), nameof(CustomValidator.NonPublicValidationMethod) };
+ yield return new object[] { typeof(CustomValidator), nameof(CustomValidator.NonStaticValidationMethod) };
+ yield return new object[] { typeof(CustomValidator), nameof(CustomValidator.ValidationMethodDoesNotReturnValidationResult) };
+ yield return new object[] { typeof(CustomValidator), nameof(CustomValidator.ValidationMethodWithNoArgs) };
+ yield return new object[] { typeof(CustomValidator), nameof(CustomValidator.ValidationMethodWithByRefArg) };
+ yield return new object[] { typeof(CustomValidator), nameof(CustomValidator.ValidationMethodTwoArgsButSecondIsNotValidationContext) };
}
- [Fact]
- public static void RequiresValidationContext_throws_InvalidOperationException_if_attribute_not_well_formed() {
- var attribute = new CustomValidationAttribute(null, "Does not matter");
- Assert.Throws<InvalidOperationException>(() => attribute.RequiresValidationContext);
-
- attribute = new CustomValidationAttribute(typeof(NonPublicCustomValidator), "Does not matter");
- Assert.Throws<InvalidOperationException>(() => attribute.RequiresValidationContext);
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), null);
- Assert.Throws<InvalidOperationException>(() => attribute.RequiresValidationContext);
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), string.Empty);
- Assert.Throws<InvalidOperationException>(() => attribute.RequiresValidationContext);
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "NonExistentMethod");
- Assert.Throws<InvalidOperationException>(() => attribute.RequiresValidationContext);
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "NonPublicValidationMethod");
- Assert.Throws<InvalidOperationException>(() => attribute.RequiresValidationContext);
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "NonStaticValidationMethod");
- Assert.Throws<InvalidOperationException>(() => attribute.RequiresValidationContext);
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "ValidationMethodDoesNotReturnValidationResult");
- Assert.Throws<InvalidOperationException>(() => attribute.RequiresValidationContext);
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "ValidationMethodWithNoArgs");
- Assert.Throws<InvalidOperationException>(() => attribute.RequiresValidationContext);
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "ValidationMethodWithByRefArg");
- Assert.Throws<InvalidOperationException>(() => attribute.RequiresValidationContext);
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "ValidationMethodTwoArgsButSecondIsNotValidationContext");
+ [Theory]
+ [MemberData(nameof(BadlyFormed_TestData))]
+ public static void RequiresValidationContext_BadlyFormed_ThrowsInvalidOperationException(Type validatorType, string method)
+ {
+ CustomValidationAttribute attribute = new CustomValidationAttribute(validatorType, method);
Assert.Throws<InvalidOperationException>(() => attribute.RequiresValidationContext);
}
- [Fact]
- public static void Validate_throws_InvalidOperationException_for_invalid_ValidatorType()
+ [Theory]
+ [MemberData(nameof(BadlyFormed_TestData))]
+ public static void Validate_BadlyFormed_ThrowsInvalidOperationException(Type validatorType, string method)
{
- var attribute = new CustomValidationAttribute(null, "Does not matter");
- Assert.Throws<InvalidOperationException>(() => attribute.Validate("Does not matter", s_testValidationContext));
-
- attribute = new CustomValidationAttribute(typeof(NonPublicCustomValidator), "Does not matter");
+ CustomValidationAttribute attribute = new CustomValidationAttribute(validatorType, method);
Assert.Throws<InvalidOperationException>(() => attribute.Validate("Does not matter", s_testValidationContext));
}
- [Fact]
- public static void Validate_throws_InvalidOperationException_for_invalid_validation_method()
+ [Theory]
+ [MemberData(nameof(BadlyFormed_TestData))]
+ public static void FormatErrorMessage_BadlyFormed_ThrowsInvalidOperationException(Type validatorType, string method)
{
- var attribute = new CustomValidationAttribute(typeof(CustomValidator), null);
- Assert.Throws<InvalidOperationException>(() => attribute.Validate("Does not matter", s_testValidationContext));
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), string.Empty);
- Assert.Throws<InvalidOperationException>(() => attribute.Validate("Does not matter", s_testValidationContext));
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "NonExistentMethod");
- Assert.Throws<InvalidOperationException>(() => attribute.Validate("Does not matter", s_testValidationContext));
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "NonPublicValidationMethod");
- Assert.Throws<InvalidOperationException>(() => attribute.Validate("Does not matter", s_testValidationContext));
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "NonStaticValidationMethod");
- Assert.Throws<InvalidOperationException>(() => attribute.Validate("Does not matter", s_testValidationContext));
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "ValidationMethodDoesNotReturnValidationResult");
- Assert.Throws<InvalidOperationException>(() => attribute.Validate("Does not matter", s_testValidationContext));
+ CustomValidationAttribute attribute = new CustomValidationAttribute(validatorType, method);
+ Assert.Throws<InvalidOperationException>(() => attribute.FormatErrorMessage("name"));
+ }
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "ValidationMethodWithNoArgs");
- Assert.Throws<InvalidOperationException>(() => attribute.Validate("Does not matter", s_testValidationContext));
+ public static IEnumerable<object[]> Validate_Valid_TestData()
+ {
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodOneArg), "AnyString" };
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodTwoArgs), new TestClass("AnyString") };
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodOneArgStronglyTyped), "AnyString" };
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodTwoArgsStronglyTyped), new TestClass("AnyString") };
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "ValidationMethodWithByRefArg");
- Assert.Throws<InvalidOperationException>(() => attribute.Validate("Does not matter", s_testValidationContext));
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodOneArgNullable), null };
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodOneArgNullable), new TestStruct() { Value = "Valid Value" } };
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "ValidationMethodTwoArgsButSecondIsNotValidationContext");
- Assert.Throws<InvalidOperationException>(() => attribute.Validate("Does not matter", s_testValidationContext));
- }
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodTwoArgsWithFirstNullable), null };
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodTwoArgsWithFirstNullable), new TestStruct() { Value = "Valid Value" } };
- [Fact]
- public static void Validate_successful_for_valid_validation_type_and_method()
- {
- var attribute = new CustomValidationAttribute(typeof(CustomValidator), "CorrectValidationMethodOneArg");
- AssertEx.DoesNotThrow(() => attribute.Validate("Validation returns success for any string", s_testValidationContext));
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodTwoArgsStronglyTyped), new DerivedTestClass("AnyString") };
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "CorrectValidationMethodTwoArgs");
- AssertEx.DoesNotThrow(() => attribute.Validate(new TestClass("Validation returns success for any TestClass"), s_testValidationContext));
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodIntegerArg), 123 };
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodIntegerArg), false };
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodIntegerArg), 123456L };
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodIntegerArg), 123.456F };
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodIntegerArg), 123.456D };
}
- [Fact]
- public static void Validate_successful_for_valid_validation_type_and_method_with_strongly_typed_first_arg()
+ [Theory]
+ [MemberData(nameof(Validate_Valid_TestData))]
+ public static void Validate_ValidArguments_DoesNotThrow(string method, object value)
{
- var attribute = new CustomValidationAttribute(typeof(CustomValidator), "CorrectValidationMethodOneArgStronglyTyped");
- AssertEx.DoesNotThrow(() => attribute.Validate("Validation returns success for any string", s_testValidationContext));
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "CorrectValidationMethodTwoArgsStronglyTyped");
- AssertEx.DoesNotThrow(() => attribute.Validate(new TestClass("Validation returns success for any TestClass"), s_testValidationContext));
+ CustomValidationAttribute attribute = new CustomValidationAttribute(typeof(CustomValidator), method);
+ attribute.Validate(value, s_testValidationContext);
}
- [Fact]
- public static void Validate_throws_ValidationException_for_invalid_values()
+ public static IEnumerable<object[]> Validate_Invalid_TestData()
{
- var attribute = new CustomValidationAttribute(typeof(CustomValidator), "CorrectValidationMethodOneArg");
- Assert.Throws<ValidationException>(
- () => attribute.Validate(new TestClass("Value is not a string - so validation fails"), s_testValidationContext));
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "CorrectValidationMethodTwoArgs");
- Assert.Throws<ValidationException>(
- () => attribute.Validate("Value is not a TestClass - so validation fails", s_testValidationContext));
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodOneArg), new TestClass("AnyString"), typeof(ValidationException) };
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodTwoArgs), "AnyString", typeof(ValidationException) };
// This Assert produces different results on Core CLR versus .Net Native. In CustomValidationAttribute.TryConvertValue()
// we call Convert.ChangeType(instanceOfAClass, typeof(string), ...). On K this throws InvalidCastException because
// the class does not implement IConvertible. On N this just returns the result of ToString() on the class and does not throw.
// As of 7/9/14 no plans to change this.
- //attribute = new CustomValidationAttribute(typeof(CustomValidator), "CorrectValidationMethodOneArgStronglyTyped");
- //Assert.Throws<ValidationException>(
- // () => attribute.Validate(new TestClass("Validation method expects a string but is given a TestClass and so fails"), TestValidationContext));
+ // yield return new object[] { nameof(CustomValidator.CorrectValidationMethodOneArgStronglyTyped), new TestClass("AnyString"), typeof(ValidationException) };
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodTwoArgsStronglyTyped), "AnyString", typeof(ValidationException) };
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "CorrectValidationMethodTwoArgsStronglyTyped");
- Assert.Throws<ValidationException>(
- () => attribute.Validate("Validation method expects a TestClass but is given a string and so fails", s_testValidationContext));
- }
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodOneArgNullable), new TestStruct() { Value = "Invalid Value" }, typeof(ValidationException) };
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodTwoArgsWithFirstNullable), new TestStruct() { Value = "Invalid Value" }, typeof(ValidationException) };
- [Fact]
- public static void Validation_works_for_null_and_non_null_values_and_validation_method_taking_nullable_value_type()
- {
- var attribute = new CustomValidationAttribute(typeof(CustomValidator), "CorrectValidationMethodOneArgNullable");
- AssertEx.DoesNotThrow(() => attribute.Validate(null, s_testValidationContext));
- AssertEx.DoesNotThrow(
- () => attribute.Validate(new TestStruct() { Value = "Valid Value" }, s_testValidationContext));
- Assert.Throws<ValidationException>(
- () => attribute.Validate(new TestStruct() { Value = "Some non-valid value" }, s_testValidationContext));
-
- attribute = new CustomValidationAttribute(typeof(CustomValidator), "CorrectValidationMethodTwoArgsWithFirstNullable");
- AssertEx.DoesNotThrow(() => attribute.Validate(null, s_testValidationContext));
- AssertEx.DoesNotThrow(
- () => attribute.Validate(new TestStruct() { Value = "Valid Value" }, s_testValidationContext));
- Assert.Throws<ValidationException>(
- () => attribute.Validate(new TestStruct() { Value = "Some non-valid value" }, s_testValidationContext));
- }
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodIntegerArg), null, typeof(ValidationException) };
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodIntegerArg), new TestClass("NotInt"), typeof(ValidationException) };
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodIntegerArg), new DateTime(2014, 3, 19), typeof(ValidationException) };
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodOneArgDateTime), "abcdef", typeof(ValidationException) };
- [Fact]
- public static void Validate_successful_for_validation_method_with_strongly_typed_first_arg_and_value_type_assignable_from_expected_type()
- {
- var attribute = new CustomValidationAttribute(typeof(CustomValidator), "CorrectValidationMethodTwoArgsStronglyTyped");
- AssertEx.DoesNotThrow(
- () => attribute.Validate(new DerivedTestClass("Validation returns success for DerivedTestClass too"), s_testValidationContext));
- }
+ // Implements IConvertible (throws NotSupportedException - is caught)
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodOneArgDateTime), new IConvertibleImplementor(), typeof(ValidationException) };
- [Fact]
- public static void Validate_successful_for_validation_method_with_strongly_typed_first_arg_and_value_type_convertible_to_expected_type()
- {
- var attribute = new CustomValidationAttribute(typeof(CustomValidator), "CorrectValidationMethodIntegerArg");
+ // Implements IConvertible (throws custom ArithmeticException - is not caught)
+ yield return new object[] { nameof(CustomValidator.CorrectValidationMethodOneArgDecimal), new IConvertibleImplementor(), typeof(ArithmeticException) };
- // validation works for integer value as it is declared with integer arg
- AssertEx.DoesNotThrow(() => attribute.Validate(123, s_testValidationContext));
+ yield return new object[] { nameof(CustomValidator.ValidationMethodThrowsException), null, typeof(ArgumentException) };
+ }
- // also works with bool, long, float & double as can convert them to int
- AssertEx.DoesNotThrow(() => attribute.Validate(false, s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate(123456L, s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate(123.456F, s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate(123.456D, s_testValidationContext));
+ [Theory]
+ [MemberData(nameof(Validate_Invalid_TestData))]
+ public static void Validate_InvalidArguments_ThrowsValidationException(string method, object value, Type exceptionType)
+ {
+ CustomValidationAttribute attribute = new CustomValidationAttribute(typeof(CustomValidator), method);
+ Assert.Throws(exceptionType, () => attribute.Validate(value, s_testValidationContext));
- // does not work with TestClass or DateTime as cannot convert them
- Assert.Throws<ValidationException>(() => attribute.Validate(new TestClass("Does not convert to int"), s_testValidationContext));
- Assert.Throws<ValidationException>(() => attribute.Validate(new DateTime(2014, 3, 19), s_testValidationContext));
+ Assert.NotEmpty(attribute.FormatErrorMessage("name"));
}
internal class NonPublicCustomValidator
{
- public static ValidationResult ValidationMethodOneArg(object o)
- {
- return ValidationResult.Success;
- }
+ public static ValidationResult ValidationMethodOneArg(object o) => ValidationResult.Success;
}
public class CustomValidator
{
- internal static ValidationResult NonPublicValidationMethod(object o)
- {
- return ValidationResult.Success;
- }
+ internal static ValidationResult NonPublicValidationMethod(object o) => ValidationResult.Success;
- public ValidationResult NonStaticValidationMethod(object o)
- {
- return ValidationResult.Success;
- }
+ public ValidationResult NonStaticValidationMethod(object o) => ValidationResult.Success;
- public static string ValidationMethodDoesNotReturnValidationResult(object o)
- {
- return null;
- }
+ public static string ValidationMethodDoesNotReturnValidationResult(object o) => null;
- public static ValidationResult ValidationMethodWithNoArgs()
- {
- return ValidationResult.Success;
- }
+ public static ValidationResult ValidationMethodWithNoArgs() => ValidationResult.Success;
- public static ValidationResult ValidationMethodWithByRefArg(ref object o)
- {
- return ValidationResult.Success;
- }
+ public static ValidationResult ValidationMethodWithByRefArg(ref object o) => ValidationResult.Success;
public static ValidationResult ValidationMethodTwoArgsButSecondIsNotValidationContext(object o, object someOtherObject)
{
return ValidationResult.Success;
}
+
+ public static ValidationResult ValidationMethodThrowsException(object o)
+ {
+ throw new ArgumentException();
+ }
public static ValidationResult ValidationMethodThreeArgs(object o, ValidationContext context, object someOtherObject)
{
@@ -269,10 +180,7 @@ namespace System.ComponentModel.DataAnnotations
return new ValidationResult("Validation failed - not a string");
}
- public static ValidationResult CorrectValidationMethodOneArgStronglyTyped(string s)
- {
- return ValidationResult.Success;
- }
+ public static ValidationResult CorrectValidationMethodOneArgStronglyTyped(string s) => ValidationResult.Success;
public static ValidationResult CorrectValidationMethodTwoArgs(object o, ValidationContext context)
{
@@ -285,12 +193,9 @@ namespace System.ComponentModel.DataAnnotations
return ValidationResult.Success;
}
- public static ValidationResult CorrectValidationMethodIntegerArg(int i)
- {
- return ValidationResult.Success;
- }
+ public static ValidationResult CorrectValidationMethodIntegerArg(int i) => ValidationResult.Success;
- public static ValidationResult CorrectValidationMethodOneArgNullable(Nullable<TestStruct> testStruct)
+ public static ValidationResult CorrectValidationMethodOneArgNullable(TestStruct? testStruct)
{
if (testStruct == null) { return ValidationResult.Success; }
var ts = (TestStruct)testStruct;
@@ -298,13 +203,16 @@ namespace System.ComponentModel.DataAnnotations
return new ValidationResult("Validation failed - neither null nor Value=\"Valid Value\"");
}
- public static ValidationResult CorrectValidationMethodTwoArgsWithFirstNullable(Nullable<TestStruct> testStruct, ValidationContext context)
+ public static ValidationResult CorrectValidationMethodTwoArgsWithFirstNullable(TestStruct? testStruct, ValidationContext context)
{
if (testStruct == null) { return ValidationResult.Success; }
var ts = (TestStruct)testStruct;
if ("Valid Value".Equals(ts.Value)) { return ValidationResult.Success; }
return new ValidationResult("Validation failed - neither null nor Value=\"Valid Value\"");
}
+
+ public static ValidationResult CorrectValidationMethodOneArgDateTime(DateTime dateTime) => ValidationResult.Success;
+ public static ValidationResult CorrectValidationMethodOneArgDecimal(decimal d) => ValidationResult.Success;
}
public class TestClass
@@ -321,5 +229,37 @@ namespace System.ComponentModel.DataAnnotations
{
public string Value { get; set; }
}
- }
+
+ public class IConvertibleImplementor : IConvertible
+ {
+ public TypeCode GetTypeCode() => TypeCode.Empty;
+
+ public bool ToBoolean(IFormatProvider provider) => true;
+ public byte ToByte(IFormatProvider provider) => 0;
+ public char ToChar(IFormatProvider provider) => '\0';
+ public DateTime ToDateTime(IFormatProvider provider)
+ {
+ throw new NotSupportedException();
+ }
+
+ public decimal ToDecimal(IFormatProvider provider)
+ {
+ throw new ArithmeticException();
+ }
+
+ public double ToDouble(IFormatProvider provider) => 0;
+ public short ToInt16(IFormatProvider provider) => 0;
+ public int ToInt32(IFormatProvider provider) => 0;
+ public long ToInt64(IFormatProvider provider) => 0;
+ public sbyte ToSByte(IFormatProvider provider) => 0;
+ public float ToSingle(IFormatProvider provider) => 0;
+
+ public string ToString(IFormatProvider provider) => "";
+ public object ToType(Type conversionType, IFormatProvider provider) => null;
+
+ public ushort ToUInt16(IFormatProvider provider) => 0;
+ public uint ToUInt32(IFormatProvider provider) => 0;
+ public ulong ToUInt64(IFormatProvider provider) => 0;
+ }
+ }
}
diff --git a/src/System.ComponentModel.Annotations/tests/DataTypeAttributeTests.cs b/src/System.ComponentModel.Annotations/tests/DataTypeAttributeTests.cs
index 0491d94942..bb146c1b5b 100644
--- a/src/System.ComponentModel.Annotations/tests/DataTypeAttributeTests.cs
+++ b/src/System.ComponentModel.Annotations/tests/DataTypeAttributeTests.cs
@@ -2,6 +2,8 @@
// 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.Collections.Generic;
+using System.Linq;
using Xunit;
namespace System.ComponentModel.DataAnnotations
@@ -10,105 +12,94 @@ namespace System.ComponentModel.DataAnnotations
{
private static readonly ValidationContext s_testValidationContext = new ValidationContext(new object());
- [Fact]
- public static void DataType_and_CustomDataType_assigned_correctly_for_all_non_custom_DataTypes()
+ private static readonly DataType[] s_dataTypes = (DataType[])Enum.GetValues(typeof(DataType));
+ public static IEnumerable<object[]> DataTypes_TestData => s_dataTypes.Select(type => new object[] { type });
+
+ [Theory]
+ [MemberData(nameof(DataTypes_TestData))]
+ [InlineData((DataType)(-1))]
+ [InlineData(DataType.Upload + 1)]
+ public static void Ctor_DataType(DataType dataType)
{
- foreach (var enumValue in Enum.GetValues(typeof(DataType)))
- {
- var dataType = (DataType)enumValue;
- if (DataType.Custom != dataType)
- {
- var attribute = new DataTypeAttribute(dataType);
- Assert.Equal(dataType, attribute.DataType);
- Assert.Null(attribute.CustomDataType);
- }
- }
+ DataTypeAttribute attribute = new DataTypeAttribute(dataType);
+ Assert.Equal(dataType, attribute.DataType);
+ Assert.Null(attribute.CustomDataType);
+
+ bool expectedNull = dataType != DataType.Date && dataType != DataType.Time && dataType != DataType.Currency;
+ Assert.Equal(expectedNull, attribute.DisplayFormat == null);
}
- [Fact]
- public static void GetDataTypeName_and_Validate_successful_for_all_non_custom_DataTypes()
+ [Theory]
+ [MemberData(nameof(DataTypes_TestData))]
+ public static void GetDataTypeName_ReturnsExpectedName(DataType dataType)
{
- foreach (var enumValue in Enum.GetValues(typeof(DataType)))
+ if (dataType != DataType.Custom)
{
- var dataType = (DataType)enumValue;
- if (DataType.Custom != dataType)
- {
- var attribute = new DataTypeAttribute(dataType);
- Assert.Equal(Enum.GetName(typeof(DataType), enumValue), attribute.GetDataTypeName());
- AssertEx.DoesNotThrow(() => attribute.Validate(new object(), s_testValidationContext));
- }
+ DataTypeAttribute attribute = new DataTypeAttribute(dataType);
+ Assert.Equal(Enum.GetName(typeof(DataType), dataType), attribute.GetDataTypeName());
}
}
- [Fact]
- public static void DataType_and_CustomDataType_assigned_correctly_for_custom_DataType()
+ [Theory]
+ [InlineData((DataType)(-1))]
+ [InlineData(DataType.Upload + 1)]
+ public static void GetDataTypeName_InvalidDataType_ThrowsIndexOutOfRangeException(DataType dataType)
{
- var attribute = new DataTypeAttribute("CustomValue");
- Assert.Equal(DataType.Custom, attribute.DataType);
- Assert.Equal("CustomValue", attribute.CustomDataType);
+ DataTypeAttribute attribute = new DataTypeAttribute(dataType);
+ Assert.Throws<IndexOutOfRangeException>(() => attribute.GetDataTypeName());
}
- [Fact]
- public static void GetDataTypeName_and_IsValid_on_null_custom_DataTypeAttribute_throws_exception()
+ [Theory]
+ [InlineData((DataType)(-1))]
+ [InlineData(DataType.Upload + 1)]
+ public static void Validate_InvalidDataType_DoesNotThrow(DataType dataType)
{
- var attribute = new DataTypeAttribute((string)null);
- Assert.Equal(DataType.Custom, attribute.DataType); // Only throw when call GetDataTypeName() or Validate()
- Assert.Null(attribute.CustomDataType); // Only throw when call GetDataTypeName() or Validate()
- Assert.Throws<InvalidOperationException>(() => attribute.GetDataTypeName());
- Assert.Throws<InvalidOperationException>(() => attribute.Validate(new object(), s_testValidationContext));
+ DataTypeAttribute attribute = new DataTypeAttribute(dataType);
+ attribute.Validate(new object(), s_testValidationContext);
}
- [Fact]
- public static void GetDataTypeName_and_IsValid_on_empty_custom_DataTypeAttribute_throws_exception()
+ [Theory]
+ [MemberData(nameof(DataTypes_TestData))]
+ public static void Validate_DoesNotThrow(DataType dataType)
{
- var attribute = new DataTypeAttribute(string.Empty);
- Assert.Equal(DataType.Custom, attribute.DataType); // Only throw when call GetDataTypeName() or Validate()
- AssertEx.Empty(attribute.CustomDataType); // Only throw when call GetDataTypeName() or Validate()
- Assert.Throws<InvalidOperationException>(() => attribute.GetDataTypeName());
- Assert.Throws<InvalidOperationException>(() => attribute.Validate(new object(), s_testValidationContext));
- }
-
- [Fact]
- public static void GetDataTypeName_and_IsValid_on_non_null_custom_DataTypeAttribute_is_successful()
- {
- var attribute = new DataTypeAttribute("TestCustomDataType");
- Assert.Equal("TestCustomDataType", attribute.GetDataTypeName());
- AssertEx.DoesNotThrow(() => attribute.Validate(new object(), s_testValidationContext));
+ if (dataType != DataType.Custom)
+ {
+ DataTypeAttribute attribute = new DataTypeAttribute(dataType);
+ attribute.Validate(new object(), s_testValidationContext);
+ }
}
- [Fact]
- public static void DisplayFormat_set_correctly_for_date_time_and_currency()
+ [Theory]
+ [InlineData("CustomValue")]
+ [InlineData("")]
+ [InlineData(null)]
+ public static void Ctor_String(string customDataType)
{
- var dateAttribute = new DataTypeAttribute(DataType.Date);
- Assert.NotNull(dateAttribute.DisplayFormat);
- Assert.Equal("{0:d}", dateAttribute.DisplayFormat.DataFormatString);
- Assert.True(dateAttribute.DisplayFormat.ApplyFormatInEditMode);
-
- var timeAttribute = new DataTypeAttribute(DataType.Time);
- Assert.NotNull(timeAttribute.DisplayFormat);
- Assert.Equal("{0:t}", timeAttribute.DisplayFormat.DataFormatString);
- Assert.True(timeAttribute.DisplayFormat.ApplyFormatInEditMode);
+ DataTypeAttribute attribute = new DataTypeAttribute(customDataType);
+ Assert.Equal(DataType.Custom, attribute.DataType);
+ Assert.Equal(customDataType, attribute.CustomDataType);
- var currencyAttribute = new DataTypeAttribute(DataType.Currency);
- Assert.NotNull(currencyAttribute.DisplayFormat);
- Assert.Equal("{0:C}", currencyAttribute.DisplayFormat.DataFormatString);
- Assert.False(currencyAttribute.DisplayFormat.ApplyFormatInEditMode);
+ if (string.IsNullOrEmpty(customDataType))
+ {
+ Assert.Throws<InvalidOperationException>(() => attribute.GetDataTypeName());
+ Assert.Throws<InvalidOperationException>(() => attribute.Validate(new object(), s_testValidationContext));
+ }
+ else
+ {
+ Assert.Equal(customDataType, attribute.GetDataTypeName());
+ attribute.Validate(new object(), s_testValidationContext);
+ }
}
- [Fact]
- public static void DisplayFormat_null_for_non_date_time_and_currency()
+ [Theory]
+ [InlineData(DataType.Date, "{0:d}", true)]
+ [InlineData(DataType.Time, "{0:t}", true)]
+ [InlineData(DataType.Currency, "{0:C}", false)]
+ public static void DisplayFormat_ReturnsExpected(DataType dataType, string dataFormatString, bool applyFormatInEditMode)
{
- foreach (var enumValue in Enum.GetValues(typeof(DataType)))
- {
- var dataType = (DataType)enumValue;
- if (DataType.Date != dataType
- && DataType.Time != dataType
- && DataType.Currency != dataType)
- {
- var attribute = new DataTypeAttribute(dataType);
- Assert.Null(attribute.DisplayFormat);
- }
- }
+ DataTypeAttribute attribute = new DataTypeAttribute(dataType);
+ Assert.Equal(dataFormatString, attribute.DisplayFormat.DataFormatString);
+ Assert.Equal(applyFormatInEditMode, attribute.DisplayFormat.ApplyFormatInEditMode);
}
}
}
diff --git a/src/System.ComponentModel.Annotations/tests/EditableAttributeTests.cs b/src/System.ComponentModel.Annotations/tests/EditableAttributeTests.cs
index 0a26368050..52ea79bea5 100644
--- a/src/System.ComponentModel.Annotations/tests/EditableAttributeTests.cs
+++ b/src/System.ComponentModel.Annotations/tests/EditableAttributeTests.cs
@@ -11,7 +11,7 @@ namespace System.ComponentModel.DataAnnotations
[Theory]
[InlineData(true)]
[InlineData(false)]
- public void Can_construct_and_both_AllowEdit_and_AllowInitialValue_are_set(bool value)
+ public void Ctor(bool value)
{
var attribute = new EditableAttribute(value);
Assert.Equal(value, attribute.AllowEdit);
@@ -21,7 +21,7 @@ namespace System.ComponentModel.DataAnnotations
[Theory]
[InlineData(true)]
[InlineData(false)]
- public void Properties_are_independent(bool value)
+ public void Properties_ChangingOneProperty_DoesNotAffectTheOther(bool value)
{
var attribute = new EditableAttribute(value);
Assert.Equal(value, attribute.AllowEdit);
diff --git a/src/System.ComponentModel.Annotations/tests/EmailAddressAttributeTests.cs b/src/System.ComponentModel.Annotations/tests/EmailAddressAttributeTests.cs
index 4415935b50..10a1d3c08c 100644
--- a/src/System.ComponentModel.Annotations/tests/EmailAddressAttributeTests.cs
+++ b/src/System.ComponentModel.Annotations/tests/EmailAddressAttributeTests.cs
@@ -11,144 +11,113 @@ namespace System.ComponentModel.DataAnnotations
private static readonly ValidationContext s_testValidationContext = new ValidationContext(new object());
[Fact]
- public static void EmailAddressAttribute_creation_DataType_and_CustomDataType()
+ public static void DataType_CustomDataType_ReturnExpected()
{
var attribute = new EmailAddressAttribute();
Assert.Equal(DataType.EmailAddress, attribute.DataType);
Assert.Null(attribute.CustomDataType);
}
- [Fact]
- public static void Validate_successful_for_null_address()
- {
- var attribute = new EmailAddressAttribute();
-
- AssertEx.DoesNotThrow(() => attribute.Validate(null, s_testValidationContext)); // Null is valid
- }
-
- [Fact]
- public static void Validate_successful_for_valid_local_part()
- {
- var attribute = new EmailAddressAttribute();
-
- AssertEx.DoesNotThrow(() => attribute.Validate("someName@someDomain.com", s_testValidationContext)); // Simple valid value
- AssertEx.DoesNotThrow(() => attribute.Validate("1234@someDomain.com", s_testValidationContext)); // numbers are valid
- AssertEx.DoesNotThrow(() => attribute.Validate("firstName.lastName@someDomain.com", s_testValidationContext)); // With dot in name
- AssertEx.DoesNotThrow(() => attribute.Validate("\u00A0@someDomain.com", s_testValidationContext)); // With valid \u character
- AssertEx.DoesNotThrow(() => attribute.Validate("!#$%&'*+-/=?^_`|~@someDomain.com", s_testValidationContext)); // With valid (but unusual) characters
- AssertEx.DoesNotThrow(() => attribute.Validate("\"firstName.lastName\"@someDomain.com", s_testValidationContext)); // quotes around whole local part
- }
-
- [Fact]
- public static void Validate_successful_for_valid_domain_part()
+ [Theory]
+ [InlineData(null)]
+ [InlineData("someName@someDomain.com")]
+ [InlineData("1234@someDomain.com")]
+ [InlineData("firstName.lastName@someDomain.com")]
+ [InlineData("\u00A0@someDomain.com")]
+ [InlineData("!#$%&'*+-/=?^_`|~@someDomain.com")]
+ [InlineData("\"firstName.lastName\"@someDomain.com")]
+ [InlineData("someName@someDomain.com")]
+ [InlineData("someName@some~domain.com")]
+ [InlineData("someName@some_domain.com")]
+ [InlineData("someName@1234.com")]
+ [InlineData("someName@someDomain\uFFEF.com")]
+ public static void Validate_ValidValue_DoesNotThrow(string value)
{
var attribute = new EmailAddressAttribute();
-
- AssertEx.DoesNotThrow(() => attribute.Validate("someName@someDomain.com", s_testValidationContext)); // Simple valid value
- AssertEx.DoesNotThrow(() => attribute.Validate("someName@some~domain.com", s_testValidationContext)); // With tilde
- AssertEx.DoesNotThrow(() => attribute.Validate("someName@some_domain.com", s_testValidationContext)); // With underscore
- AssertEx.DoesNotThrow(() => attribute.Validate("someName@1234.com", s_testValidationContext)); // numbers are valid
- AssertEx.DoesNotThrow(() => attribute.Validate("someName@someDomain\uFFEF.com", s_testValidationContext)); // With valid \u character
+ attribute.Validate(value, s_testValidationContext);
}
- [Fact]
- public static void Validate_throws_for_invalid_local_part()
+ [Theory]
+ [InlineData(0)]
+ [InlineData("")]
+ [InlineData(" \r \t \n")]
+ [InlineData("@someDomain.com")]
+ [InlineData("@someDomain@abc.com")]
+ [InlineData("someName")]
+ [InlineData("someName@")]
+ [InlineData("someName@a@b.com")]
+ public static void Validate_InvalidValue_ThrowsValidationException(object value)
{
var attribute = new EmailAddressAttribute();
-
- Assert.Throws<ValidationException>(() => attribute.Validate("@someDomain.com", s_testValidationContext)); // no local part
- Assert.Throws<ValidationException>(() => attribute.Validate("@someDomain@abc.com", s_testValidationContext)); // multiple @'s
+ Assert.Throws<ValidationException>(() => attribute.Validate(value, s_testValidationContext));
}
[Fact]
- public static void Validate_throws_for_invalid_domain_name()
+ public static void Validate_ErrorMessageNotSet_ThrowsInvalidOperationException()
{
- var attribute = new EmailAddressAttribute();
-
- Assert.Throws<ValidationException>(() => attribute.Validate("someName", s_testValidationContext)); // no domain
- Assert.Throws<ValidationException>(() => attribute.Validate("someName@", s_testValidationContext)); // no domain
- Assert.Throws<ValidationException>(() => attribute.Validate("someName@a@b.com", s_testValidationContext)); // multiple @'s
- }
-
- [Fact]
- public static void Validate_throws_InvalidOperationException_if_ErrorMessage_is_null()
- {
- var attribute = new EmailAddressAttribute();
- attribute.ErrorMessage = null; // note: this overrides the default value
+ var attribute = new EmailAddressAttribute() { ErrorMessage = null };
Assert.Throws<InvalidOperationException>(() => attribute.Validate("InvalidEmailAddress", s_testValidationContext));
}
[Fact]
- public static void Validate_throws_InvalidOperationException_if_ErrorMessage_and_ErrorMessageResourceName_are_set()
+ public static void Validate_ErrorMessageSet_ErrorMessageResourceNameSet_ThrowsInvalidOperationException()
{
- var attribute = new EmailAddressAttribute();
- attribute.ErrorMessage = "SomeErrorMessage";
- attribute.ErrorMessageResourceName = "SomeErrorMessageResourceName";
+ var attribute = new EmailAddressAttribute() { ErrorMessage = "Some", ErrorMessageResourceName = "Some" };
Assert.Throws<InvalidOperationException>(() => attribute.Validate("InvalidEmailAddress", s_testValidationContext));
}
[Fact]
- public static void Validate_throws_InvalidOperationException_if_ErrorMessageResourceName_set_but_ErrorMessageResourceType_not_set()
+ public static void Validate_ErrorMessageResourceNameSet_ErrorMessageResourceTypeNotSet_ThrowsInvalidOperationException()
{
- var attribute = new EmailAddressAttribute();
- attribute.ErrorMessageResourceName = "SomeErrorMessageResourceName";
- attribute.ErrorMessageResourceType = null;
+ var attribute = new EmailAddressAttribute() { ErrorMessageResourceName = "Some", ErrorMessageResourceType = null };
Assert.Throws<InvalidOperationException>(() => attribute.Validate("InvalidEmailAddress", s_testValidationContext));
}
[Fact]
- public static void Validate_throws_InvalidOperationException_if_ErrorMessageResourceType_set_but_ErrorMessageResourceName_not_set()
+ public static void Validate_ErrorMessageResourceNameNotSet_ErrorMessageResourceTypeSet_ThrowsInvalidOperationException()
{
- var attribute = new EmailAddressAttribute();
- attribute.ErrorMessageResourceName = null;
- attribute.ErrorMessageResourceType = typeof(ErrorMessageResources);
+ var attribute = new EmailAddressAttribute() { ErrorMessageResourceName = null, ErrorMessageResourceType = typeof(ErrorMessageResources) };
Assert.Throws<InvalidOperationException>(() => attribute.Validate("InvalidEmailAddress", s_testValidationContext));
}
[Fact]
- public static void GetValidationResult_returns_ErrorMessage_if_ErrorMessage_overrides_default()
+ public static void GetValidationResult_ErrorMessageSet_ReturnsOverridenValue()
{
var attribute = new EmailAddressAttribute();
attribute.ErrorMessage = "SomeErrorMessage";
var toBeTested = new EmailClassToBeTested();
var validationContext = new ValidationContext(toBeTested);
- validationContext.MemberName = "EmailPropertyToBeTested";
+ validationContext.MemberName = nameof(EmailClassToBeTested.EmailPropertyToBeTested);
var validationResult = attribute.GetValidationResult(toBeTested, validationContext);
Assert.Equal("SomeErrorMessage", validationResult.ErrorMessage);
}
-
[Fact]
- public static void GetValidationResult_returns_DefaultErrorMessage_if_ErrorMessage_is_not_set()
+ public static void GetValidationResult_ErrorMessageNotSet_ReturnsDefaultValue()
{
var attribute = new EmailAddressAttribute();
var toBeTested = new EmailClassToBeTested();
var validationContext = new ValidationContext(toBeTested);
- validationContext.MemberName = "EmailPropertyToBeTested";
- AssertEx.DoesNotThrow(() => attribute.GetValidationResult(toBeTested, validationContext));
+ validationContext.MemberName = nameof(EmailClassToBeTested.EmailPropertyToBeTested);
+ attribute.GetValidationResult(toBeTested, validationContext);
}
[Fact]
- public static void GetValidationResult_returns_ErrorMessage_from_resource_if_ErrorMessageResourceName_and_ErrorMessageResourceType_both_set()
+ public static void GetValidationResult_ErrorMessageSetFromResource_ReturnsExpectedValue()
{
var attribute = new EmailAddressAttribute();
attribute.ErrorMessageResourceName = "InternalErrorMessageTestProperty";
attribute.ErrorMessageResourceType = typeof(ErrorMessageResources);
var toBeTested = new EmailClassToBeTested();
var validationContext = new ValidationContext(toBeTested);
- validationContext.MemberName = "EmailPropertyToBeTested";
+ validationContext.MemberName = nameof(EmailClassToBeTested.EmailPropertyToBeTested);
var validationResult = attribute.GetValidationResult(toBeTested, validationContext);
- Assert.Equal(
- "Error Message from ErrorMessageResources.InternalErrorMessageTestProperty",
- validationResult.ErrorMessage);
+ Assert.Equal("Error Message from ErrorMessageResources.InternalErrorMessageTestProperty", validationResult.ErrorMessage);
}
}
public class EmailClassToBeTested
{
- public string EmailPropertyToBeTested
- {
- get { return "InvalidEmailAddress"; }
- }
+ public string EmailPropertyToBeTested => "InvalidEmailAddress";
}
}
diff --git a/src/System.ComponentModel.Annotations/tests/EnumDataTypeAttributeTests.cs b/src/System.ComponentModel.Annotations/tests/EnumDataTypeAttributeTests.cs
index 074791e6e6..d75bbeea74 100644
--- a/src/System.ComponentModel.Annotations/tests/EnumDataTypeAttributeTests.cs
+++ b/src/System.ComponentModel.Annotations/tests/EnumDataTypeAttributeTests.cs
@@ -2,6 +2,7 @@
// 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.Collections.Generic;
using Xunit;
namespace System.ComponentModel.DataAnnotations
@@ -10,160 +11,85 @@ namespace System.ComponentModel.DataAnnotations
{
private static readonly ValidationContext s_testValidationContext = new ValidationContext(new object());
- [Fact]
- public static void EnumDataTypeAttribute_creation_DataType_and_CustomDataType()
+ [Theory]
+ [InlineData(null)]
+ [InlineData(typeof(string))]
+ [InlineData(typeof(NonFlagsEnumType))]
+ [InlineData(typeof(FlagsEnumType))]
+ public static void Ctor(Type enumType)
{
- var attribute = new EnumDataTypeAttribute(null);
+ var attribute = new EnumDataTypeAttribute(enumType);
Assert.Equal(DataType.Custom, attribute.DataType);
Assert.Equal("Enumeration", attribute.CustomDataType);
- }
-
- [Fact]
- public static void Can_get_EnumType()
- {
- var attribute = new EnumDataTypeAttribute(null);
- Assert.Null(attribute.EnumType);
-
- attribute = new EnumDataTypeAttribute(typeof(NonFlagsEnumType));
- Assert.Equal(typeof(NonFlagsEnumType), attribute.EnumType);
- }
-
- [Fact]
- public static void Validate_successful_for_null_value()
- {
- var attribute = new EnumDataTypeAttribute(typeof(NonFlagsEnumType));
- AssertEx.DoesNotThrow(() => attribute.Validate(null, s_testValidationContext)); // Null is valid
- }
-
- [Fact]
- public static void Validate_throws_InvalidOperationException_for_null_EnumType()
- {
- var attribute = new EnumDataTypeAttribute(null);
- Assert.Null(attribute.EnumType);
- Assert.Throws<InvalidOperationException>(
- () => attribute.Validate("Value does not matter - EnumType is null", s_testValidationContext));
- }
-
-
- [Fact]
- public static void Validate_throws_InvalidOperationException_for_non_enum_EnumType()
- {
- var attribute = new EnumDataTypeAttribute(typeof(string));
- Assert.Equal(typeof(string), attribute.EnumType);
- Assert.Throws<InvalidOperationException>(
- () => attribute.Validate("Value does not matter - EnumType is not an enum", s_testValidationContext));
- }
-
- [Fact]
- public static void Validate_throws_InvalidOperationException_for_Nullable_EnumType()
- {
- var attribute = new EnumDataTypeAttribute(typeof(Nullable<NonFlagsEnumType>));
- Assert.Throws<InvalidOperationException>(
- () => attribute.Validate("Value does not matter - EnumType is Nullable", s_testValidationContext));
-
- attribute = new EnumDataTypeAttribute(typeof(Nullable<FlagsEnumType>));
- Assert.Throws<InvalidOperationException>(
- () => attribute.Validate("Value does not matter - EnumType is Nullable", s_testValidationContext));
- }
-
- [Fact]
- public static void Validate_successful_for_null_or_empty_value()
- {
- var attribute = new EnumDataTypeAttribute(typeof(NonFlagsEnumType));
- AssertEx.DoesNotThrow(() => attribute.Validate(null, s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate(string.Empty, s_testValidationContext));
- }
-
- [Fact]
- public static void Validate_throws_for_non_matching_EnumType()
- {
- var attribute = new EnumDataTypeAttribute(typeof(NonFlagsEnumType));
- Assert.Throws<ValidationException>(() => attribute.Validate(FlagsEnumType.X, s_testValidationContext));
- }
-
- [Fact]
- public static void Validate_throws_for_non_ValueType_value()
- {
- var attribute = new EnumDataTypeAttribute(typeof(NonFlagsEnumType));
- Assert.Throws<ValidationException>(() => attribute.Validate(new object(), s_testValidationContext));
- }
-
- [Fact]
- public static void Validate_throws_for_non_integral_values()
- {
- var attribute = new EnumDataTypeAttribute(typeof(NonFlagsEnumType));
- Assert.Throws<ValidationException>(() => attribute.Validate(true, s_testValidationContext)); // bool
- Assert.Throws<ValidationException>(() => attribute.Validate(1.1f, s_testValidationContext)); // float
- Assert.Throws<ValidationException>(() => attribute.Validate(123.456d, s_testValidationContext)); // double
- Assert.Throws<ValidationException>(() => attribute.Validate(123.456m, s_testValidationContext)); // decimal
- Assert.Throws<ValidationException>(() => attribute.Validate('0', s_testValidationContext)); // char
- }
-
- [Fact]
- public static void Validate_successful_for_matching_non_flags_enums_and_matching_values()
- {
- var attribute = new EnumDataTypeAttribute(typeof(NonFlagsEnumType));
- AssertEx.DoesNotThrow(() => attribute.Validate(NonFlagsEnumType.A, s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate(10, s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate(100, s_testValidationContext));
- }
-
- [Fact]
- public static void Validate_successful_for_matching_flags_enums_and_matching_values()
- {
- var attribute = new EnumDataTypeAttribute(typeof(FlagsEnumType));
- AssertEx.DoesNotThrow(() => attribute.Validate(FlagsEnumType.X, s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate(FlagsEnumType.X | FlagsEnumType.Y, s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate(5, s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate(7, s_testValidationContext));
- }
-
- [Fact]
- public static void Validate_throws_for_matching_non_flags_enums_and_non_matching_values()
- {
- var attribute = new EnumDataTypeAttribute(typeof(NonFlagsEnumType));
- Assert.Throws<ValidationException>(() => attribute.Validate(42, s_testValidationContext));
- }
-
- [Fact]
- public static void Validate_throws_for_matching_flags_enums_and_non_matching_values()
- {
- var attribute = new EnumDataTypeAttribute(typeof(FlagsEnumType));
- Assert.Throws<ValidationException>(() => attribute.Validate(0, s_testValidationContext));
- Assert.Throws<ValidationException>(() => attribute.Validate(8, s_testValidationContext));
- }
-
- [Fact]
- public static void Validate_successful_for_string_values_which_can_be_converted_to_enum_values()
- {
- var attribute = new EnumDataTypeAttribute(typeof(NonFlagsEnumType));
- AssertEx.DoesNotThrow(() => attribute.Validate("A", s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate("B", s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate("C", s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate("0", s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate("10", s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate("100", s_testValidationContext));
-
- attribute = new EnumDataTypeAttribute(typeof(FlagsEnumType));
- AssertEx.DoesNotThrow(() => attribute.Validate("X", s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate("X, Y", s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate("X, Y, Z", s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate("1", s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate("5", s_testValidationContext));
- AssertEx.DoesNotThrow(() => attribute.Validate("7", s_testValidationContext));
- }
-
- [Fact]
- public static void Validate_throws_for_string_values_which_cannot_be_converted_to_enum_values()
- {
- var attribute = new EnumDataTypeAttribute(typeof(NonFlagsEnumType));
- Assert.Throws<ValidationException>(() => attribute.Validate("NonExist", s_testValidationContext));
- Assert.Throws<ValidationException>(() => attribute.Validate("42", s_testValidationContext));
- attribute = new EnumDataTypeAttribute(typeof(FlagsEnumType));
- Assert.Throws<ValidationException>(() => attribute.Validate("NonExist", s_testValidationContext));
- Assert.Throws<ValidationException>(() => attribute.Validate("0", s_testValidationContext));
- Assert.Throws<ValidationException>(() => attribute.Validate("8", s_testValidationContext));
+ Assert.Equal(enumType, attribute.EnumType);
+ }
+
+ [Theory]
+ [InlineData(typeof(NonFlagsEnumType), null)]
+ [InlineData(typeof(NonFlagsEnumType), "")]
+ [InlineData(typeof(NonFlagsEnumType), NonFlagsEnumType.A)]
+ [InlineData(typeof(NonFlagsEnumType), 10)]
+ [InlineData(typeof(NonFlagsEnumType), 100)]
+ [InlineData(typeof(FlagsEnumType), FlagsEnumType.X)]
+ [InlineData(typeof(FlagsEnumType), FlagsEnumType.X | FlagsEnumType.Y)]
+ [InlineData(typeof(FlagsEnumType), 5)]
+ [InlineData(typeof(FlagsEnumType), 7)]
+ [InlineData(typeof(NonFlagsEnumType), "A")]
+ [InlineData(typeof(NonFlagsEnumType), "B")]
+ [InlineData(typeof(NonFlagsEnumType), "C")]
+ [InlineData(typeof(NonFlagsEnumType), "0")]
+ [InlineData(typeof(NonFlagsEnumType), "10")]
+ [InlineData(typeof(NonFlagsEnumType), "100")]
+ [InlineData(typeof(FlagsEnumType), "X")]
+ [InlineData(typeof(FlagsEnumType), "X, Y")]
+ [InlineData(typeof(FlagsEnumType), "X, Y, Z")]
+ [InlineData(typeof(FlagsEnumType), "1")]
+ [InlineData(typeof(FlagsEnumType), "5")]
+ [InlineData(typeof(FlagsEnumType), "7")]
+ public static void Validate_Valid_DoesNotThrow(Type enumType, object value)
+ {
+ var attribute = new EnumDataTypeAttribute(enumType);
+ attribute.Validate(value, s_testValidationContext);
+ }
+
+ [Theory]
+ [InlineData(null)]
+ [InlineData(typeof(string))]
+ [InlineData(typeof(NonFlagsEnumType?))]
+ [InlineData(typeof(FlagsEnumType?))]
+ public static void Validate_InvalidEnumType_ThrowsInvalidOperationException(Type enumType)
+ {
+ var attribute = new EnumDataTypeAttribute(enumType);
+ Assert.Throws<InvalidOperationException>(() => attribute.Validate("AnyValue", s_testValidationContext));
+ }
+
+ public static IEnumerable<object[]> Validate_Invalid_TestData()
+ {
+ yield return new object[] { typeof(NonFlagsEnumType), FlagsEnumType.X };
+ yield return new object[] { typeof(NonFlagsEnumType), new object() };
+ yield return new object[] { typeof(NonFlagsEnumType), true };
+ yield return new object[] { typeof(NonFlagsEnumType), 1.1f };
+ yield return new object[] { typeof(NonFlagsEnumType), 123.456d };
+ yield return new object[] { typeof(NonFlagsEnumType), 123.456m };
+ yield return new object[] { typeof(NonFlagsEnumType), '0' };
+ yield return new object[] { typeof(NonFlagsEnumType), 42 };
+ yield return new object[] { typeof(NonFlagsEnumType), "NoSuchValue" };
+ yield return new object[] { typeof(NonFlagsEnumType), "42" };
+
+ yield return new object[] { typeof(FlagsEnumType), 0 };
+ yield return new object[] { typeof(FlagsEnumType), 8 };
+ yield return new object[] { typeof(FlagsEnumType), "NoSuchValue" };
+ yield return new object[] { typeof(FlagsEnumType), "0" };
+ yield return new object[] { typeof(FlagsEnumType), "8" };
+ }
+
+ [Theory]
+ [MemberData(nameof(Validate_Invalid_TestData))]
+ public static void Validate_Invalid_ThrowsValidationException(Type enumType, object value)
+ {
+ var attribute = new EnumDataTypeAttribute(enumType);
+ Assert.Throws<ValidationException>(() => attribute.Validate(value, s_testValidationContext));
}
private enum NonFlagsEnumType
diff --git a/src/System.ComponentModel.Annotations/tests/MaxLengthAttributeTests.cs b/src/System.ComponentModel.Annotations/tests/MaxLengthAttributeTests.cs
index daabda9d34..71f5c86a6c 100644
--- a/src/System.ComponentModel.Annotations/tests/MaxLengthAttributeTests.cs
+++ b/src/System.ComponentModel.Annotations/tests/MaxLengthAttributeTests.cs
@@ -7,87 +7,105 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using Xunit;
-namespace System.ComponentModel.DataAnnotations
+namespace System.ComponentModel.DataAnnotations.Tests
{
public class MaxLengthAttributeTests
{
private static readonly ValidationContext s_testValidationContext = new ValidationContext(new object());
[Fact]
- public static void Length_returns_set_length()
+ public static void Ctor()
{
Assert.Equal(-1, new MaxLengthAttribute().Length);
- Assert.Equal(-1, new MaxLengthAttribute(-1).Length);
- Assert.Equal(10, new MaxLengthAttribute(10).Length);
-
- // These only throw when GetValidationResult is called
- Assert.Equal(0, new MaxLengthAttribute(0).Length);
- Assert.Equal(-10, new MaxLengthAttribute(-10).Length);
}
- [Fact]
- public static void GetValidationResult_throws_for_negative_or_zero_lengths_other_than_negative_one()
+ [Theory]
+ [InlineData(-1)]
+ [InlineData(10)]
+ [InlineData(0)]
+ [InlineData(-10)]
+ public static void Ctor_Int(int length)
{
- var attribute1 = new MaxLengthAttribute(0);
- Assert.Throws<InvalidOperationException>(
- () => attribute1.GetValidationResult("Twoflower", s_testValidationContext));
+ Assert.Equal(length, new MaxLengthAttribute(length).Length);
+ }
- var attribute2 = new MaxLengthAttribute(-10);
- Assert.Throws<InvalidOperationException>(
- () => attribute2.GetValidationResult("Rincewind", s_testValidationContext));
+ [Theory]
+ [InlineData(0)]
+ [InlineData(-10)]
+ public static void GetValidationResult_InvalidLength_ThrowsInvalidOperationException(int length)
+ {
+ var attribute = new MaxLengthAttribute(length);
+ Assert.Throws<InvalidOperationException>(() => attribute.Validate("Twoflower", s_testValidationContext));
}
[Fact]
- public static void GetValidationResult_throws_for_object_that_is_not_string_or_array()
+ public static void GetValidationResult_ValueNotStringOrICollection_ThrowsInvalidCastException()
{
- Assert.Throws<InvalidCastException>(
- () => new MaxLengthAttribute().GetValidationResult(new Random(), s_testValidationContext));
+ Assert.Throws<InvalidCastException>(() => new MaxLengthAttribute().GetValidationResult(new Random(), s_testValidationContext));
}
[Fact]
- public static void GetValidationResult_returns_success_for_null_target()
+ public static void GetValidationResult_ValueGenericICollection_ThrowsInvalidCastException()
{
- Assert.Equal(ValidationResult.Success, new MaxLengthAttribute(10).GetValidationResult(null, s_testValidationContext));
+ Assert.Throws<InvalidCastException>(() => new MaxLengthAttribute().GetValidationResult(new GenericICollectionClass(), s_testValidationContext));
}
- [Fact]
- public static void GetValidationResult_validates_string_length()
+ public static IEnumerable<object[]> Valid_TestData()
{
- Assert.Equal(ValidationResult.Success, new MaxLengthAttribute().GetValidationResult("UnspecifiedMaxLength", s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MaxLengthAttribute(15).GetValidationResult("UnderMaxLength", s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MaxLengthAttribute(16).GetValidationResult("EqualToMaxLength", s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MaxLengthAttribute(-1).GetValidationResult("SpecifiedMaximumMaxLength", s_testValidationContext));
- Assert.NotNull((new MaxLengthAttribute(12).GetValidationResult("OverMaxLength", s_testValidationContext)).ErrorMessage);
+ yield return new object[] { 10, null };
+ yield return new object[] { 15, "UnderMaxLength" };
+ yield return new object[] { 16, "EqualToMaxLength" };
+ yield return new object[] { -1, "SpecifiedMaximumMaxLength" };
+ yield return new object[] { -1, new int[20] };
+ yield return new object[] { 15, new string[14] };
+ yield return new object[] { 16, new string[16] };
+ yield return new object[] { -1, new Collection<int>(new int[20]) };
+ yield return new object[] { 15, new Collection<string>(new string[14]) };
+ yield return new object[] { 16, new Collection<string>(new string[16]) };
+ yield return new object[] { -1, new List<int>(new int[20]) };
+ yield return new object[] { 15, new List<string>(new string[14]) };
+ yield return new object[] { 16, new List<string>(new string[16]) };
+
+ yield return new object[] { 16, new int[4, 4] };
+ yield return new object[] { 16, new string[3, 4] };
}
- [Fact]
- public static void GetValidationResult_validates_array_length()
+ [Theory]
+ [MemberData(nameof(Valid_TestData))]
+ public static void GetValidationResult_ValidValue_ReturnsSuccess(int length, object value)
{
- Assert.Equal(ValidationResult.Success, new MaxLengthAttribute().GetValidationResult(new int[500], s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MaxLengthAttribute(15).GetValidationResult(new string[14], s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MaxLengthAttribute(16).GetValidationResult(new string[16], s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MaxLengthAttribute(-1).GetValidationResult(new object[500], s_testValidationContext));
- Assert.NotNull((new MaxLengthAttribute(12).GetValidationResult(new byte[13], s_testValidationContext)).ErrorMessage);
+ Assert.Equal(ValidationResult.Success, new MaxLengthAttribute(length).GetValidationResult(value, s_testValidationContext));
}
- [Fact]
- public static void GetValidationResult_validates_collection_length()
+ public static IEnumerable<object[]>Invalid_TestData()
{
- Assert.Equal(ValidationResult.Success, new MaxLengthAttribute().GetValidationResult(new Collection<int>(new int[500]), s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MaxLengthAttribute(15).GetValidationResult(new Collection<string>(new string[14]), s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MaxLengthAttribute(16).GetValidationResult(new Collection<string>(new string[16]), s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MaxLengthAttribute(-1).GetValidationResult(new Collection<object>(new object[500]), s_testValidationContext));
- Assert.NotNull((new MaxLengthAttribute(12).GetValidationResult(new Collection<byte>(new byte[13]), s_testValidationContext)).ErrorMessage);
+ yield return new object[] { 12, "OverMaxLength" };
+ yield return new object[] { 12, new byte[13] };
+ yield return new object[] { 12, new Collection<byte>(new byte[13]) };
+ yield return new object[] { 12, new List<byte>(new byte[13]) };
+
+ yield return new object[] { 12, new int[4, 4] };
}
- [Fact]
- public static void GetValidationResult_validates_list_length()
+ [Theory]
+ [MemberData(nameof(Invalid_TestData))]
+ public static void GetValidationResult_InvalidValue_ReturnsNotNull(int length, object value)
{
- Assert.Equal(ValidationResult.Success, new MaxLengthAttribute().GetValidationResult(new List<int>(new int[500]), s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MaxLengthAttribute(15).GetValidationResult(new List<string>(new string[14]), s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MaxLengthAttribute(16).GetValidationResult(new List<string>(new string[16]), s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MaxLengthAttribute(-1).GetValidationResult(new List<object>(new object[500]), s_testValidationContext));
- Assert.NotNull((new MaxLengthAttribute(12).GetValidationResult(new List<byte>(new byte[13]), s_testValidationContext)).ErrorMessage);
+ ValidationResult result = new MaxLengthAttribute(length).GetValidationResult(value, s_testValidationContext);
+ Assert.NotNull(result.ErrorMessage);
}
}
+
+ class GenericICollectionClass : ICollection<int>
+ {
+ public int Count { get; set; }
+ public bool IsReadOnly => false;
+ public void Add(int item) { }
+ public void Clear() { }
+ public bool Contains(int item) => false;
+ public void CopyTo(int[] array, int arrayIndex) { }
+ public IEnumerator<int> GetEnumerator() => new List<int>(new int[Count]).GetEnumerator();
+ public bool Remove(int item) => false;
+ IEnumerator IEnumerable.GetEnumerator() => new List<int>(new int[Count]).GetEnumerator();
+ }
}
diff --git a/src/System.ComponentModel.Annotations/tests/MinLengthAttributeTests.cs b/src/System.ComponentModel.Annotations/tests/MinLengthAttributeTests.cs
index 6b38545daa..e54846c124 100644
--- a/src/System.ComponentModel.Annotations/tests/MinLengthAttributeTests.cs
+++ b/src/System.ComponentModel.Annotations/tests/MinLengthAttributeTests.cs
@@ -2,82 +2,87 @@
// 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.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Xunit;
-namespace System.ComponentModel.DataAnnotations
+namespace System.ComponentModel.DataAnnotations.Tests
{
public class MinLengthAttributeTests
{
private static readonly ValidationContext s_testValidationContext = new ValidationContext(new object());
- [Fact]
- public static void Length_returns_set_length()
+ [Theory]
+ [InlineData(10)]
+ [InlineData(0)]
+ [InlineData(-1)]
+ public static void Ctor(int length)
{
- Assert.Equal(10, new MinLengthAttribute(10).Length);
- Assert.Equal(0, new MinLengthAttribute(0).Length);
-
- // This only throws when GetValidationResult is called
- Assert.Equal(-1, new MinLengthAttribute(-1).Length);
+ Assert.Equal(length, new MinLengthAttribute(length).Length);
}
[Fact]
- public static void GetValidationResult_throws_for_negative_lengths()
+ public static void GetValidationResult_InvalidLength_ThrowsInvalidOperationException()
{
var attribute = new MinLengthAttribute(-1);
- Assert.Throws<InvalidOperationException>(
- () => attribute.GetValidationResult("Rincewind", s_testValidationContext));
+ Assert.Throws<InvalidOperationException>(() => attribute.GetValidationResult("Rincewind", s_testValidationContext));
}
[Fact]
- public static void GetValidationResult_throws_for_object_that_is_not_string_or_array()
+ public static void GetValidationResult_ValueNotStringOrICollection_ThrowsInvalidCastException()
{
- Assert.Throws<InvalidCastException>(
- () => new MinLengthAttribute(0).GetValidationResult(new Random(), s_testValidationContext));
+ Assert.Throws<InvalidCastException>(() => new MinLengthAttribute(0).GetValidationResult(new Random(), s_testValidationContext));
}
[Fact]
- public static void GetValidationResult_returns_success_for_null_target()
+ public static void GetValidationResult_ValueGenericICollection_ThrowsInvalidCastException()
{
- Assert.Equal(ValidationResult.Success, new MinLengthAttribute(10).GetValidationResult(null, s_testValidationContext));
+ Assert.Throws<InvalidCastException>(() => new MinLengthAttribute(0).GetValidationResult(new GenericICollectionClass(), s_testValidationContext));
}
- [Fact]
- public static void GetValidationResult_validates_string_length()
+ public static IEnumerable<object[]> Valid_TestData()
{
- Assert.Equal(ValidationResult.Success, new MinLengthAttribute(0).GetValidationResult(string.Empty, s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MinLengthAttribute(12).GetValidationResult("OverMinLength", s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MinLengthAttribute(16).GetValidationResult("EqualToMinLength", s_testValidationContext));
- Assert.NotNull((new MinLengthAttribute(15).GetValidationResult("UnderMinLength", s_testValidationContext)).ErrorMessage);
+ yield return new object[] { 10, null };
+ yield return new object[] { 0, "" };
+ yield return new object[] { 12, "OverMinLength" };
+ yield return new object[] { 16, "EqualToMinLength" };
+
+ yield return new object[] { 0, new int[0] };
+ yield return new object[] { 12, new int[13] };
+ yield return new object[] { 16, new string[16] };
+
+ yield return new object[] { 0, new Collection<int>(new int[0]) };
+ yield return new object[] { 12, new Collection<int>(new int[13]) };
+ yield return new object[] { 16, new Collection<string>(new string[16]) };
+
+ yield return new object[] { 0, new List<int>(new int[0]) };
+ yield return new object[] { 12, new List<int>(new int[13]) };
+ yield return new object[] { 16, new List<string>(new string[16]) };
}
- [Fact]
- public static void GetValidationResult_validates_array_length()
+ [Theory]
+ [MemberData(nameof(Valid_TestData))]
+ public static void GetValidationResult_ValidValue_ReturnsSuccess(int length, object value)
{
- Assert.Equal(ValidationResult.Success, new MinLengthAttribute(0).GetValidationResult(new int[0], s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MinLengthAttribute(12).GetValidationResult(new int[13], s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MinLengthAttribute(16).GetValidationResult(new string[16], s_testValidationContext));
- Assert.NotNull((new MinLengthAttribute(15).GetValidationResult(new byte[14], s_testValidationContext)).ErrorMessage);
+ Assert.Equal(ValidationResult.Success, new MinLengthAttribute(length).GetValidationResult(value, s_testValidationContext));
}
- [Fact]
- public static void GetValidationResult_validates_collection_length()
+ public static IEnumerable<object[]> Invalid_TestData()
{
- Assert.Equal(ValidationResult.Success, new MinLengthAttribute(0).GetValidationResult(new Collection<int>(new int[0]), s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MinLengthAttribute(12).GetValidationResult(new Collection<int>(new int[13]), s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MinLengthAttribute(16).GetValidationResult(new Collection<string>(new string[16]), s_testValidationContext));
- Assert.NotNull((new MinLengthAttribute(15).GetValidationResult(new Collection<byte>(new byte[14]), s_testValidationContext)).ErrorMessage);
+ yield return new object[] { 15, "UnderMinLength" };
+ yield return new object[] { 15, new byte[14] };
+ yield return new object[] { 15, new Collection<byte>(new byte[14]) };
+ yield return new object[] { 15, new List<byte>(new byte[14]) };
+
+ yield return new object[] { 12, new int[3, 3] };
}
- [Fact]
- public static void GetValidationResult_validates_list_length()
+ [Theory]
+ [MemberData(nameof(Invalid_TestData))]
+ public static void GetValidationResult_InvalidValue_ReturnsNotNull(int length, object value)
{
- Assert.Equal(ValidationResult.Success, new MinLengthAttribute(0).GetValidationResult(new List<int>(new int[0]), s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MinLengthAttribute(12).GetValidationResult(new List<int>(new int[13]), s_testValidationContext));
- Assert.Equal(ValidationResult.Success, new MinLengthAttribute(16).GetValidationResult(new List<string>(new string[16]), s_testValidationContext));
- Assert.NotNull((new MinLengthAttribute(15).GetValidationResult(new List<byte>(new byte[14]), s_testValidationContext)).ErrorMessage);
+ ValidationResult result = new MinLengthAttribute(length).GetValidationResult(value, s_testValidationContext);
+ Assert.NotNull(result.ErrorMessage);
}
}
}
diff --git a/src/System.ComponentModel.EventBasedAsync/dir.props b/src/System.ComponentModel.EventBasedAsync/dir.props
new file mode 100644
index 0000000000..d16ef39bdb
--- /dev/null
+++ b/src/System.ComponentModel.EventBasedAsync/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.12.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.ComponentModel.EventBasedAsync/pkg/System.ComponentModel.EventBasedAsync.pkgproj b/src/System.ComponentModel.EventBasedAsync/pkg/System.ComponentModel.EventBasedAsync.pkgproj
index b638698363..fe586026b6 100644
--- a/src/System.ComponentModel.EventBasedAsync/pkg/System.ComponentModel.EventBasedAsync.pkgproj
+++ b/src/System.ComponentModel.EventBasedAsync/pkg/System.ComponentModel.EventBasedAsync.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.12.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\4.0.0\System.ComponentModel.EventBasedAsync.depproj">
diff --git a/src/System.ComponentModel.EventBasedAsync/pkg/ValidationSuppression.txt b/src/System.ComponentModel.EventBasedAsync/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.ComponentModel.EventBasedAsync/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.ComponentModel.EventBasedAsync/ref/4.0.0/System.ComponentModel.EventBasedAsync.depproj b/src/System.ComponentModel.EventBasedAsync/ref/4.0.0/System.ComponentModel.EventBasedAsync.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.ComponentModel.EventBasedAsync/ref/4.0.0/System.ComponentModel.EventBasedAsync.depproj
+++ b/src/System.ComponentModel.EventBasedAsync/ref/4.0.0/System.ComponentModel.EventBasedAsync.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.ComponentModel.EventBasedAsync/ref/System.ComponentModel.EventBasedAsync.csproj b/src/System.ComponentModel.EventBasedAsync/ref/System.ComponentModel.EventBasedAsync.csproj
index 287042c63d..69ebddea82 100644
--- a/src/System.ComponentModel.EventBasedAsync/ref/System.ComponentModel.EventBasedAsync.csproj
+++ b/src/System.ComponentModel.EventBasedAsync/ref/System.ComponentModel.EventBasedAsync.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.ComponentModel.EventBasedAsync/src/System.ComponentModel.EventBasedAsync.csproj b/src/System.ComponentModel.EventBasedAsync/src/System.ComponentModel.EventBasedAsync.csproj
index 95ee01aa8b..19a236069b 100644
--- a/src/System.ComponentModel.EventBasedAsync/src/System.ComponentModel.EventBasedAsync.csproj
+++ b/src/System.ComponentModel.EventBasedAsync/src/System.ComponentModel.EventBasedAsync.csproj
@@ -5,9 +5,7 @@
<ProjectGuid>{551A6340-8EEF-445E-A2A2-639CC23DBD36}</ProjectGuid>
<RootNamespace>System.ComponentModel.EventBasedAsync</RootNamespace>
<AssemblyName>System.ComponentModel.EventBasedAsync</AssemblyName>
- <AssemblyVersion>4.0.12.0</AssemblyVersion>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.ComponentModel.EventBasedAsync/src/System/ComponentModel/AsyncOperation.cs b/src/System.ComponentModel.EventBasedAsync/src/System/ComponentModel/AsyncOperation.cs
index fe56f63a8d..712d3a4c51 100644
--- a/src/System.ComponentModel.EventBasedAsync/src/System/ComponentModel/AsyncOperation.cs
+++ b/src/System.ComponentModel.EventBasedAsync/src/System/ComponentModel/AsyncOperation.cs
@@ -43,7 +43,6 @@ namespace System.ComponentModel
}
}
- /// <include file='doc\AsyncOperation.uex' path='docs/doc[@for="AsyncOperation.SynchronizationContext"]/*' />
public SynchronizationContext SynchronizationContext
{
get
diff --git a/src/System.ComponentModel.Primitives/dir.props b/src/System.ComponentModel.Primitives/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.ComponentModel.Primitives/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.ComponentModel.Primitives/ref/System.ComponentModel.Primitives.csproj b/src/System.ComponentModel.Primitives/ref/System.ComponentModel.Primitives.csproj
index aa1efdfc5d..4b45ad2dff 100644
--- a/src/System.ComponentModel.Primitives/ref/System.ComponentModel.Primitives.csproj
+++ b/src/System.ComponentModel.Primitives/ref/System.ComponentModel.Primitives.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.ComponentModel.Primitives/src/System.ComponentModel.Primitives.csproj b/src/System.ComponentModel.Primitives/src/System.ComponentModel.Primitives.csproj
index 6addc54d1c..a8bc507c7f 100644
--- a/src/System.ComponentModel.Primitives/src/System.ComponentModel.Primitives.csproj
+++ b/src/System.ComponentModel.Primitives/src/System.ComponentModel.Primitives.csproj
@@ -5,8 +5,6 @@
<ProjectGuid>{F620F382-30D1-451E-B125-2A612F92068B}</ProjectGuid>
<RootNamespace>System.ComponentModel.Primitives</RootNamespace>
<AssemblyName>System.ComponentModel.Primitives</AssemblyName>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)'==''">netstandard1.0</PackageTargetFramework>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net45'">true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.ComponentModel.Primitives/src/System/ComponentModel/EventHandlerList.cs b/src/System.ComponentModel.Primitives/src/System/ComponentModel/EventHandlerList.cs
index af5f7f0180..be508c978a 100644
--- a/src/System.ComponentModel.Primitives/src/System/ComponentModel/EventHandlerList.cs
+++ b/src/System.ComponentModel.Primitives/src/System/ComponentModel/EventHandlerList.cs
@@ -29,7 +29,7 @@ namespace System.ComponentModel
[SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")]
get
{
- ListEntry e = null;
+ ListEntry e = Find(key);
if (e != null)
{
return e.handler;
diff --git a/src/System.ComponentModel.Primitives/tests/EventHandlerListTests.cs b/src/System.ComponentModel.Primitives/tests/EventHandlerListTests.cs
new file mode 100644
index 0000000000..44947f906c
--- /dev/null
+++ b/src/System.ComponentModel.Primitives/tests/EventHandlerListTests.cs
@@ -0,0 +1,177 @@
+// 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 Xunit;
+
+namespace System.ComponentModel.Primitives.Tests
+{
+ public class EventHandlerListTests
+ {
+ [Fact]
+ public void AddHandler_Getter_RemoveHandler_Getter_Roundtrips()
+ {
+ var list = new EventHandlerList();
+
+ // Create two different delegate instances
+ Action a1 = () => Assert.True(false);
+ Action a2 = () => Assert.False(true);
+ Assert.NotSame(a1, a2);
+
+ // Neither entry in the list has a delegate
+ Assert.Null(list["key1"]);
+ Assert.Null(list["key2"]);
+
+ // Add the first delegate to the first entry
+ list.AddHandler("key1", a1);
+ Assert.Same(a1, list["key1"]);
+ Assert.Null(list["key2"]);
+
+ // Add the second delegate to the second entry
+ list.AddHandler("key2", a2);
+ Assert.Same(a1, list["key1"]);
+ Assert.Same(a2, list["key2"]);
+
+ // Then remove the first delegate
+ list.RemoveHandler("key1", a1);
+ Assert.Null(list["key1"]);
+ Assert.Same(a2, list["key2"]);
+
+ // And remove the second delegate
+ list.RemoveHandler("key2", a2);
+ Assert.Null(list["key1"]);
+ Assert.Null(list["key2"]);
+ }
+
+ [Fact]
+ public void AddHandler_MultipleInSameKey_Getter_CombinedDelegates()
+ {
+ var list = new EventHandlerList();
+
+ // Create two delegates that will increase total by different amounts
+ int total = 0;
+ Action a1 = () => total += 1;
+ Action a2 = () => total += 2;
+
+ // Add both delegates for the same key and make sure we get them both out of the indexer
+ list.AddHandler("key1", a1);
+ list.AddHandler("key1", a2);
+ list["key1"].DynamicInvoke();
+ Assert.Equal(3, total);
+
+ // Remove the first delegate and make sure the second delegate can still be retrieved
+ list.RemoveHandler("key1", a1);
+ list["key1"].DynamicInvoke();
+ Assert.Equal(5, total);
+
+ // Remove a delegate that was never in the list; nop
+ list.RemoveHandler("key1", new Action(() => { }));
+ list["key1"].DynamicInvoke();
+ Assert.Equal(7, total);
+
+ // Then remove the second delegate
+ list.RemoveHandler("key1", a2);
+ Assert.Null(list["key1"]);
+ }
+
+ [Fact]
+ public void AddHandlers_Gettable()
+ {
+ var list1 = new EventHandlerList();
+ var list2 = new EventHandlerList();
+
+ int total = 0;
+ Action a1 = () => total += 1;
+ Action a2 = () => total += 2;
+
+ // Add the delegates to separate keys in the first list
+ list1.AddHandler("key1", a1);
+ list1.AddHandler("key2", a2);
+
+ // Then add the first list to the second
+ list2.AddHandlers(list1);
+
+ // And make sure they contain the same entries
+ Assert.Same(list1["key1"], list2["key1"]);
+ Assert.Same(list1["key2"], list2["key2"]);
+ }
+
+ [Fact]
+ public void Dispose_ClearsList()
+ {
+ var list = new EventHandlerList();
+
+ // Create two different delegate instances
+ Action a1 = () => Assert.True(false);
+ Action a2 = () => Assert.False(true);
+ Assert.NotSame(a1, a2);
+
+ // Neither entry in the list has a delegate
+ Assert.Null(list["key1"]);
+ Assert.Null(list["key2"]);
+
+ for (int i = 0; i < 2; i++)
+ {
+ // Add the delegates
+ list.AddHandler("key1", a1);
+ list.AddHandler("key2", a2);
+ Assert.Same(a1, list["key1"]);
+ Assert.Same(a2, list["key2"]);
+
+ // Dispose to clear the list
+ list.Dispose();
+ Assert.Null(list["key1"]);
+ Assert.Null(list["key2"]);
+
+ // List is still usable, though, so loop around to do it again
+ }
+ }
+
+ [Fact]
+ public void Setter_AddsOrOverwrites()
+ {
+ var list = new EventHandlerList();
+
+ int total = 0;
+ Action a1 = () => total += 1;
+ Action a2 = () => total += 2;
+
+ list["key1"] = a1;
+ Assert.Same(a1, list["key1"]);
+
+ list["key2"] = a2;
+ Assert.Same(a2, list["key2"]);
+
+ list["key2"] = a1;
+ Assert.Same(a1, list["key1"]);
+ }
+
+ [Fact]
+ public void RemoveHandler_EmptyList_Nop()
+ {
+ var list = new EventHandlerList();
+ list.RemoveHandler("key1", new Action(() => { })); // no error
+ }
+
+ [Fact]
+ public void NullKey_Valid()
+ {
+ var list = new EventHandlerList();
+
+ int total = 0;
+ Action a1 = () => total += 1;
+
+ list[null] = a1;
+ Assert.Same(a1, list[null]);
+ }
+
+ [Fact]
+ public void NullValue_Nop()
+ {
+ var list = new EventHandlerList();
+
+ list["key1"] = null;
+ Assert.Null(list["key1"]);
+ }
+ }
+}
diff --git a/src/System.ComponentModel.Primitives/tests/System.ComponentModel.Primitives.Tests.csproj b/src/System.ComponentModel.Primitives/tests/System.ComponentModel.Primitives.Tests.csproj
index 5866438b7b..49517ea1f9 100644
--- a/src/System.ComponentModel.Primitives/tests/System.ComponentModel.Primitives.Tests.csproj
+++ b/src/System.ComponentModel.Primitives/tests/System.ComponentModel.Primitives.Tests.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
@@ -22,6 +22,7 @@
<Compile Include="DescriptionAttributeTests.cs" />
<Compile Include="DesignerCategoryAttributeTests.cs" />
<Compile Include="DesignerSerializationVisibilityAttributeTests.cs" />
+ <Compile Include="EventHandlerListTests.cs" />
<Compile Include="DesignOnlyAttributeTests.cs" />
<Compile Include="DisplayNameAttributeTests.cs" />
<Compile Include="ImmutableObjectAttributeTests.cs" />
diff --git a/src/System.ComponentModel.TypeConverter/dir.props b/src/System.ComponentModel.TypeConverter/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.ComponentModel.TypeConverter/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.ComponentModel.TypeConverter/ref/4.0/System.ComponentModel.TypeConverter.depproj b/src/System.ComponentModel.TypeConverter/ref/4.0/System.ComponentModel.TypeConverter.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.ComponentModel.TypeConverter/ref/4.0/System.ComponentModel.TypeConverter.depproj
+++ b/src/System.ComponentModel.TypeConverter/ref/4.0/System.ComponentModel.TypeConverter.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.csproj b/src/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.csproj
index 5e55998a88..4017d64217 100644
--- a/src/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.csproj
+++ b/src/System.ComponentModel.TypeConverter/ref/System.ComponentModel.TypeConverter.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.5</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.5</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.ComponentModel.TypeConverter/src/System.ComponentModel.TypeConverter.csproj b/src/System.ComponentModel.TypeConverter/src/System.ComponentModel.TypeConverter.csproj
index 944e6df8f7..d632da0a0b 100644
--- a/src/System.ComponentModel.TypeConverter/src/System.ComponentModel.TypeConverter.csproj
+++ b/src/System.ComponentModel.TypeConverter/src/System.ComponentModel.TypeConverter.csproj
@@ -5,10 +5,8 @@
<ProjectGuid>{AF3EBF3B-526A-4B51-9F3D-62B0113CD01F}</ProjectGuid>
<RootNamespace>System.ComponentModel.TypeConverter</RootNamespace>
<AssemblyName>System.ComponentModel.TypeConverter</AssemblyName>
- <AssemblyVersion Condition="'$(TargetGroup)' == '' OR '$(TargetGroup)'=='net462'">4.1.1.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)' == 'netstandard1.0' OR '$(TargetGroup)'=='net45'">4.0.0.0</AssemblyVersion>
<ContractProject Condition="'$(TargetGroup)' == 'netstandard1.0' OR '$(TargetGroup)'=='net45'">..\ref\4.0\$(AssemblyName).depproj</ContractProject>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)'==''">netstandard1.5</PackageTargetFramework>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net45' OR '$(TargetGroup)'=='net462'">true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.5</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/AttributeProviderAttribute.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/AttributeProviderAttribute.cs
index 41b41b2b92..ba396d8e3d 100644
--- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/AttributeProviderAttribute.cs
+++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/AttributeProviderAttribute.cs
@@ -4,7 +4,6 @@
namespace System.ComponentModel
{
- /// <include file='doc\AttributeProviderAttribute.uex' path='docs/doc[@for="AttributeProviderAttribute"]/*' />
/// <summary>
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
@@ -14,7 +13,6 @@ namespace System.ComponentModel
private readonly string _typeName;
private readonly string _propertyName;
- /// <include file='doc\AttributeProviderAttribute.uex' path='docs/doc[@for="AttributeProviderAttribute.AttributeProviderAttribute"]/*' />
/// <summary>
/// Creates a new AttributeProviderAttribute object.
/// </summary>
@@ -28,7 +26,6 @@ namespace System.ComponentModel
_typeName = typeName;
}
- /// <include file='doc\AttributeProviderAttribute.uex' path='docs/doc[@for="AttributeProviderAttribute.AttributeProviderAttribute"]/*' />
/// <summary>
/// Creates a new AttributeProviderAttribute object.
/// </summary>
@@ -47,7 +44,6 @@ namespace System.ComponentModel
_propertyName = propertyName;
}
- /// <include file='doc\AttributeProviderAttribute.uex' path='docs/doc[@for="AttributeProviderAttribute.AttributeProviderAttribute1"]/*' />
/// <summary>
/// Creates a new AttributeProviderAttribute object.
/// </summary>
@@ -61,7 +57,6 @@ namespace System.ComponentModel
_typeName = type.AssemblyQualifiedName;
}
- /// <include file='doc\AttributeProviderAttribute.uex' path='docs/doc[@for="AttributeProviderAttribute.TypeName"]/*' />
/// <summary>
/// The TypeName property returns the assembly qualified type name
/// passed into the constructor.
@@ -74,7 +69,6 @@ namespace System.ComponentModel
}
}
- /// <include file='doc\AttributeProviderAttribute.uex' path='docs/doc[@for="AttributeProviderAttribute.TypeName"]/*' />
/// <summary>
/// The TypeName property returns the property name that will be used to query attributes from.
/// </summary>
diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MemberDescriptor.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MemberDescriptor.cs
index 468bac7bd6..03d3654d2a 100644
--- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MemberDescriptor.cs
+++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MemberDescriptor.cs
@@ -304,7 +304,6 @@ namespace System.ComponentModel
}
}
- /// <include file='doc\MemberDescriptor.uex' path='docs/doc[@for="MemberDescriptor.CreateAttributeCollection"]/*' />
/// <summary>
/// <para>
/// Creates a collection of attributes using the
diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/NullableConverter.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/NullableConverter.cs
index 9b00e6f839..ed587bf473 100644
--- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/NullableConverter.cs
+++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/NullableConverter.cs
@@ -125,7 +125,6 @@ namespace System.ComponentModel
return base.ConvertTo(context, culture, value, destinationType);
}
- /// <include file='doc\NullableConverter.uex' path='docs/doc[@for="NullableConverter.CreateInstance"]/*' />
/// <summary>
/// </summary>
public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/PropertyDescriptor.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/PropertyDescriptor.cs
index c3bccfb9e0..7f68e0b103 100644
--- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/PropertyDescriptor.cs
+++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/PropertyDescriptor.cs
@@ -247,7 +247,6 @@ namespace System.ComponentModel
base.FillAttributes(attributeList);
}
- /// <include file='doc\PropertyDescriptor.uex' path='docs/doc[@for="PropertyDescriptor.GetChildProperties"]/*' />
/// <summary>
/// <para>[To be supplied.]</para>
/// </summary>
diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs
index eac540d848..4d1987d415 100644
--- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs
+++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs
@@ -103,7 +103,6 @@ namespace System.ComponentModel
}
}
- /// <include file='doc\TypeDescriptor.uex' path='docs/doc[@for="TypeDescriptor.Refreshed"]/*' />
/// <summary>
/// Occurs when Refreshed is raised for a component.
/// </summary>
diff --git a/src/System.ComponentModel/dir.props b/src/System.ComponentModel/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.ComponentModel/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.ComponentModel/pkg/System.ComponentModel.pkgproj b/src/System.ComponentModel/pkg/System.ComponentModel.pkgproj
index 91448b0142..ee35e4ee40 100644
--- a/src/System.ComponentModel/pkg/System.ComponentModel.pkgproj
+++ b/src/System.ComponentModel/pkg/System.ComponentModel.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.ComponentModel.csproj">
diff --git a/src/System.ComponentModel/pkg/ValidationSuppression.txt b/src/System.ComponentModel/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.ComponentModel/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.ComponentModel/ref/System.ComponentModel.csproj b/src/System.ComponentModel/ref/System.ComponentModel.csproj
index 31167afbb6..315be498d5 100644
--- a/src/System.ComponentModel/ref/System.ComponentModel.csproj
+++ b/src/System.ComponentModel/ref/System.ComponentModel.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.ComponentModel/src/System.ComponentModel.csproj b/src/System.ComponentModel/src/System.ComponentModel.csproj
index a88c2812a4..46a5ff5e9f 100644
--- a/src/System.ComponentModel/src/System.ComponentModel.csproj
+++ b/src/System.ComponentModel/src/System.ComponentModel.csproj
@@ -5,10 +5,8 @@
<ProjectGuid>{AF3EBF3B-526A-4B51-9F3D-62B0113CD01F}</ProjectGuid>
<RootNamespace>System.ComponentModel</RootNamespace>
<AssemblyName>System.ComponentModel</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Composition.AttributedModel/dir.props b/src/System.Composition.AttributedModel/dir.props
new file mode 100644
index 0000000000..eb20696627
--- /dev/null
+++ b/src/System.Composition.AttributedModel/dir.props
@@ -0,0 +1,8 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <PackageVersion>1.0.31</PackageVersion>
+ <AssemblyVersion>1.0.31.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Composition.AttributedModel/src/System.Composition.AttributedModel.csproj b/src/System.Composition.AttributedModel/src/System.Composition.AttributedModel.csproj
index 9d49c37c37..9ce8707493 100644
--- a/src/System.Composition.AttributedModel/src/System.Composition.AttributedModel.csproj
+++ b/src/System.Composition.AttributedModel/src/System.Composition.AttributedModel.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
@@ -6,16 +6,8 @@
<RootNamespace>System.Composition</RootNamespace>
<AssemblyName>System.Composition.AttributedModel</AssemblyName>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
- <AssemblyVersion>1.0.31.0</AssemblyVersion>
+ <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.0;portable-net45+win8+wp8+wpa81</PackageTargetFramework>
</PropertyGroup>
- <ItemGroup Condition="'$(PackageTargetFramework)' == ''">
- <PackageDestination Include="lib/netstandard1.0">
- <TargetFramework>netstandard1.0</TargetFramework>
- </PackageDestination>
- <PackageDestination Include="lib/portable-net45+win8+wp8+wpa81">
- <TargetFramework>portable-net45+win8+wp8+wpa81</TargetFramework>
- </PackageDestination>
- </ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
<ItemGroup>
@@ -34,4 +26,4 @@
<Compile Include="System\Composition\SharingBoundaryAttribute.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/System.Composition.Convention/dir.props b/src/System.Composition.Convention/dir.props
new file mode 100644
index 0000000000..eb20696627
--- /dev/null
+++ b/src/System.Composition.Convention/dir.props
@@ -0,0 +1,8 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <PackageVersion>1.0.31</PackageVersion>
+ <AssemblyVersion>1.0.31.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Composition.Convention/src/System.Composition.Convention.csproj b/src/System.Composition.Convention/src/System.Composition.Convention.csproj
index 027effaadf..210c486799 100644
--- a/src/System.Composition.Convention/src/System.Composition.Convention.csproj
+++ b/src/System.Composition.Convention/src/System.Composition.Convention.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
@@ -6,16 +6,8 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<AssemblyName>System.Composition.Convention</AssemblyName>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
- <AssemblyVersion>1.0.31.0</AssemblyVersion>
+ <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.0;portable-net45+win8+wp8+wpa81</PackageTargetFramework>
</PropertyGroup>
- <ItemGroup Condition="'$(PackageTargetFramework)' == ''">
- <PackageDestination Include="lib/netstandard1.0">
- <TargetFramework>netstandard1.0</TargetFramework>
- </PackageDestination>
- <PackageDestination Include="lib/portable-net45+win8+wp8+wpa81">
- <TargetFramework>portable-net45+win8+wp8+wpa81</TargetFramework>
- </PackageDestination>
- </ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
<ItemGroup>
@@ -70,4 +62,4 @@
</ProjectReference>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/System.Composition.Hosting/dir.props b/src/System.Composition.Hosting/dir.props
new file mode 100644
index 0000000000..eb20696627
--- /dev/null
+++ b/src/System.Composition.Hosting/dir.props
@@ -0,0 +1,8 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <PackageVersion>1.0.31</PackageVersion>
+ <AssemblyVersion>1.0.31.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Composition.Hosting/src/System.Composition.Hosting.csproj b/src/System.Composition.Hosting/src/System.Composition.Hosting.csproj
index 916ee3c526..f65a6d2ed6 100644
--- a/src/System.Composition.Hosting/src/System.Composition.Hosting.csproj
+++ b/src/System.Composition.Hosting/src/System.Composition.Hosting.csproj
@@ -1,20 +1,12 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<ProjectGuid>{2B8FECC6-34A1-48FE-BA75-99572D2D6DB2}</ProjectGuid>
<AssemblyName>System.Composition.Hosting</AssemblyName>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
- <AssemblyVersion>1.0.31.0</AssemblyVersion>
+ <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.0;portable-net45+win8+wp8+wpa81</PackageTargetFramework>
</PropertyGroup>
- <ItemGroup Condition="'$(PackageTargetFramework)' == ''">
- <PackageDestination Include="lib/netstandard1.0">
- <TargetFramework>netstandard1.0</TargetFramework>
- </PackageDestination>
- <PackageDestination Include="lib/portable-net45+win8+wp8+wpa81">
- <TargetFramework>portable-net45+win8+wp8+wpa81</TargetFramework>
- </PackageDestination>
- </ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
<ItemGroup>
@@ -90,4 +82,4 @@
</EmbeddedResource>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/System.Composition.Runtime/dir.props b/src/System.Composition.Runtime/dir.props
new file mode 100644
index 0000000000..eb20696627
--- /dev/null
+++ b/src/System.Composition.Runtime/dir.props
@@ -0,0 +1,8 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <PackageVersion>1.0.31</PackageVersion>
+ <AssemblyVersion>1.0.31.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Composition.Runtime/src/System.Composition.Runtime.csproj b/src/System.Composition.Runtime/src/System.Composition.Runtime.csproj
index 75cc166b42..9d089ad461 100644
--- a/src/System.Composition.Runtime/src/System.Composition.Runtime.csproj
+++ b/src/System.Composition.Runtime/src/System.Composition.Runtime.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
@@ -6,16 +6,8 @@
<RootNamespace>System.Composition</RootNamespace>
<AssemblyName>System.Composition.Runtime</AssemblyName>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
- <AssemblyVersion>1.0.31.0</AssemblyVersion>
+ <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.0;portable-net45+win8+wp8+wpa81</PackageTargetFramework>
</PropertyGroup>
- <ItemGroup Condition="'$(PackageTargetFramework)' == ''">
- <PackageDestination Include="lib/netstandard1.0">
- <TargetFramework>netstandard1.0</TargetFramework>
- </PackageDestination>
- <PackageDestination Include="lib/portable-net45+win8+wp8+wpa81">
- <TargetFramework>portable-net45+win8+wp8+wpa81</TargetFramework>
- </PackageDestination>
- </ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
<ItemGroup>
@@ -39,4 +31,4 @@
<Compile Include="System\Composition\Runtime\Util\Formatters.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/System.Composition.TypedParts/dir.props b/src/System.Composition.TypedParts/dir.props
new file mode 100644
index 0000000000..eb20696627
--- /dev/null
+++ b/src/System.Composition.TypedParts/dir.props
@@ -0,0 +1,8 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <PackageVersion>1.0.31</PackageVersion>
+ <AssemblyVersion>1.0.31.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Composition.TypedParts/src/System.Composition.TypedParts.csproj b/src/System.Composition.TypedParts/src/System.Composition.TypedParts.csproj
index 15be6e5610..5d6934bea1 100644
--- a/src/System.Composition.TypedParts/src/System.Composition.TypedParts.csproj
+++ b/src/System.Composition.TypedParts/src/System.Composition.TypedParts.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
@@ -6,16 +6,8 @@
<RootNamespace>System.Composition</RootNamespace>
<AssemblyName>System.Composition.TypedParts</AssemblyName>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
- <AssemblyVersion>1.0.31.0</AssemblyVersion>
+ <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.0;portable-net45+win8+wp8+wpa81</PackageTargetFramework>
</PropertyGroup>
- <ItemGroup Condition="'$(PackageTargetFramework)' == ''">
- <PackageDestination Include="lib/netstandard1.0">
- <TargetFramework>netstandard1.0</TargetFramework>
- </PackageDestination>
- <PackageDestination Include="lib/portable-net45+win8+wp8+wpa81">
- <TargetFramework>portable-net45+win8+wp8+wpa81</TargetFramework>
- </PackageDestination>
- </ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
<PropertyGroup>
@@ -73,4 +65,4 @@
</EmbeddedResource>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/System.Composition/dir.props b/src/System.Composition/dir.props
new file mode 100644
index 0000000000..eb20696627
--- /dev/null
+++ b/src/System.Composition/dir.props
@@ -0,0 +1,8 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <PackageVersion>1.0.31</PackageVersion>
+ <AssemblyVersion>1.0.31.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Composition/pkg/System.Composition.pkgproj b/src/System.Composition/pkg/System.Composition.pkgproj
index 49051215b3..5f621a5e22 100644
--- a/src/System.Composition/pkg/System.Composition.pkgproj
+++ b/src/System.Composition/pkg/System.Composition.pkgproj
@@ -2,10 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Version>1.0.31</Version>
- </PropertyGroup>
-
<ItemGroup>
<ProjectReference Include="..\..\System.Composition.AttributedModel\pkg\System.Composition.AttributedModel.pkgproj" />
<ProjectReference Include="..\..\System.Composition.Convention\pkg\System.Composition.Convention.pkgproj" />
diff --git a/src/System.Console/dir.props b/src/System.Console/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Console/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Console/ref/System.Console.csproj b/src/System.Console/ref/System.Console.csproj
index 7d942b245e..0976202e9f 100644
--- a/src/System.Console/ref/System.Console.csproj
+++ b/src/System.Console/ref/System.Console.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Console/src/System.Console.csproj b/src/System.Console/src/System.Console.csproj
index 1c458b7e78..4c15c3e9f1 100644
--- a/src/System.Console/src/System.Console.csproj
+++ b/src/System.Console/src/System.Console.csproj
@@ -8,12 +8,10 @@
<ProjectGuid>{F9DF2357-81B4-4317-908E-512DA9395583}</ProjectGuid>
<RootNamespace>System.Console</RootNamespace>
<AssemblyName>System.Console</AssemblyName>
- <AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)'=='netstandard1.3' OR '$(TargetGroup)'=='net46' OR '$(TargetGroup)'=='netcore50'">4.0.1.0</AssemblyVersion>
<ContractProject Condition="'$(AssemblyVersion)'=='4.0.1.0'">../ref/4.0.0/System.Console.depproj</ContractProject>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46' OR '$(TargetGroup)' == 'net463'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)'==''">netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup Condition="'$(TargetGroup)'=='netstandard1.3'">
diff --git a/src/System.Console/src/System/ConsolePal.Windows.cs b/src/System.Console/src/System/ConsolePal.Windows.cs
index 691adba63b..98c4e51ca8 100644
--- a/src/System.Console/src/System/ConsolePal.Windows.cs
+++ b/src/System.Console/src/System/ConsolePal.Windows.cs
@@ -914,7 +914,7 @@ namespace System
get
{
Interop.mincore.CONSOLE_SCREEN_BUFFER_INFO csbi = GetBufferInfo();
- return csbi.srWindow.Left;
+ return csbi.srWindow.Top;
}
set
{
diff --git a/src/System.Data.Common/dir.props b/src/System.Data.Common/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.Data.Common/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Data.Common/pkg/System.Data.Common.pkgproj b/src/System.Data.Common/pkg/System.Data.Common.pkgproj
index 708805fca2..279fc2aef6 100644
--- a/src/System.Data.Common/pkg/System.Data.Common.pkgproj
+++ b/src/System.Data.Common/pkg/System.Data.Common.pkgproj
@@ -18,5 +18,10 @@
<InboxOnTargetFramework Include="xamarintvos10" />
<InboxOnTargetFramework Include="xamarinwatchos10" />
</ItemGroup>
+ <ItemGroup>
+ <ValidatePackageSuppression Include="SuppressNETStandardInference">
+ <Value>.NETCore,Version=v4.5;WindowsPhone,Version=v8.0</Value>
+ </ValidatePackageSuppression>
+ </ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project> \ No newline at end of file
diff --git a/src/System.Data.Common/pkg/ValidationSuppression.txt b/src/System.Data.Common/pkg/ValidationSuppression.txt
deleted file mode 100644
index 9cecbaeedc..0000000000
--- a/src/System.Data.Common/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-PermitImplementation=.NETCore,Version=v4.5;WindowsPhone,Version=v8.0
-SuppressNETStandardInference=.NETCore,Version=v4.5;WindowsPhone,Version=v8.0 \ No newline at end of file
diff --git a/src/System.Data.Common/ref/System.Data.Common.csproj b/src/System.Data.Common/ref/System.Data.Common.csproj
index 6452b9f07c..55dc10a259 100644
--- a/src/System.Data.Common/ref/System.Data.Common.csproj
+++ b/src/System.Data.Common/ref/System.Data.Common.csproj
@@ -2,18 +2,10 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
+ <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.2;portable-net451+win8+wp8+wpa81</PackageTargetFramework>
</PropertyGroup>
- <ItemGroup Condition="'$(PackageTargetFramework)' == ''">
- <PackageDestination Include="ref/netstandard1.2">
- <TargetFramework>netstandard1.2</TargetFramework>
- </PackageDestination>
- <PackageDestination Include="ref/portable-net451+win8+wp8+wpa81">
- <TargetFramework>portable-net451+win8+wp8+wpa81</TargetFramework>
- </PackageDestination>
- </ItemGroup>
<ItemGroup>
<Compile Include="System.Data.Common.cs" />
<Compile Include="System.Data.Common.Manual.cs" />
diff --git a/src/System.Data.Common/src/System.Data.Common.csproj b/src/System.Data.Common/src/System.Data.Common.csproj
index c328ed0bad..b29a72e03c 100644
--- a/src/System.Data.Common/src/System.Data.Common.csproj
+++ b/src/System.Data.Common/src/System.Data.Common.csproj
@@ -4,20 +4,12 @@
<PropertyGroup>
<ProjectGuid>{29EF8D53-8E84-4E49-B90F-5950A2FE7D54}</ProjectGuid>
<AssemblyName>System.Data.Common</AssemblyName>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>AnyCPU</PlatformTarget>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
+ <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.2;portable-net451+win8+wp8+wpa81</PackageTargetFramework>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net451'">true</IsPartialFacadeAssembly>
</PropertyGroup>
- <ItemGroup Condition="'$(PackageTargetFramework)' == ''">
- <PackageDestination Include="lib/netstandard1.2">
- <TargetFramework>netstandard1.2</TargetFramework>
- </PackageDestination>
- <PackageDestination Include="lib/portable-net451+win8+wp8+wpa81">
- <TargetFramework>portable-net451+win8+wp8+wpa81</TargetFramework>
- </PackageDestination>
- </ItemGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
diff --git a/src/System.Data.SqlClient/System.Data.SqlClient.sln b/src/System.Data.SqlClient/System.Data.SqlClient.sln
index cac28999f3..c8d8963565 100644
--- a/src/System.Data.SqlClient/System.Data.SqlClient.sln
+++ b/src/System.Data.SqlClient/System.Data.SqlClient.sln
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
-VisualStudioVersion = 14.0.24720.0
+VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SqlClient", "src\System.Data.SqlClient.csproj", "{D4550556-4745-457F-BA8F-3EBF3836D6B4}"
EndProject
@@ -10,6 +10,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SqlClient.Tests
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SqlClient.ManualTesting.Tests", "tests\ManualTests\System.Data.SqlClient.ManualTesting.Tests.csproj", "{45DB5F86-7AE3-45C6-870D-F9357B66BDB5}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "stresstest", "tests\stress\StressTest\stresstest.csproj", "{529B187A-DE4F-4F4D-9FBB-D3D416FDB683}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -52,6 +54,18 @@ Global
{45DB5F86-7AE3-45C6-870D-F9357B66BDB5}.Windows_Debug|Any CPU.Build.0 = Windows_Debug|Any CPU
{45DB5F86-7AE3-45C6-870D-F9357B66BDB5}.Windows_Release|Any CPU.ActiveCfg = Windows_Release|Any CPU
{45DB5F86-7AE3-45C6-870D-F9357B66BDB5}.Windows_Release|Any CPU.Build.0 = Windows_Release|Any CPU
+ {529B187A-DE4F-4F4D-9FBB-D3D416FDB683}.Debug|Any CPU.ActiveCfg = Windows_Debug|Any CPU
+ {529B187A-DE4F-4F4D-9FBB-D3D416FDB683}.Debug|Any CPU.Build.0 = Windows_Debug|Any CPU
+ {529B187A-DE4F-4F4D-9FBB-D3D416FDB683}.Release|Any CPU.ActiveCfg = Windows_Release|Any CPU
+ {529B187A-DE4F-4F4D-9FBB-D3D416FDB683}.Release|Any CPU.Build.0 = Windows_Release|Any CPU
+ {529B187A-DE4F-4F4D-9FBB-D3D416FDB683}.Unix_Debug|Any CPU.ActiveCfg = Unix_Debug|Any CPU
+ {529B187A-DE4F-4F4D-9FBB-D3D416FDB683}.Unix_Debug|Any CPU.Build.0 = Unix_Debug|Any CPU
+ {529B187A-DE4F-4F4D-9FBB-D3D416FDB683}.Unix_Release|Any CPU.ActiveCfg = Unix_Release|Any CPU
+ {529B187A-DE4F-4F4D-9FBB-D3D416FDB683}.Unix_Release|Any CPU.Build.0 = Unix_Release|Any CPU
+ {529B187A-DE4F-4F4D-9FBB-D3D416FDB683}.Windows_Debug|Any CPU.ActiveCfg = Windows_Debug|Any CPU
+ {529B187A-DE4F-4F4D-9FBB-D3D416FDB683}.Windows_Debug|Any CPU.Build.0 = Windows_Debug|Any CPU
+ {529B187A-DE4F-4F4D-9FBB-D3D416FDB683}.Windows_Release|Any CPU.ActiveCfg = Windows_Release|Any CPU
+ {529B187A-DE4F-4F4D-9FBB-D3D416FDB683}.Windows_Release|Any CPU.Build.0 = Windows_Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/System.Data.SqlClient/dir.props b/src/System.Data.SqlClient/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.Data.SqlClient/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Data.SqlClient/ref/4.0/System.Data.SqlClient.depproj b/src/System.Data.SqlClient/ref/4.0/System.Data.SqlClient.depproj
index 07d7940da2..24b1450138 100644
--- a/src/System.Data.SqlClient/ref/4.0/System.Data.SqlClient.depproj
+++ b/src/System.Data.SqlClient/ref/4.0/System.Data.SqlClient.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.2</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.2</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Data.SqlClient/ref/System.Data.SqlClient.csproj b/src/System.Data.SqlClient/ref/System.Data.SqlClient.csproj
index 02f36817bb..319c664454 100644
--- a/src/System.Data.SqlClient/ref/System.Data.SqlClient.csproj
+++ b/src/System.Data.SqlClient/ref/System.Data.SqlClient.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Data.SqlClient/src/Interop/SNINativeMethodWrapper.Windows.cs b/src/System.Data.SqlClient/src/Interop/SNINativeMethodWrapper.Windows.cs
index 43581de89b..c3a5ee7b72 100644
--- a/src/System.Data.SqlClient/src/Interop/SNINativeMethodWrapper.Windows.cs
+++ b/src/System.Data.SqlClient/src/Interop/SNINativeMethodWrapper.Windows.cs
@@ -13,6 +13,8 @@ namespace System.Data.SqlClient
private static int s_sniMaxComposedSpnLength = -1;
+ private const int SniOpenTimeOut = -1; // infinite
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void SqlAsyncCallbackDelegate(IntPtr m_ConsKey, IntPtr pPacket, uint dwError);
@@ -116,6 +118,13 @@ namespace System.Data.SqlClient
SNI_QUERY_CONN_SUPPORTS_SYNC_OVER_ASYNC,
}
+ internal enum TransparentNetworkResolutionMode : byte
+ {
+ DisabledMode = 0,
+ SequentialMode,
+ ParallelMode
+ };
+
[StructLayout(LayoutKind.Sequential)]
private struct Sni_Consumer_Info
{
@@ -127,7 +136,7 @@ namespace System.Data.SqlClient
public IntPtr fnAcceptComp;
public uint dwNumProts;
public IntPtr rgListenInfo;
- public uint NodeAffinity;
+ public IntPtr NodeAffinity;
}
[StructLayout(LayoutKind.Sequential)]
@@ -148,6 +157,9 @@ namespace System.Data.SqlClient
public int timeout;
[MarshalAs(UnmanagedType.Bool)]
public bool fParallel;
+ public TransparentNetworkResolutionMode transparentNetworkResolution;
+ public int totalTimeout;
+ public bool isAzureSqlServerEndpoint;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
diff --git a/src/System.Data.SqlClient/src/System.Data.SqlClient.csproj b/src/System.Data.SqlClient/src/System.Data.SqlClient.csproj
index dfda7aa773..6745a969f9 100644
--- a/src/System.Data.SqlClient/src/System.Data.SqlClient.csproj
+++ b/src/System.Data.SqlClient/src/System.Data.SqlClient.csproj
@@ -8,12 +8,9 @@
<ProjectGuid>{D4550556-4745-457F-BA8F-3EBF3836D6B4}</ProjectGuid>
<AssemblyName>System.Data.SqlClient</AssemblyName>
<AssemblyVersion Condition="'$(TargetGroup)' == 'net451'">4.0.0.0</AssemblyVersion>
- <AssemblyVersion Condition="'$(TargetGroup)' != 'net451'">4.1.1.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ContractProject Condition="'$(AssemblyVersion)' == '4.0.0.0'">..\ref\4.0\System.Data.SqlClient.depproj</ContractProject>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net451' OR '$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(TargetGroup)' == 'net451'">net451</PackageTargetFramework>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetsWindows)' != 'true' ">
diff --git a/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNINpHandle.cs b/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNINpHandle.cs
index 5551dae157..2dccfe2880 100644
--- a/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNINpHandle.cs
+++ b/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNINpHandle.cs
@@ -1,3 +1,7 @@
+// 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.IO;
using System.IO.Pipes;
using System.Net.Security;
diff --git a/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlClientDiagnosticListenerExtensions.cs b/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlClientDiagnosticListenerExtensions.cs
index 3da3d8102f..6f714f0344 100644
--- a/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlClientDiagnosticListenerExtensions.cs
+++ b/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlClientDiagnosticListenerExtensions.cs
@@ -1,4 +1,8 @@
-using System.Collections;
+// 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.Collections;
using System.Diagnostics;
using System.Runtime.CompilerServices;
diff --git a/src/System.Data.SqlClient/tests/FunctionalTests/DiagnosticTest.cs b/src/System.Data.SqlClient/tests/FunctionalTests/DiagnosticTest.cs
index 11a766e4c5..9dcf4c8549 100644
--- a/src/System.Data.SqlClient/tests/FunctionalTests/DiagnosticTest.cs
+++ b/src/System.Data.SqlClient/tests/FunctionalTests/DiagnosticTest.cs
@@ -1,4 +1,8 @@
-using Xunit;
+// 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 Xunit;
using System.Reflection;
using System.Diagnostics;
using System.Collections;
diff --git a/src/System.Data.SqlClient/tests/FunctionalTests/FakeDiagnosticListenerObserver.cs b/src/System.Data.SqlClient/tests/FunctionalTests/FakeDiagnosticListenerObserver.cs
index 8d448bac3b..f9f6e9264a 100644
--- a/src/System.Data.SqlClient/tests/FunctionalTests/FakeDiagnosticListenerObserver.cs
+++ b/src/System.Data.SqlClient/tests/FunctionalTests/FakeDiagnosticListenerObserver.cs
@@ -1,4 +1,8 @@
-using System;
+// 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.Collections.Generic;
using System.Linq;
using System.Text;
diff --git a/src/System.Data.SqlClient/tests/ManualTests/DataCommon/CheckConnStrSetupFactAttribute.cs b/src/System.Data.SqlClient/tests/ManualTests/DataCommon/CheckConnStrSetupFactAttribute.cs
index 8629acb221..a23817aa79 100644
--- a/src/System.Data.SqlClient/tests/ManualTests/DataCommon/CheckConnStrSetupFactAttribute.cs
+++ b/src/System.Data.SqlClient/tests/ManualTests/DataCommon/CheckConnStrSetupFactAttribute.cs
@@ -1,4 +1,8 @@
-using System;
+// 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.Collections.Generic;
using System.Linq;
using System.Text;
diff --git a/src/System.Data.SqlClient/tests/ManualTests/SQL/SplitPacketTest/SplitPacketTest.cs b/src/System.Data.SqlClient/tests/ManualTests/SQL/SplitPacketTest/SplitPacketTest.cs
index 572a04de32..0790abbd45 100644
--- a/src/System.Data.SqlClient/tests/ManualTests/SQL/SplitPacketTest/SplitPacketTest.cs
+++ b/src/System.Data.SqlClient/tests/ManualTests/SQL/SplitPacketTest/SplitPacketTest.cs
@@ -1,3 +1,7 @@
+// 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.Net;
using System.Net.Sockets;
diff --git a/src/System.Data.SqlClient/tests/StressTests/IMonitorLoader/IMonitorLoader.cs b/src/System.Data.SqlClient/tests/StressTests/IMonitorLoader/IMonitorLoader.cs
new file mode 100644
index 0000000000..5a9dc16880
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/IMonitorLoader/IMonitorLoader.cs
@@ -0,0 +1,33 @@
+// 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.Collections.Generic;
+using Monitoring;
+
+namespace Monitoring
+{
+ public interface IMonitorLoader
+ {
+ string HostMachine { get; set; }
+ string AssemblyPath { get; set; }
+ string TestName { get; set; }
+ bool Enabled { get; set; }
+
+ void Action(MonitorLoaderUtils.MonitorAction monitoraction);
+ void AddPerfData(MonitorMetrics data);
+ Dictionary<string, MonitorMetrics> GetPerfData();
+ }
+
+ public class MonitorLoaderUtils
+ {
+ public enum MonitorAction
+ {
+ Initialize,
+ Start,
+ Stop,
+ DoNothing
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/IMonitorLoader/IMonitorLoader.csproj b/src/System.Data.SqlClient/tests/StressTests/IMonitorLoader/IMonitorLoader.csproj
new file mode 100644
index 0000000000..801b389001
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/IMonitorLoader/IMonitorLoader.csproj
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <ProjectGuid>{AF78BA88-6428-47EA-8682-442DAF8E9656}</ProjectGuid>
+ <RootNamespace>Monitoring</RootNamespace>
+ <AssemblyName>Monitoring</AssemblyName>
+ <OutputType>Library</OutputType>
+ <NugetTargetMoniker>.NETStandard,Version=v1.3</NugetTargetMoniker>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Unix_Debug|AnyCPU'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Unix_Release|AnyCPU'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Windows_Debug|AnyCPU'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Windows_Release|AnyCPU'" />
+ <ItemGroup>
+ <Compile Include="IMonitorLoader.cs" />
+ <Compile Include="MonitorMetrics.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <!--Import the targets-->
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/System.Data.SqlClient/tests/StressTests/IMonitorLoader/MonitorMetrics.cs b/src/System.Data.SqlClient/tests/StressTests/IMonitorLoader/MonitorMetrics.cs
new file mode 100644
index 0000000000..ed37544e4e
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/IMonitorLoader/MonitorMetrics.cs
@@ -0,0 +1,96 @@
+// 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;
+
+namespace Monitoring
+{
+ public class MonitorMetrics
+ {
+ private string _name;
+ private string _strValue;
+ private string _unit;
+ private bool _isPrimary;
+ private bool _isHigherBetter;
+ private double _dblValue;
+ private long _lngValue;
+ private char _valueType; // D=double, L=long, S=String
+
+ public MonitorMetrics(string name, string value, string unit, bool HigherIsBetter, bool Primary)
+ {
+ _name = name;
+ _strValue = value;
+ _unit = unit;
+ _valueType = 'S';
+ _isHigherBetter = HigherIsBetter;
+ _isPrimary = Primary;
+ }
+
+ public MonitorMetrics(string name, double value, string unit, bool HigherIsBetter, bool Primary)
+ {
+ _name = name;
+ _dblValue = value;
+ _unit = unit;
+ _valueType = 'D';
+ _isHigherBetter = HigherIsBetter;
+ _isPrimary = Primary;
+ }
+
+ public MonitorMetrics(string name, long value, string unit, bool HigherIsBetter, bool Primary)
+ {
+ _name = name;
+ _lngValue = value;
+ _unit = unit;
+ _valueType = 'L';
+ _isHigherBetter = HigherIsBetter;
+ _isPrimary = Primary;
+ }
+
+ public string GetName()
+ {
+ return _name;
+ }
+
+ public string GetUnit()
+ {
+ return _unit;
+ }
+
+ public bool GetPrimary()
+ {
+ return _isPrimary;
+ }
+
+ public bool GetHigherIsBetter()
+ {
+ return _isHigherBetter;
+ }
+
+ public char GetValueType()
+ {
+ return _valueType;
+ }
+
+ public string GetStringValue()
+ {
+ if (_valueType == 'S')
+ return _strValue;
+ throw new Exception("Value is not a string");
+ }
+
+ public double GetDoubleValue()
+ {
+ if (_valueType == 'D')
+ return _dblValue;
+ throw new Exception("Value is not a double");
+ }
+
+ public long GetLongValue()
+ {
+ if (_valueType == 'L')
+ return _lngValue;
+ throw new Exception("Value is not a long");
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/IMonitorLoader/project.json b/src/System.Data.SqlClient/tests/StressTests/IMonitorLoader/project.json
new file mode 100644
index 0000000000..2b962935d2
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/IMonitorLoader/project.json
@@ -0,0 +1,9 @@
+{
+ "dependencies": {
+ "Microsoft.NETCore.Platforms": "4.3.0-beta-24501-02",
+ "System.Collections": "4.3.0-beta-24501-02"
+ },
+ "frameworks": {
+ "netstandard1.3": {}
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/AsyncUtils.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/AsyncUtils.cs
new file mode 100644
index 0000000000..ce9562a8a1
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/AsyncUtils.cs
@@ -0,0 +1,201 @@
+// 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.Data.SqlClient;
+using System.Linq;
+using System.Runtime.ExceptionServices;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Xml;
+using DPStressHarness;
+
+namespace Stress.Data
+{
+ public enum SyncAsyncMode
+ {
+ Sync, // call sync method, e.g. connection.Open(), and return completed task
+ SyncOverAsync, // call async method, e.g. connection.OpenAsync().Wait(), and return completed task
+ Async // call async method, e.g. connection.OpenAsync(), and return running task
+ }
+
+ public static class AsyncUtils
+ {
+ // Singleton object of a task that is already completed
+ private static Task s_completedTask;
+ private static Task CompletedTask
+ {
+ get
+ {
+ // No need to lock, it is fine to just have the last thread win
+ if (s_completedTask == null)
+ {
+ s_completedTask = Task.FromResult<object>(null);
+ }
+ return s_completedTask;
+ }
+ }
+
+ public static Task<TResult> SyncOrAsyncMethod<TResult>(Func<TResult> syncFunc, Func<Task<TResult>> asyncFunc, SyncAsyncMode mode)
+ {
+ switch (mode)
+ {
+ case SyncAsyncMode.Sync:
+ TResult result = syncFunc();
+ return Task.FromResult(result);
+
+ case SyncAsyncMode.SyncOverAsync:
+ Task<TResult> t = asyncFunc();
+ WaitAndUnwrapException(t);
+ return t;
+
+ case SyncAsyncMode.Async:
+ return asyncFunc();
+
+ default:
+ throw new ArgumentException(mode.ToString());
+ }
+ }
+
+ public static Task SyncOrAsyncMethod(Action syncFunc, Func<Task> asyncFunc, SyncAsyncMode mode)
+ {
+ switch (mode)
+ {
+ case SyncAsyncMode.Sync:
+ syncFunc();
+ return CompletedTask;
+
+ case SyncAsyncMode.SyncOverAsync:
+ Task t = asyncFunc();
+ WaitAndUnwrapException(t);
+ return t;
+
+ case SyncAsyncMode.Async:
+ return asyncFunc();
+
+ default:
+ throw new ArgumentException(mode.ToString());
+ }
+ }
+
+ public static void WaitAll(params Task[] ts)
+ {
+ DeadlockDetection.DisableThreadAbort();
+ try
+ {
+ Task.WaitAll(ts);
+ }
+ finally
+ {
+ DeadlockDetection.EnableThreadAbort();
+ }
+ }
+
+ public static void WaitAllNullable(params Task[] ts)
+ {
+ DeadlockDetection.DisableThreadAbort();
+ try
+ {
+ Task[] tasks = ts.Where(t => t != null).ToArray();
+ Task.WaitAll(tasks);
+ }
+ finally
+ {
+ DeadlockDetection.EnableThreadAbort();
+ }
+ }
+
+ public static void WaitAndUnwrapException(Task t)
+ {
+ DeadlockDetection.DisableThreadAbort();
+ try
+ {
+ t.Wait();
+ }
+ catch (AggregateException ae)
+ {
+ // The callers of this API may not expect AggregateException, so throw the inner exception
+ // If AggregateException contains more than one InnerExceptions, throw it out as it is,
+ // because that is unexpected
+ if ((ae.InnerExceptions != null) && (ae.InnerExceptions.Count == 1))
+ {
+ if (ae.InnerException != null)
+ {
+ ExceptionDispatchInfo info = ExceptionDispatchInfo.Capture(ae.InnerException);
+ info.Throw();
+ }
+ }
+
+ throw;
+ }
+ finally
+ {
+ DeadlockDetection.EnableThreadAbort();
+ }
+ }
+
+ public static T GetResult<T>(IAsyncResult result)
+ {
+ return GetResult<T>((Task<T>)result);
+ }
+
+ public static T GetResult<T>(Task<T> result)
+ {
+ DeadlockDetection.DisableThreadAbort();
+ try
+ {
+ return result.Result;
+ }
+ finally
+ {
+ DeadlockDetection.EnableThreadAbort();
+ }
+ }
+
+ public static SqlDataReader ExecuteReader(SqlCommand command)
+ {
+ DeadlockDetection.DisableThreadAbort();
+ try
+ {
+ return command.ExecuteReader();
+ }
+ finally
+ {
+ DeadlockDetection.EnableThreadAbort();
+ }
+ }
+
+ public static int ExecuteNonQuery(SqlCommand command)
+ {
+ DeadlockDetection.DisableThreadAbort();
+ try
+ {
+ return command.ExecuteNonQuery();
+ }
+ finally
+ {
+ DeadlockDetection.DisableThreadAbort();
+ }
+ }
+
+ public static XmlReader ExecuteXmlReader(SqlCommand command)
+ {
+ DeadlockDetection.DisableThreadAbort();
+ try
+ {
+ return command.ExecuteXmlReader();
+ }
+ finally
+ {
+ DeadlockDetection.EnableThreadAbort();
+ }
+ }
+
+ public static SyncAsyncMode ChooseSyncAsyncMode(Random rnd)
+ {
+ // Any mode is allowed
+ return (SyncAsyncMode)rnd.Next(3);
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataSource.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataSource.cs
new file mode 100644
index 0000000000..73c1d5dc96
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataSource.cs
@@ -0,0 +1,160 @@
+// 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.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Stress.Data
+{
+ /// <summary>
+ /// supported source types - values for 'type' attribute for 'source' node in App.config
+ /// </summary>
+ public enum DataSourceType
+ {
+ SqlServer
+ }
+
+ /// <summary>
+ /// base class for database source information (SQL Server, Oracle Server, Access Database file, etc...).
+ /// Data sources are loaded from the app config file.
+ /// </summary>
+ public abstract class DataSource
+ {
+ /// <summary>
+ /// name of the source - can be used in command line: StressTest ... -override source "sourcename"
+ /// </summary>
+ public readonly string Name;
+
+ /// <summary>
+ /// database type
+ /// </summary>
+ public readonly DataSourceType Type;
+
+ /// <summary>
+ /// whether this source is the default one for the type specified
+ /// </summary>
+ public readonly bool IsDefault;
+
+ /// <summary>
+ /// constructs new data source - called by derived class c-tors only (thus protected)
+ /// </summary>
+ protected DataSource(string name, DataSourceType type, bool isDefault)
+ {
+ this.Name = name;
+ this.Type = type;
+ this.IsDefault = isDefault;
+ }
+
+ /// <summary>
+ /// this method is used to create the data source, based on its type
+ /// </summary>
+ public static DataSource Create(string name, DataSourceType sourceType, bool isDefault, IDictionary<string, string> properties)
+ {
+ switch (sourceType)
+ {
+ case DataSourceType.SqlServer:
+ return new SqlServerDataSource(name, isDefault, properties);
+ default:
+ throw new ArgumentException("Wrong source type value: " + sourceType);
+ }
+ }
+
+ /// <summary>
+ /// used by GetRequiredAttributeValue or derived classes to construct exception on missing required attribute
+ /// </summary>
+ /// <param name="sourceName">name of the source (from XML) to include in exception message (for troubleshooting)</param>
+ protected Exception MissingAttributeValueException(string sourceName, string attributeName)
+ {
+ return new ArgumentException(string.Format("Missing or empty value for {0} attribute in the config file for source: {1}", attributeName, sourceName));
+ }
+
+ /// <summary>
+ /// search for required attribute or fail if not found
+ /// </summary>
+ protected string GetRequiredAttributeValue(string sourceName, IDictionary<string, string> properties, string valueName, bool allowEmpty)
+ {
+ string value;
+ if (!properties.TryGetValue(valueName, out value) || (value == null) || (!allowEmpty && value.Length == 0))
+ {
+ throw MissingAttributeValueException(sourceName, valueName);
+ }
+ return value;
+ }
+
+ /// <summary>
+ /// search for optional attribute or return default vale
+ /// </summary>
+ protected string GetOptionalAttributeValue(IDictionary<string, string> properties, string valueName, string defaultValue)
+ {
+ string value;
+ if (!properties.TryGetValue(valueName, out value) || (value == null))
+ {
+ value = defaultValue;
+ }
+ return value;
+ }
+ }
+
+ /// <summary>
+ /// Represents SQL Server data source. This source is used by SqlClient as well as by ODBC and OLEDB when connecting to SQL with SNAC or MDAC/WDAC
+ /// </summary>
+ /// <example>
+ /// <source
+ /// name="mysrv01"
+ /// type="SqlServer"
+ /// isDefault="false"
+ /// dataSource="mysrv01"
+ /// database="stress"
+ /// user="stress"
+ /// password=""
+ /// supportsWindowsAuthentication="false">
+ /// </source>
+ /// </example>
+ public class SqlServerDataSource : DataSource
+ {
+ public readonly string DataSource;
+ public readonly string Database;
+ public readonly bool IsLocal;
+
+ // if user and password are set, test can create connection strings with SQL auth settings
+ public readonly string User;
+ public readonly string Password;
+
+ // if true, test can create connnection strings with integrated security (trusted connection) set to true (or SSPI).
+ public readonly bool SupportsWindowsAuthentication;
+
+ public bool DisableMultiSubnetFailoverSetup;
+
+ public bool DisableNamedPipes;
+
+ internal SqlServerDataSource(string name, bool isDefault, IDictionary<string, string> properties)
+ : base(name, DataSourceType.SqlServer, isDefault)
+ {
+ this.DataSource = GetOptionalAttributeValue(properties, "dataSource", "localhost");
+ this.Database = GetOptionalAttributeValue(properties, "database", "stress");
+
+ this.User = GetOptionalAttributeValue(properties, "user", string.Empty);
+ this.Password = GetOptionalAttributeValue(properties, "password", string.Empty);
+
+ this.IsLocal = bool.Parse(GetOptionalAttributeValue(properties, "islocal", bool.FalseString));
+
+ this.DisableMultiSubnetFailoverSetup = bool.Parse(GetOptionalAttributeValue(properties, "DisableMultiSubnetFailoverSetup", bool.TrueString));
+
+ this.DisableNamedPipes = bool.Parse(GetOptionalAttributeValue(properties, "DisableNamedPipes", bool.TrueString));
+
+ string temp = GetOptionalAttributeValue(properties, "supportsWindowsAuthentication", "false");
+ if (!string.IsNullOrEmpty(temp))
+ SupportsWindowsAuthentication = Convert.ToBoolean(temp);
+ else
+ SupportsWindowsAuthentication = false;
+
+ if (string.IsNullOrEmpty(User) && !SupportsWindowsAuthentication)
+ throw new ArgumentException("SQL Server settings should include either a valid User name or SupportsWindowsAuthentication=true");
+ }
+ }
+
+
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressConnection.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressConnection.cs
new file mode 100644
index 0000000000..45e932b34b
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressConnection.cs
@@ -0,0 +1,236 @@
+// 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.Collections.Generic;
+using System.Data.Common;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Security.Principal;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Stress.Data
+{
+ public class DataStressConnection : IDisposable
+ {
+ public DbConnection DbConnection { get; private set; }
+ private readonly bool _clearPoolBeforeClose;
+ public DataStressConnection(DbConnection conn, bool clearPoolBeforeClose = false)
+ {
+ if (conn == null)
+ throw new ArgumentException("Cannot pass in null DbConnection to make new DataStressConnection!");
+ this.DbConnection = conn;
+ _clearPoolBeforeClose = clearPoolBeforeClose;
+ }
+
+ private short _spid = 0;
+
+ [ThreadStatic]
+ private static TrackedRandom s_randomInstance;
+ private static TrackedRandom RandomInstance
+ {
+ get
+ {
+ if (s_randomInstance == null)
+ s_randomInstance = new TrackedRandom();
+ return s_randomInstance;
+ }
+ }
+
+ public void Open()
+ {
+ bool sync = RandomInstance.NextBool();
+
+ if (sync)
+ {
+ OpenSync();
+ }
+ else
+ {
+ Task t = OpenAsync();
+ AsyncUtils.WaitAndUnwrapException(t);
+ }
+ }
+
+ public async Task OpenAsync()
+ {
+ int startMilliseconds = Environment.TickCount;
+ try
+ {
+ await DbConnection.OpenAsync();
+ }
+ catch (ObjectDisposedException e)
+ {
+ HandleObjectDisposedException(e, true);
+ throw;
+ }
+ catch (InvalidOperationException e)
+ {
+ int endMilliseconds = Environment.TickCount;
+
+ // we may be able to handle this exception
+ HandleInvalidOperationException(e, startMilliseconds, endMilliseconds, true);
+ throw;
+ }
+
+ GetSpid();
+ }
+
+ private void OpenSync()
+ {
+ int startMilliseconds = Environment.TickCount;
+ try
+ {
+ DbConnection.Open();
+ }
+ catch (ObjectDisposedException e)
+ {
+ HandleObjectDisposedException(e, false);
+ throw;
+ }
+ catch (InvalidOperationException e)
+ {
+ int endMilliseconds = Environment.TickCount;
+
+ // we may be able to handle this exception
+ HandleInvalidOperationException(e, startMilliseconds, endMilliseconds, false);
+ throw;
+ }
+
+ GetSpid();
+ }
+
+ private void HandleObjectDisposedException(ObjectDisposedException e, bool async)
+ {
+ // Race condition in DbConnectionFactory.TryGetConnection results in an ObjectDisposedException when calling OpenAsync on a non-pooled connection
+ string methodName = async ? "OpenAsync()" : "Open()";
+ throw DataStressErrors.ProductError(
+ "Hit ObjectDisposedException in SqlConnection." + methodName, e);
+ }
+
+ private static int s_fastTimeoutCountOpen; // number of times hit by SqlConnection.Open
+ private static int s_fastTimeoutCountOpenAsync; // number of times hit by SqlConnection.OpenAsync
+ private static readonly DateTime s_startTime = DateTime.Now;
+
+ private const int MaxFastTimeoutCountPerDay = 200;
+
+ /// <summary>
+ /// Handles InvalidOperationException generated from Open or OpenAsync calls.
+ /// For any other type of Exception, it simply returns
+ /// </summary>
+ private void HandleInvalidOperationException(InvalidOperationException e, int startMilliseconds, int endMilliseconds, bool async)
+ {
+ int elapsedMilliseconds = unchecked(endMilliseconds - startMilliseconds); // unchecked to handle overflow of Environment.TickCount
+
+ // Since InvalidOperationExceptions due to timeout can be caused by issues
+ // (e.g. network hiccup, server unavailable, etc) we need a heuristic to guess whether or not this exception
+ // should have happened or not.
+ bool wasTimeoutFromPool = (e.GetType() == typeof(InvalidOperationException)) &&
+ (e.Message.StartsWith("Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool"));
+
+ bool wasTooEarly = (elapsedMilliseconds < ((DbConnection.ConnectionTimeout - 5) * 1000));
+
+ if (wasTimeoutFromPool && wasTooEarly)
+ {
+ if (async)
+ Interlocked.Increment(ref s_fastTimeoutCountOpenAsync);
+ else
+ Interlocked.Increment(ref s_fastTimeoutCountOpen);
+ }
+ }
+
+ /// <summary>
+ /// Gets spid value.
+ /// </summary>
+ /// <remarks>
+ /// If we want to kill the connection, we get its spid up front before the test case uses the connection. Otherwise if
+ /// we try to get the spid when KillConnection is called, then the connection could be in a bad state (e.g. enlisted in
+ /// aborted transaction, or has open datareader) and we will fail to get the spid. Also the randomization is put here
+ /// instead of in KillConnection because otherwise this method would execute a command for every single connection which
+ /// most of the time will not be used later.
+ /// </remarks>
+ private void GetSpid()
+ {
+ if (DbConnection is System.Data.SqlClient.SqlConnection && RandomInstance.Next(0, 20) == 0)
+ {
+ using (var cmd = DbConnection.CreateCommand())
+ {
+ cmd.CommandText = "select @@spid";
+ _spid = (short)cmd.ExecuteScalar();
+ }
+ }
+ else
+ {
+ _spid = 0;
+ }
+ }
+
+ /// <summary>
+ /// Kills the given connection using "kill [spid]" if the parameter is nonzero
+ /// </summary>
+ private void KillConnection()
+ {
+ DataStressErrors.Assert(_spid != 0, "Called KillConnection with spid != 0");
+
+ using (var killerConn = DataTestGroup.Factory.CreateConnection())
+ {
+ killerConn.Open();
+
+ using (var killerCmd = killerConn.CreateCommand())
+ {
+ killerCmd.CommandText = "begin try kill " + _spid + " end try begin catch end catch";
+ killerCmd.ExecuteNonQuery();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Kills the given connection using "kill [spid]" if the parameter is nonzero
+ /// </summary>
+ /// <returns>a Task that is asynchronously killing the connection, or null if the connection is not being killed</returns>
+ public Task KillConnectionAsync()
+ {
+ if (_spid == 0)
+ return null;
+ else
+ return Task.Factory.StartNew(() => KillConnection());
+ }
+
+ public void Close()
+ {
+ if (_spid != 0)
+ {
+ KillConnection();
+
+ // Wait before putting the connection back in the pool, to ensure that
+ // the pool checks the connection the next time it is used.
+ Task.Delay(10).ContinueWith((t) => DbConnection.Close());
+ }
+ else
+ {
+ // If this is a SqlConnection, and it is a connection with a unique connection string that we will never use again,
+ // then call SqlConnection.ClearPool() before closing so that it is fully closed and does not waste client & server resources.
+ if (_clearPoolBeforeClose)
+ {
+ SqlConnection sqlConn = DbConnection as SqlConnection;
+ if (sqlConn != null) SqlConnection.ClearPool(sqlConn);
+ }
+
+ DbConnection.Close();
+ }
+ }
+
+ public void Dispose()
+ {
+ Close();
+ }
+
+ public DbCommand CreateCommand()
+ {
+ return DbConnection.CreateCommand();
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressErrors.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressErrors.cs
new file mode 100644
index 0000000000..2a341ecd63
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressErrors.cs
@@ -0,0 +1,216 @@
+// 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.Diagnostics;
+using System.Runtime.Serialization;
+
+namespace Stress.Data
+{
+ public enum ErrorHandlingAction
+ {
+ // If you add an item here, remember to add it to all of the methods below
+ DebugBreak,
+ ThrowException
+ }
+
+ /// <summary>
+ /// Static class containing methods to report errors.
+ ///
+ /// The StressTest executor will eat exceptions that are thrown and write them out to the console. In theory these should all be
+ /// either harmless exceptions or product bugs, however at present there are a large number of test issues that will cause a flood
+ /// of exceptions. Therefore if something actually bad happens (e.g. a known product bug is hit due to regression, or a major test
+ /// programming error) this error would be easy to miss if it were reported just by throwing an exception. To solve this, we use
+ /// this class for structured & consistent handling of errors.
+ /// </summary>
+ public static class DataStressErrors
+ {
+ private static void DebugBreak(string message, Exception exception)
+ {
+ // Print out the error before breaking to make debugging easier
+ Console.WriteLine(message);
+ if (exception != null)
+ {
+ Console.WriteLine(exception);
+ }
+
+ Debugger.Break();
+ }
+
+ /// <summary>
+ /// Reports that a product bug has been hit. The action that will be taken is configurable in the .config file.
+ /// This can be used to check for regressions of known product bugs.
+ /// </summary>
+ /// <param name="description">A description of the product bug hit (e.g. title, bug number & database, more information)</param>
+ /// <param name="exception">The exception that was thrown that indicates a product bug, or null if the product bug was detected without
+ /// having thrown an exception</param>
+ /// <returns>An exception that the caller should throw.</returns>
+ public static Exception ProductError(string description, Exception exception = null)
+ {
+ switch (DataStressSettings.Instance.ActionOnProductError)
+ {
+ case ErrorHandlingAction.DebugBreak:
+ DebugBreak("Hit product error: " + description, exception);
+ return new ProductErrorException(description, exception);
+
+ case ErrorHandlingAction.ThrowException:
+ return new ProductErrorException(description, exception);
+
+ default:
+ throw UnhandledCaseError(DataStressSettings.Instance.ActionOnProductError);
+ }
+ }
+
+ /// <summary>
+ /// Reports that a non-fatal test error has been hit. The action that will be taken is configurable in the .config file.
+ /// This should be used for test errors that do not prevent the test from running.
+ /// </summary>
+ /// <param name="description">A description of the error</param>
+ /// <param name="exception">The exception that was thrown that indicates an error, or null if the error was detected without
+ /// <returns>An exception that the caller should throw.</returns>
+ public static Exception TestError(string description, Exception exception = null)
+ {
+ switch (DataStressSettings.Instance.ActionOnTestError)
+ {
+ case ErrorHandlingAction.DebugBreak:
+ DebugBreak("Hit test error: " + description, exception);
+ return new TestErrorException(description, exception);
+
+ case ErrorHandlingAction.ThrowException:
+ return new TestErrorException(description, exception);
+
+ default:
+ throw UnhandledCaseError(DataStressSettings.Instance.ActionOnTestError);
+ }
+ }
+
+ /// <summary>
+ /// Reports that a programming error in the test code has occurred. The action that will be taken is configurable in the .config file.
+ /// This must strictly be used to report programming errors. It should not be in any way possible to see one of these errors unless
+ /// you make an incorrect change to the code, for example having an unhandled case in a switch statement.
+ /// </summary>
+ /// <param name="description">A description of the error</param>
+ /// <param name="exception">The exception that was thrown that indicates an error, or null if the error was detected without
+ /// having thrown an exception</param>
+ /// <returns>An exception that the caller should throw.</returns>
+ private static Exception ProgrammingError(string description, Exception exception = null)
+ {
+ switch (DataStressSettings.Instance.ActionOnProgrammingError)
+ {
+ case ErrorHandlingAction.DebugBreak:
+ DebugBreak("Hit programming error: " + description, exception);
+ return new ProgrammingErrorException(description, exception);
+
+ case ErrorHandlingAction.ThrowException:
+ return new ProgrammingErrorException(description, exception);
+
+ default:
+ // If we are here then it's a programming error, but calling UnhandledCaseError here would cause an inifite loop.
+ goto case ErrorHandlingAction.DebugBreak;
+ }
+ }
+
+ /// <summary>
+ /// Reports that an unhandled case in a switch statement in the test code has occurred. The action that will be taken is configurable
+ /// as a programming error in the .config file. It should not be in any way possible to see one of these errors unless
+ /// you make an incorrect change to the test code, for example having an unhandled case in a switch statement.
+ /// </summary>
+ /// <param name="unhandledValue">The value that was not handled in the switch statement</param>
+ /// <returns>An exception that the caller should throw.</returns>
+ public static Exception UnhandledCaseError<T>(T unhandledValue)
+ {
+ return ProgrammingError("Unhandled case in switch statement: " + unhandledValue);
+ }
+
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false then throws a ProgrammingError.
+ /// This must strictly be used to report programming errors. It should not be in any way possible to see one of these errors unless
+ /// you make an incorrect change to the code, for example having an unhandled case in a switch statement.
+ /// </summary>
+ /// <param name="condition">A condition to assert</param>
+ /// <param name="description">A description of the error</param>
+ /// <exception cref="ProgrammingErrorException">if the condition is false</exception>
+ public static void Assert(bool condition, string description)
+ {
+ if (!condition)
+ {
+ throw ProgrammingError(description);
+ }
+ }
+
+ /// <summary>
+ /// Reports that a fatal error has happened. This is a error that completely prevents the test from continuing,
+ /// for example a setup failure. Ordinary programming errors should not be handled by this method.
+ /// </summary>
+ /// <param name="description">A description of the error</param>
+ /// <returns>An exception that the caller should throw.</returns>
+ public static Exception FatalError(string description)
+ {
+ Console.WriteLine("Fatal test error: {0}", description);
+ Debugger.Break(); // Give the user a chance to debug
+ Environment.FailFast("Fatal error. Exit.");
+ return new Exception(); // Caller should throw this to indicate to the compiler that any code after the call is unreachable
+ }
+
+ #region Exception types
+
+ // These exception types are provided so that they can be easily found in logs, i.e. just do a text search in the console
+ // output log for "ProductErrorException"
+
+ private class ProductErrorException : Exception
+ {
+ public ProductErrorException()
+ : base()
+ {
+ }
+
+ public ProductErrorException(string message)
+ : base(message)
+ {
+ }
+
+ public ProductErrorException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+ }
+
+ private class ProgrammingErrorException : Exception
+ {
+ public ProgrammingErrorException()
+ : base()
+ {
+ }
+
+ public ProgrammingErrorException(string message)
+ : base(message)
+ {
+ }
+
+ public ProgrammingErrorException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+ }
+
+ private class TestErrorException : Exception
+ {
+ public TestErrorException()
+ : base()
+ {
+ }
+
+ public TestErrorException(string message)
+ : base(message)
+ {
+ }
+
+ public TestErrorException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+ }
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressFactory.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressFactory.cs
new file mode 100644
index 0000000000..2da8be788f
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressFactory.cs
@@ -0,0 +1,955 @@
+// 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.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Data;
+using System.Data.Common;
+using System.Diagnostics;
+
+namespace Stress.Data
+{
+ /// <summary>
+ /// Base class to generate utility objects required for stress tests to run. For example: connection strings, command texts,
+ /// data tables and views, and other information
+ /// </summary>
+ public abstract class DataStressFactory : IDisposable
+ {
+ // This is the maximum number of rows, stress will operate on
+ public const int Depth = 100;
+
+ // A string value to be used for scalar data retrieval while constructing
+ // a select statement that retrieves multiple result sets.
+ public static readonly string LargeStringParam = new string('p', 2000);
+
+ // A temp table that when create puts the server session into a non-recoverable state until dropped.
+ private static readonly string s_tempTableName = String.Format("#stress_{0}", Guid.NewGuid().ToString("N"));
+
+ // The languages used for "SET LANGUAGE [language]" statements that modify the server session state. Let's
+ // keep error message readable so we're only using english languages.
+ private static string[] s_languages = new string[]
+ {
+ "English",
+ "British English",
+ };
+
+ public DbProviderFactory DbFactory { get; private set; }
+
+ protected DataStressFactory(DbProviderFactory factory)
+ {
+ DataStressErrors.Assert(factory != null, "Argument to DataStressFactory constructor is null");
+ this.DbFactory = factory;
+ }
+
+
+ public void Dispose()
+ {
+ GC.SuppressFinalize(this);
+ }
+
+ public abstract string GetParameterName(string pName);
+
+
+ public abstract bool PrimaryKeyValueIsRequired
+ {
+ get;
+ }
+
+ [Flags]
+ public enum SelectStatementOptions
+ {
+ UseNOLOCK = 0x1,
+
+ // keep last
+ Default = 0
+ }
+
+ #region PoolingStressMode
+
+ public enum PoolingStressMode
+ {
+ RandomizeConnectionStrings, // Use many different connection strings with the same identity, which will result in many DbConnectionPoolGroups each containing one DbConnectionPool
+ }
+
+ protected PoolingStressMode CurrentPoolingStressMode
+ {
+ get;
+ private set;
+ }
+
+
+ private Timer _currentPoolingStressModeTimer;
+
+ #endregion
+
+
+ /// <summary>
+ /// Creates a new connection and initializes it with random connection string generated from the factory's source
+ /// Note: if rnd is null, create a connection with minimal string required to connect to the target database
+ /// </summary>
+ /// <param name="rnd">Randomizes Connection Pool enablement, the application Name to randomize connection pool</param>
+ /// <param name="options"></param>
+ /// <returns></returns>
+ public DataStressConnection CreateConnection(Random rnd = null, ConnectionStringOptions options = ConnectionStringOptions.Default)
+ {
+ // Determine connection options (connection string, identity, etc)
+ string connectionString = CreateBaseConnectionString(rnd, options);
+ bool clearPoolBeforeClose = false;
+
+ if (rnd != null)
+ {
+ // Connection string and/or identity are randomized
+
+ // We implement this using the Application Name field in the connection string since this field
+ // should not affect behaviour other than connection pooling, since all connections in a pool
+ // must have the exact same connection string (including Application Name)
+
+ if (rnd.NextBool(.1))
+ {
+ // Disable pooling
+ connectionString = connectionString + ";Pooling=false;";
+ }
+ else if (rnd.NextBool(0.001))
+ {
+ // Use a unique Application Name to get a new connection from a new pool. We do this in order to
+ // stress the code that creates/deletes pools.
+ connectionString = string.Format("{0}; Pooling=true; Application Name=\"{1}\";", connectionString, GetRandomApplicationName());
+
+ // Tell DataStressConnection to call SqlConnection.ClearPool when closing the connection. This ensures
+ // we do not keep a large number of connections in the pool that we will never use again.
+ clearPoolBeforeClose = true;
+ }
+ else
+ {
+ switch (CurrentPoolingStressMode)
+ {
+ case PoolingStressMode.RandomizeConnectionStrings:
+ // Use one of the pre-generated Application Names in order to get a pooled connection with a randomized connection string
+ connectionString = string.Format("{0}; Pooling=true; Application Name=\"{1}\";", connectionString, _applicationNames[rnd.Next(_applicationNames.Count)]);
+ break;
+ default:
+ throw DataStressErrors.UnhandledCaseError(CurrentPoolingStressMode);
+ }
+ }
+ }
+
+ // All options have been determined, now create
+ DbConnection con = DbFactory.CreateConnection();
+ con.ConnectionString = connectionString;
+ return new DataStressConnection(con, clearPoolBeforeClose);
+ }
+
+ [Flags]
+ public enum ConnectionStringOptions
+ {
+ Default = 0,
+
+ // by default, MARS is disabled
+ EnableMars = 0x2,
+
+ // by default, MultiSubnetFailover is enabled
+ DisableMultiSubnetFailover = 0x8
+ }
+
+ /// <summary>
+ /// Creates a new connection string.
+ /// Note: if rnd is null, create minimal connection string required to connect to the target database (used during setup)
+ /// Otherwise, string is randomized to enable multiple pools.
+ /// </summary>
+ public abstract string CreateBaseConnectionString(Random rnd, ConnectionStringOptions options);
+
+ protected virtual int GetNumDifferentApplicationNames()
+ {
+ return DataStressSettings.Instance.NumberOfConnectionPools;
+ }
+
+ private string GetRandomApplicationName()
+ {
+ return Guid.NewGuid().ToString();
+ }
+
+
+ /// <summary>
+ /// Returns index of a random table
+ /// This will be used to narrow down memory leaks
+ /// related to specific tables.
+ /// </summary>
+ public TableMetadata GetRandomTable(Random rnd)
+ {
+ return TableMetadataList[rnd.Next(TableMetadataList.Count)];
+ }
+
+ /// <summary>
+ /// Returns a random command object
+ /// </summary>
+ public DbCommand GetCommand(Random rnd, TableMetadata table, DataStressConnection conn, bool query, bool isXml = false)
+ {
+ if (query)
+ {
+ return GetSelectCommand(rnd, table, conn, isXml);
+ }
+ else
+ {
+ // make sure arguments are correct
+ DataStressErrors.Assert(!isXml, "wrong usage of GetCommand: cannot create command with FOR XML that is not query");
+
+ int select = rnd.Next(4);
+ switch (select)
+ {
+ case 0:
+ return GetUpdateCommand(rnd, table, conn);
+ case 1:
+ return GetInsertCommand(rnd, table, conn);
+ case 2:
+ return GetDeleteCommand(rnd, table, conn);
+ default:
+ return GetSelectCommand(rnd, table, conn);
+ }
+ }
+ }
+
+ private DbCommand CreateCommand(Random rnd, DataStressConnection conn)
+ {
+ DbCommand cmd;
+ if (conn == null)
+ {
+ cmd = DbFactory.CreateCommand();
+ }
+ else
+ {
+ cmd = conn.CreateCommand();
+ }
+
+ if (rnd != null)
+ {
+ cmd.CommandTimeout = rnd.NextBool() ? 30 : 600;
+ }
+
+ return cmd;
+ }
+
+ /// <summary>
+ /// Returns a random SELECT command
+ /// </summary>
+ public DbCommand GetSelectCommand(Random rnd, TableMetadata tableMetadata, DataStressConnection conn, bool isXml = false)
+ {
+ DbCommand com = CreateCommand(rnd, conn);
+ StringBuilder cmdText = new StringBuilder();
+ cmdText.Append(GetSelectCommandForMultipleRows(rnd, com, tableMetadata, isXml));
+
+ // 33% of the time, we also want to add another batch to the select command to allow for
+ // multiple result sets.
+ if ((!isXml) && (rnd.Next(0, 3) == 0))
+ {
+ cmdText.Append(";").Append(GetSelectCommandForScalarValue(com));
+ }
+
+ if ((!isXml) && ShouldModifySession(rnd))
+ {
+ cmdText.Append(";").Append(GetRandomSessionModificationStatement(rnd));
+ }
+
+ com.CommandText = cmdText.ToString();
+ return com;
+ }
+
+ /// <summary>
+ /// Returns a SELECT command that retrieves data from a table
+ /// </summary>
+ private String GetSelectCommandForMultipleRows(Random rnd, DbCommand com, TableMetadata inputTable, bool isXml)
+ {
+ int rowcount = rnd.Next(Depth);
+
+ StringBuilder cmdText = new StringBuilder();
+ cmdText.Append("SELECT TOP ");
+ cmdText.Append(rowcount); //Jonfo added this to prevent table scan of 75k row tables
+ cmdText.Append(" PrimaryKey");
+
+ List<TableColumn> columns = inputTable.Columns;
+ int colindex = rnd.Next(0, columns.Count);
+
+ for (int i = 0; i <= colindex; i++)
+ {
+ if (columns[i].ColumnName == "PrimaryKey") continue;
+ cmdText.Append(", ");
+ cmdText.Append(columns[i].ColumnName);
+ }
+
+ cmdText.Append(" FROM \"");
+ cmdText.Append(inputTable.TableName);
+ cmdText.Append("\" WITH(NOLOCK) WHERE PrimaryKey ");
+
+ // We randomly pick an operator from '>' or '=' to allow for randomization
+ // of possible rows returned by this query. This approach *may* help
+ // in reducing the likelihood of multiple threads accessing same rows.
+ // If multiple threads access same rows, there may be locking issues
+ // which may be avoided because of this randomization.
+ string op = rnd.NextBool() ? ">" : "=";
+ cmdText.Append(op).Append(" ");
+
+ string pName = GetParameterName("P0");
+ cmdText.Append(pName);
+
+ DbParameter param = DbFactory.CreateParameter();
+ param.ParameterName = pName;
+ param.Value = GetRandomPK(rnd, inputTable);
+ param.DbType = DbType.Int32;
+ com.Parameters.Add(param);
+
+ return cmdText.ToString();
+ }
+
+ /// <summary>
+ /// Returns a SELECT command that returns a single string parameter value.
+ /// </summary>
+ private String GetSelectCommandForScalarValue(DbCommand com)
+ {
+ string pName = GetParameterName("P1");
+ StringBuilder cmdText = new StringBuilder();
+
+ cmdText.Append("SELECT ").Append(pName);
+
+ DbParameter param = DbFactory.CreateParameter();
+ param.ParameterName = pName;
+ param.Value = LargeStringParam;
+ param.Size = LargeStringParam.Length;
+ param.DbType = DbType.String;
+ com.Parameters.Add(param);
+
+ return cmdText.ToString();
+ }
+
+ /// <summary>
+ /// Returns a random existing Primary Key value
+ /// </summary>
+ private int GetRandomPK(Random rnd, TableMetadata table)
+ {
+ using (DataStressConnection conn = CreateConnection())
+ {
+ conn.Open();
+
+ // This technique to get a random row comes from http://www.4guysfromrolla.com/webtech/042606-1.shtml
+ // When you set rowcount and then select into a scalar value, then the query is optimised so that
+ // just the last value is selected. So if n = ROWCOUNT then the query returns the n'th row.
+
+ int rowNumber = rnd.Next(Depth);
+
+ DbCommand com = conn.CreateCommand();
+ string cmdText = string.Format(
+ @"SET ROWCOUNT {0};
+ DECLARE @PK INT;
+ SELECT @PK = PrimaryKey FROM {1} WITH(NOLOCK)
+ SELECT @PK", rowNumber, table.TableName);
+
+ com.CommandText = cmdText;
+
+ object result = com.ExecuteScalarSyncOrAsync(CancellationToken.None, rnd).Result;
+ if (result == DBNull.Value)
+ {
+ throw DataStressErrors.TestError(string.Format("Table {0} returned DBNull for primary key", table.TableName));
+ }
+ else
+ {
+ int primaryKey = (int)result;
+ return primaryKey;
+ }
+ }
+ }
+
+ private DbParameter CreateRandomParameter(Random rnd, string prefix, TableColumn column)
+ {
+ DbParameter param = DbFactory.CreateParameter();
+
+ param.ParameterName = GetParameterName(prefix);
+
+ param.Value = GetRandomData(rnd, column);
+
+ return param;
+ }
+
+ /// <summary>
+ /// Returns a random UPDATE command
+ /// </summary>
+ public DbCommand GetUpdateCommand(Random rnd, TableMetadata table, DataStressConnection conn)
+ {
+ DbCommand com = CreateCommand(rnd, conn);
+
+ StringBuilder cmdText = new StringBuilder();
+ cmdText.Append("UPDATE \"");
+ cmdText.Append(table.TableName);
+ cmdText.Append("\" SET ");
+
+ List<TableColumn> columns = table.Columns;
+ int numColumns = rnd.Next(2, columns.Count);
+ bool mostlyNull = rnd.NextBool(0.1); // 10% of rows have 90% chance of each column being null, in order to test nbcrow
+
+ for (int i = 0; i < numColumns; i++)
+ {
+ if (columns[i].ColumnName == "PrimaryKey") continue;
+ if (columns[i].ColumnName.ToUpper() == "TIMESTAMP_FLD") continue;
+
+ if (i > 1) cmdText.Append(", ");
+ cmdText.Append(columns[i].ColumnName);
+ cmdText.Append(" = ");
+
+ if (mostlyNull && rnd.NextBool(0.9))
+ {
+ cmdText.Append("NULL");
+ }
+ else
+ {
+ DbParameter param = CreateRandomParameter(rnd, string.Format("P{0}", (i + 1)), columns[i]);
+ cmdText.Append(param.ParameterName);
+ com.Parameters.Add(param);
+ }
+ }
+
+ cmdText.Append(" WHERE PrimaryKey = ");
+ string pName = GetParameterName("P0");
+ cmdText.Append(pName);
+ DbParameter keyParam = DbFactory.CreateParameter();
+ keyParam.ParameterName = pName;
+ keyParam.Value = GetRandomPK(rnd, table);
+ com.Parameters.Add(keyParam);
+
+ if (ShouldModifySession(rnd))
+ {
+ cmdText.Append(";").Append(GetRandomSessionModificationStatement(rnd));
+ }
+
+ com.CommandText = cmdText.ToString(); ;
+ return com;
+ }
+
+ /// <summary>
+ /// Returns a random INSERT command
+ /// </summary>
+ public DbCommand GetInsertCommand(Random rnd, TableMetadata table, DataStressConnection conn)
+ {
+ DbCommand com = CreateCommand(rnd, conn);
+
+ StringBuilder cmdText = new StringBuilder();
+ cmdText.Append("INSERT INTO \"");
+ cmdText.Append(table.TableName);
+ cmdText.Append("\" (");
+
+ StringBuilder valuesText = new StringBuilder();
+ valuesText.Append(") VALUES (");
+
+ List<TableColumn> columns = table.Columns;
+ int numColumns = rnd.Next(2, columns.Count);
+ bool mostlyNull = rnd.NextBool(0.1); // 10% of rows have 90% chance of each column being null, in order to test nbcrow
+
+ for (int i = 0; i < numColumns; i++)
+ {
+ if (columns[i].ColumnName.ToUpper() == "PRIMARYKEY") continue;
+
+ if (i > 1)
+ {
+ cmdText.Append(", ");
+ valuesText.Append(", ");
+ }
+
+ cmdText.Append(columns[i].ColumnName);
+
+ if (columns[i].ColumnName.ToUpper() == "TIMESTAMP_FLD")
+ {
+ valuesText.Append("DEFAULT"); // Cannot insert an explicit value in a timestamp field
+ }
+ else if (mostlyNull && rnd.NextBool(0.9))
+ {
+ valuesText.Append("NULL");
+ }
+ else
+ {
+ DbParameter param = CreateRandomParameter(rnd, string.Format("P{0}", i + 1), columns[i]);
+
+ valuesText.Append(param.ParameterName);
+ com.Parameters.Add(param);
+ }
+ }
+
+ // To deal databases that do not support auto-incremented columns (Oracle?)
+ // if (!columns["PrimaryKey"].AutoIncrement)
+ if (PrimaryKeyValueIsRequired)
+ {
+ DbParameter param = CreateRandomParameter(rnd, "P0", table.GetColumn("PrimaryKey"));
+ cmdText.Append(", PrimaryKey");
+ valuesText.Append(", ");
+ valuesText.Append(param.ParameterName);
+ com.Parameters.Add(param);
+ }
+
+ valuesText.Append(")");
+ cmdText.Append(valuesText);
+
+ if (ShouldModifySession(rnd))
+ {
+ cmdText.Append(";").Append(GetRandomSessionModificationStatement(rnd));
+ }
+
+ com.CommandText = cmdText.ToString();
+ return com;
+ }
+
+ /// <summary>
+ /// Returns a random DELETE command
+ /// </summary>
+ public DbCommand GetDeleteCommand(Random rnd, TableMetadata table, DataStressConnection conn)
+ {
+ DbCommand com = CreateCommand(rnd, conn);
+
+ StringBuilder cmdText = new StringBuilder();
+ cmdText.Append("DELETE FROM \"");
+
+ List<TableColumn> columns = table.Columns;
+ string pName = GetParameterName("P0");
+ cmdText.Append(table.TableName);
+ cmdText.Append("\" WHERE PrimaryKey = ");
+ cmdText.Append(pName);
+
+ DbParameter param = DbFactory.CreateParameter();
+ param.ParameterName = pName;
+ param.Value = GetRandomPK(rnd, table);
+ com.Parameters.Add(param);
+
+ if (ShouldModifySession(rnd))
+ {
+ cmdText.Append(";").Append(GetRandomSessionModificationStatement(rnd));
+ }
+
+ com.CommandText = cmdText.ToString();
+ return com;
+ }
+
+ public bool ShouldModifySession(Random rnd)
+ {
+ // 33% of the time, we want to modify the user session on the server
+ return rnd.NextBool(.33);
+ }
+
+ /// <summary>
+ /// Returns a random statement that will modify the session on the server.
+ /// </summary>
+ public string GetRandomSessionModificationStatement(Random rnd)
+ {
+ string sessionStmt = null;
+ int select = rnd.Next(3);
+ switch (select)
+ {
+ case 0:
+ // Create a SET CONTEXT_INFO statement using a hex string of random data
+ StringBuilder sb = new StringBuilder("0x");
+ int count = rnd.Next(1, 129);
+ for (int i = 0; i < count; i++)
+ {
+ sb.AppendFormat("{0:x2}", (byte)rnd.Next(0, (int)(byte.MaxValue + 1)));
+ }
+ string contextInfoData = sb.ToString();
+ sessionStmt = string.Format("SET CONTEXT_INFO {0}", contextInfoData);
+ break;
+
+ case 1:
+ // Create or drop the temp table
+ sessionStmt = string.Format("IF OBJECT_ID('tempdb..{0}') IS NULL CREATE TABLE {0}(id INT) ELSE DROP TABLE {0}", s_tempTableName);
+ break;
+
+ default:
+ // Create a SET LANGUAGE statement
+ sessionStmt = string.Format("SET LANGUAGE N'{0}'", s_languages[rnd.Next(s_languages.Length)]);
+ break;
+ }
+ return sessionStmt;
+ }
+
+ /// <summary>
+ /// Returns random data
+ /// </summary>
+ public object GetRandomData(Random rnd, TableColumn column)
+ {
+ int length = column.MaxLength;
+ int maxTargetLength = (length > 255 || length == -1) ? 255 : length;
+
+ DbType dbType = GetDbType(column);
+ return GetRandomData(rnd, dbType, maxTargetLength);
+ }
+
+ private DbType GetDbType(TableColumn column)
+ {
+ switch (column.ColumnName)
+ {
+ case "bit_FLD": return DbType.Boolean;
+ case "tinyint_FLD": return DbType.Byte;
+ case "smallint_FLD": return DbType.Int16;
+ case "int_FLD": return DbType.Int32;
+ case "PrimaryKey": return DbType.Int32;
+ case "bigint_FLD": return DbType.Int64;
+ case "real_FLD": return DbType.Single;
+ case "float_FLD": return DbType.Double;
+ case "smallmoney_FLD": return DbType.Decimal;
+ case "money_FLD": return DbType.Decimal;
+ case "decimal_FLD": return DbType.Decimal;
+ case "numeric_FLD": return DbType.Decimal;
+ case "datetime_FLD": return DbType.DateTime;
+ case "smalldatetime_FLD": return DbType.DateTime;
+ case "datetime2_FLD": return DbType.DateTime2;
+ case "timestamp_FLD": return DbType.Binary;
+ case "date_FLD": return DbType.Date;
+ case "time_FLD": return DbType.Time;
+ case "datetimeoffset_FLD": return DbType.DateTimeOffset;
+ case "uniqueidentifier_FLD": return DbType.Guid;
+ case "sql_variant_FLD": return DbType.Object;
+ case "image_FLD": return DbType.Binary;
+ case "varbinary_FLD": return DbType.Binary;
+ case "binary_FLD": return DbType.Binary;
+ case "char_FLD": return DbType.String;
+ case "varchar_FLD": return DbType.String;
+ case "text_FLD": return DbType.String;
+ case "ntext_FLD": return DbType.String;
+ case "nvarchar_FLD": return DbType.String;
+ case "nchar_FLD": return DbType.String;
+ case "nvarcharmax_FLD": return DbType.String;
+ case "varbinarymax_FLD": return DbType.Binary;
+ case "varcharmax_FLD": return DbType.String;
+ case "xml_FLD": return DbType.Xml;
+ default: throw DataStressErrors.UnhandledCaseError(column.ColumnName);
+ }
+ }
+
+ protected virtual object GetRandomData(Random rnd, DbType dbType, int maxLength)
+ {
+ byte[] buffer;
+ switch (dbType)
+ {
+ case DbType.Boolean:
+ return (rnd.Next(2) == 0 ? false : true);
+ case DbType.Byte:
+ return rnd.Next(byte.MinValue, byte.MaxValue + 1);
+ case DbType.Int16:
+ return rnd.Next(Int16.MinValue, Int16.MaxValue + 1);
+ case DbType.Int32:
+ return (rnd.Next(2) == 0 ? Int32.MaxValue / rnd.Next(1, 3) : Int32.MinValue / rnd.Next(1, 3));
+ case DbType.Int64:
+ return (rnd.Next(2) == 0 ? Int64.MaxValue / rnd.Next(1, 3) : Int64.MinValue / rnd.Next(1, 3));
+ case DbType.Single:
+ return rnd.NextDouble() * (rnd.Next(2) == 0 ? Single.MaxValue : Single.MinValue);
+ case DbType.Double:
+ return rnd.NextDouble() * (rnd.Next(2) == 0 ? Double.MaxValue : Double.MinValue);
+ case DbType.Decimal:
+ return rnd.Next(Int16.MinValue, Int16.MaxValue + 1);
+ case DbType.DateTime:
+ case DbType.DateTime2:
+ return DateTime.Now;
+ case DbType.Date:
+ return DateTime.Now.Date;
+ case DbType.Time:
+ return DateTime.Now.TimeOfDay.ToString("c");
+ case DbType.DateTimeOffset:
+ return DateTimeOffset.Now;
+ case DbType.Guid:
+ buffer = new byte[16];
+ rnd.NextBytes(buffer);
+ return (new Guid(buffer));
+ case DbType.Object:
+ case DbType.Binary:
+ rnd.NextBytes(buffer = new byte[rnd.Next(1, maxLength)]);
+ return buffer;
+ case DbType.String:
+ case DbType.Xml:
+ string openTag = "<Data>";
+ string closeTag = "</Data>";
+ int tagLength = openTag.Length + closeTag.Length;
+
+ if (tagLength > maxLength)
+ {
+ // Case (1): tagLength > maxTargetLength
+ return "";
+ }
+ else
+ {
+ StringBuilder builder = new StringBuilder(maxLength);
+
+ builder.Append(openTag);
+
+ // The data is just a repeat of one character because to the managed provider
+ // it is only really the length that matters, not the content of the data
+ char characterToUse = (char)rnd.Next((int)'@', (int)'~'); // Choosing random characters in this range to avoid special
+ // xml chars like '<' or '&'
+ int numRepeats = rnd.Next(0, maxLength - tagLength); // Case (2): tagLength == maxTargetLength
+ // Case (3): tagLength < maxTargetLength <-- most common
+ builder.Append(characterToUse, numRepeats);
+
+ builder.Append(closeTag);
+
+ DataStressErrors.Assert(builder.Length <= maxLength, "Incorrect length of randomly generated string");
+
+ return builder.ToString();
+ }
+ default:
+ throw DataStressErrors.UnhandledCaseError(dbType);
+ }
+ }
+
+ #region Table information to be used by stress
+
+ // method used to create stress tables in the database
+ protected void BuildUserTables(List<TableMetadata> TableMetadataList)
+ {
+ string CreateTable1 =
+ "CREATE TABLE stress_test_table_1 (PrimaryKey int identity(1,1) primary key, int_FLD int, smallint_FLD smallint, real_FLD real, float_FLD float, decimal_FLD decimal(28,4), " +
+ "smallmoney_FLD smallmoney, bit_FLD bit, tinyint_FLD tinyint, uniqueidentifier_FLD uniqueidentifier, varbinary_FLD varbinary(756), binary_FLD binary(756), " +
+ "image_FLD image, varbinarymax_FLD varbinary(max), timestamp_FLD timestamp, char_FLD char(756), text_FLD text, varcharmax_FLD varchar(max), " +
+ "varchar_FLD varchar(756), nchar_FLD nchar(756), ntext_FLD ntext, nvarcharmax_FLD nvarchar(max), nvarchar_FLD nvarchar(756), datetime_FLD datetime, " +
+ "smalldatetime_FLD smalldatetime);" +
+ "CREATE UNIQUE INDEX stress_test_table_1 on stress_test_table_1 ( PrimaryKey );" +
+ "insert into stress_test_table_1(int_FLD, smallint_FLD, real_FLD, float_FLD, decimal_FLD, " +
+ "smallmoney_FLD, bit_FLD, tinyint_FLD, uniqueidentifier_FLD, varbinary_FLD, binary_FLD, " +
+ "image_FLD, varbinarymax_FLD, char_FLD, text_FLD, varcharmax_FLD, " +
+ "varchar_FLD, nchar_FLD, ntext_FLD, nvarcharmax_FLD, nvarchar_FLD, datetime_FLD, " +
+ "smalldatetime_FLD) values ( 0, 0, 0, 0, 0, $0, 0, 0, '00000000-0000-0000-0000-000000000000', " +
+ "0x00, 0x00, 0x00, 0x00, '0', '0', '0', '0', N'0', N'0', N'0', N'0', '01/11/2000 12:54:01', '01/11/2000 12:54:00' );"
+ ;
+
+ string CreateTable2 =
+ "CREATE TABLE stress_test_table_2 (PrimaryKey int identity(1,1) primary key, bigint_FLD bigint, money_FLD money, numeric_FLD numeric, " +
+ "time_FLD time, date_FLD date, datetimeoffset_FLD datetimeoffset, sql_variant_FLD sql_variant, " +
+ "datetime2_FLD datetime2, xml_FLD xml);" +
+ "CREATE UNIQUE INDEX stress_test_table_2 on stress_test_table_2 ( PrimaryKey );" +
+ "insert into stress_test_table_2(bigint_FLD, money_FLD, numeric_FLD, " +
+ "time_FLD, date_FLD, datetimeoffset_FLD, sql_variant_FLD, " +
+ "datetime2_FLD, xml_FLD) values ( 0, $0, 0, '01/11/2015 12:54:01', '01/11/2015 12:54:01', '01/11/2000 12:54:01 -08:00', 0, '01/11/2000 12:54:01', '0' );"
+ ;
+
+ if (TableMetadataList == null)
+ {
+ TableMetadataList = new List<TableMetadata>();
+ }
+
+ List<TableColumn> tableColumns1 = new List<TableColumn>();
+ tableColumns1.Add(new TableColumn("PrimaryKey", -1));
+ tableColumns1.Add(new TableColumn("int_FLD", -1));
+ tableColumns1.Add(new TableColumn("smallint_FLD", -1));
+ tableColumns1.Add(new TableColumn("real_FLD", -1));
+ tableColumns1.Add(new TableColumn("float_FLD", -1));
+ tableColumns1.Add(new TableColumn("decimal_FLD", -1));
+ tableColumns1.Add(new TableColumn("smallmoney_FLD", -1));
+ tableColumns1.Add(new TableColumn("bit_FLD", -1));
+ tableColumns1.Add(new TableColumn("tinyint_FLD", -1));
+ tableColumns1.Add(new TableColumn("uniqueidentifier_FLD", -1));
+ tableColumns1.Add(new TableColumn("varbinary_FLD", 756));
+ tableColumns1.Add(new TableColumn("binary_FLD", 756));
+ tableColumns1.Add(new TableColumn("image_FLD", -1));
+ tableColumns1.Add(new TableColumn("varbinarymax_FLD", -1));
+ tableColumns1.Add(new TableColumn("timestamp_FLD", -1));
+ tableColumns1.Add(new TableColumn("char_FLD", -1));
+ tableColumns1.Add(new TableColumn("text_FLD", -1));
+ tableColumns1.Add(new TableColumn("varcharmax_FLD", -1));
+ tableColumns1.Add(new TableColumn("varchar_FLD", 756));
+ tableColumns1.Add(new TableColumn("nchar_FLD", 756));
+ tableColumns1.Add(new TableColumn("ntext_FLD", -1));
+ tableColumns1.Add(new TableColumn("nvarcharmax_FLD", -1));
+ tableColumns1.Add(new TableColumn("nvarchar_FLD", 756));
+ tableColumns1.Add(new TableColumn("datetime_FLD", -1));
+ tableColumns1.Add(new TableColumn("smalldatetime_FLD", -1));
+ TableMetadata tableMeta1 = new TableMetadata("stress_test_table_1", tableColumns1);
+ TableMetadataList.Add(tableMeta1);
+
+ List<TableColumn> tableColumns2 = new List<TableColumn>();
+ tableColumns2.Add(new TableColumn("PrimaryKey", -1));
+ tableColumns2.Add(new TableColumn("bigint_FLD", -1));
+ tableColumns2.Add(new TableColumn("money_FLD", -1));
+ tableColumns2.Add(new TableColumn("numeric_FLD", -1));
+ tableColumns2.Add(new TableColumn("time_FLD", -1));
+ tableColumns2.Add(new TableColumn("date_FLD", -1));
+ tableColumns2.Add(new TableColumn("datetimeoffset_FLD", -1));
+ tableColumns2.Add(new TableColumn("sql_variant_FLD", -1));
+ tableColumns2.Add(new TableColumn("datetime2_FLD", -1));
+ tableColumns2.Add(new TableColumn("xml_FLD", -1));
+ TableMetadata tableMeta2 = new TableMetadata("stress_test_table_2", tableColumns2);
+ TableMetadataList.Add(tableMeta2);
+
+ using (DataStressConnection conn = CreateConnection(null))
+ {
+ conn.Open();
+ using (DbCommand com = conn.CreateCommand())
+ {
+ try
+ {
+ com.CommandText = CreateTable1;
+ com.ExecuteNonQuery();
+ }
+ catch (DbException de)
+ {
+ // This can be improved by doing a Drop Table if exists.
+ if (de.Message.Contains("There is already an object named \'" + tableMeta1.TableName + "\' in the database."))
+ {
+ CleanupUserTables(tableMeta1);
+ com.ExecuteNonQuery();
+ }
+ else
+ {
+ throw de;
+ }
+ }
+
+ try
+ {
+ com.CommandText = CreateTable2;
+ com.ExecuteNonQuery();
+ }
+ catch (DbException de)
+ {
+ // This can be improved by doing a Drop Table if exists in the query itself.
+ if (de.Message.Contains("There is already an object named \'" + tableMeta2.TableName + "\' in the database."))
+ {
+ CleanupUserTables(tableMeta2);
+ com.ExecuteNonQuery();
+ }
+ else
+ {
+ throw de;
+ }
+ }
+
+ for (int i = 0; i < Depth; i++)
+ {
+ TrackedRandom randomInstance = new TrackedRandom();
+ randomInstance.Mark();
+
+ DbCommand comInsert1 = GetInsertCommand(randomInstance, tableMeta1, conn);
+ comInsert1.ExecuteNonQuery();
+
+ DbCommand comInsert2 = GetInsertCommand(randomInstance, tableMeta2, conn);
+ comInsert2.ExecuteNonQuery();
+ }
+ }
+ }
+ }
+
+ // method used to delete stress tables in the database
+ protected void CleanupUserTables(TableMetadata tableMetadata)
+ {
+ string DropTable = "drop TABLE " + tableMetadata.TableName + ";";
+
+ using (DataStressConnection conn = CreateConnection(null))
+ {
+ conn.Open();
+ using (DbCommand com = conn.CreateCommand())
+ {
+ try
+ {
+ com.CommandText = DropTable;
+ com.ExecuteNonQuery();
+ }
+ catch (Exception) { }
+ }
+ }
+ }
+
+ public List<TableMetadata> TableMetadataList
+ {
+ get;
+ private set;
+ }
+
+ public class TableMetadata
+ {
+ private string _tableName;
+ private List<TableColumn> _columns = new List<TableColumn>();
+
+ public TableMetadata(string tbleName, List<TableColumn> cols)
+ {
+ _tableName = tbleName;
+ _columns = cols;
+ }
+
+ public string TableName
+ {
+ get { return _tableName; }
+ }
+
+ public List<TableColumn> Columns
+ {
+ get { return _columns; }
+ }
+
+ public TableColumn GetColumn(string colName)
+ {
+ foreach (TableColumn column in _columns)
+ {
+ if (column.ColumnName.Equals(colName))
+ {
+ return column;
+ }
+ }
+ return null;
+ }
+ }
+
+ public class TableColumn
+ {
+ private string _columnName;
+ private int _maxLength;
+
+ public TableColumn(string colName, int maxLen)
+ {
+ _columnName = colName;
+ _maxLength = maxLen;
+ }
+
+ public string ColumnName
+ {
+ get { return _columnName; }
+ }
+
+ public int MaxLength
+ {
+ get { return _maxLength; }
+ }
+ }
+
+ private List<string> _applicationNames;
+
+ /// <summary>
+ /// Gets schema of all tables from the back-end database and fills
+ /// the m_Tables DataSet with this schema. This DataSet is used to
+ /// generate random command text for tests.
+ /// </summary>
+ public void InitializeSharedData(DataSource source)
+ {
+ Trace.WriteLine("Creating shared objects", this.ToString());
+
+ // Initialize m_sharedDataSet
+ TableMetadataList = new List<TableMetadata>();
+ BuildUserTables(TableMetadataList);
+
+ // Initialize m_applicationNames
+ _applicationNames = new List<string>();
+ for (int i = 0; i < GetNumDifferentApplicationNames(); i++)
+ {
+ _applicationNames.Add(GetRandomApplicationName());
+ }
+
+ // Initialize CurrentPoolingStressMode
+ CurrentPoolingStressMode = PoolingStressMode.RandomizeConnectionStrings;
+
+
+ Trace.WriteLine("Finished creating shared objects", this.ToString());
+ }
+
+ public void CleanupSharedData()
+ {
+ foreach (TableMetadata meta in TableMetadataList)
+ {
+ CleanupUserTables(meta);
+ }
+ TableMetadataList = null;
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressReader.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressReader.cs
new file mode 100644
index 0000000000..2b081cfead
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressReader.cs
@@ -0,0 +1,350 @@
+// 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.Collections.Generic;
+using System.Xml;
+using System.Data;
+using System.Data.Common;
+using System.Data.SqlClient;
+using System.Data.SqlTypes;
+using System.IO;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Stress.Data
+{
+ public class DataStressReader : IDisposable
+ {
+ #region Type method mapping
+
+ private static Dictionary<Type, Func<DataStressReader, int, CancellationToken, Random, Task<object>>> s_sqlTypes;
+ private static Dictionary<Type, Func<DataStressReader, int, CancellationToken, Random, Task<object>>> s_clrTypes;
+
+ static DataStressReader()
+ {
+ InitSqlTypes();
+ InitClrTypes();
+ }
+
+ private static void InitSqlTypes()
+ {
+ s_sqlTypes = new Dictionary<Type, Func<DataStressReader, int, CancellationToken, Random, Task<object>>>();
+
+ s_sqlTypes.Add(typeof(SqlBinary), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<SqlBinary>(ordinal, token, rnd));
+ s_sqlTypes.Add(typeof(SqlBoolean), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<SqlBoolean>(ordinal, token, rnd));
+ s_sqlTypes.Add(typeof(SqlByte), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<SqlByte>(ordinal, token, rnd));
+ s_sqlTypes.Add(typeof(SqlBytes), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<SqlBytes>(ordinal, token, rnd));
+ s_sqlTypes.Add(typeof(SqlChars), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<SqlChars>(ordinal, token, rnd));
+ s_sqlTypes.Add(typeof(SqlDateTime), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<SqlDateTime>(ordinal, token, rnd));
+ s_sqlTypes.Add(typeof(SqlDecimal), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<SqlDecimal>(ordinal, token, rnd));
+ s_sqlTypes.Add(typeof(SqlDouble), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<SqlDouble>(ordinal, token, rnd));
+ s_sqlTypes.Add(typeof(SqlGuid), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<SqlGuid>(ordinal, token, rnd));
+ s_sqlTypes.Add(typeof(SqlInt16), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<SqlInt16>(ordinal, token, rnd));
+ s_sqlTypes.Add(typeof(SqlInt32), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<SqlInt32>(ordinal, token, rnd));
+ s_sqlTypes.Add(typeof(SqlInt64), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<SqlInt64>(ordinal, token, rnd));
+ s_sqlTypes.Add(typeof(SqlMoney), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<SqlMoney>(ordinal, token, rnd));
+ s_sqlTypes.Add(typeof(SqlSingle), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<SqlSingle>(ordinal, token, rnd));
+ s_sqlTypes.Add(typeof(SqlString), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<SqlString>(ordinal, token, rnd));
+ s_sqlTypes.Add(typeof(SqlXml), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<SqlXml>(ordinal, token, rnd));
+ }
+
+ private static void InitClrTypes()
+ {
+ s_clrTypes = new Dictionary<Type, Func<DataStressReader, int, CancellationToken, Random, Task<object>>>();
+
+ s_clrTypes.Add(typeof(Boolean), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<Boolean>(ordinal, token, rnd));
+ s_clrTypes.Add(typeof(Byte), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<Byte>(ordinal, token, rnd));
+ s_clrTypes.Add(typeof(Int16), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<Int16>(ordinal, token, rnd));
+ s_clrTypes.Add(typeof(Int32), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<Int32>(ordinal, token, rnd));
+ s_clrTypes.Add(typeof(Int64), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<Int64>(ordinal, token, rnd));
+ s_clrTypes.Add(typeof(Single), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<Single>(ordinal, token, rnd));
+ s_clrTypes.Add(typeof(Double), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<Double>(ordinal, token, rnd));
+ s_clrTypes.Add(typeof(String), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<String>(ordinal, token, rnd));
+ s_clrTypes.Add(typeof(Char), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<Char>(ordinal, token, rnd));
+ s_clrTypes.Add(typeof(Decimal), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<Decimal>(ordinal, token, rnd));
+ s_clrTypes.Add(typeof(Guid), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<Guid>(ordinal, token, rnd));
+ s_clrTypes.Add(typeof(DateTime), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<DateTime>(ordinal, token, rnd));
+ s_clrTypes.Add(typeof(TimeSpan), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<TimeSpan>(ordinal, token, rnd));
+ s_clrTypes.Add(typeof(DateTimeOffset), (reader, ordinal, token, rnd) => reader.GetFieldValueSyncOrAsync<DateTimeOffset>(ordinal, token, rnd));
+ }
+
+ #endregion
+
+ private readonly DbDataReader _reader;
+ private SemaphoreSlim _closeAsyncSemaphore;
+
+ public DataStressReader(DbDataReader internalReader)
+ {
+ _reader = internalReader;
+ }
+
+ public void Close()
+ {
+ _reader.Dispose();
+ }
+
+ public void Dispose()
+ {
+ _reader.Dispose();
+ if (_closeAsyncSemaphore != null) _closeAsyncSemaphore.Dispose();
+ }
+
+ public Task CloseAsync()
+ {
+ _closeAsyncSemaphore = new SemaphoreSlim(1);
+ return Task.Run(() => ExecuteWithCloseAsyncSemaphore(Close));
+ }
+
+ /// <summary>
+ /// Executes the action while holding the CloseAsync Semaphore.
+ /// This MUST be used for reader.Close() and all methods that are not safe to call at the same time as reader.Close(), i.e. all sync methods.
+ /// Otherwise we will see AV's.
+ /// </summary>
+ public void ExecuteWithCloseAsyncSemaphore(Action a)
+ {
+ try
+ {
+ if (_closeAsyncSemaphore != null) _closeAsyncSemaphore.Wait();
+ a();
+ }
+ finally
+ {
+ if (_closeAsyncSemaphore != null) _closeAsyncSemaphore.Release();
+ }
+ }
+
+ /// <summary>
+ /// Executes the action while holding the CloseAsync Semaphore.
+ /// This MUST be used for reader.Close() and all methods that are not safe to call at the same time as reader.Close(), i.e. all sync methods.
+ /// Otherwise we will see AV's.
+ /// </summary>
+ public T ExecuteWithCloseAsyncSemaphore<T>(Func<T> f)
+ {
+ try
+ {
+ if (_closeAsyncSemaphore != null) _closeAsyncSemaphore.Wait();
+ return f();
+ }
+ finally
+ {
+ if (_closeAsyncSemaphore != null) _closeAsyncSemaphore.Release();
+ }
+ }
+
+ #region SyncOrAsync methods
+
+ public Task<bool> ReadSyncOrAsync(CancellationToken token, Random rnd)
+ {
+ return AsyncUtils.SyncOrAsyncMethod(
+ () => ExecuteWithCloseAsyncSemaphore(() => _reader.Read()),
+ () => ExecuteWithCloseAsyncSemaphore(() => _reader.ReadAsync(token)),
+ AsyncUtils.ChooseSyncAsyncMode(rnd)
+ );
+ }
+
+ public Task<bool> NextResultSyncOrAsync(CancellationToken token, Random rnd)
+ {
+ return AsyncUtils.SyncOrAsyncMethod(
+ () => ExecuteWithCloseAsyncSemaphore(() => _reader.NextResult()),
+ () => ExecuteWithCloseAsyncSemaphore(() => _reader.NextResultAsync(token)),
+ AsyncUtils.ChooseSyncAsyncMode(rnd)
+ );
+ }
+
+ public Task<bool> IsDBNullSyncOrAsync(int ordinal, CancellationToken token, Random rnd)
+ {
+ return AsyncUtils.SyncOrAsyncMethod(
+ () => ExecuteWithCloseAsyncSemaphore(() => _reader.IsDBNull(ordinal)),
+ () => ExecuteWithCloseAsyncSemaphore(() => _reader.IsDBNullAsync(ordinal, token)),
+ AsyncUtils.ChooseSyncAsyncMode(rnd)
+ );
+ }
+
+ public Task<object> GetValueSyncOrAsync(int ordinal, CancellationToken token, Random rnd)
+ {
+ if (rnd.NextBool(0.3))
+ {
+ // Use sync-only GetValue
+ return Task.FromResult(GetValue(ordinal));
+ }
+ else
+ {
+ // Use GetFieldValue or GetFieldValueAsync
+ Func<DataStressReader, int, CancellationToken, Random, Task<object>> getFieldValueFunc = null;
+
+ if (rnd.NextBool())
+ {
+ // Choose provider-specific getter
+ Type sqlType = GetProviderSpecificFieldType(ordinal);
+ s_sqlTypes.TryGetValue(sqlType, out getFieldValueFunc);
+ }
+ else
+ {
+ // Choose clr type getter
+ Type clrType = GetFieldType(ordinal);
+ s_clrTypes.TryGetValue(clrType, out getFieldValueFunc);
+ }
+
+ if (getFieldValueFunc != null)
+ {
+ // Execute the type-specific func, e.g. GetFieldValue<int> or GetFieldValueAsync<int>
+ return getFieldValueFunc(this, ordinal, token, rnd);
+ }
+ else
+ {
+ // Execute GetFieldValue<object> or GetFieldValueAsync<object> as a fallback
+ return GetFieldValueSyncOrAsync<object>(ordinal, token, rnd);
+ }
+ }
+ }
+
+ private Task<object> GetFieldValueSyncOrAsync<T>(int ordinal, CancellationToken token, Random rnd)
+ {
+ return AsyncUtils.SyncOrAsyncMethod<object>(
+ () => ExecuteWithCloseAsyncSemaphore(() => _reader.GetFieldValue<T>(ordinal)),
+ async () => ((object)(await ExecuteWithCloseAsyncSemaphore(() => _reader.GetFieldValueAsync<T>(ordinal, token)))),
+ AsyncUtils.ChooseSyncAsyncMode(rnd)
+ );
+ }
+
+ #endregion
+
+ #region Sync-only methods
+
+ public long GetBytes(int ordinal, long dataOffset, byte[] buffer, int bufferOffset, int length)
+ {
+ return ExecuteWithCloseAsyncSemaphore(() => _reader.GetBytes(ordinal, dataOffset, buffer, bufferOffset, length));
+ }
+
+ public long GetChars(int ordinal, long dataOffset, char[] buffer, int bufferOffset, int length)
+ {
+ return ExecuteWithCloseAsyncSemaphore(() => _reader.GetChars(ordinal, dataOffset, buffer, bufferOffset, length));
+ }
+
+ public Type GetFieldType(int ordinal)
+ {
+ return ExecuteWithCloseAsyncSemaphore(() => _reader.GetFieldType(ordinal));
+ }
+
+ public string GetName(int ordinal)
+ {
+ return ExecuteWithCloseAsyncSemaphore(() => _reader.GetName(ordinal));
+ }
+
+ public Type GetProviderSpecificFieldType(int ordinal)
+ {
+ return ExecuteWithCloseAsyncSemaphore(() => _reader.GetProviderSpecificFieldType(ordinal));
+ }
+
+
+ public DataStressStream GetStream(int ordinal)
+ {
+ Stream s = ExecuteWithCloseAsyncSemaphore(() => _reader.GetStream(ordinal));
+ return new DataStressStream(s, this);
+ }
+
+ public DataStressTextReader GetTextReader(int ordinal)
+ {
+ TextReader t = ExecuteWithCloseAsyncSemaphore(() => _reader.GetTextReader(ordinal));
+ return new DataStressTextReader(t, this);
+ }
+
+ public DataStressXmlReader GetXmlReader(int ordinal)
+ {
+ XmlReader x = ExecuteWithCloseAsyncSemaphore(() => ((SqlDataReader)_reader).GetXmlReader(ordinal));
+ return new DataStressXmlReader(x, this);
+ }
+
+ public object GetValue(int ordinal)
+ {
+ return ExecuteWithCloseAsyncSemaphore(() => _reader.GetValue(ordinal));
+ }
+
+ public int FieldCount
+ {
+ get { return ExecuteWithCloseAsyncSemaphore(() => _reader.FieldCount); }
+ }
+
+ #endregion
+ }
+
+ public class DataStressStream : IDisposable
+ {
+ private Stream _stream;
+ private DataStressReader _reader;
+
+ public DataStressStream(Stream stream, DataStressReader reader)
+ {
+ _stream = stream;
+ _reader = reader;
+ }
+
+ public void Dispose()
+ {
+ _stream.Dispose();
+ }
+
+ public Task<int> ReadSyncOrAsync(byte[] buffer, int offset, int count, CancellationToken token, Random rnd)
+ {
+ return AsyncUtils.SyncOrAsyncMethod(
+ () => _reader.ExecuteWithCloseAsyncSemaphore(() => _stream.Read(buffer, offset, count)),
+ () => _reader.ExecuteWithCloseAsyncSemaphore(() => _stream.ReadAsync(buffer, offset, count)),
+ AsyncUtils.ChooseSyncAsyncMode(rnd)
+ );
+ }
+ }
+
+ public class DataStressTextReader : IDisposable
+ {
+ private TextReader _textReader;
+ private DataStressReader _reader;
+
+ public DataStressTextReader(TextReader textReader, DataStressReader reader)
+ {
+ _textReader = textReader;
+ _reader = reader;
+ }
+
+ public void Dispose()
+ {
+ _textReader.Dispose();
+ }
+
+ public int Peek()
+ {
+ return _reader.ExecuteWithCloseAsyncSemaphore(() => _textReader.Peek());
+ }
+
+ public Task<int> ReadSyncOrAsync(char[] buffer, int index, int count, Random rnd)
+ {
+ return AsyncUtils.SyncOrAsyncMethod(
+ () => _reader.ExecuteWithCloseAsyncSemaphore(() => _textReader.Read(buffer, index, count)),
+ () => _reader.ExecuteWithCloseAsyncSemaphore(() => _textReader.ReadAsync(buffer, index, count)),
+ AsyncUtils.ChooseSyncAsyncMode(rnd));
+ }
+ }
+
+ public class DataStressXmlReader : IDisposable
+ {
+ private XmlReader _xmlReader;
+ private DataStressReader _reader;
+
+ public DataStressXmlReader(XmlReader xmlReader, DataStressReader reader)
+ {
+ _xmlReader = xmlReader;
+ _reader = reader;
+ }
+
+ public void Dispose()
+ {
+ _xmlReader.Dispose();
+ }
+
+ public void Read()
+ {
+ _reader.ExecuteWithCloseAsyncSemaphore(() => _xmlReader.Read());
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressSettings.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressSettings.cs
new file mode 100644
index 0000000000..ff77d19137
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressSettings.cs
@@ -0,0 +1,305 @@
+// 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.Collections.Generic;
+using System.Data.SqlClient;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+
+namespace Stress.Data
+{
+ /// <summary>
+ /// Loads dataStressSettings section from Stress.Data.Framework.dll.config (App.config in source tree)
+ /// </summary>
+ public class DataStressSettings
+ {
+
+ internal static readonly string s_configFileName = "StressTest.config";
+
+ // use Instance to access the settings
+ private DataStressSettings()
+ {
+ }
+
+ private bool Initialized { get; set; }
+
+ private DataStressConfigurationSection _dataStressSettings = new DataStressConfigurationSection();
+
+ // list of sources read from the config file
+ private Dictionary<string, DataSource> _sources = new Dictionary<string, DataSource>(StringComparer.CurrentCultureIgnoreCase);
+ public ErrorHandlingAction ActionOnProductError
+ {
+ get;
+ private set;
+ }
+ public ErrorHandlingAction ActionOnTestError
+ {
+ get;
+ private set;
+ }
+ public ErrorHandlingAction ActionOnProgrammingError
+ {
+ get;
+ private set;
+ }
+
+ public int NumberOfConnectionPools
+ {
+ get;
+ private set;
+ }
+
+ // singleton instance, lazy evaluation
+ private static DataStressSettings s_instance = new DataStressSettings();
+ public static DataStressSettings Instance
+ {
+ get
+ {
+ if (!s_instance.Initialized)
+ {
+ lock (s_instance)
+ {
+ if (!s_instance.Initialized)
+ {
+ s_instance.Load();
+ }
+ }
+ }
+ return s_instance;
+ }
+ }
+
+ #region Configuration file handlers
+
+ private class DataStressConfigurationSection
+ {
+ private List<DataSourceElement> _sources = new List<DataSourceElement>();
+ private ErrorHandlingPolicyElement _errorHandlingPolicy = new ErrorHandlingPolicyElement();
+ private ConnectionPoolPolicyElement _connectionPoolPolicy = new ConnectionPoolPolicyElement();
+
+ StressConfigReader reader = new StressConfigReader(s_configFileName);
+
+ public List<DataSourceElement> Sources
+ {
+ get
+ {
+ if(_sources.Count == 0)
+ {
+ reader.Load();
+ _sources = reader.Sources;
+ }
+ return _sources;
+ }
+ }
+
+ public ErrorHandlingPolicyElement ErroHandlingPolicy
+ {
+ get
+ {
+ return _errorHandlingPolicy;
+ }
+ }
+
+ public ConnectionPoolPolicyElement ConnectionPoolPolicy
+ {
+ get
+ {
+ return _connectionPoolPolicy;
+ }
+ }
+ }
+
+
+ internal class DataSourceElement
+ {
+ private string _name;
+ private string _type;
+ private bool _isDefault = false;
+
+ public readonly Dictionary<string, string> SourceProperties = new Dictionary<string, string>();
+
+
+ public DataSourceElement(string ds_name,
+ string ds_type,
+ string ds_server,
+ string ds_datasource,
+ string ds_database,
+ string ds_user,
+ string ds_password,
+ bool ds_isDefault = false,
+ bool ds_winAuth = false,
+ bool ds_isLocal = false,
+ string ds_dbFile = null,
+ bool disableMultiSubnetFailoverSetup = true,
+ bool disableNamedPipes = true)
+ {
+ _name = ds_name;
+ _type = ds_type;
+ _isDefault = ds_isDefault;
+
+ if (ds_server != null)
+ {
+ SourceProperties.Add("server", ds_server);
+ }
+ if (ds_datasource != null)
+ {
+ SourceProperties.Add("dataSource", ds_datasource);
+ }
+ if (ds_database != null)
+ {
+ SourceProperties.Add("database", ds_database);
+ }
+ if (ds_user != null)
+ {
+ SourceProperties.Add("user", ds_user);
+ }
+ if (ds_password != null)
+ {
+ SourceProperties.Add("password", ds_password);
+ }
+
+ SourceProperties.Add("supportsWindowsAuthentication", ds_winAuth.ToString());
+ SourceProperties.Add("islocal", ds_isLocal.ToString());
+
+ SourceProperties.Add("DisableMultiSubnetFailoverSetup", disableMultiSubnetFailoverSetup.ToString());
+
+ SourceProperties.Add("DisableNamedPipes", disableNamedPipes.ToString());
+
+
+ if (ds_dbFile != null)
+ {
+ SourceProperties.Add("databaseFile", ds_dbFile);
+ }
+ }
+
+ public string Name
+ {
+ get { return _name; }
+ }
+
+ public string Type
+ {
+ get { return _type; }
+ }
+
+ public bool IsDefault
+ {
+ get { return _isDefault; }
+ }
+ }
+
+ private class ErrorHandlingPolicyElement
+ {
+ private string _onProductError = "debugBreak";
+ private string _onTestError = "throwException";
+ private string _onProgrammingError = "debugBreak";
+
+ public string OnProductError
+ {
+ get
+ {
+ return _onProductError;
+ }
+ }
+
+ public string OnTestError
+ {
+ get
+ {
+ return _onTestError;
+ }
+ }
+
+ public string OnProgrammingError
+ {
+ get
+ {
+ return _onProgrammingError;
+ }
+ }
+ }
+
+ private class ConnectionPoolPolicyElement
+ {
+ private int _numberOfPools = 10;
+
+ public int NumberOfPools
+ {
+ get
+ {
+ return _numberOfPools;
+ }
+ }
+ }
+
+ #endregion
+
+ /// <summary>
+ /// loads the configuration data from the app config file (Stress.Data.Framework.dll.config) and initializes the Sources collection
+ /// </summary>
+ private void Load()
+ {
+ // Parse <sources>
+ foreach (DataSourceElement sourceElement in _dataStressSettings.Sources)
+ {
+ // if Parse raises exception, check that the type attribute is set to the relevant the SourceType enumeration value name
+ DataSourceType sourceType = (DataSourceType)Enum.Parse(typeof(DataSourceType), sourceElement.Type, true);
+
+ DataSource newSource = DataSource.Create(sourceElement.Name, sourceType, sourceElement.IsDefault, sourceElement.SourceProperties);
+ _sources.Add(newSource.Name, newSource);
+ }
+
+ // Parse <errorhandlingpolicy>
+ // if Parse raises exception, check that the action attribute is set to a valid ActionOnProductBugFound enumeration value name
+ this.ActionOnProductError = (ErrorHandlingAction)Enum.Parse(typeof(ErrorHandlingAction), _dataStressSettings.ErroHandlingPolicy.OnProductError, true);
+ this.ActionOnTestError = (ErrorHandlingAction)Enum.Parse(typeof(ErrorHandlingAction), _dataStressSettings.ErroHandlingPolicy.OnTestError, true);
+ this.ActionOnProgrammingError = (ErrorHandlingAction)Enum.Parse(typeof(ErrorHandlingAction), _dataStressSettings.ErroHandlingPolicy.OnProgrammingError, true);
+
+ // Parse <connectionPoolPolicy>
+ this.NumberOfConnectionPools = _dataStressSettings.ConnectionPoolPolicy.NumberOfPools;
+
+ this.Initialized = true;
+ }
+
+
+ /// <summary>
+ /// use this method to retrieve the source data by its name (represented with 'name' attribute in config file)
+ /// </summary>
+ /// <param name="name">case-sensitive name</param>
+ public DataSource GetSourceByName(string name)
+ {
+ return _sources[name];
+ }
+
+ /// <summary>
+ /// Use this method to retrieve the default source associated with the type specified.
+ /// The type of the node is specified with 'type' attribute on the sources file - see DataSourceType enum for list of supported types.
+ /// If there is a source node with isDefault=true, this node is returned (first one found in config file).
+ /// Otherwise, first source node from type specified is returned.
+ /// </summary>
+ public DataSource GetDefaultSourceByType(DataSourceType type)
+ {
+ DataSource defaultSource = null;
+ foreach (DataSource source in _sources.Values)
+ {
+ if (source.Type == type)
+ {
+ if (defaultSource == null)
+ {
+ // use the first found source, if default is not set
+ defaultSource = source;
+ }
+ else if (source.IsDefault)
+ {
+ defaultSource = source;
+ break;
+ }
+ }
+ }
+ return defaultSource;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataTestGroup.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataTestGroup.cs
new file mode 100644
index 0000000000..0e98b878e8
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataTestGroup.cs
@@ -0,0 +1,698 @@
+// 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.Collections.Generic;
+using System.Data;
+using System.Data.Common;
+using System.Data.SqlClient;
+using System.Data.SqlTypes;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Xml;
+
+using DPStressHarness;
+
+namespace Stress.Data
+{
+ /// <summary>
+ /// basic set of tests to run on each managed provider
+ /// </summary>
+ public abstract class DataTestGroup
+ {
+ // random is not thread-safe, create one per thread - use RandomInstance to access it.
+ // note that each thread and each test method has a different instance of this object, so it
+ // doesn't need to be synchronised or have [ThreadStatic], etc
+ private TrackedRandom _randomInstance = new TrackedRandom();
+ protected Random RandomInstance
+ {
+ get
+ {
+ _randomInstance.Mark();
+ return _randomInstance;
+ }
+ }
+
+ /// <summary>
+ /// Test factory to use for generation of connection strings and other test objects. Factory is initialized during setup.
+ /// null is not returned - if setup was not called yet, exception is raised
+ /// This is static so that is shared across all threads (since stresstest will create a new DataTestGroup object for each thread)
+ /// </summary>
+ private static DataStressFactory s_factory;
+ public static DataStressFactory Factory
+ {
+ get
+ {
+ DataStressErrors.Assert(s_factory != null, "Tried to access DataTestGroup.Factory before Setup has been called");
+ return s_factory;
+ }
+ }
+
+ /// <summary>
+ /// This method is called to create the stress factory used to create connections, commands, etc...
+ /// Implementation should set the source and the scenario to valid values if inputs are null/empty.
+ /// </summary>
+ /// <param name="scenario">Scenario string specified by the user or empty to set default</param>
+ /// <param name="dataSource">DataSource string specified by the user or empty to use connection string as is, useful when developing new tests</param>
+ protected abstract DataStressFactory CreateFactory(ref string scenario, ref DataSource source);
+
+ /// <summary>
+ /// scenario to run, initialized in setup
+ /// null is not returned - if setup was not called yet, exception is raised
+ /// This is static so that is shared across all threads (since stresstest will create a new DataTestGroup object for each thread)
+ /// </summary>
+ private static string s_scenario;
+ protected static string Scenario
+ {
+ get
+ {
+ DataStressErrors.Assert(s_scenario != null, "Tried to access DataTestGroup.Scenario before Setup has been called");
+ return s_scenario;
+ }
+ }
+
+ /// <summary>
+ /// data source information used by stress, initialized in Setup
+ /// null is not returned - if setup was not called yet, exception is raised
+ /// This is static so that is shared across all threads (since stresstest will create a new DataTestGroup object for each thread)
+ /// </summary>
+ private static DataSource s_source;
+ protected static DataSource Source
+ {
+ get
+ {
+ DataStressErrors.Assert(s_source != null, "Tried to access DataTestGroup.Source before Setup has been called");
+ return s_source;
+ }
+ }
+
+
+ /// <summary>
+ /// Does test setup that is shared across all threads. This method will be called only once, before
+ /// any [TestSetup] methods are called.
+ /// If you override this method you must call base.GlobalTestSetup() at the beginning.
+ /// </summary>
+ [GlobalTestSetup]
+ public virtual void GlobalTestSetup()
+ {
+ // Preconditions - ensure this setup is only called once
+ DataStressErrors.Assert(string.IsNullOrEmpty(s_scenario), "Scenario was already set");
+ DataStressErrors.Assert(s_source == null, "Source was already set");
+ DataStressErrors.Assert(s_factory == null, "Factory was already set");
+
+ // Set m_scenario
+ string userProvidedScenario;
+ TestMetrics.Overrides.TryGetValue("scenario", out userProvidedScenario);
+ // Empty means default scenario for the test group
+ s_scenario = (userProvidedScenario ?? string.Empty);
+ s_scenario = s_scenario.ToUpperInvariant();
+
+ // Set m_source
+ // Empty means that test group will peek the default data source from the config file based on the scenario
+ string userProvidedSourceName;
+ if (TestMetrics.Overrides.TryGetValue("source", out userProvidedSourceName))
+ {
+ s_source = DataStressSettings.Instance.GetSourceByName(userProvidedSourceName);
+ }
+
+ // Set m_factory
+ s_factory = CreateFactory(ref s_scenario, ref s_source);
+ s_factory.InitializeSharedData(s_source);
+
+ // Postconditions
+ DataStressErrors.Assert(!string.IsNullOrEmpty(s_scenario), "Scenario was not set");
+ DataStressErrors.Assert(s_source != null, "Source was not set");
+ DataStressErrors.Assert(s_factory != null, "Factory was not set");
+ }
+
+ /// <summary>
+ /// Does test cleanup that is shared across all threads. This method will not be called until all
+ /// threads have finished executing [StressTest] methods. This method will be called only once.
+ /// If you override this method you must call base.GlobalTestSetup() at the beginning.
+ /// </summary>
+ [GlobalTestCleanup]
+ public virtual void GlobalTestCleanup()
+ {
+ s_factory.CleanupSharedData();
+ s_source = null;
+ s_scenario = null;
+ s_factory.Dispose();
+ s_factory = null;
+ }
+
+
+ protected bool OpenConnection(DataStressConnection conn)
+ {
+ try
+ {
+ conn.Open();
+ return true;
+ }
+ catch (Exception e)
+ {
+ if (IsServerNotAccessibleException(e, conn.DbConnection.ConnectionString, conn.DbConnection.DataSource))
+ {
+ // Ignore this exception.
+ // This exception will fire when using named pipes with MultiSubnetFailover option set to true.
+ // MultiSubnetFailover=true only works with TCP/IP protocol and will result in exception when using with named pipes.
+ return false;
+ }
+ else
+ {
+ throw e;
+ }
+ }
+ }
+
+
+ [GlobalExceptionHandler]
+ public virtual void GlobalExceptionHandler(Exception e)
+ {
+ }
+
+ /// <summary>
+ /// Returns whether or not the datareader should be closed
+ /// </summary>
+ protected virtual bool ShouldCloseDataReader()
+ {
+ // Ignore commandCancelled, instead randomly close it 9/10 of the time
+ return RandomInstance.Next(10) != 0;
+ }
+
+
+ #region CommandExecute and Consume methods
+
+ /// <summary>
+ /// Utility function used by command tests
+ /// </summary>
+ protected virtual void CommandExecute(Random rnd, DbCommand com, bool query)
+ {
+ AsyncUtils.WaitAndUnwrapException(CommandExecuteAsync(rnd, com, query));
+ }
+
+ protected async virtual Task CommandExecuteAsync(Random rnd, DbCommand com, bool query)
+ {
+ CancellationTokenSource cts = null;
+
+ // Cancel 1/10 commands
+ Task cancelTask = null;
+ bool cancelCommand = rnd.NextBool(0.1);
+ if (cancelCommand)
+ {
+ if (rnd.NextBool())
+ {
+ // Use DbCommand.Cancel
+ cancelTask = Task.Run(() => CommandCancel(com));
+ }
+ else
+ {
+ // Use CancellationTokenSource
+ if (cts == null) cts = new CancellationTokenSource();
+ cancelTask = Task.Run(() => cts.Cancel());
+ }
+ }
+
+ // Get the CancellationToken
+ CancellationToken token = (cts != null) ? cts.Token : CancellationToken.None;
+
+ DataStressReader reader = null;
+ try
+ {
+ if (query)
+ {
+ CommandBehavior commandBehavior = CommandBehavior.Default;
+ if (rnd.NextBool(0.5)) commandBehavior |= CommandBehavior.SequentialAccess;
+ if (rnd.NextBool(0.25)) commandBehavior |= CommandBehavior.KeyInfo;
+ if (rnd.NextBool(0.1)) commandBehavior |= CommandBehavior.SchemaOnly;
+
+ // Get the reader
+ reader = new DataStressReader(await com.ExecuteReaderSyncOrAsync(commandBehavior, token, rnd));
+
+ // Consume the reader's data
+ await ConsumeReaderAsync(reader, commandBehavior.HasFlag(CommandBehavior.SequentialAccess), token, rnd);
+ }
+ else
+ {
+ await com.ExecuteNonQuerySyncOrAsync(token, rnd);
+ }
+ }
+ catch (Exception e)
+ {
+ if (cancelCommand && IsCommandCancelledException(e))
+ {
+ // Catch command canceled exception
+ }
+ else
+ {
+ throw;
+ }
+ }
+ finally
+ {
+ if (cancelTask != null) AsyncUtils.WaitAndUnwrapException(cancelTask);
+ if (reader != null && ShouldCloseDataReader()) reader.Close();
+ }
+ }
+
+ /// <summary>
+ /// Utility function to consume a reader in a random fashion
+ /// </summary>
+ protected virtual async Task ConsumeReaderAsync(DataStressReader reader, bool sequentialAccess, CancellationToken token, Random rnd)
+ {
+ // Close 1/10 of readers while they are reading
+ Task closeTask = null;
+ if (AllowReaderCloseDuringReadAsync() && rnd.NextBool(0.1))
+ {
+ // Begin closing now on another thread
+ closeTask = reader.CloseAsync();
+ }
+
+ try
+ {
+ do
+ {
+ while (await reader.ReadSyncOrAsync(token, rnd))
+ {
+ // Optionally stop reading the current result set
+ if (rnd.NextBool(0.1)) break;
+
+ // Read the current row
+ await ConsumeRowAsync(reader, sequentialAccess, token, rnd);
+ }
+
+ // Executing NextResult only 50% of the time
+ if (rnd.NextBool())
+ break;
+ } while (await reader.NextResultSyncOrAsync(token, rnd));
+ }
+ catch (Exception e)
+ {
+ if (closeTask != null && IsReaderClosedException(e))
+ {
+ // Catch reader closed exception
+ }
+ else
+ {
+ throw;
+ }
+ }
+ finally
+ {
+ if (closeTask != null) AsyncUtils.WaitAndUnwrapException(closeTask);
+ }
+ }
+
+ /// <summary>
+ /// Utility function to consume a single row of a reader in a random fashion after Read/ReadAsync has been invoked.
+ /// </summary>
+ protected virtual async Task ConsumeRowAsync(DataStressReader reader, bool sequentialAccess, CancellationToken token, Random rnd)
+ {
+ for (int i = 0; i < reader.FieldCount; i++)
+ {
+ if (rnd.Next(10) == 0) break; // stop reading from this row
+ if (rnd.Next(2) == 0) continue; // skip this field
+ bool hasBeenRead = false;
+
+ // If the field is not null, we can optionally use streaming API
+ if ((!await reader.IsDBNullSyncOrAsync(i, token, rnd)) && (rnd.NextBool()))
+ {
+ Type t = reader.GetFieldType(i);
+ if (t == typeof(byte[]))
+ {
+ await ConsumeBytesAsync(reader, i, token, rnd);
+ hasBeenRead = true;
+ }
+ else if (t == typeof(string))
+ {
+ await ConsumeCharsAsync(reader, i, token, rnd);
+ hasBeenRead = true;
+ }
+ }
+
+ // If the field has not yet been read, or if it is non-sequential then we can re-read it
+ if ((!hasBeenRead) || (!sequentialAccess))
+ {
+ if (!await reader.IsDBNullSyncOrAsync(i, token, rnd))
+ {
+ // Field value is not null, we can use new GetFieldValue<T> methods
+ await reader.GetValueSyncOrAsync(i, token, rnd);
+ }
+ else
+ {
+ // Field value is null, we have to use old GetValue method
+ reader.GetValue(i);
+ }
+ }
+
+ // Do IsDBNull check again with 50% probability
+ if (rnd.NextBool()) await reader.IsDBNullSyncOrAsync(i, token, rnd);
+ }
+ }
+
+ protected virtual async Task ConsumeBytesAsync(DataStressReader reader, int i, CancellationToken token, Random rnd)
+ {
+ byte[] buffer = new byte[255];
+
+ if (rnd.NextBool())
+ {
+ // We can optionally use GetBytes
+ reader.GetBytes(i, rnd.Next(20), buffer, rnd.Next(20), rnd.Next(200));
+ }
+ else if (reader.GetName(i) != "timestamp_FLD")
+ {
+ // Timestamp appears to be binary, but cannot be read by Stream
+ DataStressStream stream = reader.GetStream(i);
+ await stream.ReadSyncOrAsync(buffer, rnd.Next(20), rnd.Next(200), token, rnd);
+ }
+ else
+ {
+ // It is timestamp column, so read it later with GetValueSyncOrAsync
+ await reader.GetValueSyncOrAsync(i, token, rnd);
+ }
+ }
+
+ protected virtual async Task ConsumeCharsAsync(DataStressReader reader, int i, CancellationToken token, Random rnd)
+ {
+ char[] buffer = new char[255];
+
+ if (rnd.NextBool())
+ {
+ // Read with GetChars
+ reader.GetChars(i, rnd.Next(20), buffer, rnd.Next(20), rnd.Next(200));
+ }
+ else if (reader.GetProviderSpecificFieldType(i) == typeof(SqlXml))
+ {
+ // SqlClient only: Xml is read by XmlReader
+ DataStressXmlReader xmlReader = reader.GetXmlReader(i);
+ xmlReader.Read();
+ }
+ else
+ {
+ // Read with TextReader
+ DataStressTextReader textReader = reader.GetTextReader(i);
+ if (rnd.NextBool())
+ {
+ textReader.Peek();
+ }
+ await textReader.ReadSyncOrAsync(buffer, rnd.Next(20), rnd.Next(200), rnd);
+ if (rnd.NextBool())
+ {
+ textReader.Peek();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Returns true if the given exception is expected for the current provider when a command is cancelled by another thread.
+ /// </summary>
+ /// <param name="e"></param>
+ protected virtual bool IsCommandCancelledException(Exception e)
+ {
+ return e is TaskCanceledException;
+ }
+
+ /// <summary>
+ /// Returns true if the given exception is expected for the current provider when trying to read from a reader that has been closed
+ /// </summary>
+ /// <param name="e"></param>
+ protected virtual bool IsReaderClosedException(Exception e)
+ {
+ return false;
+ }
+
+ /// <summary>
+ /// Returns true if the given exception is expected for the current provider when trying to connect to unavailable/non-existent server
+ /// </summary>
+ /// <param name="e"></param>
+ protected bool IsServerNotAccessibleException(Exception e, string connString, string dataSource)
+ {
+ return
+ e is ArgumentException &&
+ connString.Contains("MultiSubnetFailover=True") &&
+ dataSource.Contains("np:") &&
+ e.Message.Contains("Connecting to a SQL Server instance using the MultiSubnetFailover connection option is only supported when using the TCP protocol.");
+ }
+
+ /// <summary>
+ /// Returns true if the backend provider supports closing a datareader while asynchronously reading from it
+ /// </summary>
+ /// <returns></returns>
+ protected virtual bool AllowReaderCloseDuringReadAsync()
+ {
+ return false;
+ }
+
+ /// <summary>
+ /// Thread Callback function which cancels queries using DbCommand.Cancel()
+ /// </summary>
+ /// <param name="cmd"></param>
+ protected void CommandCancel(object o)
+ {
+ try
+ {
+ DbCommand cmd = (DbCommand)o;
+ cmd.Cancel();
+ }
+ catch (Exception ex)
+ {
+ Trace.WriteLine(ex.ToString(), this.ToString());
+ }
+ }
+
+ #endregion
+
+ #region Command and Parameter Tests
+
+ /// <summary>
+ /// Command Reader Test: Executes a simple SELECT statement without parameters
+ /// </summary>
+ [StressTest("TestCommandReader", Weight = 10)]
+ public void TestCommandReader()
+ {
+ Random rnd = RandomInstance;
+
+ using (DataStressConnection conn = Factory.CreateConnection(rnd))
+ {
+ if (!OpenConnection(conn)) return;
+ DataStressFactory.TableMetadata table = Factory.GetRandomTable(rnd);
+ DbCommand com = Factory.GetCommand(rnd, table, conn, true);
+ CommandExecute(rnd, com, true);
+ }
+ }
+
+ /// <summary>
+ /// Command Select Test: Executes a single SELECT statement with parameters
+ /// </summary>
+ [StressTest("TestCommandSelect", Weight = 10)]
+ public void TestCommandSelect()
+ {
+ Random rnd = RandomInstance;
+
+ using (DataStressConnection conn = Factory.CreateConnection(rnd))
+ {
+ if (!OpenConnection(conn)) return;
+ DataStressFactory.TableMetadata table = Factory.GetRandomTable(rnd);
+ DbCommand com = Factory.GetSelectCommand(rnd, table, conn);
+ CommandExecute(rnd, com, true);
+ }
+ }
+
+ /// <summary>
+ /// Command Insert Test: Executes a single INSERT statement with parameters
+ /// </summary>
+ [StressTest("TestCommandInsert", Weight = 10)]
+ public void TestCommandInsert()
+ {
+ Random rnd = RandomInstance;
+
+ using (DataStressConnection conn = Factory.CreateConnection(rnd))
+ {
+ if (!OpenConnection(conn)) return;
+ DataStressFactory.TableMetadata table = Factory.GetRandomTable(rnd);
+ DbCommand com = Factory.GetInsertCommand(rnd, table, conn);
+ CommandExecute(rnd, com, false);
+ }
+ }
+
+ /// <summary>
+ /// Command Update Test: Executes a single UPDATE statement with parameters
+ /// </summary>
+ [StressTest("TestCommandUpdate", Weight = 10)]
+ public void TestCommandUpdate()
+ {
+ Random rnd = RandomInstance;
+
+ using (DataStressConnection conn = Factory.CreateConnection(rnd))
+ {
+ if (!OpenConnection(conn)) return;
+ DataStressFactory.TableMetadata table = Factory.GetRandomTable(rnd);
+ DbCommand com = Factory.GetUpdateCommand(rnd, table, conn);
+ CommandExecute(rnd, com, false);
+ }
+ }
+
+ /// <summary>
+ /// Command Update Test: Executes a single DELETE statement with parameters
+ /// </summary>
+ [StressTest("TestCommandDelete", Weight = 10)]
+ public void TestCommandDelete()
+ {
+ Random rnd = RandomInstance;
+
+ using (DataStressConnection conn = Factory.CreateConnection(rnd))
+ {
+ if (!OpenConnection(conn)) return;
+ DataStressFactory.TableMetadata table = Factory.GetRandomTable(rnd);
+ DbCommand com = Factory.GetDeleteCommand(rnd, table, conn);
+ CommandExecute(rnd, com, false);
+ }
+ }
+
+ [StressTest("TestCommandTimeout", Weight = 10)]
+ public void TestCommandTimeout()
+ {
+ Random rnd = RandomInstance;
+ DataStressConnection conn = null;
+ try
+ {
+ // Use a transaction 50% of the time
+ if (rnd.NextBool())
+ {
+ }
+
+ // Create a select command
+ conn = Factory.CreateConnection(rnd);
+ if (!OpenConnection(conn)) return;
+ DataStressFactory.TableMetadata table = Factory.GetRandomTable(rnd);
+ DbCommand com = Factory.GetSelectCommand(rnd, table, conn);
+
+ // Setup timeout. We want to see various possibilities of timeout happening before, after, or at the same time as when the result comes in.
+ int delay = rnd.Next(0, 10); // delay is from 0 to 9 seconds inclusive
+ int timeout = rnd.Next(1, 10); // timeout is from 1 to 9 seconds inclusive
+ com.CommandText += string.Format("; WAITFOR DELAY '00:00:0{0}'", delay);
+ com.CommandTimeout = timeout;
+
+ // Execute command and catch timeout exception
+ try
+ {
+ CommandExecute(rnd, com, true);
+ }
+ catch (DbException e)
+ {
+ if (e is SqlException && ((SqlException)e).Number == 3989)
+ {
+ throw DataStressErrors.ProductError("Timing issue between OnTimeout and ReadAsyncCallback results in SqlClient's packet parsing going out of sync", e);
+ }
+ else if (!e.Message.ToLower().Contains("timeout"))
+ {
+ throw;
+ }
+ }
+ }
+ finally
+ {
+ if (conn != null) conn.Dispose();
+ }
+ }
+
+ [StressTest("TestCommandAndReaderAsync", Weight = 10)]
+ public void TestCommandAndReaderAsync()
+ {
+ // Since we're calling an "async" method, we need to do a Wait() here.
+ AsyncUtils.WaitAndUnwrapException(TestCommandAndReaderAsyncInternal());
+ }
+
+ /// <summary>
+ /// Utility method to test Async scenario using await keyword
+ /// </summary>
+ /// <returns></returns>
+ protected virtual async Task TestCommandAndReaderAsyncInternal()
+ {
+ Random rnd = RandomInstance;
+ using (DataStressConnection conn = Factory.CreateConnection(rnd))
+ {
+ if (!OpenConnection(conn)) return;
+ DataStressFactory.TableMetadata table = Factory.GetRandomTable(rnd);
+ DbCommand com;
+
+ com = Factory.GetInsertCommand(rnd, table, conn);
+ await CommandExecuteAsync(rnd, com, false);
+
+ com = Factory.GetDeleteCommand(rnd, table, conn);
+ await CommandExecuteAsync(rnd, com, false);
+
+ com = Factory.GetSelectCommand(rnd, table, conn);
+ await com.ExecuteScalarAsync();
+
+ com = Factory.GetSelectCommand(rnd, table, conn);
+ await CommandExecuteAsync(rnd, com, true);
+ }
+ }
+
+ /// <summary>
+ /// Utility function used by MARS tests
+ /// </summary>
+ private void TestCommandMARS(Random rnd, bool query)
+ {
+ if (Source.Type != DataSourceType.SqlServer)
+ return; // skip for non-SQL Server databases
+
+ using (DataStressConnection conn = Factory.CreateConnection(rnd, DataStressFactory.ConnectionStringOptions.EnableMars))
+ {
+ if (!OpenConnection(conn)) return;
+ DbCommand[] commands = new DbCommand[rnd.Next(5, 10)];
+ List<Task> tasks = new List<Task>();
+ // Create commands
+ for (int i = 0; i < commands.Length; i++)
+ {
+ DataStressFactory.TableMetadata table = Factory.GetRandomTable(rnd);
+ commands[i] = Factory.GetCommand(rnd, table, conn, query);
+ }
+
+ try
+ {
+ // Execute commands
+ for (int i = 0; i < commands.Length; i++)
+ {
+ if (rnd.NextBool(0.7))
+ tasks.Add(CommandExecuteAsync(rnd, commands[i], query));
+ else
+ CommandExecute(rnd, commands[i], query);
+ }
+ }
+ finally
+ {
+ // All commands must be complete before closing the connection
+ AsyncUtils.WaitAll(tasks.ToArray());
+ }
+ }
+ }
+
+ /// <summary>
+ /// Command MARS Test: Tests MARS by executing multiple readers on same connection
+ /// </summary>
+ [StressTest("TestCommandMARSRead", Weight = 10)]
+ public void TestCommandMARSRead()
+ {
+ Random rnd = RandomInstance;
+ TestCommandMARS(rnd, true);
+ }
+
+ /// <summary>
+ /// Command MARS Test: Tests MARS by getting multiple connection objects from same connection
+ /// </summary>
+ [StressTest("TestCommandMARSWrite", Weight = 10)]
+ public void TestCommandMARSWrite()
+ {
+ Random rnd = RandomInstance;
+ TestCommandMARS(rnd, false);
+ }
+
+ #endregion
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/Extensions.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/Extensions.cs
new file mode 100644
index 0000000000..a480fb489d
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/Extensions.cs
@@ -0,0 +1,94 @@
+// 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.Data;
+using System.Data.Common;
+using System.Data.SqlClient;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Xml;
+
+namespace Stress.Data
+{
+ public static class Extensions
+ {
+ /// <param name="probability">the probability that true will be returned</param>
+ public static bool NextBool(this Random rnd, double probability)
+ {
+ return rnd.NextDouble() < probability;
+ }
+
+ /// <summary>
+ /// Generate a true or false with equal probability.
+ /// </summary>
+ public static bool NextBool(this Random rnd)
+ {
+ return rnd.NextBool(0.5);
+ }
+
+ public static Task<int> ExecuteNonQuerySyncOrAsync(this DbCommand command, CancellationToken token, Random rnd)
+ {
+ return AsyncUtils.SyncOrAsyncMethod(
+ command.ExecuteNonQuery,
+ () => command.ExecuteNonQueryAsync(token),
+ AsyncUtils.ChooseSyncAsyncMode(rnd)
+ );
+ }
+
+ public static Task<object> ExecuteScalarSyncOrAsync(this DbCommand command, CancellationToken token, Random rnd)
+ {
+ return AsyncUtils.SyncOrAsyncMethod(
+ command.ExecuteScalar,
+ () => command.ExecuteScalarAsync(token),
+ AsyncUtils.ChooseSyncAsyncMode(rnd)
+ );
+ }
+
+ public static Task<DbDataReader> ExecuteReaderSyncOrAsync(this DbCommand command, CancellationToken token, Random rnd)
+ {
+ return AsyncUtils.SyncOrAsyncMethod(
+ command.ExecuteReader,
+ () => command.ExecuteReaderAsync(token),
+ AsyncUtils.ChooseSyncAsyncMode(rnd)
+ );
+ }
+
+ public static Task<DbDataReader> ExecuteReaderSyncOrAsync(this DbCommand command, CommandBehavior cb, CancellationToken token, Random rnd)
+ {
+ return AsyncUtils.SyncOrAsyncMethod(
+ () => command.ExecuteReader(cb),
+ () => command.ExecuteReaderAsync(cb, token),
+ AsyncUtils.ChooseSyncAsyncMode(rnd)
+ );
+ }
+
+ public static Task<SqlDataReader> ExecuteReaderSyncOrAsync(this SqlCommand command, CancellationToken token, Random rnd)
+ {
+ return AsyncUtils.SyncOrAsyncMethod(
+ command.ExecuteReader,
+ () => command.ExecuteReaderAsync(token),
+ AsyncUtils.ChooseSyncAsyncMode(rnd)
+ );
+ }
+
+ public static Task<SqlDataReader> ExecuteReaderSyncOrAsync(this SqlCommand command, CommandBehavior cb, CancellationToken token, Random rnd)
+ {
+ return AsyncUtils.SyncOrAsyncMethod(
+ () => command.ExecuteReader(cb),
+ () => command.ExecuteReaderAsync(cb, token),
+ AsyncUtils.ChooseSyncAsyncMode(rnd)
+ );
+ }
+
+ public static Task<XmlReader> ExecuteXmlReaderSyncOrAsync(this SqlCommand command, CancellationToken token, Random rnd)
+ {
+ return AsyncUtils.SyncOrAsyncMethod(
+ command.ExecuteXmlReader,
+ () => command.ExecuteXmlReaderAsync(token),
+ AsyncUtils.ChooseSyncAsyncMode(rnd)
+ );
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/StressConfigReader.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/StressConfigReader.cs
new file mode 100644
index 0000000000..24894ca0ba
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/StressConfigReader.cs
@@ -0,0 +1,83 @@
+// 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.Collections.Generic;
+using System.IO;
+using System.Xml;
+using System.Xml.XPath;
+using static Stress.Data.DataStressSettings;
+
+namespace Stress.Data
+{
+ /// <summary>
+ /// Reads the configuration from a configuration file and provides the configuration
+ /// </summary>
+ internal class StressConfigReader
+ {
+ private string _configFilePath;
+ private const string dataStressSettings = "dataStressSettings";
+ private const string sourcePath = "//dataStressSettings/sources/source";
+ internal List<DataSourceElement> Sources
+ {
+ get; private set;
+ }
+
+ public StressConfigReader(string configFilePath)
+ {
+ this._configFilePath = configFilePath;
+ }
+
+ internal void Load()
+ {
+ XmlReader reader = null;
+ try {
+ Sources = new List<DataSourceElement>();
+ reader = CreateReader();
+
+ XPathDocument xpathDocument = new XPathDocument(reader);
+
+ XPathNavigator navigator = xpathDocument.CreateNavigator();
+
+ XPathNodeIterator sourceIterator = navigator.Select(sourcePath);
+
+ foreach (XPathNavigator sourceNavigator in sourceIterator)
+ {
+ string nsUri = sourceNavigator.NamespaceURI;
+ string sourceName = sourceNavigator.GetAttribute("name", nsUri);
+ string sourceType = sourceNavigator.GetAttribute("type", nsUri);
+ bool isDefault;
+ isDefault = bool.TryParse(sourceNavigator.GetAttribute("isDefault", nsUri), out isDefault) ? isDefault : false;
+ string dataSource = sourceNavigator.GetAttribute("dataSource", nsUri);
+ string user = sourceNavigator.GetAttribute("user", nsUri);
+ string password = sourceNavigator.GetAttribute("password", nsUri);
+ string database = sourceNavigator.GetAttribute("database", nsUri);
+ bool supportsWindowsAuthentication;
+ supportsWindowsAuthentication = bool.TryParse(sourceNavigator.GetAttribute("supportsWindowsAuthentication", nsUri), out supportsWindowsAuthentication) ? supportsWindowsAuthentication : false;
+ bool isLocal;
+ isLocal = bool.TryParse(sourceNavigator.GetAttribute("isLocal", nsUri), out isLocal) ? isLocal : false;
+ bool disableMultiSubnetFailover;
+ disableMultiSubnetFailover = bool.TryParse(sourceNavigator.GetAttribute("disableMultiSubnetFailover", nsUri), out disableMultiSubnetFailover) ? disableMultiSubnetFailover : false;
+ bool disableNamedPipes;
+ disableMultiSubnetFailover = bool.TryParse(sourceNavigator.GetAttribute("disableNamedPipes", nsUri), out disableNamedPipes) ? disableNamedPipes : false;
+
+ DataSourceElement element = new DataSourceElement(sourceName, sourceType, null, dataSource, database, user, password, ds_isDefault: isDefault, ds_isLocal: isLocal, disableMultiSubnetFailoverSetup: disableMultiSubnetFailover, disableNamedPipes: disableNamedPipes);
+ Sources.Add(element);
+ }
+ }
+ finally
+ {
+ reader.Dispose();
+ }
+ }
+
+ private XmlReader CreateReader()
+ {
+ FileStream configurationStream = new FileStream(this._configFilePath, FileMode.Open);
+ XmlReaderSettings settings = new XmlReaderSettings();
+ settings.DtdProcessing = DtdProcessing.Prohibit;
+ XmlReader reader = XmlReader.Create(configurationStream, settings);
+ return reader;
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/StressTest.config b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/StressTest.config
new file mode 100644
index 0000000000..c343a4a637
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/StressTest.config
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <dataStressSettings>
+ <sources>
+ <source
+ name="LocalSqlServer"
+ type="SqlServer"
+ isDefault="true"
+ dataSource="(local)"
+ database="stress"
+ user="stress"
+ password=""
+ supportsWindowsAuthentication="false"
+ islocal='true'
+ disableMultiSubnetFailover = 'true'
+ disableNamedPipes = 'true'>
+ </source>
+ </sources>
+ </dataStressSettings>
+</configuration> \ No newline at end of file
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/System.Data.StressFramework.csproj b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/System.Data.StressFramework.csproj
new file mode 100644
index 0000000000..9b4eec4fee
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/System.Data.StressFramework.csproj
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <ProjectGuid>{518A4E22-0144-4699-80AE-757B744E8E38}</ProjectGuid>
+ <RootNamespace>Stress.Data</RootNamespace>
+ <NugetTargetMoniker>.NETStandard,Version=v1.3</NugetTargetMoniker>
+ <OutputType>Library</OutputType>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Unix_Debug|AnyCPU'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Unix_Release|AnyCPU'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Windows_Debug|AnyCPU'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Windows_Release|AnyCPU'" />
+ <ItemGroup>
+ <ProjectReference Include="..\System.Data.StressRunner\System.Data.StressRunner.csproj" />
+ <Compile Include="AsyncUtils.cs" />
+ <Compile Include="DataSource.cs" />
+ <Compile Include="DataStressConnection.cs" />
+ <Compile Include="DataStressErrors.cs" />
+ <Compile Include="DataStressFactory.cs" />
+ <Compile Include="DataStressReader.cs" />
+ <Compile Include="DataStressSettings.cs" />
+ <Compile Include="DataTestGroup.cs" />
+ <Compile Include="Extensions.cs" />
+ <Compile Include="StressConfigReader.cs" />
+ <Compile Include="TrackedRandom.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ <None Include="StressTest.config">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ </ItemGroup>
+ <PropertyGroup Condition=" '$(TargetsWindows)' != 'true' ">
+ <DefineConstants>$(DefineConstants);PROJECTK</DefineConstants>
+ </PropertyGroup>
+ <!--Import the targets-->
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/TrackedRandom.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/TrackedRandom.cs
new file mode 100644
index 0000000000..b42128fff5
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/TrackedRandom.cs
@@ -0,0 +1,184 @@
+// 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.Collections.Generic;
+
+namespace Stress.Data
+{
+ /// <summary>
+ /// Random number generator that tracks information necessary to reproduce a sequence of random numbers.
+ /// </summary>
+ /// <remarks>
+ /// There are three items maintained by instances of this class
+ /// that are used to assist in the reproduction of a sequence of generated numbers:
+ ///
+ /// 1. The seed used for initialization.
+ /// 2. The count of numbers generated.
+ /// 3. Markers to indicate relevant points in the sequence.
+ ///
+ /// For tests that use random numbers to control execution,
+ /// these tracked items can be used to help determine the specific code path that was executed.
+ /// Here's an example:
+ ///
+ /// A test starts to execute, and retrieves an instance of this class.
+ /// If an instance of this class has not been created beforehand, it is constructed and the *seed* is stored.
+ /// The test inserts a *marker* to track the *count* of numbers generated before the test starts its work.
+ /// As the test executes, it asks for a sequence of random numbers. At some point, the test causes a crash.
+ /// Using the resulting dump (or live debugging session if available), it is possible to examine an instance
+ /// of this class to recreate the sequence of numbers used by the test.
+ /// You can create an instance of a Random offline using the tracked *seed*,
+ /// and generate numbers up to the *marked* count to determine the starting point for the sequence of numbers used by the test.
+ /// The length of the sequence is indicated by the last *count* of number generated.
+ /// So for a failed test, you can use the numbers from Mark+1 to Count to retrace the code path taken by the test.
+ ///
+ /// Instances of this class keep track of a finite number of multiple marks,
+ /// so it is possible to track the beginning and end of a series of tests,
+ /// assuming they all mark at least the start of their execution.
+ /// </remarks>
+ public class TrackedRandom : Random
+ {
+ private readonly int _seed;
+
+ /// <summary>
+ /// Number of random numbers generated.
+ /// </summary>
+ private long _count;
+
+ /// <summary>
+ /// Circular buffer to track the most recent marks that indicate the count at the time a given mark was created.
+ /// </summary>
+ private readonly long[] _marks = new long[16];
+
+ /// <summary>
+ /// Index of where to place next mark in buffer.
+ /// This index is incremented after each mark, and wraps around as necessary.
+ /// </summary>
+ private int _nextMark;
+
+ private const int EmptyMark = -1;
+
+ public TrackedRandom()
+ : this(Environment.TickCount)
+ {
+ }
+
+ public TrackedRandom(int seed)
+ : base(seed)
+ {
+ _seed = seed;
+
+ for (int i = 0; i < _marks.Length; i++)
+ {
+ _marks[i] = EmptyMark;
+ }
+ }
+
+ public int Seed
+ {
+ get
+ {
+ return _seed;
+ }
+ }
+
+ public long Count
+ {
+ get
+ {
+ return _count;
+ }
+ }
+
+ public void Mark()
+ {
+ long mark = _count;
+
+ // marking forward
+ _marks[_nextMark++] = mark;
+
+ // wrap when necessary
+ if (_nextMark == _marks.Length)
+ {
+ _nextMark = 0;
+ }
+ }
+
+ /// <summary>
+ /// Return an enumerable that can be used to iterate over the most recent marks,
+ /// starting from the most recent, and ending with the earliest mark still being tracked.
+ /// </summary>
+ public IEnumerable<long> Marks
+ {
+ get
+ {
+ // Iterate backwards through the mark array,
+ // starting just before the index of the next mark,
+ // and ending at the next mark.
+ // Iteration stops earlier if an empty mark is found.
+ int index;
+ long mark;
+
+ for (int i = 1; i <= _marks.Length; i++)
+ {
+ // Index of current element determined by:
+ // ((L+n) - i) % L
+ // where
+ // L is the length of the array,
+ // n is the index of where to insert the next mark, 0 <= n < L,
+ // i is the current iteration variable value, 0 < i <= L.
+ index = (_marks.Length + _nextMark - i) % _marks.Length;
+ mark = _marks[index];
+
+ if (mark == EmptyMark)
+ {
+ break;
+ }
+
+ yield return mark;
+ }
+ }
+ }
+
+ private void IncrementCount()
+ {
+ if (_count == long.MaxValue)
+ {
+ _count = -1;
+ }
+
+ ++_count;
+ }
+
+ public override int Next()
+ {
+ IncrementCount();
+ return base.Next();
+ }
+
+ public override int Next(int minValue, int maxValue)
+ {
+ IncrementCount();
+ return base.Next(minValue, maxValue);
+ }
+
+ public override int Next(int maxValue)
+ {
+ IncrementCount();
+ return base.Next(maxValue);
+ }
+
+ public override void NextBytes(byte[] buffer)
+ {
+ IncrementCount();
+ base.NextBytes(buffer);
+ }
+
+ public override double NextDouble()
+ {
+ IncrementCount();
+ return base.NextDouble();
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/project.json b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/project.json
new file mode 100644
index 0000000000..9f8fdf54ca
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/project.json
@@ -0,0 +1,40 @@
+{
+ "dependencies": {
+ "Microsoft.NETCore.Platforms": "4.3.0-beta-24501-02",
+ "System.Console": "4.3.0-beta-24501-02",
+ "System.Collections": "4.3.0-beta-24501-02",
+ "System.Collections.Concurrent": "4.3.0-beta-24501-02",
+ "System.Data.Common": "4.3.0-beta-24501-02",
+ "System.Data.SqlClient": "4.3.0-beta-24501-02",
+ "System.Diagnostics.Debug": "4.3.0-beta-24501-02",
+ "System.Diagnostics.DiagnosticSource": "4.3.0-beta-24501-02",
+ "System.Diagnostics.FileVersionInfo": "4.3.0-beta-24501-02",
+ "System.Diagnostics.Process": "4.3.0-beta-24501-02",
+ "System.Diagnostics.TextWriterTraceListener": "4.3.0-beta-24501-02",
+ "System.Diagnostics.TraceSource": "4.3.0-beta-24501-02",
+ "System.IO.FileSystem": "4.3.0-beta-24501-02",
+ "System.Linq": "4.3.0-beta-24501-02",
+ "System.Linq.Expressions": "4.3.0-beta-24501-02",
+ "System.Net.NameResolution": "4.3.0-beta-24501-02",
+ "System.Reflection": "4.3.0-beta-24501-02",
+ "System.Reflection.Emit": "4.3.0-beta-24501-02",
+ "System.Reflection.Extensions": "4.3.0-beta-24501-02",
+ "System.Reflection.TypeExtensions": "4.3.0-beta-24501-02",
+ "System.Runtime.Extensions": "4.3.0-beta-24501-02",
+ "System.Runtime.InteropServices": "4.3.0-beta-24501-02",
+ "System.Security.Principal": "4.3.0-beta-24501-02",
+ "System.Security.Principal.Windows": "4.3.0-beta-24501-02",
+ "System.Text.RegularExpressions": "4.3.0-beta-24501-02",
+ "System.Threading": "4.3.0-beta-24501-02",
+ "System.Threading.Timer": "4.3.0-beta-24501-02",
+ "System.Threading.Thread": "4.3.0-beta-24501-02",
+ "System.Threading.ThreadPool": "4.3.0-beta-24501-02",
+ "System.Runtime.Serialization.Primitives": "4.1.1",
+ "System.Xml.ReaderWriter": "4.3.0-beta-24501-02",
+ "System.Xml.XPath": "4.3.0-beta-24501-02",
+ "System.Xml.XmlDocument": "4.3.0-beta-24501-02"
+ },
+ "frameworks": {
+ "netstandard1.3": {}
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/Constants.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/Constants.cs
new file mode 100644
index 0000000000..10f0ecb41b
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/Constants.cs
@@ -0,0 +1,53 @@
+// 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.Collections.Generic;
+using System.Text;
+
+namespace DPStressHarness
+{
+ public static class Constants
+ {
+ public const string XML_ELEM_RESULTS = "PerfResults";
+ public const string XML_ELEM_RUN = "Run";
+ public const string XML_ELEM_RUN_METRIC = "RunMetric";
+ public const string XML_ELEM_TEST = "Test";
+ public const string XML_ELEM_TEST_METRIC = "TestMetric";
+ public const string XML_ELEM_EXCEPTION = "Exception";
+
+ public const string XML_ATTR_RUN_LABEL = "label";
+ public const string XML_ATTR_RUN_START_TIME = "startTime";
+ public const string XML_ATTR_RUN_OFFICIAL = "official";
+ public const string XML_ATTR_RUN_MILESTONE = "milestone";
+ public const string XML_ATTR_RUN_BRANCH = "branch";
+ public const string XML_ATTR_RUN_UPLOADED = "uploaded";
+ public const string XML_ATTR_RUN_METRIC_NAME = "name";
+ public const string XML_ATTR_TEST_NAME = "name";
+ public const string XML_ATTR_TEST_METRIC_NAME = "name";
+ public const string XML_ATTR_TEST_METRIC_UNITS = "units";
+ public const string XML_ATTR_TEST_METRIC_ISHIGHERBETTER = "isHigherBetter";
+
+ public const string XML_ATTR_VALUE_TRUE = "true";
+ public const string XML_ATTR_VALUE_FALSE = "false";
+
+ public const string RUN_METRIC_PROCESSOR_COUNT = "Processor Count";
+ public const string RUN_DNS_HOST_NAME = "DNS Host Name";
+ public const string RUN_IDENTITY_NAME = "Identity Name";
+ public const string RUN_PROCESS_MACHINE_NAME = "Process Machine Name";
+
+ public const string TEST_METRIC_TEST_ASSEMBLY = "Test Assembly";
+ public const string TEST_METRIC_TEST_IMPROVEMENT = "Improvement";
+ public const string TEST_METRIC_TEST_OWNER = "Owner";
+ public const string TEST_METRIC_TEST_CATEGORY = "Category";
+ public const string TEST_METRIC_TEST_PRIORITY = "Priority";
+ public const string TEST_METRIC_APPLICATION_NAME = "Application Name";
+ public const string TEST_METRIC_TARGET_ASSEMBLY_NAME = "Target Assembly Name";
+ public const string TEST_METRIC_ELAPSED_SECONDS = "Elapsed Seconds";
+ public const string TEST_METRIC_RPS = "Requests Per Second";
+ public const string TEST_METRIC_PEAK_WORKING_SET = "Peak Working Set";
+ public const string TEST_METRIC_WORKING_SET = "Working Set";
+ public const string TEST_METRIC_PRIVATE_BYTES = "Private Bytes";
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/DeadlockDetection.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/DeadlockDetection.cs
new file mode 100644
index 0000000000..eba76414fd
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/DeadlockDetection.cs
@@ -0,0 +1,192 @@
+// 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.Collections.Concurrent;
+using System.Diagnostics;
+using System.Reflection;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace DPStressHarness
+{
+ public class DeadlockDetection
+ {
+ /// <summary>
+ /// Information for a thread relating to deadlock detection. All of its information is stored in a reference object to make updating it easier.
+ /// </summary>
+ private class ThreadInfo
+ {
+ public ThreadInfo(long dueTime)
+ {
+ this.DueTime = dueTime;
+ }
+
+ /// <summary>
+ /// The time (in ticks) when the thread should be completed
+ /// </summary>
+ public long DueTime;
+
+ /// <summary>
+ /// True if the thread should not be aborted
+ /// </summary>
+ public bool DisableAbort;
+
+ /// <summary>
+ /// The time when DisableAbort was set to true
+ /// </summary>
+ public long DisableAbortTime;
+ }
+
+ /// <summary>
+ /// Maximum time that a test thread (i.e. a thread that is directly executing a [StressTest] method) can
+ /// execute before it is considered to be deadlocked. This should be longer than the
+ /// TaskThreadDeadlockTimeoutTicks because if the test is waiting for a task then the test will always
+ /// take longer to execute than the task.
+ /// </summary>
+ public const long TestThreadDeadlockTimeoutTicks = 20 * 60 * TimeSpan.TicksPerSecond;
+
+ /// <summary>
+ /// Maximum time that any Task can execute before it is considered to be deadlocked
+ /// </summary>
+ public const long TaskThreadDeadlockTimeoutTicks = 10 * 60 * TimeSpan.TicksPerSecond;
+
+ /// <summary>
+ /// Dictionary that maps Threads to the time (in ticks) when they should be completed. If they are not completed by that time then
+ /// they are considered to be deadlocked.
+ /// </summary>
+ private static ConcurrentDictionary<Thread, ThreadInfo> s_threadDueTimes = null;
+
+ /// <summary>
+ /// Timer that scans through _threadDueTimes to find deadlocked threads
+ /// </summary>
+ private static Timer s_deadlockWatchdog = null;
+
+ /// <summary>
+ /// Interval of _deadlockWatchdog, in milliseconds
+ /// </summary>
+ private const int _watchdogIntervalMs = 60 * 1000;
+
+ /// <summary>
+ /// true if deadlock detection is enabled, otherwise false. Should be set only at process startup.
+ /// </summary>
+ private static bool s_isEnabled = false;
+
+ /// <summary>
+ /// Enables deadlock detection.
+ /// </summary>
+ public static void Enable()
+ {
+ // Switch out the default TaskScheduler. We must use reflection because it is private.
+ FieldInfo defaultTaskScheduler = typeof(TaskScheduler).GetField("s_defaultTaskScheduler", BindingFlags.NonPublic | BindingFlags.Static);
+ DeadlockDetectionTaskScheduler newTaskScheduler = new DeadlockDetectionTaskScheduler();
+ defaultTaskScheduler.SetValue(null, newTaskScheduler);
+
+ s_threadDueTimes = new ConcurrentDictionary<Thread, ThreadInfo>();
+ s_deadlockWatchdog = new Timer(CheckForDeadlocks, null, _watchdogIntervalMs, _watchdogIntervalMs);
+
+ s_isEnabled = true;
+ }
+
+ /// <summary>
+ /// Adds the current Task execution thread to the tracked thread collection.
+ /// </summary>
+ public static void AddTaskThread()
+ {
+ if (s_isEnabled)
+ {
+ long dueTime = DateTime.UtcNow.Ticks + TaskThreadDeadlockTimeoutTicks;
+ AddThread(dueTime);
+ }
+ }
+
+ /// <summary>
+ /// Adds the current Test execution thread (i.e. a thread that is directly executing a [StressTest] method) to the tracked thread collection.
+ /// </summary>
+ public static void AddTestThread()
+ {
+ if (s_isEnabled)
+ {
+ long dueTime = DateTime.UtcNow.Ticks + TestThreadDeadlockTimeoutTicks;
+ AddThread(dueTime);
+ }
+ }
+
+ private static void AddThread(long dueTime)
+ {
+ s_threadDueTimes.TryAdd(Thread.CurrentThread, new ThreadInfo(dueTime));
+ }
+
+ /// <summary>
+ /// Removes the current thread from the tracked thread collection
+ /// </summary>
+ public static void RemoveThread()
+ {
+ if (s_isEnabled)
+ {
+ ThreadInfo unused;
+ s_threadDueTimes.TryRemove(Thread.CurrentThread, out unused);
+ }
+ }
+
+ /// <summary>
+ /// Disables abort of current thread. Call this when the current thread is waiting on a task.
+ /// </summary>
+ public static void DisableThreadAbort()
+ {
+ if (s_isEnabled)
+ {
+ ThreadInfo threadInfo;
+ if (s_threadDueTimes.TryGetValue(Thread.CurrentThread, out threadInfo))
+ {
+ threadInfo.DisableAbort = true;
+ threadInfo.DisableAbortTime = DateTime.UtcNow.Ticks;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Enables abort of current thread after calling DisableThreadAbort(). The elapsed time since calling DisableThreadAbort() is added to the due time.
+ /// </summary>
+ public static void EnableThreadAbort()
+ {
+ if (s_isEnabled)
+ {
+ ThreadInfo threadInfo;
+ if (s_threadDueTimes.TryGetValue(Thread.CurrentThread, out threadInfo))
+ {
+ threadInfo.DueTime += DateTime.UtcNow.Ticks - threadInfo.DisableAbortTime;
+ threadInfo.DisableAbort = false;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Looks through the tracked thread collection and aborts any thread that is past its due time
+ /// </summary>
+ /// <param name="state">unused</param>
+ private static void CheckForDeadlocks(object state)
+ {
+ if (s_isEnabled)
+ {
+ long now = DateTime.UtcNow.Ticks;
+
+ // Find candidate threads
+ foreach (var threadDuePair in s_threadDueTimes)
+ {
+ if (!threadDuePair.Value.DisableAbort && now > threadDuePair.Value.DueTime)
+ {
+ // Abort the misbehaving thread and the return
+ // NOTE: We only want to abort a single thread at a time to allow the other thread in the deadlock pair to continue
+ Thread t = threadDuePair.Key;
+ Console.WriteLine("Deadlock detected on thread with managed thread id {0}", t.ManagedThreadId);
+ Debugger.Break();
+ t.Join();
+ return;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/DeadlockDetectionTaskScheduler.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/DeadlockDetectionTaskScheduler.cs
new file mode 100644
index 0000000000..a96ac40777
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/DeadlockDetectionTaskScheduler.cs
@@ -0,0 +1,94 @@
+// 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.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace DPStressHarness
+{
+ public class DeadlockDetectionTaskScheduler : TaskScheduler
+ {
+ private readonly WaitCallback _runTaskCallback;
+ private readonly ParameterizedThreadStart _runTaskThreadStart;
+#if DEBUG
+ private readonly ConcurrentDictionary<Task, object> _queuedItems = new ConcurrentDictionary<Task, object>();
+#endif
+
+ public DeadlockDetectionTaskScheduler()
+ {
+ _runTaskCallback = new WaitCallback(RunTask);
+ _runTaskThreadStart = new ParameterizedThreadStart(RunTask);
+ }
+
+ // This is only used for debugging, so for retail we'd prefer the perf
+ protected override IEnumerable<Task> GetScheduledTasks()
+ {
+#if DEBUG
+ return _queuedItems.Keys;
+#else
+ return new Task[0];
+#endif
+ }
+
+ protected override void QueueTask(Task task)
+ {
+ if ((task.CreationOptions & TaskCreationOptions.LongRunning) == TaskCreationOptions.LongRunning)
+ {
+ // Create a new background thread for long running tasks
+ Thread thread = new Thread(_runTaskThreadStart) { IsBackground = true };
+ thread.Start(task);
+ }
+ else
+ {
+ // Otherwise queue the work on the threadpool
+#if DEBUG
+ _queuedItems.TryAdd(task, null);
+#endif
+
+ ThreadPool.QueueUserWorkItem(_runTaskCallback, task);
+ }
+ }
+
+ protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
+ {
+ if (!taskWasPreviouslyQueued)
+ {
+ // Run the task inline
+ RunTask(task);
+ return true;
+ }
+
+ // Couldn't run the task
+ return false;
+ }
+
+ private void RunTask(object state)
+ {
+ Task inTask = state as Task;
+
+#if DEBUG
+ // Remove from the dictionary of queued items
+ object ignored;
+ _queuedItems.TryRemove(inTask, out ignored);
+#endif
+
+ // Note when the thread started work
+ DeadlockDetection.AddTaskThread();
+
+ try
+ {
+ // Run the task
+ base.TryExecuteTask(inTask);
+ }
+ finally
+ {
+ // Remove the thread from the list when complete
+ DeadlockDetection.RemoveThread();
+ }
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/FakeConsole.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/FakeConsole.cs
new file mode 100644
index 0000000000..f13949ae8e
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/FakeConsole.cs
@@ -0,0 +1,34 @@
+// 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.Collections.Generic;
+using System.Text;
+
+namespace DPStressHarness
+{
+ public static class FakeConsole
+ {
+ public static void Write(string value)
+ {
+#if DEBUG
+ Console.Write(value);
+#endif
+ }
+
+ public static void WriteLine(string value)
+ {
+#if DEBUG
+ Console.WriteLine(value);
+#endif
+ }
+
+ public static void WriteLine(string format, params object[] arg)
+ {
+#if DEBUG
+ Console.WriteLine(format, arg);
+#endif
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/GlobalExceptionHandlerAttribute.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/GlobalExceptionHandlerAttribute.cs
new file mode 100644
index 0000000000..810580d9f8
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/GlobalExceptionHandlerAttribute.cs
@@ -0,0 +1,16 @@
+// 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;
+
+namespace DPStressHarness
+{
+ [AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
+ public class GlobalExceptionHandlerAttribute : Attribute
+ {
+ public GlobalExceptionHandlerAttribute()
+ {
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/GlobalTestCleanupAttribute.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/GlobalTestCleanupAttribute.cs
new file mode 100644
index 0000000000..2159d2630e
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/GlobalTestCleanupAttribute.cs
@@ -0,0 +1,16 @@
+// 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;
+
+namespace DPStressHarness
+{
+ [AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
+ public class GlobalTestCleanupAttribute : Attribute
+ {
+ public GlobalTestCleanupAttribute()
+ {
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/GlobalTestSetupAttribute.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/GlobalTestSetupAttribute.cs
new file mode 100644
index 0000000000..00ed3d5b05
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/GlobalTestSetupAttribute.cs
@@ -0,0 +1,16 @@
+// 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;
+
+namespace DPStressHarness
+{
+ [AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
+ public class GlobalTestSetupAttribute : Attribute
+ {
+ public GlobalTestSetupAttribute()
+ {
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/ITestAttributeFilter.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/ITestAttributeFilter.cs
new file mode 100644
index 0000000000..c3afa9251d
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/ITestAttributeFilter.cs
@@ -0,0 +1,11 @@
+// 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.
+
+namespace DPStressHarness
+{
+ public interface ITestAttributeFilter
+ {
+ bool MatchFilter(string filterString);
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/Logger.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/Logger.cs
new file mode 100644
index 0000000000..37a2c46aa0
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/Logger.cs
@@ -0,0 +1,227 @@
+// 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.IO;
+using System.Xml;
+using System.Diagnostics;
+
+namespace DPStressHarness
+{
+ public class Logger
+ {
+ private const string _resultDocumentName = "perfout.xml";
+
+ private XmlDocument _doc;
+ private XmlElement _runElem;
+ private XmlElement _testElem;
+
+ public Logger(string runLabel, bool isOfficial, string milestone, string branch)
+ {
+ _doc = GetTestResultDocument();
+
+ _runElem = GetRunElement(_doc, runLabel, DateTime.Now.ToString(), isOfficial, milestone, branch);
+
+ Process currentProcess = Process.GetCurrentProcess();
+ AddRunMetric(Constants.RUN_PROCESS_MACHINE_NAME, currentProcess.MachineName);
+ AddRunMetric(Constants.RUN_DNS_HOST_NAME, System.Net.Dns.GetHostName());
+ AddRunMetric(Constants.RUN_IDENTITY_NAME, System.Security.Principal.WindowsIdentity.GetCurrent().Name);
+ AddRunMetric(Constants.RUN_METRIC_PROCESSOR_COUNT, Environment.ProcessorCount.ToString());
+
+ }
+
+ public void AddRunMetric(string metricName, string metricValue)
+ {
+ Debug.Assert(_runElem != null);
+
+ if (metricValue.Equals(String.Empty))
+ return;
+
+ AddRunMetricElement(_runElem, metricName, metricValue);
+ }
+
+ public void AddTest(string testName)
+ {
+ Debug.Assert(_runElem != null);
+
+ _testElem = AddTestElement(_runElem, testName);
+ }
+
+ public void AddTestMetric(string metricName, string metricValue, string metricUnits)
+ {
+ AddTestMetric(metricName, metricValue, metricUnits, null);
+ }
+
+ public void AddTestMetric(string metricName, string metricValue, string metricUnits, bool? isHigherBetter)
+ {
+ Debug.Assert(_runElem != null);
+ Debug.Assert(_testElem != null);
+
+ if (metricValue.Equals(String.Empty))
+ return;
+
+ AddTestMetricElement(_testElem, metricName, metricValue, metricUnits, isHigherBetter);
+ }
+
+ public void AddTestException(string exceptionData)
+ {
+ Debug.Assert(_runElem != null);
+ Debug.Assert(_testElem != null);
+
+ AddTestExceptionElement(_testElem, exceptionData);
+ }
+
+ public void Save()
+ {
+ FileStream resultDocumentStream = new FileStream(_resultDocumentName, FileMode.Create);
+ _doc.Save(resultDocumentStream);
+ resultDocumentStream.Dispose();
+ }
+
+ private static XmlDocument GetTestResultDocument()
+ {
+ if (File.Exists(_resultDocumentName))
+ {
+ XmlDocument doc = new XmlDocument();
+ FileStream resultDocumentStream = new FileStream(_resultDocumentName, FileMode.Open, FileAccess.Read);
+ doc.Load(resultDocumentStream);
+ resultDocumentStream.Dispose();
+ return doc;
+ }
+ else
+ {
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\" ?><PerfResults></PerfResults>");
+ FileStream resultDocumentStream = new FileStream(_resultDocumentName, FileMode.CreateNew);
+ doc.Save(resultDocumentStream);
+ resultDocumentStream.Dispose();
+ return doc;
+ }
+ }
+
+
+ private static XmlElement GetRunElement(XmlDocument doc, string label, string startTime, bool isOfficial, string milestone, string branch)
+ {
+ foreach (XmlNode node in doc.DocumentElement.ChildNodes)
+ {
+ if (node.NodeType == XmlNodeType.Element &&
+ node.Name.Equals(Constants.XML_ELEM_RUN) &&
+ ((XmlElement)node).GetAttribute(Constants.XML_ATTR_RUN_LABEL).Equals(label))
+ {
+ return (XmlElement)node;
+ }
+ }
+
+ XmlElement runElement = doc.CreateElement(Constants.XML_ELEM_RUN);
+
+ XmlAttribute attrLabel = doc.CreateAttribute(Constants.XML_ATTR_RUN_LABEL);
+ attrLabel.Value = label;
+ runElement.Attributes.Append(attrLabel);
+
+ XmlAttribute attrStartTime = doc.CreateAttribute(Constants.XML_ATTR_RUN_START_TIME);
+ attrStartTime.Value = startTime;
+ runElement.Attributes.Append(attrStartTime);
+
+ XmlAttribute attrOfficial = doc.CreateAttribute(Constants.XML_ATTR_RUN_OFFICIAL);
+ attrOfficial.Value = isOfficial.ToString();
+ runElement.Attributes.Append(attrOfficial);
+
+ if (milestone != null)
+ {
+ XmlAttribute attrMilestone = doc.CreateAttribute(Constants.XML_ATTR_RUN_MILESTONE);
+ attrMilestone.Value = milestone;
+ runElement.Attributes.Append(attrMilestone);
+ }
+
+ if (branch != null)
+ {
+ XmlAttribute attrBranch = doc.CreateAttribute(Constants.XML_ATTR_RUN_BRANCH);
+ attrBranch.Value = branch;
+ runElement.Attributes.Append(attrBranch);
+ }
+
+ doc.DocumentElement.AppendChild(runElement);
+
+ return runElement;
+ }
+
+
+ private static void AddRunMetricElement(XmlElement runElement, string name, string value)
+ {
+ // First check and make sure the metric hasn't already been added.
+ // If it has, it's from a previous test in the same run, so just return.
+ foreach (XmlNode node in runElement.ChildNodes)
+ {
+ if (node.NodeType == XmlNodeType.Element && node.Name.Equals(Constants.XML_ELEM_RUN_METRIC))
+ {
+ if (node.Attributes[Constants.XML_ATTR_RUN_METRIC_NAME].Value.Equals(name))
+ return;
+ }
+ }
+
+ XmlElement runMetricElement = runElement.OwnerDocument.CreateElement(Constants.XML_ELEM_RUN_METRIC);
+
+ XmlAttribute attrName = runElement.OwnerDocument.CreateAttribute(Constants.XML_ATTR_RUN_METRIC_NAME);
+ attrName.Value = name;
+ runMetricElement.Attributes.Append(attrName);
+
+ XmlText nodeValue = runElement.OwnerDocument.CreateTextNode(value);
+ runMetricElement.AppendChild(nodeValue);
+
+ runElement.AppendChild(runMetricElement);
+ }
+
+
+ private static XmlElement AddTestElement(XmlElement runElement, string name)
+ {
+ XmlElement testElement = runElement.OwnerDocument.CreateElement(Constants.XML_ELEM_TEST);
+
+ XmlAttribute attrName = runElement.OwnerDocument.CreateAttribute(Constants.XML_ATTR_TEST_NAME);
+ attrName.Value = name;
+ testElement.Attributes.Append(attrName);
+
+ runElement.AppendChild(testElement);
+
+ return testElement;
+ }
+
+
+ private static void AddTestMetricElement(XmlElement testElement, string name, string value, string units, bool? isHigherBetter)
+ {
+ XmlElement testMetricElement = testElement.OwnerDocument.CreateElement(Constants.XML_ELEM_TEST_METRIC);
+
+ XmlAttribute attrName = testElement.OwnerDocument.CreateAttribute(Constants.XML_ATTR_TEST_METRIC_NAME);
+ attrName.Value = name;
+ testMetricElement.Attributes.Append(attrName);
+
+ if (units != null)
+ {
+ XmlAttribute attrUnits = testElement.OwnerDocument.CreateAttribute(Constants.XML_ATTR_TEST_METRIC_UNITS);
+ attrUnits.Value = units;
+ testMetricElement.Attributes.Append(attrUnits);
+ }
+
+ if (isHigherBetter.HasValue)
+ {
+ XmlAttribute attrIsHigherBetter = testElement.OwnerDocument.CreateAttribute(Constants.XML_ATTR_TEST_METRIC_ISHIGHERBETTER);
+ attrIsHigherBetter.Value = isHigherBetter.ToString();
+ testMetricElement.Attributes.Append(attrIsHigherBetter);
+ }
+
+ XmlText nodeValue = testElement.OwnerDocument.CreateTextNode(value);
+ testMetricElement.AppendChild(nodeValue);
+
+ testElement.AppendChild(testMetricElement);
+ }
+
+ private static void AddTestExceptionElement(XmlElement testElement, string exceptionData)
+ {
+ XmlElement testFailureElement = testElement.OwnerDocument.CreateElement(Constants.XML_ELEM_EXCEPTION);
+ XmlText txtNode = testFailureElement.OwnerDocument.CreateTextNode(exceptionData);
+ testFailureElement.AppendChild(txtNode);
+
+ testElement.AppendChild(testFailureElement);
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/MemApi.Unix.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/MemApi.Unix.cs
new file mode 100644
index 0000000000..6dfb335dd9
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/MemApi.Unix.cs
@@ -0,0 +1,21 @@
+// 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;
+
+namespace DPStressHarness
+{
+ internal static class MemApi
+ {
+ public static IntPtr GetCurrentProcess()
+ {
+ return IntPtr.Zero;
+ }
+
+ public static bool SetProcessWorkingSetSize(IntPtr hProcess, int dwMinimumWorkingSetSize, int dwMaximumWorkingSetSize)
+ {
+ return true;
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/MemApi.Windows.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/MemApi.Windows.cs
new file mode 100644
index 0000000000..8f8953a47c
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/MemApi.Windows.cs
@@ -0,0 +1,22 @@
+// 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.Runtime.InteropServices;
+
+namespace DPStressHarness
+{
+ static class MemApi
+ {
+#pragma warning disable BCL0015 // Invalid Pinvoke call
+ [DllImport("KERNEL32")]
+ public static extern IntPtr GetCurrentProcess();
+#pragma warning restore BCL0015 // Invalid Pinvoke call
+
+#pragma warning disable BCL0015 // Invalid Pinvoke call
+ [DllImport("KERNEL32")]
+ public static extern bool SetProcessWorkingSetSize(IntPtr hProcess, int dwMinimumWorkingSetSize, int dwMaximumWorkingSetSize);
+#pragma warning restore BCL0015 // Invalid Pinvoke call
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/MonitorLoadUtils.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/MonitorLoadUtils.cs
new file mode 100644
index 0000000000..f7eb9be1e4
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/MonitorLoadUtils.cs
@@ -0,0 +1,49 @@
+// 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 Monitoring;
+using System.Reflection;
+
+namespace DPStressHarness
+{
+ public static class MonitorLoader
+ {
+ public static IMonitorLoader LoadMonitorLoaderAssembly()
+
+ {
+ IMonitorLoader monitorloader = null;
+ const string classname = "Monitoring.MonitorLoader";
+ const string interfacename = "IMonitorLoader";
+ Assembly mainAssembly = typeof(Monitoring.IMonitorLoader).GetTypeInfo().Assembly;
+
+ Type t = mainAssembly.GetType(classname);
+ //make sure the the type is derived from IMonitorLoader
+ Type[] interfaces = t.GetInterfaces();
+ bool derivedFromIMonitorLoader = false;
+ if (interfaces != null)
+ {
+ foreach (Type intrface in interfaces)
+ {
+ if (intrface.Name == interfacename)
+ {
+ derivedFromIMonitorLoader = true;
+ }
+ }
+ }
+ if (derivedFromIMonitorLoader)
+
+ {
+ monitorloader = (IMonitorLoader)Activator.CreateInstance(t);
+
+ monitorloader.AssemblyPath = mainAssembly.FullName;
+ }
+ else
+ {
+ throw new Exception("The specified assembly does not implement " + interfacename + "!!");
+ }
+ return monitorloader;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/MultithreadedTest.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/MultithreadedTest.cs
new file mode 100644
index 0000000000..82bc3c69ac
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/MultithreadedTest.cs
@@ -0,0 +1,170 @@
+// 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.Collections.Generic;
+using System.Reflection;
+using System.Diagnostics;
+using System.Threading;
+
+namespace DPStressHarness
+{
+ internal class MultiThreadedTest : TestBase
+ {
+ private MultiThreadedTestAttribute _attr;
+ public static bool _continue;
+ public static int _threadsRunning;
+ public static int _rps;
+ public static Exception _firstException = null;
+
+ private struct TestInfo
+ {
+ public object _instance;
+ public TestMethodDelegate _delegateTest;
+ }
+
+ public MultiThreadedTest(MultiThreadedTestAttribute attr,
+ MethodInfo testMethodInfo,
+ Type type,
+ List<MethodInfo> setupMethods,
+ List<MethodInfo> cleanupMethods)
+ : base(attr, testMethodInfo, type, setupMethods, cleanupMethods)
+
+ {
+ _attr = attr;
+ }
+
+ public override void Run()
+ {
+ try
+ {
+ Stopwatch timer = new Stopwatch();
+ long warmupDuration = (long)_attr.WarmupDuration * Stopwatch.Frequency;
+ long testDuration = (long)_attr.TestDuration * Stopwatch.Frequency;
+ int threads = _attr.Threads;
+
+ TestInfo[] info = new TestInfo[threads];
+ ConstructorInfo targetConstructor = _type.GetConstructor(Type.EmptyTypes);
+
+ for (int i = 0; i < threads; i++)
+ {
+ info[i] = new TestInfo();
+ info[i]._instance = targetConstructor.Invoke(null);
+ info[i]._delegateTest = CreateTestMethodDelegate();
+
+ SetVariations(info[i]._instance);
+ ExecuteSetupPhase(info[i]._instance);
+ }
+
+ _firstException = null;
+ _continue = true;
+ _rps = 0;
+
+ for (int i = 0; i < threads; i++)
+ {
+ Interlocked.Increment(ref _threadsRunning);
+ Thread t = new Thread(new ParameterizedThreadStart(MultiThreadedTest.RunThread));
+ t.Start(info[i]);
+ }
+
+ timer.Reset();
+ timer.Start();
+
+ while (timer.ElapsedTicks < warmupDuration)
+ {
+ Thread.Sleep(1000);
+ }
+
+ int warmupRequests = Interlocked.Exchange(ref _rps, 0);
+ timer.Reset();
+ timer.Start();
+ TestMetrics.StartCollection();
+
+ while (timer.ElapsedTicks < testDuration)
+ {
+ Thread.Sleep(1000);
+ }
+
+ int requests = Interlocked.Exchange(ref _rps, 0);
+ double elapsedSeconds = timer.ElapsedTicks / Stopwatch.Frequency;
+ TestMetrics.StopCollection();
+ _continue = false;
+
+ while (_threadsRunning > 0)
+ {
+ Thread.Sleep(1000);
+ }
+
+ for (int i = 0; i < threads; i++)
+ {
+ ExecuteCleanupPhase(info[i]._instance);
+ }
+
+ double rps = (double)requests / elapsedSeconds;
+
+ if (_firstException == null)
+ {
+ LogTest(rps);
+ }
+ else
+ {
+ LogTestFailure(_firstException.ToString());
+ }
+ }
+ catch (TargetInvocationException e)
+ {
+ LogTestFailure(e.InnerException.ToString());
+ }
+ catch (Exception e)
+ {
+ LogTestFailure(e.ToString());
+ }
+ }
+
+
+ public static void RunThread(Object state)
+ {
+ try
+ {
+ while (_continue)
+ {
+ TestInfo info = (TestInfo)state;
+ info._delegateTest(info._instance);
+ Interlocked.Increment(ref _rps);
+ }
+ }
+ catch (Exception e)
+ {
+ if (_firstException == null)
+ {
+ _firstException = e;
+ }
+ _continue = false;
+ }
+ finally
+ {
+ Interlocked.Decrement(ref _threadsRunning);
+ }
+ }
+
+ protected void LogTest(double rps)
+ {
+ Logger logger = new Logger(TestMetrics.RunLabel, TestMetrics.IsOfficial, TestMetrics.Milestone, TestMetrics.Branch);
+ logger.AddTest(this.Title);
+
+ LogStandardMetrics(logger);
+
+ logger.AddTestMetric(Constants.TEST_METRIC_RPS, String.Format("{0:F2}", rps), "rps", true);
+
+ logger.Save();
+
+ Console.WriteLine("{0}: Requests per Second={1:F2}, Working Set={2}, Peak Working Set={3}, Private Bytes={4}",
+ this.Title,
+ rps,
+ TestMetrics.WorkingSet,
+ TestMetrics.PeakWorkingSet,
+ TestMetrics.PrivateBytes);
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/PerfCounters.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/PerfCounters.cs
new file mode 100644
index 0000000000..3921ca1402
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/PerfCounters.cs
@@ -0,0 +1,34 @@
+// 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.Collections.Generic;
+using System.Diagnostics;
+
+namespace DPStressHarness
+{
+ public class PerfCounters
+ {
+ private long _requestsCounter;
+ //private long rpsCounter;
+
+ private long _exceptionsCounter;
+ //private long epsCounter;
+
+ public PerfCounters()
+ {
+
+ }
+
+ public void IncrementRequestsCounter()
+ {
+ _requestsCounter++;
+ }
+
+ public void IncrementExceptionsCounter()
+ {
+ _exceptionsCounter++;
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/Program.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/Program.cs
new file mode 100644
index 0000000000..aadb7ddf91
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/Program.cs
@@ -0,0 +1,277 @@
+// 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.IO;
+using System.Collections.Generic;
+using System.Text;
+using System.Reflection;
+
+
+namespace DPStressHarness
+{
+ public class Program
+ {
+ public static void Main(string[] args)
+ {
+ Init(args);
+ Run();
+ }
+ public enum RunMode
+ {
+ RunAll,
+ RunVerify,
+ Help,
+ ExitWithError
+ };
+
+ private static RunMode s_mode = RunMode.RunAll;
+ private static IEnumerable<TestBase> s_tests;
+ private static StressEngine s_eng;
+ private static string s_error;
+
+
+ public static void Init(string[] args)
+ {
+ for (int i = 0; i < args.Length; i++)
+ {
+ switch (args[i])
+ {
+ case "-a":
+ string assemblyName = args[++i];
+ TestFinder.AssemblyName = new AssemblyName(assemblyName);
+ break;
+
+ case "-all":
+ s_mode = RunMode.RunAll;
+ break;
+
+ case "-override":
+ TestMetrics.Overrides.Add(args[++i], args[++i]);
+ break;
+
+ case "-variation":
+ TestMetrics.Variations.Add(args[++i]);
+ break;
+
+ case "-test":
+ TestMetrics.SelectedTests.Add(args[++i]);
+ break;
+
+ case "-duration":
+ TestMetrics.StressDuration = Int32.Parse(args[++i]);
+ break;
+
+ case "-threads":
+ TestMetrics.StressThreads = Int32.Parse(args[++i]);
+ break;
+
+ case "-verify":
+ s_mode = RunMode.RunVerify;
+ break;
+
+ case "-debug":
+ if (System.Diagnostics.Debugger.IsAttached)
+ {
+ System.Diagnostics.Debugger.Break();
+ }
+ else
+ {
+ Console.WriteLine("Current PID: {0}, attach the debugger and press Enter to continue the execution...", System.Diagnostics.Process.GetCurrentProcess().Id);
+ Console.ReadLine();
+ }
+ break;
+
+ case "-exceptionThreshold":
+ TestMetrics.ExceptionThreshold = Int32.Parse(args[++i]);
+ break;
+
+ case "-monitorenabled":
+ TestMetrics.MonitorEnabled = bool.Parse(args[++i]);
+ break;
+
+ case "-randomSeed":
+ TestMetrics.RandomSeed = Int32.Parse(args[++i]);
+ break;
+
+ case "-filter":
+ TestMetrics.Filter = args[++i];
+ break;
+
+ case "-printMethodName":
+ TestMetrics.PrintMethodName = true;
+ break;
+
+ case "-deadlockdetection":
+ if (bool.Parse(args[++i]))
+ {
+ DeadlockDetection.Enable();
+ }
+ break;
+
+ default:
+ s_mode = RunMode.Help;
+ break;
+ }
+ }
+
+ if (TestFinder.AssemblyName != null)
+ {
+ Console.WriteLine("Assembly Found for the Assembly Name " + TestFinder.AssemblyName);
+
+ if (TestFinder.AssemblyName != null)
+ {
+ // get and load all the tests
+ s_tests = TestFinder.GetTests(Assembly.Load(TestFinder.AssemblyName));
+
+ // instantiate the stress engine
+ s_eng = new StressEngine(TestMetrics.StressThreads, TestMetrics.StressDuration, s_tests, TestMetrics.RandomSeed);
+ }
+ else
+ {
+ Program.s_error = string.Format("Assembly {0} cannot be found.", TestFinder.AssemblyName);
+ s_mode = RunMode.ExitWithError;
+ }
+ }
+ }
+
+ public static void TestCase(Assembly assembly,
+ RunMode mode,
+ int duration,
+ int threads,
+ int? exceptionThreshold = null,
+ bool printMethodName = false,
+ bool deadlockDetection = false,
+ int randomSeed = 0,
+ string[] selectedTests = null,
+ string[] overrides = null,
+ string[] variations = null,
+ string filter = null,
+ bool monitorEnabled = false,
+ string monitorMachineName = "localhost")
+ {
+ TestMetrics.Reset();
+ TestFinder.AssemblyName = assembly.GetName();
+ mode = RunMode.RunAll;
+
+ for (int i = 0; overrides != null && i < overrides.Length; i++)
+ {
+ TestMetrics.Overrides.Add(overrides[i], overrides[++i]);
+ }
+
+ for (int i = 0; variations != null && i < variations.Length; i++)
+ {
+ TestMetrics.Variations.Add(variations[i]);
+ }
+
+ for (int i = 0; selectedTests != null && i < selectedTests.Length; i++)
+ {
+ TestMetrics.SelectedTests.Add(selectedTests[i]);
+ }
+
+ TestMetrics.StressDuration = duration;
+ TestMetrics.StressThreads = threads;
+ TestMetrics.ExceptionThreshold = exceptionThreshold;
+ TestMetrics.MonitorEnabled = monitorEnabled;
+ TestMetrics.MonitorMachineName = monitorMachineName;
+ TestMetrics.RandomSeed = randomSeed;
+ TestMetrics.Filter = filter;
+ TestMetrics.PrintMethodName = printMethodName;
+
+ if (deadlockDetection)
+ {
+ DeadlockDetection.Enable();
+ }
+
+ // get and load all the tests
+ s_tests = TestFinder.GetTests(assembly);
+
+ // instantiate the stress engine
+ s_eng = new StressEngine(TestMetrics.StressThreads, TestMetrics.StressDuration, s_tests, TestMetrics.RandomSeed);
+ }
+
+ public static void Run()
+ {
+ if (TestFinder.AssemblyName == null)
+ {
+ s_mode = RunMode.Help;
+ }
+ switch (s_mode)
+ {
+ case RunMode.RunAll:
+ RunStress();
+ break;
+
+ case RunMode.RunVerify:
+ RunVerify();
+ break;
+
+ case RunMode.ExitWithError:
+ ExitWithError();
+ break;
+
+ case RunMode.Help:
+ PrintHelp();
+ break;
+ }
+ }
+
+ static private void PrintHelp()
+ {
+ Console.WriteLine("stresstest.exe [-a <module name>] <arguments>");
+ Console.WriteLine();
+ Console.WriteLine(" -a <module name> should specify path to the assembly containing the tests.");
+ Console.WriteLine();
+ Console.WriteLine("Supported options are:");
+ Console.WriteLine();
+ Console.WriteLine(" -all Run all tests - best for debugging, not perf measurements.");
+ Console.WriteLine();
+ Console.WriteLine(" -verify Run in functional verification mode.");
+ Console.WriteLine();
+ Console.WriteLine(" -duration <n> Duration of the test in seconds.");
+ Console.WriteLine();
+ Console.WriteLine(" -threads <n> Number of threads to use.");
+ Console.WriteLine();
+ Console.WriteLine(" -override <name> <value> Override the value of a test property.");
+ Console.WriteLine();
+ Console.WriteLine(" -test <name> Run specific test(s) using their name.");
+ Console.WriteLine();
+ Console.WriteLine(" -debug Print process ID in the beginning and wait for Enter (to give your time to attach the debugger).");
+ Console.WriteLine();
+ Console.WriteLine(" -exceptionThreshold <n> An optional limit on exceptions which will be caught. When reached, test will halt.");
+ Console.WriteLine();
+ Console.WriteLine(" -monitorenabled True or False to enable monitoring. Default is false");
+ Console.WriteLine();
+ Console.WriteLine(" -randomSeed Enables setting of the random number generator used internally. This serves both the purpose");
+ Console.WriteLine(" of helping to improve reproducibility and making it deterministic from Chess's perspective");
+ Console.WriteLine(" for a given schedule. Default is " + TestMetrics.RandomSeed + ".");
+ Console.WriteLine();
+ Console.WriteLine(" -filter Run tests whose stress test attributes match the given filter. Filter is not applied if attribute");
+ Console.WriteLine(" does not implement ITestAttributeFilter. Example: -filter TestType=Query,Update;IsServerTest=True ");
+ Console.WriteLine();
+ Console.WriteLine(" -printMethodName Print tests' title in console window");
+ Console.WriteLine();
+ Console.WriteLine(" -deadlockdetection True or False to enable deadlock detection. Default is false");
+ Console.WriteLine();
+ }
+
+ static private int ExitWithError()
+ {
+ Environment.FailFast("Exit with error(s).");
+ return 1;
+ }
+
+ static private int RunVerify()
+ {
+ throw new NotImplementedException();
+ }
+
+ static private int RunStress()
+ {
+ return s_eng.Run();
+ }
+ }
+
+}
+
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/RecordedExceptions.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/RecordedExceptions.cs
new file mode 100644
index 0000000000..a12e38f1a2
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/RecordedExceptions.cs
@@ -0,0 +1,107 @@
+// 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.Text;
+using System.Collections.Concurrent;
+using System.Diagnostics;
+using System.Threading;
+
+namespace DPStressHarness
+{
+ public class RecordedExceptions
+ {
+ // Reference wrapper around an integer which is used in order to make updating a little easier & more efficient
+ public class ExceptionCount
+ {
+ public int Count = 0;
+ }
+
+ private ConcurrentDictionary<string, ConcurrentDictionary<string, ExceptionCount>> _exceptions = new ConcurrentDictionary<string, ConcurrentDictionary<string, ExceptionCount>>();
+
+ /// <summary>
+ /// Records an exception and returns true if the threshold is exceeded for that exception
+ /// </summary>
+ public bool Record(string testName, Exception ex)
+ {
+ // Converting from exception to string can be expensive so only do it once and cache the string
+ string exceptionString = ex.ToString();
+ TraceException(testName, exceptionString);
+
+ // Get the exceptions for the current test case
+ ConcurrentDictionary<string, ExceptionCount> exceptionsForTest = _exceptions.GetOrAdd(testName, _ => new ConcurrentDictionary<string, ExceptionCount>());
+
+ // Get the count for the current exception
+ ExceptionCount exCount = exceptionsForTest.GetOrAdd(exceptionString, _ => new ExceptionCount());
+
+ // Increment the count
+ Interlocked.Increment(ref exCount.Count);
+
+ // If the count is over the threshold, return true
+ return TestMetrics.ExceptionThreshold.HasValue && (exCount.Count > TestMetrics.ExceptionThreshold);
+ }
+
+ private void TraceException(string testName, string exceptionString)
+ {
+ StringBuilder status = new StringBuilder();
+ status.AppendLine("========================================================================");
+ status.AppendLine("Exception Report");
+ status.AppendLine("========================================================================");
+
+ status.AppendLine(string.Format("Test: {0}", testName));
+ status.AppendLine(exceptionString);
+
+ status.AppendLine("========================================================================");
+ status.AppendLine("End of Exception Report");
+ status.AppendLine("========================================================================");
+ Trace.WriteLine(status.ToString());
+ }
+
+ public void TraceAllExceptions()
+ {
+ StringBuilder status = new StringBuilder();
+ status.AppendLine("========================================================================");
+ status.AppendLine("All Exceptions Report");
+ status.AppendLine("========================================================================");
+
+ foreach (string testName in _exceptions.Keys)
+ {
+ ConcurrentDictionary<string, ExceptionCount> exceptionsForTest = _exceptions[testName];
+
+ status.AppendLine(string.Format("Test: {0}", testName));
+ foreach (var exceptionString in exceptionsForTest.Keys)
+ {
+ status.AppendLine(string.Format("Count: {0}", exceptionsForTest[exceptionString].Count));
+ status.AppendLine(string.Format("Exception: {0}", exceptionString));
+ status.AppendLine();
+ }
+
+ status.AppendLine();
+ status.AppendLine();
+ }
+
+ status.AppendLine("========================================================================");
+ status.AppendLine("End of All Exceptions Report");
+ status.AppendLine("========================================================================");
+ Trace.WriteLine(status.ToString());
+ }
+
+ public int GetExceptionsCount()
+ {
+ int count = 0;
+
+ foreach (string testName in _exceptions.Keys)
+ {
+ ConcurrentDictionary<string, ExceptionCount> exceptionsForTest = _exceptions[testName];
+
+ foreach (var exceptionString in exceptionsForTest.Keys)
+ {
+ count += exceptionsForTest[exceptionString].Count;
+ }
+ }
+
+ return count;
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/SqlScript.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/SqlScript.cs
new file mode 100644
index 0000000000..7bd0d61548
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/SqlScript.cs
@@ -0,0 +1,64 @@
+// 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.Data;
+using System.Data.SqlClient;
+using System.Text.RegularExpressions;
+
+namespace DPStressHarness
+{
+ /// <summary>
+ /// Use SqlScript.Execute to run sql scripts prior to test execution.
+ /// Recommended practice is to store the sql scripts as a resource in your dll (if it's complicated),
+ /// or just as a string in your assembly.
+ /// </summary>
+ public static class SqlScript
+ {
+ public static void Execute(string script, string connectionString)
+ {
+ //script = Regex.Replace(script, @"/\*((?!\*/)(.|\n)*?)\*/", "", RegexOptions.Multiline | RegexOptions.IgnoreCase);
+
+ //Regex re = new Regex(@"(?<GO>^GO)|(?<COMMAND>((?!^GO)(.|\n))+)", RegexOptions.Multiline | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);
+
+ //MatchCollection matches = re.Matches(script);
+
+ //foreach (Match m in matches)
+ //{
+ // Console.WriteLine(m.Groups["GO"]);
+ // Console.WriteLine(m.Groups["COMMAND"]);
+ //}
+
+ //Console.WriteLine();
+
+
+ SqlConnection conn = new SqlConnection(connectionString);
+ conn.Open();
+
+ try
+ {
+ script = Regex.Replace(script, @"/\*((?!\*/)(.|\n)*?)\*/", "", RegexOptions.Multiline | RegexOptions.IgnoreCase);
+
+ Regex re = new Regex(@"(?<GO>^GO)|(?<COMMAND>((?!^GO)(.|\n))+)", RegexOptions.Multiline | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);
+ MatchCollection matches = re.Matches(script);
+
+ foreach (Match m in matches)
+ {
+ string cmdText = m.Groups["COMMAND"].Value.Trim();
+
+ if (cmdText == String.Empty)
+ continue;
+
+ SqlCommand cmd = new SqlCommand(cmdText, conn);
+ cmd.CommandTimeout = 300;
+ cmd.ExecuteNonQuery();
+ }
+ }
+ finally
+ {
+ conn.Close();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/StressEngine.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/StressEngine.cs
new file mode 100644
index 0000000000..d3fc60adf1
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/StressEngine.cs
@@ -0,0 +1,209 @@
+// 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.Collections.Generic;
+using System.Threading;
+using System.Diagnostics;
+using Monitoring;
+
+namespace DPStressHarness
+{
+ public class StressEngine
+ {
+ private Random _rnd;
+ private int _threads;
+ private int _duration;
+ private int _threadsRunning;
+ private bool _continue;
+ private List<StressTest> _allTests;
+ private RecordedExceptions _exceptions = new RecordedExceptions();
+ private PerfCounters _perfcounters = null;
+ private static long s_globalRequestsCounter = 0;
+
+ public StressEngine(int threads, int duration, IEnumerable<TestBase> allTests, int seed)
+ {
+ if (seed != 0)
+ {
+ _rnd = new Random(seed);
+ }
+ else
+ {
+ Random rndBootstrap = new Random();
+
+ seed = rndBootstrap.Next();
+
+ _rnd = new Random(seed);
+ }
+
+ Console.WriteLine("Seeding stress engine random number generator with {0}\n", seed);
+
+
+ _threads = threads;
+ _duration = duration;
+ _allTests = new List<StressTest>();
+
+ List<StressTest> tmpWeightedLookup = new List<StressTest>();
+
+ foreach (TestBase t in allTests)
+ {
+ if (t is StressTest)
+ {
+ _allTests.Add(t as StressTest);
+ }
+ }
+
+ try
+ {
+ _perfcounters = new PerfCounters();
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Warning: An error ocurred initializing performance counters. Performance counters can only be initialized when running with Administrator privileges. Error Message: " + e.Message);
+ }
+ }
+
+ public int Run()
+ {
+ TraceListener listener = new TextWriterTraceListener(Console.Out);
+ Trace.Listeners.Add(listener);
+ Trace.UseGlobalLock = true;
+
+ _threadsRunning = 0;
+ _continue = true;
+
+ if (_allTests.Count == 0)
+ {
+ throw new ArgumentException("The specified assembly doesn't contain any tests to run. Test methods must be decorated with a Test, StressTest, MultiThreadedTest, or ThreadPoolTest attribute.");
+ }
+
+ // Run any global setup
+ StressTest firstStressTest = _allTests.Find(t => t is StressTest);
+ if (null != firstStressTest)
+ {
+ firstStressTest.RunGlobalSetup();
+ }
+
+ //Monitoring Start
+ IMonitorLoader _monitorloader = null;
+ if (TestMetrics.MonitorEnabled)
+ {
+ _monitorloader = MonitorLoader.LoadMonitorLoaderAssembly();
+ if (_monitorloader != null)
+ {
+ _monitorloader.Enabled = TestMetrics.MonitorEnabled;
+ _monitorloader.HostMachine = TestMetrics.MonitorMachineName;
+ _monitorloader.TestName = firstStressTest.Title;
+ _monitorloader.Action(MonitorLoaderUtils.MonitorAction.Start);
+ }
+ }
+
+ for (int i = 0; i < _threads; i++)
+ {
+ Interlocked.Increment(ref _threadsRunning);
+ Thread t = new Thread(new ThreadStart(this.RunStressThread));
+ t.Start();
+ }
+
+ while (_threadsRunning > 0)
+ {
+ Thread.Sleep(1000);
+ }
+
+ //Monitoring Stop
+ if (TestMetrics.MonitorEnabled)
+ {
+ if (_monitorloader != null)
+ _monitorloader.Action(MonitorLoaderUtils.MonitorAction.Stop);
+ }
+
+ // Run any global cleanup
+ if (null != firstStressTest)
+ {
+ firstStressTest.RunGlobalCleanup();
+ }
+
+ // Write out all exceptions
+ _exceptions.TraceAllExceptions();
+ return _exceptions.GetExceptionsCount();
+ }
+
+
+ public void RunStressThread()
+ {
+ try
+ {
+ StressTest[] tests = new StressTest[_allTests.Count];
+ List<int> tmpWeightedLookup = new List<int>();
+
+ for (int i = 0; i < tests.Length; i++)
+ {
+ tests[i] = _allTests[i].Clone();
+ tests[i].RunSetup();
+
+ for (int j = 0; j < tests[i].Weight; j++)
+ {
+ tmpWeightedLookup.Add(i);
+ }
+ }
+
+ int[] weightedLookup = tmpWeightedLookup.ToArray();
+
+ Stopwatch timer = new Stopwatch();
+ long testDuration = (long)_duration * Stopwatch.Frequency;
+
+ timer.Reset();
+ timer.Start();
+
+ while (_continue && timer.ElapsedTicks < testDuration)
+ {
+ int n = _rnd.Next(0, weightedLookup.Length);
+ StressTest t = tests[weightedLookup[n]];
+
+ if (TestMetrics.PrintMethodName)
+ {
+ FakeConsole.WriteLine("{0}: {1}", ++s_globalRequestsCounter, t.Title);
+ }
+
+ try
+ {
+ DeadlockDetection.AddTestThread();
+ t.Run();
+ if (_perfcounters != null)
+ _perfcounters.IncrementRequestsCounter();
+ }
+ catch (Exception e)
+ {
+ if (_perfcounters != null)
+ _perfcounters.IncrementExceptionsCounter();
+
+ t.HandleException(e);
+
+ bool thresholdExceeded = _exceptions.Record(t.Title, e);
+ if (thresholdExceeded)
+ {
+ FakeConsole.WriteLine("Exception Threshold of {0} has been exceeded on {1} - Halting!\n",
+ TestMetrics.ExceptionThreshold, t.Title);
+ break;
+ }
+ }
+ finally
+ {
+ DeadlockDetection.RemoveThread();
+ }
+ }
+
+ foreach (StressTest t in tests)
+ {
+ t.RunCleanup();
+ }
+ }
+ finally
+ {
+ _continue = false;
+ Interlocked.Decrement(ref _threadsRunning);
+ }
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/StressTest.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/StressTest.cs
new file mode 100644
index 0000000000..c2637d5e5d
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/StressTest.cs
@@ -0,0 +1,155 @@
+// 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.Collections.Generic;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+namespace DPStressHarness
+{
+ internal class StressTest : TestBase
+ {
+ private StressTestAttribute _attr;
+ private object _targetInstance;
+ private TestMethodDelegate _tmd;
+
+ // TODO: MethodInfo objects below can have associated delegates to improve
+ // runtime performance.
+ protected MethodInfo _globalSetupMethod;
+ protected MethodInfo _globalCleanupMethod;
+
+ public delegate void ExceptionHandler(Exception e);
+
+ /// <summary>
+ /// Cache the global exception handler method reference. It is
+ /// recommended not to actually use this reference to call the
+ /// method. Use the delegate instead.
+ /// </summary>
+ protected MethodInfo _globalExceptionHandlerMethod;
+
+ /// <summary>
+ /// Create a delegate to call global exception handler method.
+ /// Use this delegate to call test assembly's exception handler.
+ /// </summary>
+ protected ExceptionHandler _globalExceptionHandlerDelegate;
+
+ public StressTest(StressTestAttribute attr,
+ MethodInfo testMethodInfo,
+ MethodInfo globalSetupMethod,
+ MethodInfo globalCleanupMethod,
+ Type type,
+ List<MethodInfo> setupMethods,
+ List<MethodInfo> cleanupMethods,
+ MethodInfo globalExceptionHandlerMethod)
+ : base(attr, testMethodInfo, type, setupMethods, cleanupMethods)
+ {
+ _attr = attr;
+ _globalSetupMethod = globalSetupMethod;
+ _globalCleanupMethod = globalCleanupMethod;
+ _globalExceptionHandlerMethod = globalExceptionHandlerMethod;
+ }
+
+ public StressTest Clone()
+ {
+ StressTest t = new StressTest(_attr, this._testMethod, this._globalSetupMethod, this._globalCleanupMethod, this._type, this._setupMethods, this._cleanupMethods, this._globalExceptionHandlerMethod);
+ return t;
+ }
+
+ private void InitTargetInstance()
+ {
+ _targetInstance = _type.GetConstructor(Type.EmptyTypes).Invoke(null);
+
+ // Create a delegate for exception handling on _targetInstance
+ if (_globalExceptionHandlerMethod != null)
+ {
+ _globalExceptionHandlerDelegate = (ExceptionHandler)_globalExceptionHandlerMethod.CreateDelegate(
+ typeof(ExceptionHandler),
+ _targetInstance
+ );
+ }
+ }
+
+ /// <summary>
+ /// Perform any global initialization for the test assembly. For example, make the connection to the database, load a workspace, etc.
+ /// </summary>
+ public void RunGlobalSetup()
+ {
+ if (null == _targetInstance)
+ {
+ InitTargetInstance();
+ }
+
+ if (null != _globalSetupMethod)
+ {
+ _globalSetupMethod.Invoke(_targetInstance, null);
+ }
+ }
+
+ /// <summary>
+ /// Run any per-thread setup needed
+ /// </summary>
+ public void RunSetup()
+ {
+ // create an instance of the class that defines the test method.
+ if (null == _targetInstance)
+ {
+ InitTargetInstance();
+ }
+ _tmd = CreateTestMethodDelegate();
+
+ // Set variation fields on the target instance
+ SetVariations(_targetInstance);
+
+ // Execute the setup phase for this thread.
+ ExecuteSetupPhase(_targetInstance);
+ }
+
+ /// <summary>
+ /// Execute the test method(s)
+ /// </summary>
+ public override void Run()
+ {
+ _tmd(_targetInstance);
+ }
+
+ /// <summary>
+ /// Provide an opportunity to handle the exception
+ /// </summary>
+ /// <param name="e"></param>
+ public void HandleException(Exception e)
+ {
+ if (null != _globalExceptionHandlerDelegate)
+ {
+ _globalExceptionHandlerDelegate(e);
+ }
+ }
+
+ /// <summary>
+ /// Run any per-thread cleanup for the test
+ /// </summary>
+ public void RunCleanup()
+ {
+ ExecuteCleanupPhase(_targetInstance);
+ }
+
+ /// <summary>
+ /// Run final global cleanup for the test assembly. Could be used to release resources or for reporting, etc.
+ /// </summary>
+ public void RunGlobalCleanup()
+ {
+ if (null != _globalCleanupMethod)
+ {
+ _globalCleanupMethod.Invoke(_targetInstance, null);
+ }
+ }
+
+ public int Weight
+ {
+ get { return _attr.Weight; }
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/System.Data.StressRunner.csproj b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/System.Data.StressRunner.csproj
new file mode 100644
index 0000000000..83b1f618d7
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/System.Data.StressRunner.csproj
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <ProjectGuid>{529B187A-DE4F-4F4D-9FBB-D3D416FDB683}</ProjectGuid>
+ <RootNamespace>DPStressHarness</RootNamespace>
+ <AssemblyName>System.Data.StressRunner</AssemblyName>
+ <OutputType>Exe</OutputType>
+ <NugetTargetMoniker>.NETStandard,Version=v1.3</NugetTargetMoniker>
+ </PropertyGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\IMonitorLoader\IMonitorLoader.csproj" />
+ </ItemGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Unix_Debug|AnyCPU'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Unix_Release|AnyCPU'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Windows_Debug|AnyCPU'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Windows_Release|AnyCPU'" />
+ <ItemGroup Condition=" '$(TargetsWindows)' != 'true' ">
+ <Compile Include="MemApi.Unix.cs" />
+ </ItemGroup>
+ <ItemGroup Condition=" '$(TargetsWindows)' == 'true' ">
+ <Compile Include="MemApi.Windows.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="DeadlockDetection.cs" />
+ <Compile Include="DeadlockDetectionTaskScheduler.cs" />
+ <Compile Include="ITestAttributeFilter.cs" />
+ <Compile Include="MonitorLoadUtils.cs" />
+ <Compile Include="Constants.cs" />
+ <Compile Include="FakeConsole.cs" />
+ <Compile Include="GlobalTestCleanupAttribute.cs" />
+ <Compile Include="GlobalTestSetupAttribute.cs" />
+ <Compile Include="GlobalExceptionHandlerAttribute.cs" />
+ <Compile Include="Logger.cs" />
+ <Compile Include="MultithreadedTest.cs" />
+ <Compile Include="PerfCounters.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="RecordedExceptions.cs" />
+ <Compile Include="SqlScript.cs" />
+ <Compile Include="StressEngine.cs" />
+ <Compile Include="StressTest.cs" />
+ <Compile Include="Test.cs" />
+ <Compile Include="TestAttribute.cs" />
+ <Compile Include="TestBase.cs" />
+ <Compile Include="TestCleanupAttribute.cs" />
+ <Compile Include="TestFinder.cs" />
+ <Compile Include="TestMetrics.cs" />
+ <Compile Include="TestSetupAttribute.cs" />
+ <Compile Include="TestVariationAttribute.cs" />
+ <Compile Include="ThreadPoolTest.cs" />
+ <Compile Include="VersionUtil.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="project.json" />
+ </ItemGroup>
+ <!--Import the targets-->
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/Test.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/Test.cs
new file mode 100644
index 0000000000..ff6833e57f
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/Test.cs
@@ -0,0 +1,119 @@
+// 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.Collections.Generic;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+
+namespace DPStressHarness
+{
+ internal class Test : TestBase
+ {
+ private TestAttribute _attr;
+ private int _overrideIterations = -1;
+ private int _overrideWarmup = -1;
+
+ public Test(TestAttribute attr,
+ MethodInfo testMethodInfo,
+ Type type,
+ List<MethodInfo> setupMethods,
+ List<MethodInfo> cleanupMethods)
+ : base(attr, testMethodInfo, type, setupMethods, cleanupMethods)
+ {
+ _attr = attr;
+ }
+
+
+ public override void Run()
+ {
+ try
+ {
+ // create an instance of the class that defines the test method.
+ object targetInstance = _type.GetConstructor(Type.EmptyTypes).Invoke(null);
+
+ SetVariations(targetInstance);
+
+ ExecuteSetupPhase(targetInstance);
+
+ TestMethodDelegate tmd = CreateTestMethodDelegate();
+
+ ExecuteTest(targetInstance, tmd);
+
+ ExecuteCleanupPhase(targetInstance);
+
+ LogTest();
+ }
+ catch (TargetInvocationException e)
+ {
+ LogTestFailure(e.InnerException.ToString());
+ }
+ catch (Exception e)
+ {
+ LogTestFailure(e.ToString());
+ }
+ }
+
+ protected void LogTest()
+ {
+ Logger logger = new Logger(TestMetrics.RunLabel, TestMetrics.IsOfficial, TestMetrics.Milestone, TestMetrics.Branch);
+ logger.AddTest(this.Title);
+
+ LogStandardMetrics(logger);
+
+ logger.AddTestMetric(Constants.TEST_METRIC_ELAPSED_SECONDS, String.Format("{0:F2}", TestMetrics.ElapsedSeconds), "sec", false);
+
+ logger.Save();
+
+ Console.WriteLine("{0}: Elapsed Seconds={1:F2}, Working Set={2}, Peak Working Set={3}, Private Bytes={4}",
+ this.Title,
+ TestMetrics.ElapsedSeconds,
+ TestMetrics.WorkingSet,
+ TestMetrics.PeakWorkingSet,
+ TestMetrics.PrivateBytes);
+ }
+
+
+ private void ExecuteTest(Object targetInstance, TestMethodDelegate tmd)
+ {
+ int warmupIterations = _attr.WarmupIterations;
+ int testIterations = _attr.TestIterations;
+
+ if (_overrideIterations >= 0)
+ {
+ testIterations = _overrideIterations;
+ }
+ if (_overrideWarmup >= 0)
+ {
+ warmupIterations = _overrideWarmup;
+ }
+
+ /** do some cleanup to make memory tests more accurate **/
+ System.GC.Collect();
+ System.GC.WaitForPendingFinalizers();
+ System.GC.Collect();
+
+ IntPtr h = MemApi.GetCurrentProcess();
+ bool fRes = MemApi.SetProcessWorkingSetSize(h, -1, -1);
+ /****/
+
+ System.Threading.Thread.Sleep(10000);
+
+ for (int i = 0; i < warmupIterations; i++)
+ {
+ tmd(targetInstance);
+ }
+
+ TestMetrics.StartCollection();
+ for (int i = 0; i < testIterations; i++)
+ {
+ tmd(targetInstance);
+ }
+ TestMetrics.StopCollection();
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestAttribute.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestAttribute.cs
new file mode 100644
index 0000000000..1fa680e022
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestAttribute.cs
@@ -0,0 +1,272 @@
+// 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;
+
+namespace DPStressHarness
+{
+ public enum TestPriority
+ {
+ BVT = 0,
+ High = 1,
+ Medium = 2,
+ Low = 3
+ }
+
+ public class TestAttributeBase : Attribute
+ {
+ private string _title;
+ private string _description = "none provided";
+ private string _applicationName = "unknown";
+ private string _improvement = "ADONETV3";
+ private string _owner = "unknown";
+ private string _category = "unknown";
+ private TestPriority _priority = TestPriority.BVT;
+
+ public TestAttributeBase(string title)
+ {
+ _title = title;
+ }
+
+ public string Title
+ {
+ get { return _title; }
+ set { _title = value; }
+ }
+
+ public string Description
+ {
+ get { return _description; }
+ set { _description = value; }
+ }
+
+ public string Improvement
+ {
+ get { return _improvement; }
+ set { _improvement = value; }
+ }
+
+ public string Owner
+ {
+ get { return _owner; }
+ set { _owner = value; }
+ }
+
+ public string ApplicationName
+ {
+ get { return _applicationName; }
+ set { _applicationName = value; }
+ }
+
+ public TestPriority Priority
+ {
+ get { return _priority; }
+ set { _priority = value; }
+ }
+
+ public string Category
+ {
+ get { return _category; }
+ set { _category = value; }
+ }
+ }
+
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
+ public class TestAttribute : TestAttributeBase
+ {
+ private int _warmupIterations = 0;
+ private int _testIterations = 1;
+
+ public TestAttribute(string title) : base(title)
+ {
+ }
+
+ public int WarmupIterations
+ {
+ get
+ {
+ string propName = "WarmupIterations";
+
+ if (TestMetrics.Overrides.ContainsKey(propName))
+ {
+ return Int32.Parse(TestMetrics.Overrides[propName]);
+ }
+ else
+ {
+ return _warmupIterations;
+ }
+ }
+ set { _warmupIterations = value; }
+ }
+
+ public int TestIterations
+ {
+ get
+ {
+ string propName = "TestIterations";
+
+ if (TestMetrics.Overrides.ContainsKey(propName))
+ {
+ return Int32.Parse(TestMetrics.Overrides[propName]);
+ }
+ else
+ {
+ return _testIterations;
+ }
+ }
+ set { _testIterations = value; }
+ }
+ }
+
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
+ public class StressTestAttribute : TestAttributeBase
+ {
+ private int _weight = 1;
+
+ public StressTestAttribute(string title)
+ : base(title)
+ {
+ }
+
+ public int Weight
+ {
+ get { return _weight; }
+ set { _weight = value; }
+ }
+ }
+
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
+ public class MultiThreadedTestAttribute : TestAttributeBase
+ {
+ private int _warmupDuration = 60;
+ private int _testDuration = 60;
+ private int _threads = 16;
+
+ public MultiThreadedTestAttribute(string title)
+ : base(title)
+ {
+ }
+
+ public int WarmupDuration
+ {
+ get
+ {
+ string propName = "WarmupDuration";
+
+ if (TestMetrics.Overrides.ContainsKey(propName))
+ {
+ return Int32.Parse(TestMetrics.Overrides[propName]);
+ }
+ else
+ {
+ return _warmupDuration;
+ }
+ }
+ set { _warmupDuration = value; }
+ }
+
+ public int TestDuration
+ {
+ get
+ {
+ string propName = "TestDuration";
+
+ if (TestMetrics.Overrides.ContainsKey(propName))
+ {
+ return Int32.Parse(TestMetrics.Overrides[propName]);
+ }
+ else
+ {
+ return _testDuration;
+ }
+ }
+ set { _testDuration = value; }
+ }
+
+ public int Threads
+ {
+ get
+ {
+ string propName = "Threads";
+
+ if (TestMetrics.Overrides.ContainsKey(propName))
+ {
+ return Int32.Parse(TestMetrics.Overrides[propName]);
+ }
+ else
+ {
+ return _threads;
+ }
+ }
+ set { _threads = value; }
+ }
+ }
+
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
+ public class ThreadPoolTestAttribute : TestAttributeBase
+ {
+ private int _warmupDuration = 60;
+ private int _testDuration = 60;
+ private int _threads = 64;
+
+ public ThreadPoolTestAttribute(string title)
+ : base(title)
+ {
+ }
+
+ public int WarmupDuration
+ {
+ get
+ {
+ string propName = "WarmupDuration";
+
+ if (TestMetrics.Overrides.ContainsKey(propName))
+ {
+ return Int32.Parse(TestMetrics.Overrides[propName]);
+ }
+ else
+ {
+ return _warmupDuration;
+ }
+ }
+ set { _warmupDuration = value; }
+ }
+
+ public int TestDuration
+ {
+ get
+ {
+ string propName = "TestDuration";
+
+ if (TestMetrics.Overrides.ContainsKey(propName))
+ {
+ return Int32.Parse(TestMetrics.Overrides[propName]);
+ }
+ else
+ {
+ return _testDuration;
+ }
+ }
+ set { _testDuration = value; }
+ }
+
+ public int Threads
+ {
+ get
+ {
+ string propName = "Threads";
+
+ if (TestMetrics.Overrides.ContainsKey(propName))
+ {
+ return Int32.Parse(TestMetrics.Overrides[propName]);
+ }
+ else
+ {
+ return _threads;
+ }
+ }
+ set { _threads = value; }
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestBase.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestBase.cs
new file mode 100644
index 0000000000..0714cd1794
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestBase.cs
@@ -0,0 +1,173 @@
+// 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.Collections.Generic;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using System.Threading;
+
+namespace DPStressHarness
+{
+ public abstract class TestBase
+ {
+ private TestAttributeBase _attr;
+ private string _variationSuffix = "";
+
+ [System.CLSCompliantAttribute(false)]
+ protected MethodInfo _testMethod;
+ [System.CLSCompliantAttribute(false)]
+ protected Type _type;
+
+ [System.CLSCompliantAttribute(false)]
+ protected List<MethodInfo> _setupMethods;
+
+ [System.CLSCompliantAttribute(false)]
+ protected List<MethodInfo> _cleanupMethods;
+
+ protected delegate void TestMethodDelegate(object t);
+
+ public TestBase(TestAttributeBase attr,
+ MethodInfo testMethodInfo,
+ Type type,
+ List<MethodInfo> setupMethods,
+ List<MethodInfo> cleanupMethods)
+ {
+ _attr = attr;
+ _testMethod = testMethodInfo;
+ _type = type;
+ _setupMethods = setupMethods;
+ _cleanupMethods = cleanupMethods;
+ }
+
+ public string Title
+ {
+ get { return _attr.Title + _variationSuffix; }
+ }
+
+ public string Description
+ {
+ get { return _attr.Description; }
+ }
+
+ public string Category
+ {
+ get { return _attr.Category; }
+ }
+
+ public TestPriority Priority
+ {
+ get { return _attr.Priority; }
+ }
+
+ public List<string> GetVariations()
+ {
+ FieldInfo[] fields = _type.GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
+
+ List<string> variations = new List<string>(10);
+ foreach (FieldInfo fi in fields)
+ {
+ TestVariationAttribute[] attrs = (TestVariationAttribute[])fi.GetCustomAttributes(typeof(TestVariationAttribute), false);
+
+ foreach (TestVariationAttribute testVarAttr in attrs)
+ {
+ if (!variations.Contains(testVarAttr.VariationName))
+ {
+ variations.Add(testVarAttr.VariationName);
+ }
+ }
+ }
+
+ return variations;
+ }
+
+ public abstract void Run();
+
+
+ protected void ExecuteSetupPhase(Object targetInstance)
+ {
+ if (_setupMethods != null)
+ {
+ foreach (MethodInfo setupMthd in _setupMethods)
+ {
+ setupMthd.Invoke(targetInstance, null);
+ }
+ }
+ }
+
+ protected void ExecuteCleanupPhase(Object targetInstance)
+ {
+ if (_cleanupMethods != null)
+ {
+ foreach (MethodInfo cleanupMethod in _cleanupMethods)
+ {
+ cleanupMethod.Invoke(targetInstance, null);
+ }
+ }
+ }
+
+ protected void SetVariations(Object targetInstance)
+ {
+ FieldInfo[] fields = targetInstance.GetType().GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
+
+ foreach (FieldInfo fi in fields)
+ {
+ TestVariationAttribute[] attrs = (TestVariationAttribute[])fi.GetCustomAttributes(typeof(TestVariationAttribute), false);
+
+ foreach (TestVariationAttribute testVarAttr in attrs)
+ {
+ foreach (string specifiedVariation in TestMetrics.Variations)
+ {
+ if (specifiedVariation.Equals(testVarAttr.VariationName))
+ {
+ fi.SetValue(targetInstance, testVarAttr.VariationValue);
+ _variationSuffix += "_" + testVarAttr.VariationName;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ protected TestMethodDelegate CreateTestMethodDelegate()
+ {
+ Type[] args = { typeof(object) };
+ return new TestMethodDelegate((instance) => _testMethod.Invoke(instance, null));
+ }
+
+
+ protected void LogTestFailure(string exceptionData)
+ {
+ Console.WriteLine("{0}: Failed", this.Title);
+ Console.WriteLine(exceptionData);
+
+ Logger logger = new Logger(TestMetrics.RunLabel, false, TestMetrics.Milestone, TestMetrics.Branch);
+ logger.AddTest(this.Title);
+ logger.AddTestMetric("Test Assembly", _testMethod.Module.FullyQualifiedName, null);
+ logger.AddTestException(exceptionData);
+ logger.Save();
+ }
+
+ protected void LogStandardMetrics(Logger logger)
+ {
+ logger.AddTestMetric(Constants.TEST_METRIC_TEST_ASSEMBLY, _testMethod.Module.FullyQualifiedName, null);
+ logger.AddTestMetric(Constants.TEST_METRIC_TEST_IMPROVEMENT, _attr.Improvement, null);
+ logger.AddTestMetric(Constants.TEST_METRIC_TEST_OWNER, _attr.Owner, null);
+ logger.AddTestMetric(Constants.TEST_METRIC_TEST_CATEGORY, _attr.Category, null);
+ logger.AddTestMetric(Constants.TEST_METRIC_TEST_PRIORITY, _attr.Priority.ToString(), null);
+ logger.AddTestMetric(Constants.TEST_METRIC_APPLICATION_NAME, _attr.Improvement, null);
+
+ if (TestMetrics.TargetAssembly != null)
+ {
+ logger.AddTestMetric(Constants.TEST_METRIC_TARGET_ASSEMBLY_NAME, (new AssemblyName(TestMetrics.TargetAssembly.FullName)).Name, null);
+ }
+
+ logger.AddTestMetric(Constants.TEST_METRIC_PEAK_WORKING_SET, String.Format("{0}", TestMetrics.PeakWorkingSet), "bytes");
+ logger.AddTestMetric(Constants.TEST_METRIC_WORKING_SET, String.Format("{0}", TestMetrics.WorkingSet), "bytes");
+ logger.AddTestMetric(Constants.TEST_METRIC_PRIVATE_BYTES, String.Format("{0}", TestMetrics.PrivateBytes), "bytes");
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestCleanupAttribute.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestCleanupAttribute.cs
new file mode 100644
index 0000000000..32bc5ee6bc
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestCleanupAttribute.cs
@@ -0,0 +1,16 @@
+// 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;
+
+namespace DPStressHarness
+{
+ [AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
+ public class TestCleanupAttribute : Attribute
+ {
+ public TestCleanupAttribute()
+ {
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestFinder.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestFinder.cs
new file mode 100644
index 0000000000..07c9d1cf12
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestFinder.cs
@@ -0,0 +1,167 @@
+// 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.Collections.Generic;
+using System.Reflection;
+using System.IO;
+
+namespace DPStressHarness
+{
+ internal class TestFinder
+ {
+ private static AssemblyName s_assemblyName;
+
+ public static AssemblyName AssemblyName
+ {
+ get { return s_assemblyName; }
+ set { s_assemblyName = value; }
+ }
+
+ public static IEnumerable<TestBase> GetTests(Assembly assembly)
+ {
+ List<TestBase> tests = new List<TestBase>();
+
+
+ Type[] typesInModule = null;
+ try
+ {
+ typesInModule = assembly.GetTypes();
+ }
+ catch (ReflectionTypeLoadException ex)
+ {
+ Console.WriteLine("ReflectionTypeLoadException Errors");
+ foreach (Exception loadEx in ex.LoaderExceptions)
+ {
+ Console.WriteLine("\t" + loadEx.Message);
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Error." + ex.Message);
+ }
+
+ foreach (Type t in typesInModule)
+ {
+ MethodInfo[] methods = t.GetMethods(BindingFlags.Instance | BindingFlags.Public);
+ List<MethodInfo> setupMethods = new List<MethodInfo>();
+ List<MethodInfo> cleanupMethods = new List<MethodInfo>();
+
+ MethodInfo globalSetupMethod = null;
+ MethodInfo globalCleanupMethod = null;
+ MethodInfo globalExceptionHandlerMethod = null;
+
+ foreach (MethodInfo m in methods)
+ {
+ GlobalTestSetupAttribute[] globalSetupAttributes = (GlobalTestSetupAttribute[])m.GetCustomAttributes(typeof(GlobalTestSetupAttribute), true);
+ if (globalSetupAttributes.Length > 0)
+ {
+ if (null == globalSetupMethod)
+ {
+ globalSetupMethod = m;
+ }
+ else
+ {
+ throw new NotSupportedException("Only one GlobalTestSetup method may be specified per type.");
+ }
+ }
+
+ GlobalTestCleanupAttribute[] globalCleanupAttributes = (GlobalTestCleanupAttribute[])m.GetCustomAttributes(typeof(GlobalTestCleanupAttribute), true);
+ if (globalCleanupAttributes.Length > 0)
+ {
+ if (null == globalCleanupMethod)
+ {
+ globalCleanupMethod = m;
+ }
+ else
+ {
+ throw new NotSupportedException("Only one GlobalTestCleanup method may be specified per type.");
+ }
+ }
+
+ GlobalExceptionHandlerAttribute[] globalExceptionHandlerAttributes = (GlobalExceptionHandlerAttribute[])m.GetCustomAttributes(typeof(GlobalExceptionHandlerAttribute), true);
+ if (globalExceptionHandlerAttributes.Length > 0)
+ {
+ if (null == globalExceptionHandlerMethod)
+ {
+ globalExceptionHandlerMethod = m;
+ }
+ else
+ {
+ throw new NotSupportedException("Only one GlobalExceptionHandler method may be specified.");
+ }
+ }
+
+ TestSetupAttribute[] testSetupAttrs = (TestSetupAttribute[])m.GetCustomAttributes(typeof(TestSetupAttribute), true);
+ if (testSetupAttrs.Length > 0)
+ {
+ setupMethods.Add(m); ;
+ }
+
+ TestCleanupAttribute[] testCleanupAttrs = (TestCleanupAttribute[])m.GetCustomAttributes(typeof(TestCleanupAttribute), true);
+ if (testCleanupAttrs.Length > 0)
+ {
+ cleanupMethods.Add(m); ;
+ }
+ }
+
+ foreach (MethodInfo m in methods)
+ {
+ // add single-threaded tests to the list
+ TestAttribute[] testAttrs = (TestAttribute[])m.GetCustomAttributes(typeof(TestAttribute), true);
+ foreach (TestAttribute attr in testAttrs)
+ {
+ tests.Add(new Test(attr, m, t, setupMethods, cleanupMethods));
+ }
+
+ // add any declared stress tests.
+ StressTestAttribute[] stressTestAttrs = (StressTestAttribute[])m.GetCustomAttributes(typeof(StressTestAttribute), true);
+ foreach (StressTestAttribute attr in stressTestAttrs)
+ {
+ if (TestMetrics.IncludeTest(attr) && MatchFilter(attr))
+ tests.Add(new StressTest(attr, m, globalSetupMethod, globalCleanupMethod, t, setupMethods, cleanupMethods, globalExceptionHandlerMethod));
+ }
+
+ // add multi-threaded (non thread pool) tests to the list
+ MultiThreadedTestAttribute[] multiThreadedTestAttrs = (MultiThreadedTestAttribute[])m.GetCustomAttributes(typeof(MultiThreadedTestAttribute), true);
+ foreach (MultiThreadedTestAttribute attr in multiThreadedTestAttrs)
+ {
+ if (TestMetrics.IncludeTest(attr))
+ tests.Add(new MultiThreadedTest(attr, m, t, setupMethods, cleanupMethods));
+ }
+
+ // add multi-threaded (with thread pool) tests to the list
+ ThreadPoolTestAttribute[] threadPoolTestAttrs = (ThreadPoolTestAttribute[])m.GetCustomAttributes(typeof(ThreadPoolTestAttribute), true);
+ foreach (ThreadPoolTestAttribute attr in threadPoolTestAttrs)
+ {
+ if (TestMetrics.IncludeTest(attr))
+ tests.Add(new ThreadPoolTest(attr, m, t, setupMethods, cleanupMethods));
+ }
+ }
+ }
+
+ return tests;
+ }
+
+ private static bool MatchFilter(StressTestAttribute attr)
+ {
+ // This change should not have impacts on any existing tests.
+ // 1. If filter is not provided in command line, we do not apply filter and select all the tests.
+ // 2. If current test attribute (such as StressTestAttribute) does not implement ITestAttriuteFilter, it is not affected and still selected.
+
+ if (string.IsNullOrEmpty(TestMetrics.Filter))
+ {
+ return true;
+ }
+
+ var filter = attr as ITestAttributeFilter;
+ if (filter == null)
+ {
+ return true;
+ }
+
+ return filter.MatchFilter(TestMetrics.Filter);
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestMetrics.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestMetrics.cs
new file mode 100644
index 0000000000..9af4147cad
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestMetrics.cs
@@ -0,0 +1,362 @@
+// 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.Diagnostics;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Globalization;
+
+namespace DPStressHarness
+{
+ public static class TestMetrics
+ {
+ private const string _defaultValue = "unknown";
+
+ private static bool s_valid = false;
+ private static bool s_reset = true;
+ private static Stopwatch s_stopwatch = new Stopwatch();
+ private static long s_workingSet;
+ private static long s_peakWorkingSet;
+ private static long s_privateBytes;
+ private static Assembly s_targetAssembly;
+ private static string s_fileVersion = _defaultValue;
+ private static string s_privateBuild = _defaultValue;
+ private static string s_runLabel = DateTime.Now.ToString();
+ private static Dictionary<string, string> s_overrides;
+ private static List<string> s_variations = null;
+ private static List<string> s_selectedTests = null;
+ private static bool s_isOfficial = false;
+ private static string s_milestone = _defaultValue;
+ private static string s_branch = _defaultValue;
+ private static List<string> s_categories = null;
+ private static bool s_profileMeasuredCode = false;
+ private static int s_stressThreads = 16;
+ private static int s_stressDuration = -1;
+ private static int? s_exceptionThreshold = null;
+ private static bool s_monitorenabled = false;
+ private static string s_monitormachinename = "localhost";
+ private static int s_randomSeed = 0;
+ private static string s_filter = null;
+ private static bool s_printMethodName = false;
+
+ /// <summary>Starts the sample profiler.</summary>
+ /// <remarks>
+ /// Do not inline to avoid errors when the functionality is not used
+ /// and the profiling DLL is not available.
+ /// </remarks>
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ private static void InternalStartProfiling()
+ {
+ // Microsoft.VisualStudio.Profiler.DataCollection.StartProfile(
+ // Microsoft.VisualStudio.Profiler.ProfileLevel.Global,
+ // Microsoft.VisualStudio.Profiler.DataCollection.CurrentId);
+ }
+
+ /// <summary>Stops the sample profiler.</summary>
+ /// <remarks>
+ /// Do not inline to avoid errors when the functionality is not used
+ /// and the profiling DLL is not available.
+ /// </remarks>
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ private static void InternalStopProfiling()
+ {
+ // Microsoft.VisualStudio.Profiler.DataCollection.StopProfile(
+ // Microsoft.VisualStudio.Profiler.ProfileLevel.Global,
+ // Microsoft.VisualStudio.Profiler.DataCollection.CurrentId);
+ }
+
+ public static void StartCollection()
+ {
+ s_valid = false;
+
+ s_stopwatch.Reset();
+ s_stopwatch.Start();
+ s_reset = true;
+ }
+
+ public static void StartProfiling()
+ {
+ if (s_profileMeasuredCode)
+ {
+ InternalStartProfiling();
+ }
+ }
+
+ public static void StopProfiling()
+ {
+ if (s_profileMeasuredCode)
+ {
+ InternalStopProfiling();
+ }
+ }
+
+ public static void StopCollection()
+ {
+ s_stopwatch.Stop();
+
+ Process p = Process.GetCurrentProcess();
+ s_workingSet = p.WorkingSet64;
+ s_peakWorkingSet = p.PeakWorkingSet64;
+ s_privateBytes = p.PrivateMemorySize64;
+
+ s_valid = true;
+ }
+
+ public static void PauseTimer()
+ {
+ s_stopwatch.Stop();
+ }
+
+ public static void UnPauseTimer()
+ {
+ if (s_reset)
+ {
+ s_stopwatch.Reset();
+ s_reset = false;
+ }
+
+ s_stopwatch.Start();
+ }
+
+ private static void ThrowIfInvalid()
+ {
+ if (!s_valid) throw new InvalidOperationException("Collection must be stopped before accessing this metric.");
+ }
+
+ public static void Reset()
+ {
+ s_valid = false;
+ s_reset = true;
+ s_stopwatch = new Stopwatch();
+ s_workingSet = new long();
+ s_peakWorkingSet = new long();
+ s_privateBytes = new long();
+ s_targetAssembly = null;
+ s_fileVersion = _defaultValue;
+ s_privateBuild = _defaultValue;
+ s_runLabel = DateTime.Now.ToString();
+ s_overrides = null;
+ s_variations = null;
+ s_selectedTests = null;
+ s_isOfficial = false;
+ s_milestone = _defaultValue;
+ s_branch = _defaultValue;
+ s_categories = null;
+ s_profileMeasuredCode = false;
+ s_stressThreads = 16;
+ s_stressDuration = -1;
+ s_exceptionThreshold = null;
+ s_monitorenabled = false;
+ s_monitormachinename = "localhost";
+ s_randomSeed = 0;
+ s_filter = null;
+ s_printMethodName = false;
+ }
+
+ public static string FileVersion
+ {
+ get { return s_fileVersion; }
+ set { s_fileVersion = value; }
+ }
+
+ public static string PrivateBuild
+ {
+ get { return s_privateBuild; }
+ set { s_privateBuild = value; }
+ }
+
+ public static Assembly TargetAssembly
+ {
+ get { return s_targetAssembly; }
+
+ set
+ {
+ s_targetAssembly = value;
+ s_fileVersion = VersionUtil.GetFileVersion(s_targetAssembly.ManifestModule.FullyQualifiedName);
+ s_privateBuild = VersionUtil.GetPrivateBuild(s_targetAssembly.ManifestModule.FullyQualifiedName);
+ }
+ }
+
+ public static string RunLabel
+ {
+ get { return s_runLabel; }
+ set { s_runLabel = value; }
+ }
+
+ public static string Milestone
+ {
+ get { return s_milestone; }
+ set { s_milestone = value; }
+ }
+
+ public static string Branch
+ {
+ get { return s_branch; }
+ set { s_branch = value; }
+ }
+
+ public static bool IsOfficial
+ {
+ get { return s_isOfficial; }
+ set { s_isOfficial = value; }
+ }
+
+ public static bool IsDefaultValue(string val)
+ {
+ return val.Equals(_defaultValue);
+ }
+
+ public static double ElapsedSeconds
+ {
+ get
+ {
+ ThrowIfInvalid();
+ return s_stopwatch.ElapsedMilliseconds / 1000.0;
+ }
+ }
+
+ public static long WorkingSet
+ {
+ get
+ {
+ ThrowIfInvalid();
+ return s_workingSet;
+ }
+ }
+
+ public static long PeakWorkingSet
+ {
+ get
+ {
+ ThrowIfInvalid();
+ return s_peakWorkingSet;
+ }
+ }
+
+ public static long PrivateBytes
+ {
+ get
+ {
+ ThrowIfInvalid();
+ return s_privateBytes;
+ }
+ }
+
+
+ public static Dictionary<string, string> Overrides
+ {
+ get
+ {
+ if (s_overrides == null)
+ {
+ s_overrides = new Dictionary<string, string>(8);
+ }
+ return s_overrides;
+ }
+ }
+
+ public static List<string> Variations
+ {
+ get
+ {
+ if (s_variations == null)
+ {
+ s_variations = new List<string>(8);
+ }
+
+ return s_variations;
+ }
+ }
+
+ public static List<string> SelectedTests
+ {
+ get
+ {
+ if (s_selectedTests == null)
+ {
+ s_selectedTests = new List<string>(8);
+ }
+
+ return s_selectedTests;
+ }
+ }
+
+ public static bool IncludeTest(TestAttributeBase test)
+ {
+ if (s_selectedTests == null || s_selectedTests.Count == 0)
+ return true; // user has no selection - run all
+ else
+ return s_selectedTests.Contains(test.Title);
+ }
+
+ public static List<string> Categories
+ {
+ get
+ {
+ if (s_categories == null)
+ {
+ s_categories = new List<string>(8);
+ }
+
+ return s_categories;
+ }
+ }
+
+ public static bool ProfileMeasuredCode
+ {
+ get { return s_profileMeasuredCode; }
+ set { s_profileMeasuredCode = value; }
+ }
+
+ public static int StressDuration
+ {
+ get { return s_stressDuration; }
+ set { s_stressDuration = value; }
+ }
+
+ public static int StressThreads
+ {
+ get { return s_stressThreads; }
+ set { s_stressThreads = value; }
+ }
+
+ public static int? ExceptionThreshold
+ {
+ get { return s_exceptionThreshold; }
+ set { s_exceptionThreshold = value; }
+ }
+
+ public static bool MonitorEnabled
+ {
+ get { return s_monitorenabled; }
+ set { s_monitorenabled = value; }
+ }
+
+
+ public static string MonitorMachineName
+ {
+ get { return s_monitormachinename; }
+ set { s_monitormachinename = value; }
+ }
+
+ public static int RandomSeed
+ {
+ get { return s_randomSeed; }
+ set { s_randomSeed = value; }
+ }
+
+ public static string Filter
+ {
+ get { return s_filter; }
+ set { s_filter = value; }
+ }
+
+ public static bool PrintMethodName
+ {
+ get { return s_printMethodName; }
+ set { s_printMethodName = value; }
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestSetupAttribute.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestSetupAttribute.cs
new file mode 100644
index 0000000000..5626032b69
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestSetupAttribute.cs
@@ -0,0 +1,16 @@
+// 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;
+
+namespace DPStressHarness
+{
+ [AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
+ public class TestSetupAttribute : Attribute
+ {
+ public TestSetupAttribute()
+ {
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestVariationAttribute.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestVariationAttribute.cs
new file mode 100644
index 0000000000..e54acfa969
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/TestVariationAttribute.cs
@@ -0,0 +1,35 @@
+// 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.Collections.Generic;
+using System.Text;
+
+namespace DPStressHarness
+{
+ [AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = true)]
+ public class TestVariationAttribute : Attribute
+ {
+ private string _variationName;
+ private object _variationValue;
+
+ public TestVariationAttribute(string variationName, object variationValue)
+ {
+ _variationName = variationName;
+ _variationValue = variationValue;
+ }
+
+ public string VariationName
+ {
+ get { return _variationName; }
+ set { _variationName = value; }
+ }
+
+ public object VariationValue
+ {
+ get { return _variationValue; }
+ set { _variationValue = value; }
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/ThreadPoolTest.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/ThreadPoolTest.cs
new file mode 100644
index 0000000000..d3894434bf
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/ThreadPoolTest.cs
@@ -0,0 +1,174 @@
+// 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.Collections.Generic;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using System.Threading;
+
+namespace DPStressHarness
+{
+ internal class ThreadPoolTest : TestBase
+ {
+ private ThreadPoolTestAttribute _attr;
+ public static bool _continue;
+ public static int _threadsRunning;
+ public static int _rps;
+ public static WaitCallback _waitCallback = new WaitCallback(RunThreadPool);
+ public static Exception _firstException = null;
+
+ private struct TestInfo
+ {
+ public object _instance;
+ public TestMethodDelegate _delegateTest;
+ }
+
+ public ThreadPoolTest(ThreadPoolTestAttribute attr,
+ MethodInfo testMethodInfo,
+ Type type,
+ List<MethodInfo> setupMethods,
+ List<MethodInfo> cleanupMethods)
+ : base(attr, testMethodInfo, type, setupMethods, cleanupMethods)
+ {
+ _attr = attr;
+ }
+
+ public override void Run()
+ {
+ try
+ {
+ Stopwatch timer = new Stopwatch();
+ long warmupDuration = (long)_attr.WarmupDuration * Stopwatch.Frequency;
+ long testDuration = (long)_attr.TestDuration * Stopwatch.Frequency;
+ int threads = _attr.Threads;
+
+ TestInfo[] info = new TestInfo[threads];
+ ConstructorInfo targetConstructor = _type.GetConstructor(Type.EmptyTypes);
+
+ for (int i = 0; i < threads; i++)
+ {
+ info[i] = new TestInfo();
+ info[i]._instance = targetConstructor.Invoke(null);
+ info[i]._delegateTest = CreateTestMethodDelegate();
+
+ ExecuteSetupPhase(info[i]._instance);
+ }
+
+ _firstException = null;
+ _continue = true;
+ _rps = 0;
+
+ for (int i = 0; i < threads; i++)
+ {
+ Interlocked.Increment(ref _threadsRunning);
+ ThreadPool.QueueUserWorkItem(_waitCallback, info[i]);
+ }
+
+ timer.Reset();
+ timer.Start();
+
+ while (timer.ElapsedTicks < warmupDuration)
+ {
+ Thread.Sleep(1000);
+ }
+
+ int warmupRequests = Interlocked.Exchange(ref _rps, 0);
+ timer.Reset();
+ timer.Start();
+ TestMetrics.StartCollection();
+
+ while (timer.ElapsedTicks < testDuration)
+ {
+ Thread.Sleep(1000);
+ }
+
+ int requests = Interlocked.Exchange(ref _rps, 0);
+ double elapsedSeconds = timer.ElapsedTicks / Stopwatch.Frequency;
+ TestMetrics.StopCollection();
+ _continue = false;
+
+ while (_threadsRunning > 0)
+ {
+ Thread.Sleep(1000);
+ }
+
+ for (int i = 0; i < threads; i++)
+ {
+ ExecuteCleanupPhase(info[i]._instance);
+ }
+
+ double rps = (double)requests / elapsedSeconds;
+
+ if (_firstException == null)
+ {
+ LogTest(rps);
+ }
+ else
+ {
+ LogTestFailure(_firstException.ToString());
+ }
+ }
+ catch (TargetInvocationException e)
+ {
+ LogTestFailure(e.InnerException.ToString());
+ }
+ catch (Exception e)
+ {
+ LogTestFailure(e.ToString());
+ }
+ }
+
+
+ public static void RunThreadPool(Object state)
+ {
+ try
+ {
+ TestInfo info = (TestInfo)state;
+ info._delegateTest(info._instance);
+ Interlocked.Increment(ref _rps);
+ }
+ catch (Exception e)
+ {
+ if (_firstException == null)
+ {
+ _firstException = e;
+ }
+ _continue = false;
+ }
+ finally
+ {
+ if (_continue)
+ {
+ ThreadPool.QueueUserWorkItem(_waitCallback, state);
+ }
+ else
+ {
+ Interlocked.Decrement(ref _threadsRunning);
+ }
+ }
+ }
+
+ protected void LogTest(double rps)
+ {
+ Logger logger = new Logger(TestMetrics.RunLabel, TestMetrics.IsOfficial, TestMetrics.Milestone, TestMetrics.Branch);
+ logger.AddTest(this.Title);
+
+ LogStandardMetrics(logger);
+
+ logger.AddTestMetric(Constants.TEST_METRIC_RPS, String.Format("{0:F2}", rps), "rps", true);
+
+ logger.Save();
+
+ Console.WriteLine("{0}: Requests per Second={1:F2}, Working Set={2}, Peak Working Set={3}, Private Bytes={4}",
+ this.Title,
+ rps,
+ TestMetrics.WorkingSet,
+ TestMetrics.PeakWorkingSet,
+ TestMetrics.PrivateBytes);
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/VersionUtil.cs b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/VersionUtil.cs
new file mode 100644
index 0000000000..dd4e76edaf
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/VersionUtil.cs
@@ -0,0 +1,42 @@
+// 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.IO;
+using System.Runtime.InteropServices;
+using System.Diagnostics;
+using System.Reflection;
+
+#pragma warning disable 618
+
+namespace DPStressHarness
+{
+ public class VersionUtil
+ {
+ public static string GetFileVersion(string moduleName)
+ {
+ FileVersionInfo info = GetFileVersionInfo(moduleName);
+ return info.FileVersion;
+ }
+
+ public static string GetPrivateBuild(string moduleName)
+ {
+ FileVersionInfo info = GetFileVersionInfo(moduleName);
+ return info.PrivateBuild;
+ }
+
+ private static FileVersionInfo GetFileVersionInfo(string moduleName)
+ {
+ if (File.Exists(moduleName))
+ {
+ return FileVersionInfo.GetVersionInfo(Path.GetFullPath(moduleName));
+ }
+ else
+ {
+ string moduleInRuntimeDir = AppContext.BaseDirectory + moduleName;
+ return FileVersionInfo.GetVersionInfo(moduleInRuntimeDir);
+ }
+ }
+ }
+}
diff --git a/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/project.json b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/project.json
new file mode 100644
index 0000000000..b213fdeaa8
--- /dev/null
+++ b/src/System.Data.SqlClient/tests/StressTests/System.Data.StressRunner/project.json
@@ -0,0 +1,47 @@
+{
+ "dependencies": {
+ "System.Runtime": "4.3.0-beta-24501-02",
+ "Microsoft.NETCore.Platforms": "4.3.0-beta-24501-02",
+ "System.AppContext": "4.3.0-beta-24501-02",
+ "System.Console": "4.3.0-beta-24501-02",
+ "System.Collections": "4.3.0-beta-24501-02",
+ "System.Collections.Concurrent": "4.3.0-beta-24501-02",
+ "System.Data.Common": "4.3.0-beta-24501-02",
+ "System.Data.SqlClient": "4.3.0-beta-24501-02",
+ "System.Diagnostics.Debug": "4.3.0-beta-24501-02",
+ "System.Diagnostics.DiagnosticSource": "4.3.0-beta-24501-02",
+ "System.Diagnostics.FileVersionInfo": "4.3.0-beta-24501-02",
+ "System.Diagnostics.Process": "4.3.0-beta-24501-02",
+ "System.Diagnostics.TextWriterTraceListener": "4.3.0-beta-24501-02",
+ "System.Diagnostics.TraceSource": "4.3.0-beta-24501-02",
+ "System.IO.FileSystem": "4.3.0-beta-24501-02",
+ "System.Net.NameResolution": "4.3.0-beta-24501-02",
+ "System.Security.Principal": "4.3.0-beta-24501-02",
+ "System.Security.Principal.Windows": "4.3.0-beta-24501-02",
+ "System.Threading.Thread": "4.0.0",
+ "System.Threading": "4.3.0-beta-24501-02",
+ "System.Threading.Timer": "4.3.0-beta-24501-02",
+ "System.Reflection.Extensions": "4.3.0-beta-24501-02",
+ "System.Reflection": "4.3.0-beta-24501-02",
+ "System.Reflection.Emit": "4.3.0-beta-24501-02",
+ "System.Reflection.TypeExtensions": "4.3.0-beta-24501-02",
+ "System.Runtime.InteropServices": "4.3.0-beta-24501-02",
+ "System.Threading.ThreadPool": "4.3.0-beta-24501-02",
+ "System.Runtime.Extensions": "4.3.0-beta-24501-02",
+ "System.Text.RegularExpressions": "4.3.0-beta-24501-02",
+ "System.Xml.ReaderWriter": "4.3.0-beta-24501-02",
+ "System.Xml.XmlDocument": "4.3.0-beta-24501-02",
+ "test-runtime": {
+ "target": "project",
+ "exclude": "compile"
+ }
+ },
+ "frameworks": {
+ "netcoreapp1.0": {
+ "imports": [
+ "dnxcore50"
+ ]
+ },
+ "netstandard1.3": {}
+ }
+}
diff --git a/src/System.Diagnostics.Contracts/dir.props b/src/System.Diagnostics.Contracts/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Diagnostics.Contracts/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Diagnostics.Contracts/pkg/System.Diagnostics.Contracts.pkgproj b/src/System.Diagnostics.Contracts/pkg/System.Diagnostics.Contracts.pkgproj
index f1db80d670..d620fdc582 100644
--- a/src/System.Diagnostics.Contracts/pkg/System.Diagnostics.Contracts.pkgproj
+++ b/src/System.Diagnostics.Contracts/pkg/System.Diagnostics.Contracts.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Diagnostics.Contracts.csproj">
diff --git a/src/System.Diagnostics.Contracts/pkg/ValidationSuppression.txt b/src/System.Diagnostics.Contracts/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Diagnostics.Contracts/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Diagnostics.Contracts/ref/System.Diagnostics.Contracts.csproj b/src/System.Diagnostics.Contracts/ref/System.Diagnostics.Contracts.csproj
index 950617f7a9..54e71d58e4 100644
--- a/src/System.Diagnostics.Contracts/ref/System.Diagnostics.Contracts.csproj
+++ b/src/System.Diagnostics.Contracts/ref/System.Diagnostics.Contracts.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Diagnostics.Contracts/src/System.Diagnostics.Contracts.csproj b/src/System.Diagnostics.Contracts/src/System.Diagnostics.Contracts.csproj
index 934170c7e0..57fc672e3e 100644
--- a/src/System.Diagnostics.Contracts/src/System.Diagnostics.Contracts.csproj
+++ b/src/System.Diagnostics.Contracts/src/System.Diagnostics.Contracts.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Diagnostics.Contracts</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Diagnostics.Debug.SymbolReader/pkg/System.Diagnostics.Debug.SymbolReader.builds b/src/System.Diagnostics.Debug.SymbolReader/pkg/System.Diagnostics.Debug.SymbolReader.builds
deleted file mode 100644
index 87418fa1ad..0000000000
--- a/src/System.Diagnostics.Debug.SymbolReader/pkg/System.Diagnostics.Debug.SymbolReader.builds
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <ItemGroup>
- <Project Include="System.Diagnostics.Debug.SymbolReader.pkgproj" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
-</Project>
-
diff --git a/src/System.Diagnostics.Debug.SymbolReader/src/System.Diagnostics.Debug.SymbolReader.builds b/src/System.Diagnostics.Debug.SymbolReader/src/System.Diagnostics.Debug.SymbolReader.builds
deleted file mode 100644
index 5b1e6e0768..0000000000
--- a/src/System.Diagnostics.Debug.SymbolReader/src/System.Diagnostics.Debug.SymbolReader.builds
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <ItemGroup>
- <Project Include="System.Diagnostics.Debug.SymbolReader.csproj" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
-</Project>
-
diff --git a/src/System.Diagnostics.Debug.SymbolReader/src/System.Diagnostics.Debug.SymbolReader.csproj b/src/System.Diagnostics.Debug.SymbolReader/src/System.Diagnostics.Debug.SymbolReader.csproj
deleted file mode 100644
index 3a577b4ff7..0000000000
--- a/src/System.Diagnostics.Debug.SymbolReader/src/System.Diagnostics.Debug.SymbolReader.csproj
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <AssemblyName>System.Diagnostics.Debug.SymbolReader</AssemblyName>
- <ProjectGuid>{1051B8A2-A157-4A17-8C70-5AC2DBD4F833}</ProjectGuid>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
- <NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the options -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
- <ItemGroup>
- <Compile Include="System/Diagnostics/Debug/SymbolReader/SymbolReader.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="project.json" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project> \ No newline at end of file
diff --git a/src/System.Diagnostics.Debug.SymbolReader/src/System/Diagnostics/Debug/SymbolReader/SymbolReader.cs b/src/System.Diagnostics.Debug.SymbolReader/src/System/Diagnostics/Debug/SymbolReader/SymbolReader.cs
deleted file mode 100644
index 5c7fc92c8a..0000000000
--- a/src/System.Diagnostics.Debug.SymbolReader/src/System/Diagnostics/Debug/SymbolReader/SymbolReader.cs
+++ /dev/null
@@ -1,369 +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.IO;
-using System.Reflection.Metadata;
-using System.Reflection.Metadata.Ecma335;
-using System.Reflection.PortableExecutable;
-using System.Runtime.InteropServices;
-using System.Collections.Generic;
-
-namespace System.Diagnostics.Debug.SymbolReader
-{
-
- public class SymbolReader
- {
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
- public struct DebugInfo
- {
- public int lineNumber;
- public int ilOffset;
- public string fileName;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public struct MethodDebugInfo
- {
- public IntPtr points;
- public int size;
- }
-
-
- /// <summary>
- /// Checks availability of debugging information for given assembly.
- /// </summary>
- /// <param name="assemblyFileName">file name of the assembly</param>
- /// <returns>true if debugging information is available</returns>
- public static bool LoadSymbolsForModule(string assemblyFileName)
- {
- MetadataReader peReader, pdbReader;
- bool found = GetReaders(assemblyFileName, out peReader, out pdbReader);
- peReader = null;
- pdbReader = null;
- return found;
- }
-
- /// <summary>
- /// Returns method token and IL offset for given source line number.
- /// </summary>
- /// <param name="assemblyFileName">file name of the assembly</param>
- /// <param name="fileName">source file name</param>
- /// <param name="lineNumber">source line number</param>
- /// <param name="methToken">method token return</param>
- /// <param name="ilOffset">IL offset return</param>
- /// <returns> true if information is available</returns>
- public static bool ResolveSequencePoint(string assemblyFileName, string fileName, int lineNumber, out int methToken, out int ilOffset)
- {
- MetadataReader peReader, pdbReader;
- methToken = 0;
- ilOffset = 0;
-
- try {
- if (!GetReaders(assemblyFileName, out peReader, out pdbReader))
- return false;
-
- foreach (MethodDefinitionHandle methodDefHandle in peReader.MethodDefinitions)
- {
- MethodDebugInformation methodDebugInfo = pdbReader.GetMethodDebugInformation(methodDefHandle);
- SequencePointCollection sequencePoints = methodDebugInfo.GetSequencePoints();
- foreach (SequencePoint point in sequencePoints)
- {
- string sourceName = pdbReader.GetString(pdbReader.GetDocument(point.Document).Name);
- if (Path.GetFileName(sourceName) == Path.GetFileName(fileName) && point.StartLine == lineNumber)
- {
- methToken = MetadataTokens.GetToken(peReader, methodDefHandle);
- ilOffset = point.Offset;
- return true;
- }
- }
- }
- }
- finally
- {
- peReader = null;
- pdbReader = null;
- }
- return false;
- }
-
-
- /// <summary>
- /// Returns source name, line numbers and IL offsets for given method token.
- /// </summary>
- /// <param name="assemblyFileName">file name of the assembly</param>
- /// <param name="methToken">method token</param>
- /// <param name="debugInfo">structure with debug information return</param>
- /// <returns> true if information is available</returns>
- public static bool GetInfoForMethod(string assemblyFileName, int methodToken, ref MethodDebugInfo debugInfo)
- {
- List<DebugInfo> points = null;
-
- if (!GetDebugInfoForMethod(assemblyFileName, methodToken, out points))
- {
- return false;
- }
-
- var structSize = Marshal.SizeOf<DebugInfo>();
-
- debugInfo.size = points.Count;
- var ptr = debugInfo.points;
-
- foreach (var info in points)
- {
- Marshal.StructureToPtr(info, ptr, false);
- ptr = (IntPtr)(ptr.ToInt64() + structSize);
- }
-
- return true;
- }
-
-
- /// <summary>
- /// Helper method to return source name, line numbers and IL offsets for given method token.
- /// </summary>
- /// <param name="assemblyFileName">file name of the assembly</param>
- /// <param name="methToken">method token</param>
- /// <param name="pints">List of debug information for each sequence point return</param>
- /// <returns> true if information is available</returns>
- private static bool GetDebugInfoForMethod(string assemblyFileName, int methodToken, out List<DebugInfo> points)
- {
- MetadataReader peReader, pdbReader;
-
- points = null;
- try
- {
- if (!GetReaders(assemblyFileName, out peReader, out pdbReader))
- return false;
- Handle handle = MetadataTokens.Handle(methodToken);
- if (handle.Kind != HandleKind.MethodDefinition)
- return false;
-
- points = new List<DebugInfo>();
- MethodDebugInformationHandle methodDebugHandle =
- ((MethodDefinitionHandle)handle).ToDebugInformationHandle();
- MethodDebugInformation methodDebugInfo = pdbReader.GetMethodDebugInformation(methodDebugHandle);
- SequencePointCollection sequencePoints = methodDebugInfo.GetSequencePoints();
-
- foreach (SequencePoint point in sequencePoints)
- {
- if (point.StartLine == 0 || point.StartLine == SequencePoint.HiddenLine)
- continue;
- DebugInfo debugInfo = new DebugInfo();
-
- debugInfo.lineNumber = point.StartLine;
- debugInfo.fileName = pdbReader.GetString(pdbReader.GetDocument(point.Document).Name);
- debugInfo.ilOffset = point.Offset;
- points.Add(debugInfo);
- }
- return true;
- }
- finally
- {
- peReader = null;
- pdbReader = null;
- }
- }
-
- /// <summary>
- /// Returns source line number and source file name for given IL offset and method token.
- /// </summary>
- /// <param name="assemblyFileName">file name of the assembly</param>
- /// <param name="methToken">method token</param>
- /// <param name="ilOffset">IL offset</param>
- /// <param name="lineNumber">source line number return</param>
- /// <param name="fileName">source file name return</param>
- /// <returns> true if information is available</returns>
- public static bool GetLineByILOffset(string assemblyFileName, int methodToken, long ilOffset, out int lineNumber, out IntPtr fileName)
- {
- lineNumber = 0;
- fileName = IntPtr.Zero;
-
- string sourceFileName = null;
-
- if (!GetSourceLineByILOffset(assemblyFileName, methodToken, ilOffset, out lineNumber, out sourceFileName))
- return false;
-
- fileName = Marshal.StringToBSTR(sourceFileName);
- sourceFileName = null;
- return true;
- }
-
- /// <summary>
- /// Helper method to return source line number and source file name for given IL offset and method token.
- /// </summary>
- /// <param name="assemblyFileName">file name of the assembly</param>
- /// <param name="methToken">method token</param>
- /// <param name="ilOffset">IL offset</param>
- /// <param name="lineNumber">source line number return</param>
- /// <param name="fileName">source file name return</param>
- /// <returns> true if information is available</returns>
- private static bool GetSourceLineByILOffset(string assemblyFileName, int methodToken, long ilOffset, out int lineNumber, out string fileName)
- {
- MetadataReader peReader, pdbReader;
- lineNumber = 0;
- fileName = null;
-
- try
- {
- if (!GetReaders(assemblyFileName, out peReader, out pdbReader))
- return false;
- Handle handle = MetadataTokens.Handle(methodToken);
- if (handle.Kind != HandleKind.MethodDefinition)
- return false;
-
- MethodDebugInformationHandle methodDebugHandle =
- ((MethodDefinitionHandle)handle).ToDebugInformationHandle();
- MethodDebugInformation methodDebugInfo = pdbReader.GetMethodDebugInformation(methodDebugHandle);
- SequencePointCollection sequencePoints = methodDebugInfo.GetSequencePoints();
-
- SequencePoint nearestPoint = sequencePoints.GetEnumerator().Current;
- foreach (SequencePoint point in sequencePoints)
- {
- if (point.Offset < ilOffset)
- nearestPoint = point;
- else
- {
- if (point.Offset == ilOffset)
- nearestPoint = point;
- if (nearestPoint.StartLine == 0 || nearestPoint.StartLine == SequencePoint.HiddenLine)
- return false;
- lineNumber = nearestPoint.StartLine;
- fileName = pdbReader.GetString(pdbReader.GetDocument(nearestPoint.Document).Name);
- return true;
- }
- }
- return false;
- }
- finally
- {
- peReader = null;
- pdbReader = null;
- }
- }
-
-
- /// <summary>
- /// Returns local variable name for given local index and IL offset.
- /// </summary>
- /// <param name="assemblyFileName">file name of the assembly</param>
- /// <param name="methodToken">method token</param>
- /// <param name="localIndex">local variable index</param>
- /// <param name="localVarName">local variable name return</param>
- /// <returns>true if name has been found</returns>
- public static bool GetLocalVariableName(string assemblyFileName, int methodToken, int localIndex, out IntPtr localVarName)
- {
- localVarName = IntPtr.Zero;
-
- string localVar = null;
- if (!GetLocalVariableByIndex(assemblyFileName, methodToken, localIndex, out localVar))
- return false;
-
- localVarName = Marshal.StringToBSTR(localVar);
- localVar = null;
- return true;
- }
-
- /// <summary>
- /// Helper method to return local variable name for given local index and IL offset.
- /// </summary>
- /// <param name="assemblyFileName">file name of the assembly</param>
- /// <param name="methodToken">method token</param>
- /// <param name="localIndex">local variable index</param>
- /// <param name="localVarName">local variable name return</param>
- /// <returns>true if name has been found</returns>
- public static bool GetLocalVariableByIndex(string assemblyFileName, int methodToken, int localIndex, out string localVarName)
- {
- MetadataReader peReader, pdbReader;
- localVarName = null;
-
- try
- {
- if (!GetReaders(assemblyFileName, out peReader, out pdbReader))
- return false;
-
- Handle handle = MetadataTokens.Handle(methodToken);
- if (handle.Kind != HandleKind.MethodDefinition)
- return false;
-
- MethodDebugInformationHandle methodDebugHandle = ((MethodDefinitionHandle)handle).ToDebugInformationHandle();
- LocalScopeHandleCollection localScopes = pdbReader.GetLocalScopes(methodDebugHandle);
- foreach (LocalScopeHandle scopeHandle in localScopes)
- {
- LocalScope scope = pdbReader.GetLocalScope(scopeHandle);
- LocalVariableHandleCollection localVars = scope.GetLocalVariables();
- foreach (LocalVariableHandle varHandle in localVars)
- {
- LocalVariable localVar = pdbReader.GetLocalVariable(varHandle);
- if (localVar.Index == localIndex)
- {
- if (localVar.Attributes == LocalVariableAttributes.DebuggerHidden)
- return false;
- localVarName = pdbReader.GetString(localVar.Name);
- return true;
- }
- }
- }
- return false;
- }
- finally
- {
- peReader = null;
- pdbReader = null;
- }
- }
-
- /// <summary>
- /// Returns metadata readers for assembly PE file and portable PDB.
- /// </summary>
- /// <param name="assemblyFileName">file name of the assembly</param>
- /// <param name="peReader">PE metadata reader return</param>
- /// <param name="pdbReader">PDB metadata reader return</param>
- /// <returns>true if debugging information is available</returns>
- private static bool GetReaders(string assemblyFileName, out MetadataReader peReader, out MetadataReader pdbReader)
- {
- peReader = null;
- pdbReader = null;
-
- if (!File.Exists(assemblyFileName))
- {
- return false;
- }
- Stream peStream = File.OpenRead(assemblyFileName);
- PEReader reader = new PEReader(peStream);
- string pdbPath = null;
-
- foreach (DebugDirectoryEntry entry in reader.ReadDebugDirectory())
- {
- if (entry.Type == DebugDirectoryEntryType.CodeView)
- {
- CodeViewDebugDirectoryData codeViewData = reader.ReadCodeViewDebugDirectoryData(entry);
- pdbPath = codeViewData.Path;
- break;
- }
- }
- if (pdbPath == null)
- {
- return false;
- }
- if (!File.Exists(pdbPath))
- {
- pdbPath = Path.GetFileName(pdbPath);
- if (!File.Exists(pdbPath))
- {
- return false;
- }
- }
-
- peReader = reader.GetMetadataReader();
- Stream pdbStream = File.OpenRead(pdbPath);
- MetadataReaderProvider provider = MetadataReaderProvider.FromPortablePdbStream(pdbStream);
- pdbReader = provider.GetMetadataReader();
-
- return true;
-
- }
- }
-
-}
diff --git a/src/System.Diagnostics.Debug.SymbolReader/src/project.json b/src/System.Diagnostics.Debug.SymbolReader/src/project.json
deleted file mode 100644
index 15355e4209..0000000000
--- a/src/System.Diagnostics.Debug.SymbolReader/src/project.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "frameworks": {
- "netstandard1.3": {
- "dependencies": {
- "System.IO.FileSystem": "4.0.1",
- "System.Reflection.Metadata": "1.3.0"
- }
- }
- }
-}
diff --git a/src/System.Diagnostics.Debug/dir.props b/src/System.Diagnostics.Debug/dir.props
new file mode 100644
index 0000000000..d16ef39bdb
--- /dev/null
+++ b/src/System.Diagnostics.Debug/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.12.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Diagnostics.Debug/pkg/System.Diagnostics.Debug.pkgproj b/src/System.Diagnostics.Debug/pkg/System.Diagnostics.Debug.pkgproj
index 0dca6005ea..8573f8c9c1 100644
--- a/src/System.Diagnostics.Debug/pkg/System.Diagnostics.Debug.pkgproj
+++ b/src/System.Diagnostics.Debug/pkg/System.Diagnostics.Debug.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.12.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\4.0.0\System.Diagnostics.Debug.depproj">
diff --git a/src/System.Diagnostics.Debug/pkg/ValidationSuppression.txt b/src/System.Diagnostics.Debug/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Diagnostics.Debug/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Diagnostics.Debug/ref/4.0.0/System.Diagnostics.Debug.depproj b/src/System.Diagnostics.Debug/ref/4.0.0/System.Diagnostics.Debug.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Diagnostics.Debug/ref/4.0.0/System.Diagnostics.Debug.depproj
+++ b/src/System.Diagnostics.Debug/ref/4.0.0/System.Diagnostics.Debug.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Diagnostics.Debug/ref/System.Diagnostics.Debug.csproj b/src/System.Diagnostics.Debug/ref/System.Diagnostics.Debug.csproj
index 3292cc7691..2bb53ad470 100644
--- a/src/System.Diagnostics.Debug/ref/System.Diagnostics.Debug.csproj
+++ b/src/System.Diagnostics.Debug/ref/System.Diagnostics.Debug.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Diagnostics.Debug/src/System.Diagnostics.Debug.csproj b/src/System.Diagnostics.Debug/src/System.Diagnostics.Debug.csproj
index 69e6b58c64..84a3d39811 100644
--- a/src/System.Diagnostics.Debug/src/System.Diagnostics.Debug.csproj
+++ b/src/System.Diagnostics.Debug/src/System.Diagnostics.Debug.csproj
@@ -7,12 +7,10 @@
<PropertyGroup>
<ProjectGuid>{E7E8DE8A-9EC1-46A8-A6EE-727DB32DBEB8}</ProjectGuid>
<AssemblyName>System.Diagnostics.Debug</AssemblyName>
- <AssemblyVersion>4.0.12.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<!-- Suppress warnings for type conflicts between SafeFileHandle in partial facade and mscorlib -->
<NoWarn>0436</NoWarn>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' != ''">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetsUnix)' == 'true' ">
diff --git a/src/System.Diagnostics.Debug/tests/DebugTests.cs b/src/System.Diagnostics.Debug/tests/DebugTests.cs
index d522135da9..d5006734bd 100644
--- a/src/System.Diagnostics.Debug/tests/DebugTests.cs
+++ b/src/System.Diagnostics.Debug/tests/DebugTests.cs
@@ -14,6 +14,7 @@ namespace System.Diagnostics.Tests
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "\r\n" : "\n";
[Fact]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.Net46)]
public void Asserts()
{
VerifyLogged(() => { Debug.Assert(true); }, "");
@@ -28,6 +29,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.Net46)]
public void Fail()
{
VerifyAssert(() => { Debug.Fail("something bad happened"); }, "something bad happened");
@@ -35,6 +37,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.Net46)]
public void Write()
{
VerifyLogged(() => { Debug.Write(5); }, "5");
@@ -51,6 +54,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.Net46)]
public void WriteLine()
{
VerifyLogged(() => { Debug.WriteLine(5); }, "5" + s_newline);
@@ -65,6 +69,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.Net46)]
public void WriteIf()
{
VerifyLogged(() => { Debug.WriteIf(true, 5); }, "5");
@@ -81,6 +86,7 @@ namespace System.Diagnostics.Tests
}
[Fact]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.Net46)]
public void WriteLineIf()
{
VerifyLogged(() => { Debug.WriteLineIf(true, 5); }, "5" + s_newline);
diff --git a/src/System.Diagnostics.DiagnosticSource/dir.props b/src/System.Diagnostics.DiagnosticSource/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Diagnostics.DiagnosticSource/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Diagnostics.DiagnosticSource/ref/System.Diagnostics.DiagnosticSource.csproj b/src/System.Diagnostics.DiagnosticSource/ref/System.Diagnostics.DiagnosticSource.csproj
index b239974830..2330bb4edd 100644
--- a/src/System.Diagnostics.DiagnosticSource/ref/System.Diagnostics.DiagnosticSource.csproj
+++ b/src/System.Diagnostics.DiagnosticSource/ref/System.Diagnostics.DiagnosticSource.csproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
<UseOpenKey Condition="'$(UseOpenKey)'==''">true</UseOpenKey>
diff --git a/src/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj b/src/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj
index 981d363f8a..c29348ab62 100644
--- a/src/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj
+++ b/src/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj
@@ -4,35 +4,19 @@
<PropertyGroup>
<ProjectGuid>{F24D3391-2928-4E83-AADE-B34423498750}</ProjectGuid>
<AssemblyName>System.Diagnostics.DiagnosticSource</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile>
<UseOpenKey Condition="'$(UseOpenKey)'==''">true</UseOpenKey>
<!-- unset PackageTargetFramework we'll use PackageDestination instead -->
<PackageTargetFramework />
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
- </PropertyGroup>
- <!-- By default we build the 'latest' which is netstandard1.3 -->
- <ItemGroup Condition="'$(TargetGroup)' == ''">
- <PackageDestination Include="lib/netstandard1.3">
- <TargetFramework>netstandard1.3</TargetFramework>
- </PackageDestination>
<!-- duplicate in net46 folder so older nuget clients can consume -->
- <PackageDestination Include="lib/net46">
- <TargetFramework>net46</TargetFramework>
- </PackageDestination>
- </ItemGroup>
- <!-- However to allow it to work on V4.5 runtimes and other old platforms
- we also have a separate complilation of this DLL that works for V4.5
- (which is netstandard1.1 -->
- <ItemGroup Condition="'$(TargetGroup)' == 'netstandard1.1'">
- <PackageDestination Include="lib/netstandard1.1">
- <TargetFramework>netstandard1.1</TargetFramework>
- </PackageDestination>
- <!-- duplicate in portable folder so older nuget clients can consume -->
- <PackageDestination Include="lib/portable-net45+win8+wpa81">
- <TargetFramework>portable-net45+win8+wpa81</TargetFramework>
- </PackageDestination>
- </ItemGroup>
+ <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3;net46</PackageTargetFramework>
+ <!-- To allow this library to work on V4.5 runtimes and other old platforms
+ we also have a separate complilation of this DLL that works for V4.5
+ (which is netstandard1.1). Again we duplicate in a portable-* folder
+ to work with older NuGet clients -->
+ <PackageTargetFramework Condition="'$(TargetGroup)' == 'netstandard1.1'">netstandard1.1;portable-net45+win8+wpa81</PackageTargetFramework>
+ </PropertyGroup>
<PropertyGroup Condition="'$(TargetGroup)' == 'netstandard1.1'">
<DefineConstants>;NO_EVENTSOURCE_COMPLEX_TYPE_SUPPORT</DefineConstants>
</PropertyGroup>
diff --git a/src/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceEventSourceBridgeTests.cs b/src/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceEventSourceBridgeTests.cs
index 5b3a07fe1c..bcc329d296 100644
--- a/src/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceEventSourceBridgeTests.cs
+++ b/src/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceEventSourceBridgeTests.cs
@@ -1,4 +1,8 @@
-using System;
+// 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.Collections.Generic;
using Xunit;
using System.Threading.Tasks;
diff --git a/src/System.Diagnostics.FileVersionInfo/dir.props b/src/System.Diagnostics.FileVersionInfo/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Diagnostics.FileVersionInfo/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Diagnostics.FileVersionInfo/ref/System.Diagnostics.FileVersionInfo.csproj b/src/System.Diagnostics.FileVersionInfo/ref/System.Diagnostics.FileVersionInfo.csproj
index 3fd162ea3a..518953cd98 100644
--- a/src/System.Diagnostics.FileVersionInfo/ref/System.Diagnostics.FileVersionInfo.csproj
+++ b/src/System.Diagnostics.FileVersionInfo/ref/System.Diagnostics.FileVersionInfo.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Diagnostics.FileVersionInfo/src/System.Diagnostics.FileVersionInfo.csproj b/src/System.Diagnostics.FileVersionInfo/src/System.Diagnostics.FileVersionInfo.csproj
index 4bd6c2fd13..921de00a7f 100644
--- a/src/System.Diagnostics.FileVersionInfo/src/System.Diagnostics.FileVersionInfo.csproj
+++ b/src/System.Diagnostics.FileVersionInfo/src/System.Diagnostics.FileVersionInfo.csproj
@@ -7,10 +7,8 @@
<PropertyGroup>
<ProjectGuid>{00EDA5FD-E802-40D3-92D5-56C27612D36D}</ProjectGuid>
<AssemblyName>System.Diagnostics.FileVersionInfo</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Diagnostics.FileVersionInfo/src/System/Diagnostics/FileVersionInfo.Metadata.cs b/src/System.Diagnostics.FileVersionInfo/src/System/Diagnostics/FileVersionInfo.Metadata.cs
index 261be6bf1f..9af3f7bf17 100644
--- a/src/System.Diagnostics.FileVersionInfo/src/System/Diagnostics/FileVersionInfo.Metadata.cs
+++ b/src/System.Diagnostics.FileVersionInfo/src/System/Diagnostics/FileVersionInfo.Metadata.cs
@@ -11,6 +11,8 @@ namespace System.Diagnostics
{
public sealed partial class FileVersionInfo
{
+ private static readonly char[] s_versionSeparators = new char[] { '.' };
+
private FileVersionInfo(string fileName)
{
_fileName = fileName;
@@ -101,6 +103,8 @@ namespace System.Diagnostics
_isPrivateBuild = false;
_isSpecialBuild = false;
+ bool sawAssemblyInformationalVersionAttribute = false;
+
// Everything else is parsed from assembly attributes
MetadataStringComparer comparer = metadataReader.StringComparer;
foreach (CustomAttributeHandle attrHandle in assemblyDefinition.GetCustomAttributes())
@@ -124,34 +128,14 @@ namespace System.Diagnostics
}
else if (comparer.Equals(typeNameHandle, "AssemblyFileVersionAttribute"))
{
- string versionString = string.Empty;
- GetStringAttributeArgumentValue(metadataReader, attr, ref versionString);
- Version v;
- if (Version.TryParse(versionString, out v))
- {
- _fileVersion = v.ToString();
- _fileMajor = v.Major;
- _fileMinor = v.Minor;
- _fileBuild = v.Build != -1 ? v.Build : 0;
- _filePrivate = v.Revision != -1 ? v.Revision : 0;
-
- // When the managed compiler sees an [AssemblyVersion(...)] attribute, it uses that to set
- // both the assembly version and the product version in the Win32 resources. If it doesn't
- // see an [AssemblyVersion(...)], then it sets the assembly version to 0.0.0.0, however it
- // sets the product version in the Win32 resources to whatever was defined in the
- // [AssemblyFileVersionAttribute(...)] if there was one. Without parsing the Win32 resources,
- // we can't differentiate these two cases, so given the rarity of explicitly setting an
- // assembly's version number to 0.0.0.0, we assume that if it is 0.0.0.0 then the attribute
- // wasn't specified and we use the file version.
- if (_productVersion == "0.0.0.0")
- {
- _productVersion = _fileVersion;
- _productMajor = _fileMajor;
- _productMinor = _fileMinor;
- _productBuild = _fileBuild;
- _productPrivate = _filePrivate;
- }
- }
+ GetStringAttributeArgumentValue(metadataReader, attr, ref _fileVersion);
+ ParseVersion(_fileVersion, out _fileMajor, out _fileMinor, out _fileBuild, out _filePrivate);
+ }
+ else if (comparer.Equals(typeNameHandle, "AssemblyInformationalVersionAttribute"))
+ {
+ GetStringAttributeArgumentValue(metadataReader, attr, ref _productVersion);
+ ParseVersion(_productVersion, out _productMajor, out _productMinor, out _productBuild, out _productPrivate);
+ sawAssemblyInformationalVersionAttribute = true;
}
else if (comparer.Equals(typeNameHandle, "AssemblyProductAttribute"))
{
@@ -167,6 +151,81 @@ namespace System.Diagnostics
}
}
}
+
+ // When the managed compiler sees an [AssemblyVersion(...)] attribute, it uses that to set
+ // both the assembly version and the product version in the Win32 resources. If it doesn't
+ // see an [AssemblyVersion(...)], then it sets the assembly version to 0.0.0.0, however it
+ // sets the product version in the Win32 resources to whatever was defined in the
+ // [AssemblyFileVersionAttribute(...)] if there was one (unless there is an AssemblyInformationalVersionAttribute,
+ // in which case it always uses that for the product version). Without parsing the Win32 resources,
+ // we can't differentiate these two cases, so given the rarity of explicitly setting an
+ // assembly's version number to 0.0.0.0, we assume that if it is 0.0.0.0 then the attribute
+ // wasn't specified and we use the file version.
+
+ if (!sawAssemblyInformationalVersionAttribute && _productVersion == "0.0.0.0")
+ {
+ _productVersion = _fileVersion;
+ _productMajor = _fileMajor;
+ _productMinor = _fileMinor;
+ _productBuild = _fileBuild;
+ _productPrivate = _filePrivate;
+ }
+ }
+
+ /// <summary>Parses the version into its constituent parts.</summary>
+ private static void ParseVersion(string versionString, out int major, out int minor, out int build, out int priv)
+ {
+ // Relatively-forgiving parsing of a version:
+ // - If there are more than four parts (separated by periods), all results are deemed 0
+ // - If any part fails to parse completely as an integer, no further parts are parsed and are left as 0.
+ // - If any part partially parses as an integer, that value is used for that part.
+ // - Whitespace is treated like any other non-digit character and thus isn't ignored.
+ // - Each component is parsed as a ushort, allowing for overflow.
+
+ string[] parts = versionString.Split(s_versionSeparators);
+ major = minor = build = priv = 0;
+ if (parts.Length <= 4)
+ {
+ bool endedEarly;
+ if (parts.Length > 0)
+ {
+ major = ParseUInt16UntilNonDigit(parts[0], out endedEarly);
+ if (!endedEarly && parts.Length > 1)
+ {
+ minor = ParseUInt16UntilNonDigit(parts[1], out endedEarly);
+ if (!endedEarly && parts.Length > 2)
+ {
+ build = ParseUInt16UntilNonDigit(parts[2], out endedEarly);
+ if (!endedEarly && parts.Length > 3)
+ {
+ priv = ParseUInt16UntilNonDigit(parts[3], out endedEarly);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /// <summary>Parses a string as a UInt16 until it hits a non-digit.</summary>
+ /// <param name="s">The string to parse.</param>
+ /// <returns>The parsed value.</returns>
+ private static ushort ParseUInt16UntilNonDigit(string s, out bool endedEarly)
+ {
+ endedEarly = false;
+ ushort result = 0;
+
+ for (int index = 0; index < s.Length; index++)
+ {
+ char c = s[index];
+ if (c < '0' || c > '9')
+ {
+ endedEarly = true;
+ break;
+ }
+ result = (ushort)((result * 10) + (c - '0')); // explicitly allow for overflow, as this is the behavior employed on Windows
+ }
+
+ return result;
}
/// <summary>Gets the name of an attribute.</summary>
diff --git a/src/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.TestAssembly/Assembly1.cs b/src/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.TestAssembly/Assembly1.cs
index a455ad3477..f97615a0f6 100644
--- a/src/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.TestAssembly/Assembly1.cs
+++ b/src/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.TestAssembly/Assembly1.cs
@@ -10,8 +10,10 @@ using System.Reflection;
[assembly:AssemblyCompanyAttribute("The name of the company.")]
// FileDescription
[assembly:AssemblyTitleAttribute("My File")]
-// FileVersion & ProductVersion
+// FileVersion
[assembly:AssemblyFileVersionAttribute("4.3.2.1")]
+// ProductVersion (overrides FileVersion to be the ProductVersion)
+[assembly: AssemblyInformationalVersionAttribute("1.2.3-beta.4")]
// LegalCopyright
[assembly:AssemblyCopyrightAttribute("Copyright, you betcha!")]
// LegalTrademarks
diff --git a/src/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/FileVersionInfoTest.cs b/src/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/FileVersionInfoTest.cs
index 8b2cd88ade..ad17041edd 100644
--- a/src/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/FileVersionInfoTest.cs
+++ b/src/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/FileVersionInfoTest.cs
@@ -159,12 +159,12 @@ namespace System.Diagnostics.Tests
LegalTrademarks = "TM",
OriginalFilename = TestAssemblyFileName,
PrivateBuild = "",
- ProductBuildPart = 2,
- ProductMajorPart = 4,
- ProductMinorPart = 3,
+ ProductBuildPart = 3,
+ ProductMajorPart = 1,
+ ProductMinorPart = 2,
ProductName = "The greatest product EVER",
- ProductPrivatePart = 1,
- ProductVersion = "4.3.2.1",
+ ProductPrivatePart = 0,
+ ProductVersion = "1.2.3-beta.4",
SpecialBuild = "",
});
}
diff --git a/src/System.Diagnostics.PerformanceCounter/dir.props b/src/System.Diagnostics.PerformanceCounter/dir.props
new file mode 100644
index 0000000000..e58893f6ab
--- /dev/null
+++ b/src/System.Diagnostics.PerformanceCounter/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.0.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj b/src/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj
index e231f6b446..591772087d 100644
--- a/src/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj
+++ b/src/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.Diagnostics.Process/dir.props b/src/System.Diagnostics.Process/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.Diagnostics.Process/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Diagnostics.Process/ref/4.0/System.Diagnostics.Process.depproj b/src/System.Diagnostics.Process/ref/4.0/System.Diagnostics.Process.depproj
index 936df44f24..1681b96d7d 100644
--- a/src/System.Diagnostics.Process/ref/4.0/System.Diagnostics.Process.depproj
+++ b/src/System.Diagnostics.Process/ref/4.0/System.Diagnostics.Process.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Diagnostics.Process/ref/System.Diagnostics.Process.csproj b/src/System.Diagnostics.Process/ref/System.Diagnostics.Process.csproj
index 9ee3f9a2c1..b6b4c3c148 100644
--- a/src/System.Diagnostics.Process/ref/System.Diagnostics.Process.csproj
+++ b/src/System.Diagnostics.Process/ref/System.Diagnostics.Process.csproj
@@ -2,10 +2,8 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
<!-- requires 5.5 since we needed surface area in Desktop 4.6.1 to support -->
- <PackageTargetFramework>netstandard1.4</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.4</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj b/src/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj
index 79906a9a8c..e1d0fbe534 100644
--- a/src/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj
+++ b/src/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj
@@ -10,11 +10,9 @@
<ProjectGuid>{63634289-90D7-4947-8BF3-DBBE98D76C85}</ProjectGuid>
<RootNamespace>System.Diagnostics.Process</RootNamespace>
<AssemblyName>System.Diagnostics.Process</AssemblyName>
- <AssemblyVersion Condition="'$(TargetGroup)'!='net46'">4.1.1.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)'=='net46'">4.0.0.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ContractProject Condition="'$(AssemblyVersion)' == '4.0.0.0'">..\ref\4.0\System.Diagnostics.Process.depproj</ContractProject>
- <PackageTargetFramework Condition="'$(TargetGroup)'==''">netstandard1.4</PackageTargetFramework>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net46' OR '$(TargetGroup)'=='net461'">true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.4</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.Diagnostics.Process/src/System/Diagnostics/Process.OSX.cs b/src/System.Diagnostics.Process/src/System/Diagnostics/Process.OSX.cs
index 7ef1522916..c3d35f1475 100644
--- a/src/System.Diagnostics.Process/src/System/Diagnostics/Process.OSX.cs
+++ b/src/System.Diagnostics.Process/src/System/Diagnostics/Process.OSX.cs
@@ -58,7 +58,7 @@ namespace System.Diagnostics
// nanoseconds elapse from boot to that the process started) to seconds.
EnsureState(State.HaveId);
Interop.libproc.rusage_info_v3 info = Interop.libproc.proc_pid_rusage(_processId);
- double seconds = info.ri_proc_start_abstime / NanoSecondToSecondFactor;
+ double seconds = info.ri_proc_start_abstime / (double)NanoSecondToSecondFactor;
// Convert timespan from boot to process start datetime.
return BootTimeToDateTime(TimeSpan.FromSeconds(seconds));
diff --git a/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Linux.cs b/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Linux.cs
index 2901e44913..c989ff0f2d 100644
--- a/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Linux.cs
+++ b/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Linux.cs
@@ -147,7 +147,7 @@ namespace System.Diagnostics
_threadId = (ulong)tid,
_basePriority = pi.BasePriority,
_currentPriority = (int)stat.nice,
- _startAddress = (IntPtr)(void *)stat.startstack,
+ _startAddress = IntPtr.Zero,
_threadState = ProcFsStateToThreadState(stat.state),
_threadWaitReason = ThreadWaitReason.Unknown
});
diff --git a/src/System.Diagnostics.Process/tests/ProcessModuleTests.cs b/src/System.Diagnostics.Process/tests/ProcessModuleTests.cs
index d91120e824..ad8fd7dc56 100644
--- a/src/System.Diagnostics.Process/tests/ProcessModuleTests.cs
+++ b/src/System.Diagnostics.Process/tests/ProcessModuleTests.cs
@@ -22,8 +22,8 @@ namespace System.Diagnostics.Tests
Assert.NotNull(module.FileName);
Assert.NotEmpty(module.FileName);
- Assert.InRange(module.BaseAddress.ToInt64(), 0, long.MaxValue);
- Assert.InRange(module.EntryPointAddress.ToInt64(), 0, long.MaxValue);
+ Assert.InRange(module.BaseAddress.ToInt64(), long.MinValue, long.MaxValue);
+ Assert.InRange(module.EntryPointAddress.ToInt64(), long.MinValue, long.MaxValue);
Assert.InRange(module.ModuleMemorySize, 0, long.MaxValue);
}
}
diff --git a/src/System.Diagnostics.Process/tests/ProcessStreamReadTests.cs b/src/System.Diagnostics.Process/tests/ProcessStreamReadTests.cs
index 1cbee05c96..24dcda55a7 100644
--- a/src/System.Diagnostics.Process/tests/ProcessStreamReadTests.cs
+++ b/src/System.Diagnostics.Process/tests/ProcessStreamReadTests.cs
@@ -1,10 +1,11 @@
// 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.IO;
using System.Text;
using System.Threading;
+using System.Collections.Generic;
using Xunit;
namespace System.Diagnostics.Tests
@@ -126,6 +127,8 @@ namespace System.Diagnostics.Tests
public void TestAsyncHalfCharacterAtATime()
{
var receivedOutput = false;
+ var collectedExceptions = new List<Exception>();
+
Process p = CreateProcess(() =>
{
var stdout = Console.OpenStandardOutput();
@@ -143,11 +146,20 @@ namespace System.Diagnostics.Tests
p.StartInfo.StandardOutputEncoding = Encoding.Unicode;
p.OutputDataReceived += (s, e) =>
{
- if (!receivedOutput)
+ try
{
- Assert.Equal(e.Data, "a");
+ if (!receivedOutput)
+ {
+ Assert.Equal(e.Data, "a");
+ }
+ receivedOutput = true;
+ }
+ catch (Exception ex)
+ {
+ // This ensures that the exception in event handlers does not break
+ // the whole unittest
+ collectedExceptions.Add(ex);
}
- receivedOutput = true;
};
p.Start();
p.BeginOutputReadLine();
@@ -156,6 +168,12 @@ namespace System.Diagnostics.Tests
p.WaitForExit(); // This ensures async event handlers are finished processing.
Assert.True(receivedOutput);
+
+ if (collectedExceptions.Count > 0)
+ {
+ // Re-throw collected exceptions
+ throw new AggregateException(collectedExceptions);
+ }
}
[Fact]
diff --git a/src/System.Diagnostics.Process/tests/ProcessTests.cs b/src/System.Diagnostics.Process/tests/ProcessTests.cs
index 66d5b864cd..e97ae03c52 100644
--- a/src/System.Diagnostics.Process/tests/ProcessTests.cs
+++ b/src/System.Diagnostics.Process/tests/ProcessTests.cs
@@ -727,7 +727,8 @@ namespace System.Diagnostics.Tests
}
[PlatformSpecific(PlatformID.Windows)]
- [Fact]
+ // NativeErrorCode not 193 on Windows Nano for ERROR_BAD_EXE_FORMAT, issue #10290
+ [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))]
public void TestStartOnWindowsWithBadFileFormat()
{
string path = GetTestFilePath();
diff --git a/src/System.Diagnostics.Process/tests/ProcessThreadTests.cs b/src/System.Diagnostics.Process/tests/ProcessThreadTests.cs
index b8d53a4d59..bfa819ffb5 100644
--- a/src/System.Diagnostics.Process/tests/ProcessThreadTests.cs
+++ b/src/System.Diagnostics.Process/tests/ProcessThreadTests.cs
@@ -98,18 +98,34 @@ namespace System.Diagnostics.Tests
// Make sure each thread's start time is at least the process'
// start time and not beyond the current time.
- Assert.All(
- threads.Cast<ProcessThread>(),
- t => Assert.InRange(t.StartTime.ToUniversalTime(), startTime - allowedWindow, curTime + allowedWindow));
+ int passed = 0;
+ foreach (ProcessThread t in threads.Cast<ProcessThread>())
+ {
+ try
+ {
+ Assert.InRange(t.StartTime.ToUniversalTime(), startTime - allowedWindow, curTime + allowedWindow);
+ passed++;
+ }
+ catch (InvalidOperationException)
+ {
+ // The thread may have gone away between our getting its info and attempting to access its StartTime
+ }
+ }
+ Assert.True(passed > 0, "Expected at least one thread to be valid for StartTime");
// Now add a thread, and from that thread, while it's still alive, verify
// that there's at least one thread greater than the current time we previously grabbed.
await Task.Factory.StartNew(() =>
{
p.Refresh();
- Assert.Contains(
- p.Threads.Cast<ProcessThread>(),
- t => t.StartTime.ToUniversalTime() >= curTime - allowedWindow);
+ try
+ {
+ Assert.Contains(p.Threads.Cast<ProcessThread>(), t => t.StartTime.ToUniversalTime() >= curTime - allowedWindow);
+ }
+ catch (InvalidOperationException)
+ {
+ // A thread may have gone away between our getting its info and attempting to access its StartTime
+ }
}, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default);
}
}
@@ -117,25 +133,16 @@ namespace System.Diagnostics.Tests
[Fact]
public void TestStartAddressProperty()
{
- Process p = Process.GetCurrentProcess();
- try
- {
- if (p.Threads.Count != 0)
- {
- ProcessThread thread = p.Threads[0];
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- Assert.True((long)thread.StartAddress >= 0);
- }
- else
- {
- Assert.Equal(RuntimeInformation.IsOSPlatform(OSPlatform.OSX), thread.StartAddress == IntPtr.Zero);
- }
- }
- }
- finally
+ using (Process p = Process.GetCurrentProcess())
{
- p.Dispose();
+ ProcessThreadCollection threads = p.Threads;
+ Assert.NotNull(threads);
+ Assert.NotEmpty(threads);
+
+ IntPtr startAddress = threads[0].StartAddress;
+
+ // There's nothing we can really validate about StartAddress, other than that we can get its value
+ // without throwing. All values (even zero) are valid on all platforms.
}
}
diff --git a/src/System.Diagnostics.StackTrace/dir.props b/src/System.Diagnostics.StackTrace/dir.props
new file mode 100644
index 0000000000..c218f90328
--- /dev/null
+++ b/src/System.Diagnostics.StackTrace/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.3.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.csproj b/src/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.csproj
index 570454341a..ae45b157e9 100644
--- a/src/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.csproj
+++ b/src/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.3.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Diagnostics.StackTrace/src/System.Diagnostics.StackTrace.csproj b/src/System.Diagnostics.StackTrace/src/System.Diagnostics.StackTrace.csproj
index 6383939007..77de54bc33 100644
--- a/src/System.Diagnostics.StackTrace/src/System.Diagnostics.StackTrace.csproj
+++ b/src/System.Diagnostics.StackTrace/src/System.Diagnostics.StackTrace.csproj
@@ -6,8 +6,6 @@
<ProjectGuid>{02304469-722E-4723-92A1-820B9A37D275}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'!='netcore50aot'">true</IsPartialFacadeAssembly>
- <AssemblyVersion>4.0.3.0</AssemblyVersion>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
<!-- Disable 1685 (aka multiple type definitions) warning so it doesn't turn into an error -->
<NoWarn>$(NoWarn);1685</NoWarn>
@@ -36,7 +34,6 @@
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == ''">
<Compile Include="System\Diagnostics\StackTraceSymbols.CoreCLR.cs" />
-
<!--
The following references are only facades that align references for the PCL
libraries (Immutable/MetadataReader) this library is referencing. We reference
diff --git a/src/System.Diagnostics.StackTrace/src/System/Diagnostics/StackTraceSymbols.CoreCLR.cs b/src/System.Diagnostics.StackTrace/src/System/Diagnostics/StackTraceSymbols.CoreCLR.cs
index 70805a3df1..985a9dfbc1 100644
--- a/src/System.Diagnostics.StackTrace/src/System/Diagnostics/StackTraceSymbols.CoreCLR.cs
+++ b/src/System.Diagnostics.StackTrace/src/System/Diagnostics/StackTraceSymbols.CoreCLR.cs
@@ -11,7 +11,7 @@ using System.Reflection.PortableExecutable;
namespace System.Diagnostics
{
- public class StackTraceSymbols : IDisposable
+ internal class StackTraceSymbols : IDisposable
{
private sealed class OpenedReader : IDisposable
{
@@ -66,7 +66,7 @@ namespace System.Diagnostics
/// <param name="sourceFile">source file return</param>
/// <param name="sourceLine">line number return</param>
/// <param name="sourceColumn">column return</param>
- public void GetSourceLineInfo(string assemblyPath, IntPtr loadedPeAddress, int loadedPeSize,
+ internal void GetSourceLineInfo(string assemblyPath, IntPtr loadedPeAddress, int loadedPeSize,
IntPtr inMemoryPdbAddress, int inMemoryPdbSize, int methodToken, int ilOffset,
out string sourceFile, out int sourceLine, out int sourceColumn)
{
diff --git a/src/System.Diagnostics.TextWriterTraceListener/dir.props b/src/System.Diagnostics.TextWriterTraceListener/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Diagnostics.TextWriterTraceListener/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Diagnostics.TextWriterTraceListener/ref/System.Diagnostics.TextWriterTraceListener.csproj b/src/System.Diagnostics.TextWriterTraceListener/ref/System.Diagnostics.TextWriterTraceListener.csproj
index 529c2daa61..53e0a0c218 100644
--- a/src/System.Diagnostics.TextWriterTraceListener/ref/System.Diagnostics.TextWriterTraceListener.csproj
+++ b/src/System.Diagnostics.TextWriterTraceListener/ref/System.Diagnostics.TextWriterTraceListener.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Diagnostics.TextWriterTraceListener/src/System.Diagnostics.TextWriterTraceListener.csproj b/src/System.Diagnostics.TextWriterTraceListener/src/System.Diagnostics.TextWriterTraceListener.csproj
index a249768d14..8476d84993 100644
--- a/src/System.Diagnostics.TextWriterTraceListener/src/System.Diagnostics.TextWriterTraceListener.csproj
+++ b/src/System.Diagnostics.TextWriterTraceListener/src/System.Diagnostics.TextWriterTraceListener.csproj
@@ -4,10 +4,8 @@
<PropertyGroup>
<RootNamespace>System.Diagnostics.TextWriterTraceListener</RootNamespace>
<AssemblyName>System.Diagnostics.TextWriterTraceListener</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<ProjectGuid>{315929D9-D76E-47E9-BE82-C787FB3A7876}</ProjectGuid>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Diagnostics.Tools/dir.props b/src/System.Diagnostics.Tools/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Diagnostics.Tools/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Diagnostics.Tools/pkg/System.Diagnostics.Tools.pkgproj b/src/System.Diagnostics.Tools/pkg/System.Diagnostics.Tools.pkgproj
index 8612d8c2d9..afeb38aca7 100644
--- a/src/System.Diagnostics.Tools/pkg/System.Diagnostics.Tools.pkgproj
+++ b/src/System.Diagnostics.Tools/pkg/System.Diagnostics.Tools.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Diagnostics.Tools.csproj">
diff --git a/src/System.Diagnostics.Tools/pkg/ValidationSuppression.txt b/src/System.Diagnostics.Tools/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Diagnostics.Tools/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Diagnostics.Tools/ref/System.Diagnostics.Tools.csproj b/src/System.Diagnostics.Tools/ref/System.Diagnostics.Tools.csproj
index 5d145bfba5..d2156f5f95 100644
--- a/src/System.Diagnostics.Tools/ref/System.Diagnostics.Tools.csproj
+++ b/src/System.Diagnostics.Tools/ref/System.Diagnostics.Tools.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Diagnostics.Tools/src/System.Diagnostics.Tools.csproj b/src/System.Diagnostics.Tools/src/System.Diagnostics.Tools.csproj
index 6dd15cb40e..64af9f6ea3 100644
--- a/src/System.Diagnostics.Tools/src/System.Diagnostics.Tools.csproj
+++ b/src/System.Diagnostics.Tools/src/System.Diagnostics.Tools.csproj
@@ -4,9 +4,7 @@
<PropertyGroup>
<ProjectGuid>{0B68298B-4672-4CA0-AD25-2F9ABEA1FF95}</ProjectGuid>
<AssemblyName>System.Diagnostics.Tools</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Diagnostics.TraceSource/dir.props b/src/System.Diagnostics.TraceSource/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Diagnostics.TraceSource/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Diagnostics.TraceSource/ref/System.Diagnostics.TraceSource.csproj b/src/System.Diagnostics.TraceSource/ref/System.Diagnostics.TraceSource.csproj
index 2daf65851b..a1085a184d 100644
--- a/src/System.Diagnostics.TraceSource/ref/System.Diagnostics.TraceSource.csproj
+++ b/src/System.Diagnostics.TraceSource/ref/System.Diagnostics.TraceSource.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Diagnostics.TraceSource/src/System.Diagnostics.TraceSource.csproj b/src/System.Diagnostics.TraceSource/src/System.Diagnostics.TraceSource.csproj
index f232800529..c61ecb3c16 100644
--- a/src/System.Diagnostics.TraceSource/src/System.Diagnostics.TraceSource.csproj
+++ b/src/System.Diagnostics.TraceSource/src/System.Diagnostics.TraceSource.csproj
@@ -7,11 +7,9 @@
<PropertyGroup>
<RootNamespace>System.Diagnostics.TraceSource</RootNamespace>
<AssemblyName>System.Diagnostics.TraceSource</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
<ProjectGuid>{5380420C-EB1D-4C53-9CFC-916578C18334}</ProjectGuid>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Diagnostics.Tracing/dir.props b/src/System.Diagnostics.Tracing/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.Diagnostics.Tracing/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Diagnostics.Tracing/pkg/aot/System.Diagnostics.Tracing.pkgproj b/src/System.Diagnostics.Tracing/pkg/aot/System.Diagnostics.Tracing.pkgproj
index e1ac91e099..311434733e 100644
--- a/src/System.Diagnostics.Tracing/pkg/aot/System.Diagnostics.Tracing.pkgproj
+++ b/src/System.Diagnostics.Tracing/pkg/aot/System.Diagnostics.Tracing.pkgproj
@@ -3,7 +3,6 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.1.1.0</Version>
<PackageTargetRuntime>aot</PackageTargetRuntime>
<PreventImplementationReference>true</PreventImplementationReference>
</PropertyGroup>
diff --git a/src/System.Diagnostics.Tracing/ref/4.0.0/System.Diagnostics.Tracing.depproj b/src/System.Diagnostics.Tracing/ref/4.0.0/System.Diagnostics.Tracing.depproj
index 29f2b6abda..5df1469c14 100644
--- a/src/System.Diagnostics.Tracing/ref/4.0.0/System.Diagnostics.Tracing.depproj
+++ b/src/System.Diagnostics.Tracing/ref/4.0.0/System.Diagnostics.Tracing.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Diagnostics.Tracing/ref/4.0.10/System.Diagnostics.Tracing.depproj b/src/System.Diagnostics.Tracing/ref/4.0.10/System.Diagnostics.Tracing.depproj
index 7aa0e70c3a..364b923bfc 100644
--- a/src/System.Diagnostics.Tracing/ref/4.0.10/System.Diagnostics.Tracing.depproj
+++ b/src/System.Diagnostics.Tracing/ref/4.0.10/System.Diagnostics.Tracing.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.2</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.2</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Diagnostics.Tracing/ref/4.0.20/System.Diagnostics.Tracing.depproj b/src/System.Diagnostics.Tracing/ref/4.0.20/System.Diagnostics.Tracing.depproj
index 2c8e3437c1..53806b0292 100644
--- a/src/System.Diagnostics.Tracing/ref/4.0.20/System.Diagnostics.Tracing.depproj
+++ b/src/System.Diagnostics.Tracing/ref/4.0.20/System.Diagnostics.Tracing.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.csproj b/src/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.csproj
index 3686a10e11..2f87f1cc9f 100644
--- a/src/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.csproj
+++ b/src/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.5</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.5</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Diagnostics.Tracing/src/System.Diagnostics.Tracing.csproj b/src/System.Diagnostics.Tracing/src/System.Diagnostics.Tracing.csproj
index afb96f9594..1a0fb8b46e 100644
--- a/src/System.Diagnostics.Tracing/src/System.Diagnostics.Tracing.csproj
+++ b/src/System.Diagnostics.Tracing/src/System.Diagnostics.Tracing.csproj
@@ -5,8 +5,6 @@
<AssemblyName>System.Diagnostics.Tracing</AssemblyName>
<ProjectGuid>{EB880FDC-326D-42B3-A3FD-0CD3BA29A7F4}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.5</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.5</NuGetTargetMoniker>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetGroup)'!='netcore50aot'">
diff --git a/src/System.Drawing.Primitives/dir.props b/src/System.Drawing.Primitives/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Drawing.Primitives/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Drawing.Primitives/ref/System.Drawing.Primitives.csproj b/src/System.Drawing.Primitives/ref/System.Drawing.Primitives.csproj
index 3f81e489c4..ebc9ce4a4d 100644
--- a/src/System.Drawing.Primitives/ref/System.Drawing.Primitives.csproj
+++ b/src/System.Drawing.Primitives/ref/System.Drawing.Primitives.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj b/src/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj
index f779ce890c..021a31476e 100644
--- a/src/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj
+++ b/src/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj
@@ -7,9 +7,7 @@
<OutputType>Library</OutputType>
<RootNamespace>System.Drawing</RootNamespace>
<AssemblyName>System.Drawing.Primitives</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net45'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.1</PackageTargetFramework>
<ProjectGuid>{F9DF2357-81B4-4317-908E-512DA9395583}</ProjectGuid>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.Dynamic.Runtime/dir.props b/src/System.Dynamic.Runtime/dir.props
new file mode 100644
index 0000000000..d16ef39bdb
--- /dev/null
+++ b/src/System.Dynamic.Runtime/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.12.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Dynamic.Runtime/pkg/System.Dynamic.Runtime.pkgproj b/src/System.Dynamic.Runtime/pkg/System.Dynamic.Runtime.pkgproj
index fd51a2962a..c3e75b4e46 100644
--- a/src/System.Dynamic.Runtime/pkg/System.Dynamic.Runtime.pkgproj
+++ b/src/System.Dynamic.Runtime/pkg/System.Dynamic.Runtime.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.12.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\4.0.0\System.Dynamic.Runtime.depproj">
diff --git a/src/System.Dynamic.Runtime/pkg/ValidationSuppression.txt b/src/System.Dynamic.Runtime/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Dynamic.Runtime/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Dynamic.Runtime/ref/4.0.0/System.Dynamic.Runtime.depproj b/src/System.Dynamic.Runtime/ref/4.0.0/System.Dynamic.Runtime.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Dynamic.Runtime/ref/4.0.0/System.Dynamic.Runtime.depproj
+++ b/src/System.Dynamic.Runtime/ref/4.0.0/System.Dynamic.Runtime.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Dynamic.Runtime/ref/System.Dynamic.Runtime.csproj b/src/System.Dynamic.Runtime/ref/System.Dynamic.Runtime.csproj
index 04852143dd..a115e39f0f 100644
--- a/src/System.Dynamic.Runtime/ref/System.Dynamic.Runtime.csproj
+++ b/src/System.Dynamic.Runtime/ref/System.Dynamic.Runtime.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Dynamic.Runtime/src/System.Dynamic.Runtime.csproj b/src/System.Dynamic.Runtime/src/System.Dynamic.Runtime.csproj
index eb7bed9308..c16956fd0e 100644
--- a/src/System.Dynamic.Runtime/src/System.Dynamic.Runtime.csproj
+++ b/src/System.Dynamic.Runtime/src/System.Dynamic.Runtime.csproj
@@ -5,11 +5,9 @@
<ProjectGuid>{C4E89B8C-07DB-40CA-8C99-82A23E8F5F39}</ProjectGuid>
<AssemblyName>System.Dynamic.Runtime</AssemblyName>
<RootNamespace>System.Dynamic.Runtime</RootNamespace>
- <AssemblyVersion>4.0.12.0</AssemblyVersion>
<IsInterpreting Condition="'$(TargetGroup)' == 'netcore50' or '$(TargetGroup)' == 'netcore50aot'">true</IsInterpreting>
<DefineConstants Condition="'$(IsInterpreting)' != 'true'">$(DefineConstants);FEATURE_COMPILER</DefineConstants>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Dynamic.Runtime/src/System/Linq/Expressions/DynamicExpression.cs b/src/System.Dynamic.Runtime/src/System/Linq/Expressions/DynamicExpression.cs
index 926ba7eb34..c410823b24 100644
--- a/src/System.Dynamic.Runtime/src/System/Linq/Expressions/DynamicExpression.cs
+++ b/src/System.Dynamic.Runtime/src/System/Linq/Expressions/DynamicExpression.cs
@@ -812,7 +812,7 @@ namespace System.Linq.Expressions
var method = GetValidMethodForDynamic(delegateType);
var args = arguments.ToReadOnly();
- ExpressionUtils.ValidateArgumentTypes(method, ExpressionType.Dynamic, ref args);
+ ExpressionUtils.ValidateArgumentTypes(method, ExpressionType.Dynamic, ref args, nameof(delegateType));
return DynamicExpression.Make(method.GetReturnType(), delegateType, binder, args);
}
@@ -841,7 +841,7 @@ namespace System.Linq.Expressions
ExpressionUtils.ValidateArgumentCount(method, ExpressionType.Dynamic, 2, parameters);
ValidateDynamicArgument(arg0);
- ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg0, parameters[1]);
+ ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg0, parameters[1], nameof(delegateType), nameof(arg0));
return DynamicExpression.Make(method.GetReturnType(), delegateType, binder, arg0);
}
@@ -871,9 +871,9 @@ namespace System.Linq.Expressions
ExpressionUtils.ValidateArgumentCount(method, ExpressionType.Dynamic, 3, parameters);
ValidateDynamicArgument(arg0);
- ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg0, parameters[1]);
+ ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg0, parameters[1], nameof(delegateType), nameof(arg0));
ValidateDynamicArgument(arg1);
- ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg1, parameters[2]);
+ ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg1, parameters[2], nameof(delegateType), nameof(arg1));
return DynamicExpression.Make(method.GetReturnType(), delegateType, binder, arg0, arg1);
}
@@ -904,11 +904,11 @@ namespace System.Linq.Expressions
ExpressionUtils.ValidateArgumentCount(method, ExpressionType.Dynamic, 4, parameters);
ValidateDynamicArgument(arg0);
- ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg0, parameters[1]);
+ ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg0, parameters[1], nameof(delegateType), nameof(arg0));
ValidateDynamicArgument(arg1);
- ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg1, parameters[2]);
+ ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg1, parameters[2], nameof(delegateType), nameof(arg1));
ValidateDynamicArgument(arg2);
- ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg2, parameters[3]);
+ ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg2, parameters[3], nameof(delegateType), nameof(arg2));
return DynamicExpression.Make(method.GetReturnType(), delegateType, binder, arg0, arg1, arg2);
}
@@ -940,13 +940,13 @@ namespace System.Linq.Expressions
ExpressionUtils.ValidateArgumentCount(method, ExpressionType.Dynamic, 5, parameters);
ValidateDynamicArgument(arg0);
- ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg0, parameters[1]);
+ ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg0, parameters[1], nameof(delegateType), nameof(arg0));
ValidateDynamicArgument(arg1);
- ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg1, parameters[2]);
+ ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg1, parameters[2], nameof(delegateType), nameof(arg1));
ValidateDynamicArgument(arg2);
- ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg2, parameters[3]);
+ ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg2, parameters[3], nameof(delegateType), nameof(arg2));
ValidateDynamicArgument(arg3);
- ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg3, parameters[4]);
+ ExpressionUtils.ValidateOneArgument(method, ExpressionType.Dynamic, arg3, parameters[4], nameof(delegateType), nameof(arg3));
return DynamicExpression.Make(method.GetReturnType(), delegateType, binder, arg0, arg1, arg2, arg3);
}
diff --git a/src/System.Globalization.Calendars/dir.props b/src/System.Globalization.Calendars/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Globalization.Calendars/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Globalization.Calendars/ref/System.Globalization.Calendars.csproj b/src/System.Globalization.Calendars/ref/System.Globalization.Calendars.csproj
index e5f325fb8b..3d2fbabd14 100644
--- a/src/System.Globalization.Calendars/ref/System.Globalization.Calendars.csproj
+++ b/src/System.Globalization.Calendars/ref/System.Globalization.Calendars.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Globalization.Calendars/src/System.Globalization.Calendars.csproj b/src/System.Globalization.Calendars/src/System.Globalization.Calendars.csproj
index 9d16a11306..96ccdf1518 100644
--- a/src/System.Globalization.Calendars/src/System.Globalization.Calendars.csproj
+++ b/src/System.Globalization.Calendars/src/System.Globalization.Calendars.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Globalization.Calendars</AssemblyName>
- <AssemblyVersion>4.1.0.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Globalization.Extensions/dir.props b/src/System.Globalization.Extensions/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Globalization.Extensions/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Globalization.Extensions/ref/System.Globalization.Extensions.csproj b/src/System.Globalization.Extensions/ref/System.Globalization.Extensions.csproj
index d6668dfa07..5cf4716e03 100644
--- a/src/System.Globalization.Extensions/ref/System.Globalization.Extensions.csproj
+++ b/src/System.Globalization.Extensions/ref/System.Globalization.Extensions.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Globalization.Extensions/src/System.Globalization.Extensions.csproj b/src/System.Globalization.Extensions/src/System.Globalization.Extensions.csproj
index 4fb2ac3c5e..e60444f9b2 100644
--- a/src/System.Globalization.Extensions/src/System.Globalization.Extensions.csproj
+++ b/src/System.Globalization.Extensions/src/System.Globalization.Extensions.csproj
@@ -10,10 +10,8 @@
<OutputType>Library</OutputType>
<RootNamespace>System.Globalization.Extensions</RootNamespace>
<AssemblyName>System.Globalization.Extensions</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ProjectGuid>{2B96AA10-84C0-4927-8611-8D2474B990E8}</ProjectGuid>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)'==''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net46'">true</IsPartialFacadeAssembly>
</PropertyGroup>
diff --git a/src/System.Globalization/dir.props b/src/System.Globalization/dir.props
new file mode 100644
index 0000000000..d16ef39bdb
--- /dev/null
+++ b/src/System.Globalization/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.12.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Globalization/pkg/System.Globalization.pkgproj b/src/System.Globalization/pkg/System.Globalization.pkgproj
index b3ef9764aa..82e12d6ae0 100644
--- a/src/System.Globalization/pkg/System.Globalization.pkgproj
+++ b/src/System.Globalization/pkg/System.Globalization.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.12.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\4.0.0\System.Globalization.depproj">
diff --git a/src/System.Globalization/pkg/ValidationSuppression.txt b/src/System.Globalization/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Globalization/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Globalization/ref/4.0.0/System.Globalization.depproj b/src/System.Globalization/ref/4.0.0/System.Globalization.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Globalization/ref/4.0.0/System.Globalization.depproj
+++ b/src/System.Globalization/ref/4.0.0/System.Globalization.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Globalization/ref/System.Globalization.csproj b/src/System.Globalization/ref/System.Globalization.csproj
index 37839f1515..fa6ec5debf 100644
--- a/src/System.Globalization/ref/System.Globalization.csproj
+++ b/src/System.Globalization/ref/System.Globalization.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Globalization/src/System.Globalization.csproj b/src/System.Globalization/src/System.Globalization.csproj
index be05ac4ff1..8917fd8f86 100644
--- a/src/System.Globalization/src/System.Globalization.csproj
+++ b/src/System.Globalization/src/System.Globalization.csproj
@@ -3,11 +3,9 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Globalization</AssemblyName>
- <AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)'=='netstandard1.3' OR '$(TargetGroup)'=='netcore50' OR '$(TargetGroup)'=='netcore50aot'">4.0.12.0</AssemblyVersion>
<ContractProject Condition="'$(AssemblyVersion)'!='4.1.0.0'">../ref/4.0.10/System.Globalization.depproj</ContractProject>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs b/src/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs
index edc8b7c9fb..4027f586c2 100644
--- a/src/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs
+++ b/src/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs
@@ -112,7 +112,8 @@ namespace System.Globalization.Tests
var psi = new ProcessStartInfo();
psi.Environment.Clear();
- CopyHomeIfPresent(psi.Environment);
+ CopyEssentialTestEnvironment(psi.Environment);
+
psi.Environment["LANG"] = langEnvVar;
RemoteInvoke(expected =>
@@ -136,7 +137,8 @@ namespace System.Globalization.Tests
var psi = new ProcessStartInfo();
psi.Environment.Clear();
- CopyHomeIfPresent(psi.Environment);
+ CopyEssentialTestEnvironment(psi.Environment);
+
if (langEnvVar != null)
{
psi.Environment["LANG"] = langEnvVar;
@@ -154,13 +156,17 @@ namespace System.Globalization.Tests
}, new RemoteInvokeOptions { StartInfo = psi }).Dispose();
}
- private static void CopyHomeIfPresent(IDictionary<string, string> environment)
+ private static void CopyEssentialTestEnvironment(IDictionary<string, string> environment)
{
- string currentHome = Environment.GetEnvironmentVariable("HOME");
-
- if (currentHome != null)
+ string[] essentialVariables = { "HOME", "LD_LIBRARY_PATH" };
+ foreach(string essentialVariable in essentialVariables)
{
- environment["HOME"] = currentHome;
+ string varValue = Environment.GetEnvironmentVariable(essentialVariable);
+
+ if (varValue != null)
+ {
+ environment[essentialVariable] = varValue;
+ }
}
}
}
diff --git a/src/System.Globalization/tests/RegionInfo/RegionInfoTests.Properties.cs b/src/System.Globalization/tests/RegionInfo/RegionInfoTests.Properties.cs
index 06815a8f6d..1d83a91273 100644
--- a/src/System.Globalization/tests/RegionInfo/RegionInfoTests.Properties.cs
+++ b/src/System.Globalization/tests/RegionInfo/RegionInfoTests.Properties.cs
@@ -36,6 +36,15 @@ namespace System.Globalization.Tests
}
[Theory]
+ [InlineData("GB", "United Kingdom")]
+ [InlineData("SE", "Sverige")]
+ [InlineData("FR", "France")]
+ public void NativeName(string name, string expected)
+ {
+ Assert.Equal(expected, new RegionInfo(name).NativeName);
+ }
+
+ [Theory]
[InlineData("en-US", new string[] { "United States" })]
[InlineData("US", new string[] { "United States" })]
[InlineData("zh-CN", new string[] { "China", "People's Republic of China" })]
diff --git a/src/System.IO.Compression.ZipFile/dir.props b/src/System.IO.Compression.ZipFile/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.IO.Compression.ZipFile/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.IO.Compression.ZipFile/ref/System.IO.Compression.ZipFile.csproj b/src/System.IO.Compression.ZipFile/ref/System.IO.Compression.ZipFile.csproj
index 235ceff952..dbb8908846 100644
--- a/src/System.IO.Compression.ZipFile/ref/System.IO.Compression.ZipFile.csproj
+++ b/src/System.IO.Compression.ZipFile/ref/System.IO.Compression.ZipFile.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<UseECMAKey Condition="'$(UseECMAKey)' == ''">true</UseECMAKey>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.IO.Compression.ZipFile/src/System.IO.Compression.ZipFile.csproj b/src/System.IO.Compression.ZipFile/src/System.IO.Compression.ZipFile.csproj
index 3e09fc6e84..00d0b801e4 100644
--- a/src/System.IO.Compression.ZipFile/src/System.IO.Compression.ZipFile.csproj
+++ b/src/System.IO.Compression.ZipFile/src/System.IO.Compression.ZipFile.csproj
@@ -5,10 +5,8 @@
<UseECMAKey Condition="'$(UseECMAKey)' == ''">true</UseECMAKey>
<AssemblyName>System.IO.Compression.ZipFile</AssemblyName>
<ProjectGuid>{A8CF61F0-56EA-4b5f-9375-0723DF4250C0}</ProjectGuid>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the options -->
diff --git a/src/System.IO.Compression/dir.props b/src/System.IO.Compression/dir.props
new file mode 100644
index 0000000000..0e3e20c392
--- /dev/null
+++ b/src/System.IO.Compression/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.IO.Compression/ref/4.0.0/System.IO.Compression.depproj b/src/System.IO.Compression/ref/4.0.0/System.IO.Compression.depproj
index 29f2b6abda..5df1469c14 100644
--- a/src/System.IO.Compression/ref/4.0.0/System.IO.Compression.depproj
+++ b/src/System.IO.Compression/ref/4.0.0/System.IO.Compression.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.IO.Compression/ref/System.IO.Compression.csproj b/src/System.IO.Compression/ref/System.IO.Compression.csproj
index 4ebf45738f..89d04f784c 100644
--- a/src/System.IO.Compression/ref/System.IO.Compression.csproj
+++ b/src/System.IO.Compression/ref/System.IO.Compression.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<UseECMAKey>true</UseECMAKey>
- <AssemblyVersion>4.2.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.IO.Compression/src/Resources/Strings.resx b/src/System.IO.Compression/src/Resources/Strings.resx
index 4594a7501c..91386d47cc 100644
--- a/src/System.IO.Compression/src/Resources/Strings.resx
+++ b/src/System.IO.Compression/src/Resources/Strings.resx
@@ -306,6 +306,9 @@
<data name="UnsupportedCompression" xml:space="preserve">
<value>The archive entry was compressed using an unsupported compression method.</value>
</data>
+ <data name="UnsupportedCompressionMethod" xml:space="preserve">
+ <value>The archive entry was compressed using {0} and is not supported.</value>
+ </data>
<data name="UpdateModeCapabilities" xml:space="preserve">
<value>Update mode requires a stream with read, write, and seek capabilities.</value>
</data>
diff --git a/src/System.IO.Compression/src/System.IO.Compression.csproj b/src/System.IO.Compression/src/System.IO.Compression.csproj
index cd155835b2..b48279d62d 100644
--- a/src/System.IO.Compression/src/System.IO.Compression.csproj
+++ b/src/System.IO.Compression/src/System.IO.Compression.csproj
@@ -6,14 +6,12 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.IO.Compression</AssemblyName>
- <AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)'=='netstandard1.3' OR '$(TargetGroup)'=='net46'">4.1.2.0</AssemblyVersion>
<ContractProject Condition="'$(AssemblyVersion)'=='4.1.2.0'">../ref/4.1.0/System.IO.Compression.depproj</ContractProject>
<OutputType>Library</OutputType>
<ProjectGuid>{5471BFE8-8071-466F-838E-5ADAA779E742}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<UseECMAKey>true</UseECMAKey>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.7</PackageTargetFramework>
<DefineConstants Condition="'$(TargetGroup)' != 'net46' And '$(TargetGroup)' != 'net463'">$(DefineConstants);FEATURE_ZLIB</DefineConstants>
<DefineConstants Condition="'$(AssemblyVersion)'!='4.1.2.0'">$(DefineConstants);netstandard17</DefineConstants>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46' Or '$(TargetGroup)' == 'net463'">true</IsPartialFacadeAssembly>
diff --git a/src/System.IO.Compression/src/System/IO/Compression/Inflater.cs b/src/System.IO.Compression/src/System/IO/Compression/Inflater.cs
index 74d65ccc48..5e02dc39e4 100644
--- a/src/System.IO.Compression/src/System/IO/Compression/Inflater.cs
+++ b/src/System.IO.Compression/src/System/IO/Compression/Inflater.cs
@@ -52,13 +52,6 @@ namespace System.IO.Compression
public unsafe bool Inflate(out byte b)
{
- // If Inflate is called on an invalid or unready inflater, return 0 to indicate no bytes have been read.
- if (NeedsInput() || _inputBufferHandle == null || !_inputBufferHandle.IsAllocated)
- {
- b = 0;
- return false;
- }
-
fixed (byte* bufPtr = &b)
{
int bytesRead = InflateVerified(bufPtr, 1);
@@ -70,7 +63,7 @@ namespace System.IO.Compression
public unsafe int Inflate(byte[] bytes, int offset, int length)
{
// If Inflate is called on an invalid or unready inflater, return 0 to indicate no bytes have been read.
- if (NeedsInput() || _inputBufferHandle == null || !_inputBufferHandle.IsAllocated || length == 0)
+ if (length == 0)
return 0;
Debug.Assert(null != bytes, "Can't pass in a null output buffer!");
@@ -83,7 +76,6 @@ namespace System.IO.Compression
public unsafe int InflateVerified(byte* bufPtr, int length)
{
// State is valid; attempt inflation
- Debug.Assert(!NeedsInput() && _inputBufferHandle != null && _inputBufferHandle.IsAllocated && length != 0);
try
{
int bytesRead;
diff --git a/src/System.IO.Compression/src/System/IO/Compression/ZipArchive.cs b/src/System.IO.Compression/src/System/IO/Compression/ZipArchive.cs
index 6f2baa86a3..7d82b75ff6 100644
--- a/src/System.IO.Compression/src/System/IO/Compression/ZipArchive.cs
+++ b/src/System.IO.Compression/src/System/IO/Compression/ZipArchive.cs
@@ -230,30 +230,25 @@ namespace System.IO.Compression
{
if (disposing && !_isDisposed)
{
- switch (_mode)
+ try
{
- case ZipArchiveMode.Read:
- break;
- case ZipArchiveMode.Create:
- case ZipArchiveMode.Update:
- default:
- Debug.Assert(_mode == ZipArchiveMode.Update || _mode == ZipArchiveMode.Create);
- try
- {
+ switch (_mode)
+ {
+ case ZipArchiveMode.Read:
+ break;
+ case ZipArchiveMode.Create:
+ case ZipArchiveMode.Update:
+ default:
+ Debug.Assert(_mode == ZipArchiveMode.Update || _mode == ZipArchiveMode.Create);
WriteFile();
- }
- catch (InvalidDataException)
- {
- CloseStreams();
- _isDisposed = true;
- throw;
- }
- break;
+ break;
+ }
+ }
+ finally
+ {
+ CloseStreams();
+ _isDisposed = true;
}
-
- CloseStreams();
-
- _isDisposed = true;
}
}
@@ -671,7 +666,6 @@ namespace System.IO.Compression
}
- //the only exceptions that this function will throw directly are InvalidDataExceptions
private void WriteFile()
{
//if we are in create mode, we always set readEntries to true in Init
@@ -691,7 +685,6 @@ namespace System.IO.Compression
_archiveStream.Seek(0, SeekOrigin.Begin);
_archiveStream.SetLength(0);
- //nothing after this should throw an exception
}
foreach (ZipArchiveEntry entry in _entries)
diff --git a/src/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs b/src/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs
index 65619b41cc..49ef75203a 100644
--- a/src/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs
+++ b/src/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs
@@ -749,7 +749,17 @@ namespace System.IO.Compression
if (CompressionMethod != CompressionMethodValues.Stored &&
CompressionMethod != CompressionMethodValues.Deflate)
{
- message = SR.UnsupportedCompression;
+ switch (CompressionMethod)
+ {
+ case CompressionMethodValues.Deflate64:
+ case CompressionMethodValues.BZip2:
+ case CompressionMethodValues.LZMA:
+ message = SR.Format(SR.UnsupportedCompressionMethod, CompressionMethod.ToString());
+ break;
+ default:
+ message = SR.UnsupportedCompression;
+ break;
+ }
return false;
}
}
@@ -1277,7 +1287,7 @@ namespace System.IO.Compression
[Flags]
private enum BitFlagValues : ushort { DataDescriptor = 0x8, UnicodeFileName = 0x800 }
- private enum CompressionMethodValues : ushort { Stored = 0x0, Deflate = 0x8 }
+ private enum CompressionMethodValues : ushort { Stored = 0x0, Deflate = 0x8, Deflate64 = 0x9, BZip2 = 0xC, LZMA = 0xE }
private enum OpenableValues { Openable, FileNonExistent, FileTooLarge }
#endregion Nested Types
diff --git a/src/System.IO.FileSystem.AccessControl/dir.props b/src/System.IO.FileSystem.AccessControl/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.IO.FileSystem.AccessControl/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.IO.FileSystem.AccessControl/ref/System.IO.FileSystem.AccessControl.csproj b/src/System.IO.FileSystem.AccessControl/ref/System.IO.FileSystem.AccessControl.csproj
index baac95e556..122cfed323 100644
--- a/src/System.IO.FileSystem.AccessControl/ref/System.IO.FileSystem.AccessControl.csproj
+++ b/src/System.IO.FileSystem.AccessControl/ref/System.IO.FileSystem.AccessControl.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj b/src/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj
index 5c706f477a..473aa69cfc 100644
--- a/src/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj
+++ b/src/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj
@@ -2,11 +2,9 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyName>System.IO.FileSystem.AccessControl</AssemblyName>
<ProjectGuid>{D77FBA6C-1AA6-45A4-93E2-97A370672C53}</ProjectGuid>
<AllowUnsafeBlocks Condition="'$(TargetGroup)'==''">true</AllowUnsafeBlocks>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)'==''">netstandard1.3</PackageTargetFramework>
<GeneratePlatformNotSupportedAssembly Condition="'$(TargetsUnix)' == 'true'">true</GeneratePlatformNotSupportedAssembly>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net46'">true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
diff --git a/src/System.IO.FileSystem.DriveInfo/dir.props b/src/System.IO.FileSystem.DriveInfo/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.IO.FileSystem.DriveInfo/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.IO.FileSystem.DriveInfo/ref/System.IO.FileSystem.DriveInfo.csproj b/src/System.IO.FileSystem.DriveInfo/ref/System.IO.FileSystem.DriveInfo.csproj
index 73ac239881..01e305ded7 100644
--- a/src/System.IO.FileSystem.DriveInfo/ref/System.IO.FileSystem.DriveInfo.csproj
+++ b/src/System.IO.FileSystem.DriveInfo/ref/System.IO.FileSystem.DriveInfo.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.IO.FileSystem.DriveInfo/src/System.IO.FileSystem.DriveInfo.csproj b/src/System.IO.FileSystem.DriveInfo/src/System.IO.FileSystem.DriveInfo.csproj
index aafb9dee9f..cc3c0377a5 100644
--- a/src/System.IO.FileSystem.DriveInfo/src/System.IO.FileSystem.DriveInfo.csproj
+++ b/src/System.IO.FileSystem.DriveInfo/src/System.IO.FileSystem.DriveInfo.csproj
@@ -7,11 +7,9 @@
<PropertyGroup>
<RootNamespace>System.IO.FileSystem.DriveInfo</RootNamespace>
<AssemblyName>System.IO.FileSystem.DriveInfo</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<ProjectGuid>{29C14AD7-DC03-45DC-897D-8DACC762707E}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.IO.FileSystem.Primitives/dir.props b/src/System.IO.FileSystem.Primitives/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.IO.FileSystem.Primitives/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.IO.FileSystem.Primitives/ref/System.IO.FileSystem.Primitives.csproj b/src/System.IO.FileSystem.Primitives/ref/System.IO.FileSystem.Primitives.csproj
index 52d8561b8d..36a121cf80 100644
--- a/src/System.IO.FileSystem.Primitives/ref/System.IO.FileSystem.Primitives.csproj
+++ b/src/System.IO.FileSystem.Primitives/ref/System.IO.FileSystem.Primitives.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.IO.FileSystem.Primitives/src/System.IO.FileSystem.Primitives.csproj b/src/System.IO.FileSystem.Primitives/src/System.IO.FileSystem.Primitives.csproj
index aa61c693a1..ed49e631c5 100644
--- a/src/System.IO.FileSystem.Primitives/src/System.IO.FileSystem.Primitives.csproj
+++ b/src/System.IO.FileSystem.Primitives/src/System.IO.FileSystem.Primitives.csproj
@@ -4,9 +4,7 @@
<PropertyGroup>
<ProjectGuid>{6C05678E-394C-4CFF-B453-A18E28C8F2C3}</ProjectGuid>
<AssemblyName>System.IO.FileSystem.Primitives</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
diff --git a/src/System.IO.FileSystem.Watcher/dir.props b/src/System.IO.FileSystem.Watcher/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.IO.FileSystem.Watcher/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.csproj b/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.csproj
index 5be0fba11e..3c79156d9c 100644
--- a/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.csproj
+++ b/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj b/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj
index 8f8bea4246..d8ab576487 100644
--- a/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj
+++ b/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj
@@ -5,12 +5,9 @@
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<ProjectGuid>{77E702D9-C6D8-4CE4-9941-D3056C3CCBED}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetsWindows)' == 'true' AND '$(TargetGroup)' == ''">
diff --git a/src/System.IO.FileSystem/dir.props b/src/System.IO.FileSystem/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.IO.FileSystem/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.IO.FileSystem/ref/System.IO.FileSystem.csproj b/src/System.IO.FileSystem/ref/System.IO.FileSystem.csproj
index 7193054bcb..cee8a1aa0b 100644
--- a/src/System.IO.FileSystem/ref/System.IO.FileSystem.csproj
+++ b/src/System.IO.FileSystem/ref/System.IO.FileSystem.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.IO.FileSystem/src/System.IO.FileSystem.csproj b/src/System.IO.FileSystem/src/System.IO.FileSystem.csproj
index d5b1ce20c0..214e51887b 100644
--- a/src/System.IO.FileSystem/src/System.IO.FileSystem.csproj
+++ b/src/System.IO.FileSystem/src/System.IO.FileSystem.csproj
@@ -7,14 +7,12 @@
<PropertyGroup>
<ProjectGuid>{879C23DC-D828-4DFB-8E92-ABBC11B71035}</ProjectGuid>
<AssemblyName>System.IO.FileSystem</AssemblyName>
- <AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)'=='netstandard1.3' Or '$(TargetGroup)'=='net46' Or '$(TargetGroup)'=='netcore50'">4.0.2.0</AssemblyVersion>
<ContractProject Condition="'$(AssemblyVersion)'=='4.0.2.0'">../ref/4.0.1/System.IO.FileSystem.depproj</ContractProject>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<EnableWinRT Condition="'$(PackageTargetFramework)' == 'netcore50'">true</EnableWinRT>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46' or '$(TargetGroup)' == 'net463'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46' or '$(TargetGroup)' == 'net463'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetsUnix)' == 'true'">
diff --git a/src/System.IO.IsolatedStorage/dir.props b/src/System.IO.IsolatedStorage/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.IO.IsolatedStorage/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.IO.IsolatedStorage/ref/System.IO.IsolatedStorage.csproj b/src/System.IO.IsolatedStorage/ref/System.IO.IsolatedStorage.csproj
index 0c6f23d422..d342e3c720 100644
--- a/src/System.IO.IsolatedStorage/ref/System.IO.IsolatedStorage.csproj
+++ b/src/System.IO.IsolatedStorage/ref/System.IO.IsolatedStorage.csproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
<ProjectGuid>{27225772-FE8B-49D7-8E58-29242D536130}</ProjectGuid>
@@ -24,13 +23,5 @@
<None Include="4.0\System.IO.IsolatedStorage.depproj" />
<None Include="project.json" />
</ItemGroup>
- <ItemGroup>
- <PackageDestination Include="ref/netstandard1.7">
- <TargetFramework>netstandard1.7</TargetFramework>
- </PackageDestination>
- <PackageDestination Include="ref/uap10.1">
- <TargetFramework>uap10.1</TargetFramework>
- </PackageDestination>
- </ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project> \ No newline at end of file
diff --git a/src/System.IO.IsolatedStorage/src/System.IO.IsolatedStorage.csproj b/src/System.IO.IsolatedStorage/src/System.IO.IsolatedStorage.csproj
index 8cb834ca87..b8d2aee50d 100644
--- a/src/System.IO.IsolatedStorage/src/System.IO.IsolatedStorage.csproj
+++ b/src/System.IO.IsolatedStorage/src/System.IO.IsolatedStorage.csproj
@@ -7,11 +7,9 @@
<PropertyGroup>
<AssemblyName>System.IO.IsolatedStorage</AssemblyName>
<ProjectGuid>{FAF5D1E4-BA43-4663-8429-C069066D75CB}</ProjectGuid>
- <AssemblyVersion>4.1.0.0</AssemblyVersion>
<EnableWinRT Condition="'$(TargetGroup)' == 'uap101'">true</EnableWinRT>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net463'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net463'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the options -->
diff --git a/src/System.IO.IsolatedStorage/src/project.json b/src/System.IO.IsolatedStorage/src/project.json
index 80f0907b54..b9ce613699 100644
--- a/src/System.IO.IsolatedStorage/src/project.json
+++ b/src/System.IO.IsolatedStorage/src/project.json
@@ -27,6 +27,7 @@
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.NETCore.Targets": "1.0.1",
+ "Microsoft.TargetingPack.Private.NETNative": "1.0.1-beta-24430-00",
"Microsoft.TargetingPack.Private.WinRT": "1.0.1",
"System.Collections": "4.0.0",
"System.IO": "4.2.0-beta-devapi-24424-01",
diff --git a/src/System.IO.MemoryMappedFiles/dir.props b/src/System.IO.MemoryMappedFiles/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.IO.MemoryMappedFiles/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.csproj b/src/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.csproj
index e46db95ec1..23bb073d6f 100644
--- a/src/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.csproj
+++ b/src/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj b/src/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj
index 030e139f74..806d549bf1 100644
--- a/src/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj
+++ b/src/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj
@@ -7,11 +7,9 @@
<PropertyGroup>
<ProjectGuid>{16EE5522-F387-4C9E-9EF2-B5134B043F37}</ProjectGuid>
<AssemblyName>System.IO.MemoryMappedFiles</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.IO.Packaging/dir.props b/src/System.IO.Packaging/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.IO.Packaging/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.IO.Packaging/ref/System.IO.Packaging.csproj b/src/System.IO.Packaging/ref/System.IO.Packaging.csproj
index b09f473c7e..bffe761ce7 100644
--- a/src/System.IO.Packaging/ref/System.IO.Packaging.csproj
+++ b/src/System.IO.Packaging/ref/System.IO.Packaging.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.IO.Packaging/src/System.IO.Packaging.csproj b/src/System.IO.Packaging/src/System.IO.Packaging.csproj
index fbaa6e9392..0f4a41127f 100644
--- a/src/System.IO.Packaging/src/System.IO.Packaging.csproj
+++ b/src/System.IO.Packaging/src/System.IO.Packaging.csproj
@@ -3,11 +3,9 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<ProjectGuid>{1F827C19-6023-48D3-909F-9F43AB42FAF0}</ProjectGuid>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<RootNamespace>System.IO.Packaging</RootNamespace>
<AssemblyName>System.IO.Packaging</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)'==''">netstandard1.3</PackageTargetFramework>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net46'">true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.IO.Pipes.AccessControl/dir.props b/src/System.IO.Pipes.AccessControl/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.IO.Pipes.AccessControl/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.IO.Pipes.AccessControl/ref/System.IO.Pipes.AccessControl.csproj b/src/System.IO.Pipes.AccessControl/ref/System.IO.Pipes.AccessControl.csproj
index c4bbdfcb14..52dbe93cbb 100644
--- a/src/System.IO.Pipes.AccessControl/ref/System.IO.Pipes.AccessControl.csproj
+++ b/src/System.IO.Pipes.AccessControl/ref/System.IO.Pipes.AccessControl.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.IO.Pipes.AccessControl/src/System.IO.Pipes.AccessControl.csproj b/src/System.IO.Pipes.AccessControl/src/System.IO.Pipes.AccessControl.csproj
index 4f625fa620..e4252283bf 100644
--- a/src/System.IO.Pipes.AccessControl/src/System.IO.Pipes.AccessControl.csproj
+++ b/src/System.IO.Pipes.AccessControl/src/System.IO.Pipes.AccessControl.csproj
@@ -5,11 +5,9 @@
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyName>System.IO.Pipes.AccessControl</AssemblyName>
<ProjectGuid>{D77FBA6C-1AA6-45A4-93E2-97A370672C53}</ProjectGuid>
<AllowUnsafeBlocks Condition="'$(TargetGroup)'==''">true</AllowUnsafeBlocks>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)'==''">netstandard1.3</PackageTargetFramework>
<GeneratePlatformNotSupportedAssembly Condition="'$(TargetsUnix)' == 'true'">true</GeneratePlatformNotSupportedAssembly>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net46'">true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
diff --git a/src/System.IO.Pipes/dir.props b/src/System.IO.Pipes/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.IO.Pipes/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.IO.Pipes/ref/System.IO.Pipes.csproj b/src/System.IO.Pipes/ref/System.IO.Pipes.csproj
index d8d9c799de..603a2a13ea 100644
--- a/src/System.IO.Pipes/ref/System.IO.Pipes.csproj
+++ b/src/System.IO.Pipes/ref/System.IO.Pipes.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.IO.Pipes/src/System.IO.Pipes.csproj b/src/System.IO.Pipes/src/System.IO.Pipes.csproj
index 84626f1b04..994403bf9e 100644
--- a/src/System.IO.Pipes/src/System.IO.Pipes.csproj
+++ b/src/System.IO.Pipes/src/System.IO.Pipes.csproj
@@ -7,13 +7,11 @@
<PropertyGroup>
<ProjectGuid>{16EE5522-F387-4C9E-9EF2-B5134B043F37}</ProjectGuid>
<AssemblyName>System.IO.Pipes</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants)</DefineConstants>
<OmitTransitiveCompileReferences>true</OmitTransitiveCompileReferences>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetsWindows)' == 'true' AND '$(TargetGroup)' == ''">
diff --git a/src/System.IO.Pipes/tests/NativeOverlapped.unix.cs b/src/System.IO.Pipes/tests/NativeOverlapped.unix.cs
index 532a7a4b96..5f30610f46 100644
--- a/src/System.IO.Pipes/tests/NativeOverlapped.unix.cs
+++ b/src/System.IO.Pipes/tests/NativeOverlapped.unix.cs
@@ -1,3 +1,6 @@
+// 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.
// stub implementation of NativeOverlapped to compile windows only tests in Unix build
internal struct NativeOverlapped {} \ No newline at end of file
diff --git a/src/System.IO.UnmanagedMemoryStream/dir.props b/src/System.IO.UnmanagedMemoryStream/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.IO.UnmanagedMemoryStream/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.IO.UnmanagedMemoryStream/ref/System.IO.UnmanagedMemoryStream.csproj b/src/System.IO.UnmanagedMemoryStream/ref/System.IO.UnmanagedMemoryStream.csproj
index 0f25aae85b..f6cce2f9fc 100644
--- a/src/System.IO.UnmanagedMemoryStream/ref/System.IO.UnmanagedMemoryStream.csproj
+++ b/src/System.IO.UnmanagedMemoryStream/ref/System.IO.UnmanagedMemoryStream.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.IO.UnmanagedMemoryStream/src/System.IO.UnmanagedMemoryStream.csproj b/src/System.IO.UnmanagedMemoryStream/src/System.IO.UnmanagedMemoryStream.csproj
index 17091155fb..f8444357a2 100644
--- a/src/System.IO.UnmanagedMemoryStream/src/System.IO.UnmanagedMemoryStream.csproj
+++ b/src/System.IO.UnmanagedMemoryStream/src/System.IO.UnmanagedMemoryStream.csproj
@@ -4,11 +4,9 @@
<PropertyGroup>
<ProjectGuid>{BCF9255A-4321-4277-AD7D-F5094092C554}</ProjectGuid>
<AssemblyName>System.IO.UnmanagedMemoryStream</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.IO/dir.props b/src/System.IO/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.IO/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.IO/ref/4.0.0/System.IO.depproj b/src/System.IO/ref/4.0.0/System.IO.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.IO/ref/4.0.0/System.IO.depproj
+++ b/src/System.IO/ref/4.0.0/System.IO.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.IO/ref/4.0.10/System.IO.depproj b/src/System.IO/ref/4.0.10/System.IO.depproj
index 61ed42e3a5..e67a3176b2 100644
--- a/src/System.IO/ref/4.0.10/System.IO.depproj
+++ b/src/System.IO/ref/4.0.10/System.IO.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.IO/ref/System.IO.csproj b/src/System.IO/ref/System.IO.csproj
index aa597103df..9497dde99b 100644
--- a/src/System.IO/ref/System.IO.csproj
+++ b/src/System.IO/ref/System.IO.csproj
@@ -2,19 +2,10 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.2.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
- <PackageDestination Include="ref/netstandard1.7">
- <TargetFramework>netstandard1.7</TargetFramework>
- </PackageDestination>
- <PackageDestination Include="ref/uap10.1">
- <TargetFramework>uap10.1</TargetFramework>
- </PackageDestination>
- </ItemGroup>
- <ItemGroup>
<Compile Include="System.IO.cs" />
<Compile Include="System.IO.Manual.cs" />
</ItemGroup>
diff --git a/src/System.IO/src/System.IO.csproj b/src/System.IO/src/System.IO.csproj
index 1c252444f4..8ad55bd5ca 100644
--- a/src/System.IO/src/System.IO.csproj
+++ b/src/System.IO/src/System.IO.csproj
@@ -4,20 +4,11 @@
<PropertyGroup>
<AssemblyName>System.IO</AssemblyName>
<ProjectGuid>{07390899-C8F6-4e83-A3A9-6867B8CB46A0}</ProjectGuid>
- <AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)' == 'net462' Or '$(TargetGroup)' == 'netstandard1.6' Or '$(TargetGroup)'=='netstandard13aot'">4.1.0.0</AssemblyVersion>
<ContractProject Condition="'$(AssemblyVersion)' == '4.1.0.0'">..\ref\4.1\System.IO.depproj</ContractProject>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
- <ItemGroup Condition="'$(PackageTargetFramework)' == ''">
- <PackageDestination Include="lib/netstandard1.7">
- <TargetFramework>netstandard1.7</TargetFramework>
- </PackageDestination>
- <PackageDestination Include="lib/uap10.1">
- <TargetFramework>uap10.1</TargetFramework>
- </PackageDestination>
- </ItemGroup>
<!-- Default configurations to help VS understand the options -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
diff --git a/src/System.Linq.Expressions/dir.props b/src/System.Linq.Expressions/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.Linq.Expressions/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Linq.Expressions/pkg/ValidationSuppression.txt b/src/System.Linq.Expressions/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Linq.Expressions/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Linq.Expressions/ref/4.0.0/System.Linq.Expressions.depproj b/src/System.Linq.Expressions/ref/4.0.0/System.Linq.Expressions.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Linq.Expressions/ref/4.0.0/System.Linq.Expressions.depproj
+++ b/src/System.Linq.Expressions/ref/4.0.0/System.Linq.Expressions.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Linq.Expressions/ref/4.0.10/System.Linq.Expressions.depproj b/src/System.Linq.Expressions/ref/4.0.10/System.Linq.Expressions.depproj
index 61ed42e3a5..e67a3176b2 100644
--- a/src/System.Linq.Expressions/ref/4.0.10/System.Linq.Expressions.depproj
+++ b/src/System.Linq.Expressions/ref/4.0.10/System.Linq.Expressions.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Linq.Expressions/ref/System.Linq.Expressions.csproj b/src/System.Linq.Expressions/ref/System.Linq.Expressions.csproj
index 5885f1527c..efa2fadab3 100644
--- a/src/System.Linq.Expressions/ref/System.Linq.Expressions.csproj
+++ b/src/System.Linq.Expressions/ref/System.Linq.Expressions.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.2.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Linq.Expressions/src/System.Linq.Expressions.csproj b/src/System.Linq.Expressions/src/System.Linq.Expressions.csproj
index 140e17c945..a4bf6e78fd 100644
--- a/src/System.Linq.Expressions/src/System.Linq.Expressions.csproj
+++ b/src/System.Linq.Expressions/src/System.Linq.Expressions.csproj
@@ -9,10 +9,8 @@
<ProjectGuid>{AEF718E9-D4FC-418F-A7AE-ED6B2C7B3787}</ProjectGuid>
<AssemblyName>System.Linq.Expressions</AssemblyName>
<RootNamespace>System.Linq.Expressions</RootNamespace>
- <AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)'=='netstandard1.6' Or '$(TargetGroup)'=='netstandard1.6'">4.1.1.0</AssemblyVersion>
<ContractProject Condition="'$(AssemblyVersion)'=='4.1.1.0'">../ref/4.1.0/System.Linq.Expressions.depproj</ContractProject>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.7</PackageTargetFramework>
<IsInterpreting Condition="'$(PackageTargetFramework)' == 'netcore50'">true</IsInterpreting>
<DefineConstants Condition=" '$(IsInterpreting)' != 'true' ">$(DefineConstants);FEATURE_COMPILE</DefineConstants>
<DefineConstants Condition=" '$(FeatureInterpret)' == 'true' ">$(DefineConstants);FEATURE_INTERPRET</DefineConstants>
@@ -144,6 +142,7 @@
<Compile Include="System\Linq\Expressions\Utils.cs" />
<Compile Include="System\Linq\IQueryable.cs" />
<Compile Include="System\Runtime\CompilerServices\IRuntimeVariables.cs" />
+ <Compile Include="System\Linq\Expressions\Common\ConstantCheck.cs" />
<Compile Include="System\Runtime\CompilerServices\ReadOnlyCollectionBuilder.cs" />
<None Include="project.json" />
</ItemGroup>
@@ -165,7 +164,6 @@
<Compile Include="System\Linq\Expressions\Compiler\BoundConstants.cs" />
<Compile Include="System\Linq\Expressions\Compiler\CompilerScope.cs" />
<Compile Include="System\Linq\Expressions\Compiler\CompilerScope.Storage.cs" />
- <Compile Include="System\Linq\Expressions\Compiler\ConstantCheck.cs" />
<Compile Include="System\Linq\Expressions\Compiler\HoistedLocals.cs" />
<Compile Include="System\Linq\Expressions\Compiler\ILGen.cs" />
<Compile Include="System\Linq\Expressions\Compiler\KeyedQueue.cs" />
@@ -198,7 +196,6 @@
<Compile Include="System\Linq\Expressions\Interpreter\BranchLabel.cs" />
<Compile Include="System\Linq\Expressions\Interpreter\CallInstruction.cs" />
<Compile Include="System\Linq\Expressions\Interpreter\CallInstruction.Generated.cs" />
- <Compile Include="System\Linq\Expressions\Interpreter\ConstantCheck.cs" />
<Compile Include="System\Linq\Expressions\Interpreter\ControlFlowInstructions.cs" />
<Compile Include="System\Linq\Expressions\Interpreter\DivInstruction.cs" />
<Compile Include="System\Linq\Expressions\Interpreter\EqualInstruction.cs" />
@@ -231,4 +228,4 @@
<TargetingPackReference Include="System.Core" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs
index 5ad4f95ef4..87153602fa 100644
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs
+++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs
@@ -265,16 +265,18 @@ namespace System.Linq.Expressions
var index = (IndexExpression)_left;
- var vars = new List<ParameterExpression>(index.Arguments.Count + 2);
- var exprs = new List<Expression>(index.Arguments.Count + 3);
+ var vars = new List<ParameterExpression>(index.ArgumentCount + 2);
+ var exprs = new List<Expression>(index.ArgumentCount + 3);
var tempObj = Expression.Variable(index.Object.Type, "tempObj");
vars.Add(tempObj);
exprs.Add(Expression.Assign(tempObj, index.Object));
- var tempArgs = new List<Expression>(index.Arguments.Count);
- foreach (var arg in index.Arguments)
+ var n = index.ArgumentCount;
+ var tempArgs = new List<Expression>(n);
+ for (var i = 0; i < n; i++)
{
+ var arg = index.GetArgument(i);
var tempArg = Expression.Variable(arg.Type, "tempArg" + tempArgs.Count);
vars.Add(tempArg);
tempArgs.Add(tempArg);
@@ -671,7 +673,7 @@ namespace System.Linq.Expressions
ValidateOperator(method, nameof(method));
ParameterInfo[] pms = method.GetParametersCached();
if (pms.Length != 2)
- throw Error.IncorrectNumberOfMethodCallArguments(method);
+ throw Error.IncorrectNumberOfMethodCallArguments(method, nameof(method));
if (ParameterIsAssignable(pms[0], left.Type) && ParameterIsAssignable(pms[1], right.Type))
{
ValidateParamswithOperandsOrThrow(pms[0].ParameterType, left.Type, binaryType, method.Name);
@@ -852,7 +854,7 @@ namespace System.Linq.Expressions
ValidateOperator(method, nameof(method));
ParameterInfo[] pms = method.GetParametersCached();
if (pms.Length != 2)
- throw Error.IncorrectNumberOfMethodCallArguments(method);
+ throw Error.IncorrectNumberOfMethodCallArguments(method, nameof(method));
if (!ParameterIsAssignable(pms[0], left))
{
if (!(TypeUtils.IsNullableType(left) && ParameterIsAssignable(pms[0], TypeUtils.GetNonNullableType(left))))
@@ -883,15 +885,15 @@ namespace System.Linq.Expressions
{
throw Error.LogicalOperatorMustHaveBooleanOperators(nodeType, method.Name);
}
- VerifyOpTrueFalse(nodeType, left, opFalse);
- VerifyOpTrueFalse(nodeType, left, opTrue);
+ VerifyOpTrueFalse(nodeType, left, opFalse, nameof(method));
+ VerifyOpTrueFalse(nodeType, left, opTrue, nameof(method));
}
- private static void VerifyOpTrueFalse(ExpressionType nodeType, Type left, MethodInfo opTrue)
+ private static void VerifyOpTrueFalse(ExpressionType nodeType, Type left, MethodInfo opTrue, string paramName)
{
ParameterInfo[] pmsOpTrue = opTrue.GetParametersCached();
if (pmsOpTrue.Length != 1)
- throw Error.IncorrectNumberOfMethodCallArguments(opTrue);
+ throw Error.IncorrectNumberOfMethodCallArguments(opTrue, paramName);
if (!ParameterIsAssignable(pmsOpTrue[0], left))
{
@@ -1492,13 +1494,13 @@ namespace System.Linq.Expressions
MethodInfo method = delegateType.GetMethod("Invoke");
if (method.ReturnType == typeof(void))
{
- throw Error.UserDefinedOperatorMustNotBeVoid(conversion, nameof(method));
+ throw Error.UserDefinedOperatorMustNotBeVoid(conversion, nameof(conversion));
}
ParameterInfo[] pms = method.GetParametersCached();
Debug.Assert(pms.Length == conversion.Parameters.Count);
if (pms.Length != 1)
{
- throw Error.IncorrectNumberOfMethodCallArguments(conversion);
+ throw Error.IncorrectNumberOfMethodCallArguments(conversion, nameof(conversion));
}
// The return type must match exactly.
// We could weaken this restriction and
@@ -1656,7 +1658,7 @@ namespace System.Linq.Expressions
Debug.Assert(pms.Length == conversion.Parameters.Count);
if (pms.Length != 1)
{
- throw Error.IncorrectNumberOfMethodCallArguments(conversion);
+ throw Error.IncorrectNumberOfMethodCallArguments(conversion, nameof(conversion));
}
if (!TypeUtils.AreEquivalent(mi.ReturnType, left.Type))
{
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/ConstantCheck.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/Common/ConstantCheck.cs
index 9f63801d04..45f5036427 100644
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/ConstantCheck.cs
+++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/Common/ConstantCheck.cs
@@ -5,7 +5,7 @@
using System.Dynamic.Utils;
using System.Reflection;
-namespace System.Linq.Expressions.Compiler
+namespace System.Linq.Expressions
{
internal enum AnalyzeTypeIsResult
{
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/ILGen.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/ILGen.cs
index d8f846895b..6304d34861 100644
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/ILGen.cs
+++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/ILGen.cs
@@ -545,7 +545,7 @@ namespace System.Linq.Expressions.Compiler
// matches TryEmitILConstant
private static bool CanEmitILConstant(Type type)
{
- switch (type.GetTypeCode())
+ switch (type.GetNonNullableType().GetTypeCode())
{
case TypeCode.Boolean:
case TypeCode.SByte:
@@ -649,6 +649,21 @@ namespace System.Linq.Expressions.Compiler
private static bool TryEmitILConstant(this ILGenerator il, object value, Type type)
{
+ Debug.Assert(value != null);
+
+ if (type.IsNullableType())
+ {
+ Type nonNullType = type.GetNonNullableType();
+
+ if (TryEmitILConstant(il, value, nonNullType))
+ {
+ il.Emit(OpCodes.Newobj, type.GetConstructor(new[] { nonNullType }));
+ return true;
+ }
+
+ return false;
+ }
+
switch (type.GetTypeCode())
{
case TypeCode.Boolean:
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Address.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Address.cs
index c71f78dc72..c1c1b170c4 100644
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Address.cs
+++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Address.cs
@@ -198,10 +198,10 @@ namespace System.Linq.Expressions.Compiler
return;
}
- if (node.Arguments.Count == 1)
+ if (node.ArgumentCount == 1)
{
EmitExpression(node.Object);
- EmitExpression(node.Arguments[0]);
+ EmitExpression(node.GetArgument(0));
_ilg.Emit(OpCodes.Ldelema, node.Type);
}
else
@@ -277,9 +277,10 @@ namespace System.Linq.Expressions.Compiler
if (node.Expression != null)
{
EmitInstance(node.Expression, instanceType = node.Expression.Type);
+
// store in local
_ilg.Emit(OpCodes.Dup);
- _ilg.Emit(OpCodes.Stloc, instanceLocal = GetLocal(instanceType));
+ _ilg.Emit(OpCodes.Stloc, instanceLocal = GetInstanceLocal(instanceType));
}
PropertyInfo pi = (PropertyInfo)node.Member;
@@ -321,15 +322,18 @@ namespace System.Linq.Expressions.Compiler
{
EmitInstance(node.Object, instanceType = node.Object.Type);
+ // store in local
_ilg.Emit(OpCodes.Dup);
- _ilg.Emit(OpCodes.Stloc, instanceLocal = GetLocal(instanceType));
+ _ilg.Emit(OpCodes.Stloc, instanceLocal = GetInstanceLocal(instanceType));
}
// Emit indexes. We don't allow byref args, so no need to worry
// about write-backs or EmitAddress
- List<LocalBuilder> args = new List<LocalBuilder>();
- foreach (var arg in node.Arguments)
+ var n = node.ArgumentCount;
+ List<LocalBuilder> args = new List<LocalBuilder>(n);
+ for (var i = 0; i < n; i++)
{
+ var arg = node.GetArgument(i);
EmitExpression(arg);
var argLocal = GetLocal(arg.Type);
@@ -366,5 +370,11 @@ namespace System.Linq.Expressions.Compiler
EmitSetIndexCall(node, instanceType);
};
}
+
+ private LocalBuilder GetInstanceLocal(Type type)
+ {
+ var instanceLocalType = type.GetTypeInfo().IsValueType ? type.MakeByRefType() : type;
+ return GetLocal(instanceLocalType);
+ }
}
}
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs
index 2a76453727..c750bb1de6 100644
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs
+++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs
@@ -186,9 +186,8 @@ namespace System.Linq.Expressions.Compiler
// if the invoke target is a lambda expression tree, first compile it into a delegate
expr = Expression.Call(expr, expr.Type.GetMethod("Compile", Array.Empty<Type>()));
}
- expr = Expression.Call(expr, expr.Type.GetMethod("Invoke"), node.Arguments);
- EmitExpression(expr);
+ EmitMethodCall(expr, expr.Type.GetMethod("Invoke"), node, CompilationFlags.EmitAsNoTail | CompilationFlags.EmitExpressionStart);
}
private void EmitInlinedInvoke(InvocationExpression invoke, CompilationFlags flags)
@@ -235,8 +234,9 @@ namespace System.Linq.Expressions.Compiler
// Emit indexes. We don't allow byref args, so no need to worry
// about write-backs or EmitAddress
- foreach (var arg in node.Arguments)
+ for (int i = 0, n = node.ArgumentCount; i < n; i++)
{
+ var arg = node.GetArgument(i);
EmitExpression(arg);
}
@@ -258,8 +258,9 @@ namespace System.Linq.Expressions.Compiler
// Emit indexes. We don't allow byref args, so no need to worry
// about write-backs or EmitAddress
- foreach (var arg in index.Arguments)
+ for (int i = 0, n = index.ArgumentCount; i < n; i++)
{
+ var arg = index.GetArgument(i);
EmitExpression(arg);
}
@@ -607,7 +608,7 @@ namespace System.Linq.Expressions.Compiler
}
else
{
- Debug.Assert(node.Arguments.Count == 0, "Node with arguments must have a constructor.");
+ Debug.Assert(node.ArgumentCount == 0, "Node with arguments must have a constructor.");
Debug.Assert(node.Type.GetTypeInfo().IsValueType, "Only value type may have constructor not set.");
LocalBuilder temp = GetLocal(node.Type);
_ilg.Emit(OpCodes.Ldloca, temp);
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/StackSpiller.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/StackSpiller.cs
index 1b1a925d86..570539b966 100644
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/StackSpiller.cs
+++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/StackSpiller.cs
@@ -171,10 +171,10 @@ namespace System.Linq.Expressions.Compiler
{
IndexExpression index = (IndexExpression)node.Left;
- ChildRewriter cr = new ChildRewriter(this, stack, 2 + index.Arguments.Count);
+ ChildRewriter cr = new ChildRewriter(this, stack, 2 + index.ArgumentCount);
cr.Add(index.Object);
- cr.Add(index.Arguments);
+ cr.AddArguments(index);
cr.Add(node.Right);
if (cr.Action == RewriteAction.SpillStack)
@@ -396,12 +396,12 @@ namespace System.Linq.Expressions.Compiler
{
IndexExpression node = (IndexExpression)expr;
- ChildRewriter cr = new ChildRewriter(this, stack, node.Arguments.Count + 1);
+ ChildRewriter cr = new ChildRewriter(this, stack, node.ArgumentCount + 1);
// For instance methods, the instance executes on the
// stack as is, but stays on the stack, making it non-empty.
cr.Add(node.Object);
- cr.Add(node.Arguments);
+ cr.AddArguments(node);
if (cr.Action == RewriteAction.SpillStack)
{
@@ -425,7 +425,7 @@ namespace System.Linq.Expressions.Compiler
{
MethodCallExpression node = (MethodCallExpression)expr;
- ChildRewriter cr = new ChildRewriter(this, stack, node.Arguments.Count + 1);
+ ChildRewriter cr = new ChildRewriter(this, stack, node.ArgumentCount + 1);
// For instance methods, the instance executes on the
// stack as is, but stays on the stack, making it non-empty.
@@ -491,8 +491,8 @@ namespace System.Linq.Expressions.Compiler
if (lambda != null)
{
// Arguments execute on current stack
- cr = new ChildRewriter(this, stack, node.Arguments.Count);
- cr.Add(node.Arguments);
+ cr = new ChildRewriter(this, stack, node.ArgumentCount);
+ cr.AddArguments(node);
if (cr.Action == RewriteAction.SpillStack)
{
@@ -512,13 +512,13 @@ namespace System.Linq.Expressions.Compiler
return new Result(result.Action | spiller._lambdaRewrite, result.Node);
}
- cr = new ChildRewriter(this, stack, node.Arguments.Count + 1);
+ cr = new ChildRewriter(this, stack, node.ArgumentCount + 1);
// first argument starts on stack as provided
cr.Add(node.Expression);
// rest of arguments have non-empty stack (delegate instance on the stack)
- cr.Add(node.Arguments);
+ cr.AddArguments(node);
if (cr.Action == RewriteAction.SpillStack)
{
@@ -535,7 +535,7 @@ namespace System.Linq.Expressions.Compiler
// The first expression starts on a stack as provided by parent,
// rest are definitely non-empty (which ChildRewriter guarantees)
- ChildRewriter cr = new ChildRewriter(this, stack, node.Arguments.Count);
+ ChildRewriter cr = new ChildRewriter(this, stack, node.ArgumentCount);
cr.AddArguments(node);
if (cr.Action == RewriteAction.SpillStack)
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/VariableBinder.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/VariableBinder.cs
index d32b12c985..1b146cfc19 100644
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/VariableBinder.cs
+++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/VariableBinder.cs
@@ -88,7 +88,10 @@ namespace System.Linq.Expressions.Compiler
Visit(MergeScopes(lambda));
_scopes.Pop();
// visit the invoke's arguments
- Visit(node.Arguments);
+ for (int i = 0, n = node.ArgumentCount; i < n; i++)
+ {
+ Visit(node.GetArgument(i));
+ }
return node;
}
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/ElementInit.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/ElementInit.cs
index f1e0eee5d0..d32e6dcb15 100644
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/ElementInit.cs
+++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/ElementInit.cs
@@ -108,13 +108,13 @@ namespace System.Linq.Expressions
RequiresCanRead(argumentsRO, nameof(arguments));
ValidateElementInitAddMethodInfo(addMethod, nameof(addMethod));
- ValidateArgumentTypes(addMethod, ExpressionType.Call, ref argumentsRO);
+ ValidateArgumentTypes(addMethod, ExpressionType.Call, ref argumentsRO, nameof(addMethod));
return new ElementInit(addMethod, argumentsRO);
}
private static void ValidateElementInitAddMethodInfo(MethodInfo addMethod, string paramName)
{
- ValidateMethodInfo(addMethod, nameof(addMethod));
+ ValidateMethodInfo(addMethod, paramName);
ParameterInfo[] pis = addMethod.GetParametersCached();
if (pis.Length == 0)
{
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/Error.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/Error.cs
index d5505d563c..b151d0a170 100644
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/Error.cs
+++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/Error.cs
@@ -401,9 +401,9 @@ namespace System.Linq.Expressions
/// <summary>
/// ArgumentException with message like "Expression of type '{0}' cannot be used for constructor parameter of type '{1}'"
/// </summary>
- internal static Exception ExpressionTypeDoesNotMatchConstructorParameter(object p0, object p1)
+ internal static Exception ExpressionTypeDoesNotMatchConstructorParameter(object p0, object p1, string paramName)
{
- return Dynamic.Utils.Error.ExpressionTypeDoesNotMatchConstructorParameter(p0, p1);
+ return Dynamic.Utils.Error.ExpressionTypeDoesNotMatchConstructorParameter(p0, p1, paramName);
}
/// <summary>
/// ArgumentException with message like " Argument type '{0}' does not match the corresponding member type '{1}'"
@@ -415,9 +415,9 @@ namespace System.Linq.Expressions
/// <summary>
/// ArgumentException with message like " The member '{0}' is not declared on type '{1}' being created"
/// </summary>
- internal static Exception ArgumentMemberNotDeclOnType(object p0, object p1)
+ internal static Exception ArgumentMemberNotDeclOnType(object p0, object p1, string paramName)
{
- return new ArgumentException(Strings.ArgumentMemberNotDeclOnType(p0, p1));
+ return new ArgumentException(Strings.ArgumentMemberNotDeclOnType(p0, p1), paramName);
}
/// <summary>
/// ArgumentException with message like "Expression of type '{0}' cannot be used for parameter of type '{1}' of method '{2}'"
@@ -492,9 +492,9 @@ namespace System.Linq.Expressions
/// <summary>
/// ArgumentException with message like "Incorrect number of arguments supplied for call to method '{0}'"
/// </summary>
- internal static Exception IncorrectNumberOfMethodCallArguments(object p0)
+ internal static Exception IncorrectNumberOfMethodCallArguments(object p0, string paramName)
{
- return Dynamic.Utils.Error.IncorrectNumberOfMethodCallArguments(p0);
+ return Dynamic.Utils.Error.IncorrectNumberOfMethodCallArguments(p0, paramName);
}
/// <summary>
/// ArgumentException with message like "Incorrect number of arguments for constructor"
@@ -825,7 +825,7 @@ namespace System.Linq.Expressions
/// </summary>
internal static Exception OutOfRange(string paramName, object p1)
{
- return new ArgumentOutOfRangeException(Strings.OutOfRange(paramName, p1), paramName);
+ return new ArgumentOutOfRangeException(paramName, Strings.OutOfRange(paramName, p1));
}
/// <summary>
/// InvalidOperationException with message like "Cannot redefine label '{0}' in an inner block."
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/ExpressionStringBuilder.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/ExpressionStringBuilder.cs
index a4eba854c4..7ba327a3ce 100644
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/ExpressionStringBuilder.cs
+++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/ExpressionStringBuilder.cs
@@ -445,7 +445,7 @@ namespace System.Linq.Expressions
protected internal override Expression VisitMemberInit(MemberInitExpression node)
{
- if (node.NewExpression.Arguments.Count == 0 &&
+ if (node.NewExpression.ArgumentCount == 0 &&
node.NewExpression.Type.Name.Contains("<"))
{
// anonymous type constructor
@@ -513,7 +513,16 @@ namespace System.Linq.Expressions
{
Out(initializer.AddMethod.ToString());
string sep = ", ";
- VisitExpressions('(', initializer.Arguments, ')', sep);
+ Out('(');
+ for (int i = 0, n = initializer.ArgumentCount; i < n; i++)
+ {
+ if (i > 0)
+ {
+ Out(sep);
+ }
+ Visit(initializer.GetArgument(i));
+ }
+ Out(')');
return initializer;
}
@@ -522,10 +531,10 @@ namespace System.Linq.Expressions
Out("Invoke(");
Visit(node.Expression);
string sep = ", ";
- for (int i = 0, n = node.Arguments.Count; i < n; i++)
+ for (int i = 0, n = node.ArgumentCount; i < n; i++)
{
Out(sep);
- Visit(node.Arguments[i]);
+ Visit(node.GetArgument(i));
}
Out(")");
return node;
@@ -539,7 +548,7 @@ namespace System.Linq.Expressions
if (node.Method.GetCustomAttribute(typeof(ExtensionAttribute)) != null)
{
start = 1;
- ob = node.Arguments[0];
+ ob = node.GetArgument(0);
}
if (ob != null)
@@ -549,11 +558,11 @@ namespace System.Linq.Expressions
}
Out(node.Method.Name);
Out("(");
- for (int i = start, n = node.Arguments.Count; i < n; i++)
+ for (int i = start, n = node.ArgumentCount; i < n; i++)
{
if (i > start)
Out(", ");
- Visit(node.Arguments[i]);
+ Visit(node.GetArgument(i));
}
Out(")");
return node;
@@ -582,7 +591,7 @@ namespace System.Linq.Expressions
Out("new " + node.Type.Name);
Out("(");
var members = node.Members;
- for (int i = 0; i < node.Arguments.Count; i++)
+ for (int i = 0; i < node.ArgumentCount; i++)
{
if (i > 0)
{
@@ -594,7 +603,7 @@ namespace System.Linq.Expressions
Out(name);
Out(" = ");
}
- Visit(node.Arguments[i]);
+ Visit(node.GetArgument(i));
}
Out(")");
return node;
@@ -791,7 +800,15 @@ namespace System.Linq.Expressions
Out(node.Indexer.Name);
}
- VisitExpressions('[', node.Arguments, ']');
+ Out('[');
+ for (int i = 0, n = node.ArgumentCount; i < n; i++)
+ {
+ if (i > 0)
+ Out(", ");
+ Visit(node.GetArgument(i));
+ }
+ Out(']');
+
return node;
}
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/IndexExpression.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/IndexExpression.cs
index 4ec26a8f11..3513dbfe35 100644
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/IndexExpression.cs
+++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/IndexExpression.cs
@@ -398,7 +398,7 @@ namespace System.Linq.Expressions
if (getter != null)
{
getParameters = getter.GetParametersCached();
- ValidateAccessor(instance, getter, getParameters, ref argList);
+ ValidateAccessor(instance, getter, getParameters, ref argList, nameof(property));
}
MethodInfo setter = property.GetSetMethod(true);
@@ -425,7 +425,7 @@ namespace System.Linq.Expressions
}
else
{
- ValidateAccessor(instance, setter, setParameters.RemoveLast(), ref argList);
+ ValidateAccessor(instance, setter, setParameters.RemoveLast(), ref argList, nameof(property));
}
}
@@ -435,7 +435,7 @@ namespace System.Linq.Expressions
}
}
- private static void ValidateAccessor(Expression instance, MethodInfo method, ParameterInfo[] indexes, ref ReadOnlyCollection<Expression> arguments)
+ private static void ValidateAccessor(Expression instance, MethodInfo method, ParameterInfo[] indexes, ref ReadOnlyCollection<Expression> arguments, string paramName)
{
ContractUtils.RequiresNotNull(arguments, nameof(arguments));
@@ -452,16 +452,16 @@ namespace System.Linq.Expressions
ValidateCallInstanceType(instance.Type, method);
}
- ValidateAccessorArgumentTypes(method, indexes, ref arguments);
+ ValidateAccessorArgumentTypes(method, indexes, ref arguments, paramName);
}
- private static void ValidateAccessorArgumentTypes(MethodInfo method, ParameterInfo[] indexes, ref ReadOnlyCollection<Expression> arguments)
+ private static void ValidateAccessorArgumentTypes(MethodInfo method, ParameterInfo[] indexes, ref ReadOnlyCollection<Expression> arguments, string paramName)
{
if (indexes.Length > 0)
{
if (indexes.Length != arguments.Count)
{
- throw Error.IncorrectNumberOfMethodCallArguments(method);
+ throw Error.IncorrectNumberOfMethodCallArguments(method, paramName);
}
Expression[] newArgs = null;
for (int i = 0, n = indexes.Length; i < n; i++)
@@ -501,7 +501,7 @@ namespace System.Linq.Expressions
}
else if (arguments.Count > 0)
{
- throw Error.IncorrectNumberOfMethodCallArguments(method);
+ throw Error.IncorrectNumberOfMethodCallArguments(method, paramName);
}
}
#endregion
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/ConstantCheck.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/ConstantCheck.cs
deleted file mode 100644
index e60bcd9b11..0000000000
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/ConstantCheck.cs
+++ /dev/null
@@ -1,104 +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.Diagnostics;
-using System.Dynamic.Utils;
-using System.Reflection;
-
-namespace System.Linq.Expressions.Interpreter
-{
- internal enum AnalyzeTypeIsResult
- {
- KnownFalse,
- KnownTrue,
- KnownAssignable, // need null check only
- Unknown, // need full runtime check
- }
-
- internal static class ConstantCheck
- {
- internal static bool IsNull(Expression e)
- {
- if (e.NodeType == ExpressionType.Constant)
- {
- return ((ConstantExpression)e).Value == null;
- }
- return false;
- }
-
-
- /// <summary>
- /// If the result of a TypeBinaryExpression is known statically, this
- /// returns the result, otherwise it returns null, meaning we'll need
- /// to perform the IsInst instruction at runtime.
- ///
- /// The result of this function must be equivalent to IsInst, or
- /// null.
- /// </summary>
- internal static AnalyzeTypeIsResult AnalyzeTypeIs(TypeBinaryExpression typeIs)
- {
- return AnalyzeTypeIs(typeIs.Expression, typeIs.TypeOperand);
- }
-
- /// <summary>
- /// If the result of an isinst opcode is known statically, this
- /// returns the result, otherwise it returns null, meaning we'll need
- /// to perform the IsInst instruction at runtime.
- ///
- /// The result of this function must be equivalent to IsInst, or
- /// null.
- /// </summary>
- private static AnalyzeTypeIsResult AnalyzeTypeIs(Expression operand, Type testType)
- {
- Type operandType = operand.Type;
-
- // An expression is either of type void, or it isn't.
- if (operandType == typeof(void))
- {
- return testType == typeof(void) ? AnalyzeTypeIsResult.KnownTrue : AnalyzeTypeIsResult.KnownFalse;
- }
-
- if (testType == typeof(void))
- {
- return AnalyzeTypeIsResult.KnownFalse;
- }
-
- //
- // Type comparisons treat nullable types as if they were the
- // underlying type. The reason is when you box a nullable it
- // becomes a boxed value of the underlying type, or null.
- //
- Type nnOperandType = operandType.GetNonNullableType();
- Type nnTestType = testType.GetNonNullableType();
-
- //
- // See if we can determine the answer based on the static types
- //
- // Extensive testing showed that Type.IsAssignableFrom,
- // Type.IsInstanceOfType, and the isinst instruction were all
- // equivalent when used against a live object
- //
- if (nnTestType.IsAssignableFrom(nnOperandType))
- {
- // If the operand is a value type (other than nullable), we
- // know the result is always true.
- if (operandType.GetTypeInfo().IsValueType && !operandType.IsNullableType())
- {
- return AnalyzeTypeIsResult.KnownTrue;
- }
-
- // For reference/nullable types, we need to compare to null at runtime
- return AnalyzeTypeIsResult.KnownAssignable;
- }
-
- // We used to have an if IsSealed, return KnownFalse check here.
- // but that doesn't handle generic types & co/contravariance correctly.
- // So just use IsInst, which we know always gives us the right answer.
-
- // Otherwise we need a full runtime check
- return AnalyzeTypeIsResult.Unknown;
- }
- }
-}
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/LightCompiler.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/LightCompiler.cs
index 755c74a2ce..c59b5e3319 100644
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/LightCompiler.cs
+++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/LightCompiler.cs
@@ -583,9 +583,9 @@ namespace System.Linq.Expressions.Interpreter
}
// indexes, byref args not allowed.
- foreach (var arg in index.Arguments)
+ for (int i = 0, n = index.ArgumentCount; i < n; i++)
{
- Compile(arg);
+ Compile(index.GetArgument(i));
}
EmitIndexGet(index);
@@ -597,7 +597,7 @@ namespace System.Linq.Expressions.Interpreter
{
_instructions.EmitCall(index.Indexer.GetGetMethod(true));
}
- else if (index.Arguments.Count != 1)
+ else if (index.ArgumentCount != 1)
{
_instructions.EmitCall(index.Object.Type.GetMethod("Get", BindingFlags.Public | BindingFlags.Instance));
}
@@ -618,9 +618,9 @@ namespace System.Linq.Expressions.Interpreter
}
// indexes, byref args not allowed.
- foreach (var arg in index.Arguments)
+ for (int i = 0, n = index.ArgumentCount; i < n; i++)
{
- Compile(arg);
+ Compile(index.GetArgument(i));
}
// value:
@@ -636,7 +636,7 @@ namespace System.Linq.Expressions.Interpreter
{
_instructions.EmitCall(index.Indexer.GetSetMethod(true));
}
- else if (index.Arguments.Count != 1)
+ else if (index.ArgumentCount != 1)
{
_instructions.EmitCall(index.Object.Type.GetMethod("Set", BindingFlags.Public | BindingFlags.Instance));
}
@@ -2121,25 +2121,29 @@ namespace System.Linq.Expressions.Interpreter
private void CompileMethodCallExpression(Expression expr)
{
var node = (MethodCallExpression)expr;
+ CompileMethodCallExpression(node.Object, node.Method, node);
+ }
- var parameters = node.Method.GetParameters();
+ private void CompileMethodCallExpression(Expression @object, MethodInfo method, IArgumentProvider arguments)
+ {
+ var parameters = method.GetParameters();
// TODO: Support pass by reference.
List<ByRefUpdater> updaters = null;
- if (!node.Method.IsStatic)
+ if (!method.IsStatic)
{
- var updater = CompileAddress(node.Object, -1);
+ var updater = CompileAddress(@object, -1);
if (updater != null)
{
updaters = new List<ByRefUpdater>() { updater };
}
}
- Debug.Assert(parameters.Length == node.Arguments.Count);
+ Debug.Assert(parameters.Length == arguments.ArgumentCount);
- for (int i = 0; i < node.Arguments.Count; i++)
+ for (int i = 0, n = arguments.ArgumentCount; i < n; i++)
{
- var arg = node.Arguments[i];
+ var arg = arguments.GetArgument(i);
// byref calls leave out values on the stack, we use a callback
// to emit the code which processes each value left on the stack.
@@ -2162,22 +2166,22 @@ namespace System.Linq.Expressions.Interpreter
}
}
- if (!node.Method.IsStatic &&
- node.Object.Type.IsNullableType())
+ if (!method.IsStatic &&
+ @object.Type.IsNullableType())
{
// reflection doesn't let us call methods on Nullable<T> when the value
// is null... so we get to special case those methods!
- _instructions.EmitNullableCall(node.Method, parameters);
+ _instructions.EmitNullableCall(method, parameters);
}
else
{
if (updaters == null)
{
- _instructions.EmitCall(node.Method, parameters);
+ _instructions.EmitCall(method, parameters);
}
else
{
- _instructions.EmitByRefCall(node.Method, parameters, updaters.ToArray());
+ _instructions.EmitByRefCall(method, parameters, updaters.ToArray());
foreach (var updater in updaters)
{
@@ -2257,18 +2261,19 @@ namespace System.Linq.Expressions.Interpreter
LocalDefinition? objTmp = null;
if (indexNode.Object != null)
{
- Compile(indexNode.Object);
objTmp = _locals.DefineLocal(Expression.Parameter(indexNode.Object.Type), _instructions.Count);
+ EmitThisForMethodCall(indexNode.Object);
_instructions.EmitDup();
_instructions.EmitStoreLocal(objTmp.Value.Index);
}
List<LocalDefinition> indexLocals = new List<LocalDefinition>();
- for (int i = 0; i < indexNode.Arguments.Count; i++)
+ for (int i = 0; i < indexNode.ArgumentCount; i++)
{
- Compile(indexNode.Arguments[i]);
+ var arg = indexNode.GetArgument(i);
+ Compile(arg);
- var argTmp = _locals.DefineLocal(Expression.Parameter(indexNode.Arguments[i].Type), _instructions.Count);
+ var argTmp = _locals.DefineLocal(Expression.Parameter(arg.Type), _instructions.Count);
_instructions.EmitDup();
_instructions.EmitStoreLocal(argTmp.Index);
@@ -2279,13 +2284,13 @@ namespace System.Linq.Expressions.Interpreter
return new IndexMethodByRefUpdater(objTmp, indexLocals.ToArray(), indexNode.Indexer.GetSetMethod(), index);
}
- else if (indexNode.Arguments.Count == 1)
+ else if (indexNode.ArgumentCount == 1)
{
- return CompileArrayIndexAddress(indexNode.Object, indexNode.Arguments[0], index);
+ return CompileArrayIndexAddress(indexNode.Object, indexNode.GetArgument(0), index);
}
else
{
- return CompileMultiDimArrayAccess(indexNode.Object, indexNode.Arguments, index);
+ return CompileMultiDimArrayAccess(indexNode.Object, indexNode, index);
}
case ExpressionType.MemberAccess:
var member = (MemberExpression)node;
@@ -2330,7 +2335,7 @@ namespace System.Linq.Expressions.Interpreter
{
return CompileMultiDimArrayAccess(
call.Object,
- call.Arguments,
+ call,
index
);
}
@@ -2342,7 +2347,7 @@ namespace System.Linq.Expressions.Interpreter
return null;
}
- private ByRefUpdater CompileMultiDimArrayAccess(Expression array, IList<Expression> arguments, int index)
+ private ByRefUpdater CompileMultiDimArrayAccess(Expression array, IArgumentProvider arguments, int index)
{
Compile(array);
LocalDefinition objTmp = _locals.DefineLocal(Expression.Parameter(array.Type), _instructions.Count);
@@ -2350,11 +2355,12 @@ namespace System.Linq.Expressions.Interpreter
_instructions.EmitStoreLocal(objTmp.Index);
List<LocalDefinition> indexLocals = new List<LocalDefinition>();
- for (int i = 0; i < arguments.Count; i++)
+ for (int i = 0; i < arguments.ArgumentCount; i++)
{
- Compile(arguments[i]);
+ var arg = arguments.GetArgument(i);
+ Compile(arg);
- var argTmp = _locals.DefineLocal(Expression.Parameter(arguments[i].Type), _instructions.Count);
+ var argTmp = _locals.DefineLocal(Expression.Parameter(arg.Type), _instructions.Count);
_instructions.EmitDup();
_instructions.EmitStoreLocal(argTmp.Index);
@@ -2380,9 +2386,11 @@ namespace System.Linq.Expressions.Interpreter
for (int i = 0; i < parameters.Length; i++)
{
+ var arg = node.GetArgument(i);
+
if (parameters[i].ParameterType.IsByRef)
{
- var updater = CompileAddress(node.Arguments[i], i);
+ var updater = CompileAddress(arg, i);
if (updater != null)
{
if (updaters == null)
@@ -2394,7 +2402,7 @@ namespace System.Linq.Expressions.Interpreter
}
else
{
- Compile(node.Arguments[i]);
+ Compile(arg);
}
}
@@ -2611,19 +2619,17 @@ namespace System.Linq.Expressions.Interpreter
var compMethod = node.Expression.Type.GetMethod("Compile", Array.Empty<Type>());
CompileMethodCallExpression(
Expression.Call(
- Expression.Call(
- node.Expression,
- compMethod
- ),
- compMethod.ReturnType.GetMethod("Invoke"),
- node.Arguments
- )
+ node.Expression,
+ compMethod
+ ),
+ compMethod.ReturnType.GetMethod("Invoke"),
+ node
);
}
else
{
CompileMethodCallExpression(
- Expression.Call(node.Expression, node.Expression.Type.GetMethod("Invoke"), node.Arguments)
+ node.Expression, node.Expression.Type.GetMethod("Invoke"), node
);
}
}
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/InvocationExpression.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/InvocationExpression.cs
index 94486176f0..3e0a32a2f7 100644
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/InvocationExpression.cs
+++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/InvocationExpression.cs
@@ -524,7 +524,7 @@ namespace System.Linq.Expressions
ValidateArgumentCount(method, ExpressionType.Invoke, 1, pis);
- arg0 = ValidateOneArgument(method, ExpressionType.Invoke, arg0, pis[0]);
+ arg0 = ValidateOneArgument(method, ExpressionType.Invoke, arg0, pis[0], nameof(expression), nameof(arg0));
return new InvocationExpression1(expression, method.ReturnType, arg0);
}
@@ -564,8 +564,8 @@ namespace System.Linq.Expressions
ValidateArgumentCount(method, ExpressionType.Invoke, 2, pis);
- arg0 = ValidateOneArgument(method, ExpressionType.Invoke, arg0, pis[0]);
- arg1 = ValidateOneArgument(method, ExpressionType.Invoke, arg1, pis[1]);
+ arg0 = ValidateOneArgument(method, ExpressionType.Invoke, arg0, pis[0], nameof(expression), nameof(arg0));
+ arg1 = ValidateOneArgument(method, ExpressionType.Invoke, arg1, pis[1], nameof(expression), nameof(arg1));
return new InvocationExpression2(expression, method.ReturnType, arg0, arg1);
}
@@ -609,9 +609,9 @@ namespace System.Linq.Expressions
ValidateArgumentCount(method, ExpressionType.Invoke, 3, pis);
- arg0 = ValidateOneArgument(method, ExpressionType.Invoke, arg0, pis[0]);
- arg1 = ValidateOneArgument(method, ExpressionType.Invoke, arg1, pis[1]);
- arg2 = ValidateOneArgument(method, ExpressionType.Invoke, arg2, pis[2]);
+ arg0 = ValidateOneArgument(method, ExpressionType.Invoke, arg0, pis[0], nameof(expression), nameof(arg0));
+ arg1 = ValidateOneArgument(method, ExpressionType.Invoke, arg1, pis[1], nameof(expression), nameof(arg1));
+ arg2 = ValidateOneArgument(method, ExpressionType.Invoke, arg2, pis[2], nameof(expression), nameof(arg2));
return new InvocationExpression3(expression, method.ReturnType, arg0, arg1, arg2);
}
@@ -658,10 +658,10 @@ namespace System.Linq.Expressions
ValidateArgumentCount(method, ExpressionType.Invoke, 4, pis);
- arg0 = ValidateOneArgument(method, ExpressionType.Invoke, arg0, pis[0]);
- arg1 = ValidateOneArgument(method, ExpressionType.Invoke, arg1, pis[1]);
- arg2 = ValidateOneArgument(method, ExpressionType.Invoke, arg2, pis[2]);
- arg3 = ValidateOneArgument(method, ExpressionType.Invoke, arg3, pis[3]);
+ arg0 = ValidateOneArgument(method, ExpressionType.Invoke, arg0, pis[0], nameof(expression), nameof(arg0));
+ arg1 = ValidateOneArgument(method, ExpressionType.Invoke, arg1, pis[1], nameof(expression), nameof(arg1));
+ arg2 = ValidateOneArgument(method, ExpressionType.Invoke, arg2, pis[2], nameof(expression), nameof(arg2));
+ arg3 = ValidateOneArgument(method, ExpressionType.Invoke, arg3, pis[3], nameof(expression), nameof(arg3));
return new InvocationExpression4(expression, method.ReturnType, arg0, arg1, arg2, arg3);
}
@@ -711,11 +711,11 @@ namespace System.Linq.Expressions
ValidateArgumentCount(method, ExpressionType.Invoke, 5, pis);
- arg0 = ValidateOneArgument(method, ExpressionType.Invoke, arg0, pis[0]);
- arg1 = ValidateOneArgument(method, ExpressionType.Invoke, arg1, pis[1]);
- arg2 = ValidateOneArgument(method, ExpressionType.Invoke, arg2, pis[2]);
- arg3 = ValidateOneArgument(method, ExpressionType.Invoke, arg3, pis[3]);
- arg4 = ValidateOneArgument(method, ExpressionType.Invoke, arg4, pis[4]);
+ arg0 = ValidateOneArgument(method, ExpressionType.Invoke, arg0, pis[0], nameof(expression), nameof(arg0));
+ arg1 = ValidateOneArgument(method, ExpressionType.Invoke, arg1, pis[1], nameof(expression), nameof(arg1));
+ arg2 = ValidateOneArgument(method, ExpressionType.Invoke, arg2, pis[2], nameof(expression), nameof(arg2));
+ arg3 = ValidateOneArgument(method, ExpressionType.Invoke, arg3, pis[3], nameof(expression), nameof(arg3));
+ arg4 = ValidateOneArgument(method, ExpressionType.Invoke, arg4, pis[4], nameof(expression), nameof(arg4));
return new InvocationExpression5(expression, method.ReturnType, arg0, arg1, arg2, arg3, arg4);
}
@@ -793,7 +793,7 @@ namespace System.Linq.Expressions
var args = argumentList.ToReadOnly(); // Ensure is TrueReadOnlyCollection when count > 5. Returns fast if it already is.
var mi = GetInvokeMethod(expression);
- ValidateArgumentTypes(mi, ExpressionType.Invoke, ref args);
+ ValidateArgumentTypes(mi, ExpressionType.Invoke, ref args, nameof(expression));
return new InvocationExpressionN(expression, args, mi.ReturnType);
}
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberExpression.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberExpression.cs
index 9331fb33af..2561928a9c 100644
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberExpression.cs
+++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/MemberExpression.cs
@@ -179,6 +179,7 @@ namespace System.Linq.Expressions
public static MemberExpression Field(Expression expression, string fieldName)
{
RequiresCanRead(expression, nameof(expression));
+ ContractUtils.RequiresNotNull(fieldName, nameof(fieldName));
// bind to public names first
FieldInfo fi = expression.Type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy);
@@ -293,12 +294,12 @@ namespace System.Linq.Expressions
}
else if (mi.GetParametersCached().Length != 1)
{
- throw Error.IncorrectNumberOfMethodCallArguments(mi);
+ throw Error.IncorrectNumberOfMethodCallArguments(mi, nameof(property));
}
}
else if (mi.GetParametersCached().Length != 0)
{
- throw Error.IncorrectNumberOfMethodCallArguments(mi);
+ throw Error.IncorrectNumberOfMethodCallArguments(mi, nameof(property));
}
if (mi.IsStatic)
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/MethodCallExpression.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/MethodCallExpression.cs
index e5a6a2ad8a..bcff4ad2bc 100644
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/MethodCallExpression.cs
+++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/MethodCallExpression.cs
@@ -730,7 +730,7 @@ namespace System.Linq.Expressions
ValidateArgumentCount(method, ExpressionType.Call, 1, pis);
- arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0]);
+ arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0], nameof(method), nameof(arg0));
return new MethodCallExpression1(method, arg0);
}
@@ -752,8 +752,8 @@ namespace System.Linq.Expressions
ValidateArgumentCount(method, ExpressionType.Call, 2, pis);
- arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0]);
- arg1 = ValidateOneArgument(method, ExpressionType.Call, arg1, pis[1]);
+ arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0], nameof(method), nameof(arg0));
+ arg1 = ValidateOneArgument(method, ExpressionType.Call, arg1, pis[1], nameof(method), nameof(arg1));
return new MethodCallExpression2(method, arg0, arg1);
}
@@ -777,9 +777,9 @@ namespace System.Linq.Expressions
ValidateArgumentCount(method, ExpressionType.Call, 3, pis);
- arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0]);
- arg1 = ValidateOneArgument(method, ExpressionType.Call, arg1, pis[1]);
- arg2 = ValidateOneArgument(method, ExpressionType.Call, arg2, pis[2]);
+ arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0], nameof(method), nameof(arg0));
+ arg1 = ValidateOneArgument(method, ExpressionType.Call, arg1, pis[1], nameof(method), nameof(arg1));
+ arg2 = ValidateOneArgument(method, ExpressionType.Call, arg2, pis[2], nameof(method), nameof(arg2));
return new MethodCallExpression3(method, arg0, arg1, arg2);
}
@@ -805,10 +805,10 @@ namespace System.Linq.Expressions
ValidateArgumentCount(method, ExpressionType.Call, 4, pis);
- arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0]);
- arg1 = ValidateOneArgument(method, ExpressionType.Call, arg1, pis[1]);
- arg2 = ValidateOneArgument(method, ExpressionType.Call, arg2, pis[2]);
- arg3 = ValidateOneArgument(method, ExpressionType.Call, arg3, pis[3]);
+ arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0], nameof(method), nameof(arg0));
+ arg1 = ValidateOneArgument(method, ExpressionType.Call, arg1, pis[1], nameof(method), nameof(arg1));
+ arg2 = ValidateOneArgument(method, ExpressionType.Call, arg2, pis[2], nameof(method), nameof(arg2));
+ arg3 = ValidateOneArgument(method, ExpressionType.Call, arg3, pis[3], nameof(method), nameof(arg3));
return new MethodCallExpression4(method, arg0, arg1, arg2, arg3);
}
@@ -837,11 +837,11 @@ namespace System.Linq.Expressions
ValidateArgumentCount(method, ExpressionType.Call, 5, pis);
- arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0]);
- arg1 = ValidateOneArgument(method, ExpressionType.Call, arg1, pis[1]);
- arg2 = ValidateOneArgument(method, ExpressionType.Call, arg2, pis[2]);
- arg3 = ValidateOneArgument(method, ExpressionType.Call, arg3, pis[3]);
- arg4 = ValidateOneArgument(method, ExpressionType.Call, arg4, pis[4]);
+ arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0], nameof(method), nameof(arg0));
+ arg1 = ValidateOneArgument(method, ExpressionType.Call, arg1, pis[1], nameof(method), nameof(arg1));
+ arg2 = ValidateOneArgument(method, ExpressionType.Call, arg2, pis[2], nameof(method), nameof(arg2));
+ arg3 = ValidateOneArgument(method, ExpressionType.Call, arg3, pis[3], nameof(method), nameof(arg3));
+ arg4 = ValidateOneArgument(method, ExpressionType.Call, arg4, pis[4], nameof(method), nameof(arg4));
return new MethodCallExpression5(method, arg0, arg1, arg2, arg3, arg4);
}
@@ -920,7 +920,7 @@ namespace System.Linq.Expressions
ValidateArgumentCount(method, ExpressionType.Call, 1, pis);
- arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0]);
+ arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0], nameof(method), nameof(arg0));
if (instance != null)
{
@@ -948,8 +948,8 @@ namespace System.Linq.Expressions
ValidateArgumentCount(method, ExpressionType.Call, 2, pis);
- arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0]);
- arg1 = ValidateOneArgument(method, ExpressionType.Call, arg1, pis[1]);
+ arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0], nameof(method), nameof(arg0));
+ arg1 = ValidateOneArgument(method, ExpressionType.Call, arg1, pis[1], nameof(method), nameof(arg1));
if (instance != null)
{
@@ -979,9 +979,9 @@ namespace System.Linq.Expressions
ValidateArgumentCount(method, ExpressionType.Call, 3, pis);
- arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0]);
- arg1 = ValidateOneArgument(method, ExpressionType.Call, arg1, pis[1]);
- arg2 = ValidateOneArgument(method, ExpressionType.Call, arg2, pis[2]);
+ arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0], nameof(method), nameof(arg0));
+ arg1 = ValidateOneArgument(method, ExpressionType.Call, arg1, pis[1], nameof(method), nameof(arg1));
+ arg2 = ValidateOneArgument(method, ExpressionType.Call, arg2, pis[2], nameof(method), nameof(arg2));
if (instance != null)
{
@@ -1084,7 +1084,7 @@ namespace System.Linq.Expressions
ValidateMethodInfo(method, nameof(method));
ValidateStaticOrInstanceMethod(instance, method);
- ValidateArgumentTypes(method, ExpressionType.Call, ref argList);
+ ValidateArgumentTypes(method, ExpressionType.Call, ref argList, nameof(method));
if (instance == null)
{
@@ -1126,9 +1126,9 @@ namespace System.Linq.Expressions
}
}
- public static void ValidateArgumentTypes(MethodBase method, ExpressionType nodeKind, ref ReadOnlyCollection<Expression> arguments)
+ public static void ValidateArgumentTypes(MethodBase method, ExpressionType nodeKind, ref ReadOnlyCollection<Expression> arguments, string methodParamName)
{
- ExpressionUtils.ValidateArgumentTypes(method, nodeKind, ref arguments);
+ ExpressionUtils.ValidateArgumentTypes(method, nodeKind, ref arguments, methodParamName);
}
private static ParameterInfo[] GetParametersForValidation(MethodBase method, ExpressionType nodeKind)
@@ -1141,9 +1141,9 @@ namespace System.Linq.Expressions
ExpressionUtils.ValidateArgumentCount(method, nodeKind, count, pis);
}
- public static Expression ValidateOneArgument(MethodBase method, ExpressionType nodeKind, Expression arg, ParameterInfo pi)
+ public static Expression ValidateOneArgument(MethodBase method, ExpressionType nodeKind, Expression arg, ParameterInfo pi, string methodParamName, string argumentParamName)
{
- return ExpressionUtils.ValidateOneArgument(method, nodeKind, arg, pi);
+ return ExpressionUtils.ValidateOneArgument(method, nodeKind, arg, pi, methodParamName, argumentParamName);
}
// Attempts to auto-quote the expression tree. Returns true if it succeeded, false otherwise.
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/NewExpression.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/NewExpression.cs
index 8faa8e8b93..4a2ee8c9d6 100644
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/NewExpression.cs
+++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/NewExpression.cs
@@ -167,7 +167,7 @@ namespace System.Linq.Expressions
TypeUtils.ValidateType(constructor.DeclaringType, nameof(constructor));
ValidateConstructor(constructor, nameof(constructor));
var argList = arguments.ToReadOnly();
- ValidateArgumentTypes(constructor, ExpressionType.New, ref argList);
+ ValidateArgumentTypes(constructor, ExpressionType.New, ref argList, nameof(constructor));
return new NewExpression(constructor, argList, null);
}
@@ -250,15 +250,15 @@ namespace System.Linq.Expressions
for (int i = 0, n = arguments.Count; i < n; i++)
{
Expression arg = arguments[i];
- RequiresCanRead(arg, "argument");
+ RequiresCanRead(arg, nameof(arguments));
MemberInfo member = members[i];
- ContractUtils.RequiresNotNull(member, nameof(member));
+ ContractUtils.RequiresNotNull(member, nameof(members));
if (!TypeUtils.AreEquivalent(member.DeclaringType, constructor.DeclaringType))
{
- throw Error.ArgumentMemberNotDeclOnType(member.Name, constructor.DeclaringType.Name);
+ throw Error.ArgumentMemberNotDeclOnType(member.Name, constructor.DeclaringType.Name, nameof(members));
}
Type memberType;
- ValidateAnonymousTypeMember(ref member, out memberType);
+ ValidateAnonymousTypeMember(ref member, out memberType, nameof(members));
if (!TypeUtils.AreReferenceAssignable(memberType, arg.Type))
{
if (!TryQuote(memberType, ref arg))
@@ -276,7 +276,7 @@ namespace System.Linq.Expressions
{
if (!TryQuote(pType, ref arg))
{
- throw Error.ExpressionTypeDoesNotMatchConstructorParameter(arg.Type, pType);
+ throw Error.ExpressionTypeDoesNotMatchConstructorParameter(arg.Type, pType, nameof(arguments));
}
}
if (newArguments == null && arg != arguments[i])
@@ -325,14 +325,14 @@ namespace System.Linq.Expressions
}
- private static void ValidateAnonymousTypeMember(ref MemberInfo member, out Type memberType)
+ private static void ValidateAnonymousTypeMember(ref MemberInfo member, out Type memberType, string paramName)
{
FieldInfo field = member as FieldInfo;
if (field != null)
{
if (field.IsStatic)
{
- throw Error.ArgumentMustBeInstanceMember(nameof(member));
+ throw Error.ArgumentMustBeInstanceMember(paramName);
}
memberType = field.FieldType;
return;
@@ -343,11 +343,11 @@ namespace System.Linq.Expressions
{
if (!pi.CanRead)
{
- throw Error.PropertyDoesNotHaveGetter(pi, nameof(member));
+ throw Error.PropertyDoesNotHaveGetter(pi, paramName);
}
if (pi.GetGetMethod().IsStatic)
{
- throw Error.ArgumentMustBeInstanceMember(nameof(member));
+ throw Error.ArgumentMustBeInstanceMember(paramName);
}
memberType = pi.PropertyType;
return;
@@ -358,15 +358,15 @@ namespace System.Linq.Expressions
{
if (method.IsStatic)
{
- throw Error.ArgumentMustBeInstanceMember(nameof(member));
+ throw Error.ArgumentMustBeInstanceMember(paramName);
}
- PropertyInfo prop = GetProperty(method, nameof(member));
+ PropertyInfo prop = GetProperty(method, paramName);
member = prop;
memberType = prop.PropertyType;
return;
}
- throw Error.ArgumentMustBeFieldInfoOrPropertyInfoOrMethod(nameof(member));
+ throw Error.ArgumentMustBeFieldInfoOrPropertyInfoOrMethod(paramName);
}
private static void ValidateConstructor(ConstructorInfo constructor, string paramName)
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/SwitchExpression.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/SwitchExpression.cs
index 9c8b9162e3..4830531ae2 100644
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/SwitchExpression.cs
+++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/SwitchExpression.cs
@@ -222,7 +222,7 @@ namespace System.Linq.Expressions
var pms = comparison.GetParametersCached();
if (pms.Length != 2)
{
- throw Error.IncorrectNumberOfMethodCallArguments(comparison);
+ throw Error.IncorrectNumberOfMethodCallArguments(comparison, nameof(comparison));
}
// Validate that the switch value's type matches the comparison method's
// left hand side parameter type.
diff --git a/src/System.Linq.Expressions/src/System/Linq/Expressions/UnaryExpression.cs b/src/System.Linq.Expressions/src/System/Linq/Expressions/UnaryExpression.cs
index 87d9c80835..65170aa275 100644
--- a/src/System.Linq.Expressions/src/System/Linq/Expressions/UnaryExpression.cs
+++ b/src/System.Linq.Expressions/src/System/Linq/Expressions/UnaryExpression.cs
@@ -255,7 +255,7 @@ namespace System.Linq.Expressions
bool prefix = IsPrefix;
var index = (IndexExpression)_operand;
- int count = index.Arguments.Count;
+ int count = index.ArgumentCount;
var block = new Expression[count + (prefix ? 2 : 4)];
var temps = new ParameterExpression[count + (prefix ? 1 : 2)];
var args = new ParameterExpression[count];
@@ -266,7 +266,7 @@ namespace System.Linq.Expressions
i++;
while (i <= count)
{
- var arg = index.Arguments[i - 1];
+ var arg = index.GetArgument(i - 1);
args[i - 1] = temps[i] = Parameter(arg.Type, null);
block[i] = Assign(temps[i], arg);
i++;
@@ -423,7 +423,7 @@ namespace System.Linq.Expressions
ValidateOperator(method, nameof(method));
ParameterInfo[] pms = method.GetParametersCached();
if (pms.Length != 1)
- throw Error.IncorrectNumberOfMethodCallArguments(method);
+ throw Error.IncorrectNumberOfMethodCallArguments(method, nameof(method));
if (ParameterIsAssignable(pms[0], operand.Type))
{
ValidateParamswithOperandsOrThrow(pms[0].ParameterType, operand.Type, unaryType, method.Name);
@@ -470,7 +470,7 @@ namespace System.Linq.Expressions
ParameterInfo[] pms = method.GetParametersCached();
if (pms.Length != 1)
{
- throw Error.IncorrectNumberOfMethodCallArguments(method);
+ throw Error.IncorrectNumberOfMethodCallArguments(method, nameof(method));
}
if (ParameterIsAssignable(pms[0], operand.Type) && TypeUtils.AreEquivalent(method.ReturnType, convertToType))
{
diff --git a/src/System.Linq.Expressions/tests/BinaryOperators/Coalesce/BinaryCoalesceTests.cs b/src/System.Linq.Expressions/tests/BinaryOperators/Coalesce/BinaryCoalesceTests.cs
index 9fd0a5ed32..dae30c0421 100644
--- a/src/System.Linq.Expressions/tests/BinaryOperators/Coalesce/BinaryCoalesceTests.cs
+++ b/src/System.Linq.Expressions/tests/BinaryOperators/Coalesce/BinaryCoalesceTests.cs
@@ -2,417 +2,82 @@
// 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.Collections.Generic;
using Xunit;
namespace System.Linq.Expressions.Tests
{
public static class BinaryCoalesceTests
{
- #region Test methods
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckBoolCoalesceTest(bool useInterpreter)
- {
- bool?[] array1 = new bool?[] { null, true, false };
- bool[] array2 = new bool[] { true, false };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyBoolCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckByteCoalesceTest(bool useInterpreter)
- {
- byte?[] array1 = new byte?[] { null, 0, 1, byte.MaxValue };
- byte[] array2 = new byte[] { 0, 1, byte.MaxValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyByteCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckCustomCoalesceTest(bool useInterpreter)
- {
- C[] array1 = new C[] { null, new C(), new D(), new D(0), new D(5) };
- C[] array2 = new C[] { null, new C(), new D(), new D(0), new D(5) };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyCustomCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckCharCoalesceTest(bool useInterpreter)
- {
- char?[] array1 = new char?[] { null, '\0', '\b', 'A', '\uffff' };
- char[] array2 = new char[] { '\0', '\b', 'A', '\uffff' };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyCharCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckCustom2CoalesceTest(bool useInterpreter)
- {
- D[] array1 = new D[] { null, new D(), new D(0), new D(5) };
- D[] array2 = new D[] { null, new D(), new D(0), new D(5) };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyCustom2Coalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckDecimalCoalesceTest(bool useInterpreter)
- {
- decimal?[] array1 = new decimal?[] { null, decimal.Zero, decimal.One, decimal.MinusOne, decimal.MinValue, decimal.MaxValue };
- decimal[] array2 = new decimal[] { decimal.Zero, decimal.One, decimal.MinusOne, decimal.MinValue, decimal.MaxValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyDecimalCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckDelegateCoalesceTest(bool useInterpreter)
- {
- Delegate[] array1 = new Delegate[] { null, (Func<object>)delegate () { return null; }, (Func<int, int>)delegate (int i) { return i + 1; }, (Action<object>)delegate { } };
- Delegate[] array2 = new Delegate[] { null, (Func<object>)delegate () { return null; }, (Func<int, int>)delegate (int i) { return i + 1; }, (Action<object>)delegate { } };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyDelegateCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckDoubleCoalesceTest(bool useInterpreter)
- {
- double?[] array1 = new double?[] { null, 0, 1, -1, double.MinValue, double.MaxValue, double.Epsilon, double.NegativeInfinity, double.PositiveInfinity, double.NaN };
- double[] array2 = new double[] { 0, 1, -1, double.MinValue, double.MaxValue, double.Epsilon, double.NegativeInfinity, double.PositiveInfinity, double.NaN };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyDoubleCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckEnumCoalesceTest(bool useInterpreter)
- {
- E?[] array1 = new E?[] { null, (E)0, E.A, E.B, (E)int.MaxValue, (E)int.MinValue };
- E[] array2 = new E[] { (E)0, E.A, E.B, (E)int.MaxValue, (E)int.MinValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyEnumCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckEnumLongCoalesceTest(bool useInterpreter)
- {
- El?[] array1 = new El?[] { null, (El)0, El.A, El.B, (El)long.MaxValue, (El)long.MinValue };
- El[] array2 = new El[] { (El)0, El.A, El.B, (El)long.MaxValue, (El)long.MinValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyEnumLongCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckFloatCoalesceTest(bool useInterpreter)
- {
- float?[] array1 = new float?[] { null, 0, 1, -1, float.MinValue, float.MaxValue, float.Epsilon, float.NegativeInfinity, float.PositiveInfinity, float.NaN };
- float[] array2 = new float[] { 0, 1, -1, float.MinValue, float.MaxValue, float.Epsilon, float.NegativeInfinity, float.PositiveInfinity, float.NaN };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyFloatCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckFuncCoalesceTest(bool useInterpreter)
- {
- Func<object>[] array1 = new Func<object>[] { null, (Func<object>)delegate () { return null; } };
- Func<object>[] array2 = new Func<object>[] { null, (Func<object>)delegate () { return null; } };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyFuncCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckInterfaceCoalesceTest(bool useInterpreter)
- {
- I[] array1 = new I[] { null, new C(), new D(), new D(0), new D(5) };
- I[] array2 = new I[] { null, new C(), new D(), new D(0), new D(5) };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyInterfaceCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckIEquatableCustomCoalesceTest(bool useInterpreter)
- {
- IEquatable<C>[] array1 = new IEquatable<C>[] { null, new C(), new D(), new D(0), new D(5) };
- IEquatable<C>[] array2 = new IEquatable<C>[] { null, new C(), new D(), new D(0), new D(5) };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyIEquatableCustomCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckIEquatableCustom2CoalesceTest(bool useInterpreter)
- {
- IEquatable<D>[] array1 = new IEquatable<D>[] { null, new D(), new D(0), new D(5) };
- IEquatable<D>[] array2 = new IEquatable<D>[] { null, new D(), new D(0), new D(5) };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyIEquatableCustom2Coalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckIntCoalesceTest(bool useInterpreter)
- {
- int?[] array1 = new int?[] { null, 0, 1, -1, int.MinValue, int.MaxValue };
- int[] array2 = new int[] { 0, 1, -1, int.MinValue, int.MaxValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyIntCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckLongCoalesceTest(bool useInterpreter)
- {
- long?[] array1 = new long?[] { null, 0, 1, -1, long.MinValue, long.MaxValue };
- long[] array2 = new long[] { 0, 1, -1, long.MinValue, long.MaxValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyLongCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckObjectCoalesceTest(bool useInterpreter)
- {
- object[] array1 = new object[] { null, new object(), new C(), new D(3) };
- object[] array2 = new object[] { null, new object(), new C(), new D(3) };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyObjectCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckStructCoalesceTest(bool useInterpreter)
- {
- S?[] array1 = new S?[] { null, default(S), new S() };
- S[] array2 = new S[] { default(S), new S() };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyStructCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckSByteCoalesceTest(bool useInterpreter)
- {
- sbyte?[] array1 = new sbyte?[] { null, 0, 1, -1, sbyte.MinValue, sbyte.MaxValue };
- sbyte[] array2 = new sbyte[] { 0, 1, -1, sbyte.MinValue, sbyte.MaxValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifySByteCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckStructWithStringCoalesceTest(bool useInterpreter)
- {
- Sc?[] array1 = new Sc?[] { null, default(Sc), new Sc(), new Sc(null) };
- Sc[] array2 = new Sc[] { default(Sc), new Sc(), new Sc(null) };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyStructWithStringCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckStructWithStringAndFieldCoalesceTest(bool useInterpreter)
- {
- Scs?[] array1 = new Scs?[] { null, default(Scs), new Scs(), new Scs(null, new S()) };
- Scs[] array2 = new Scs[] { default(Scs), new Scs(), new Scs(null, new S()) };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyStructWithStringAndFieldCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckShortCoalesceTest(bool useInterpreter)
- {
- short?[] array1 = new short?[] { null, 0, 1, -1, short.MinValue, short.MaxValue };
- short[] array2 = new short[] { 0, 1, -1, short.MinValue, short.MaxValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyShortCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckStructWithTwoValuesCoalesceTest(bool useInterpreter)
- {
- Sp?[] array1 = new Sp?[] { null, default(Sp), new Sp(), new Sp(5, 5.0) };
- Sp[] array2 = new Sp[] { default(Sp), new Sp(), new Sp(5, 5.0) };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyStructWithTwoValuesCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckStructWithValueCoalesceTest(bool useInterpreter)
- {
- Ss?[] array1 = new Ss?[] { null, default(Ss), new Ss(), new Ss(new S()) };
- Ss[] array2 = new Ss[] { default(Ss), new Ss(), new Ss(new S()) };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyStructWithValueCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckStringCoalesceTest(bool useInterpreter)
- {
- string[] array1 = new string[] { null, "", "a", "foo" };
- string[] array2 = new string[] { null, "", "a", "foo" };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyStringCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckUIntCoalesceTest(bool useInterpreter)
- {
- uint?[] array1 = new uint?[] { null, 0, 1, uint.MaxValue };
- uint[] array2 = new uint[] { 0, 1, uint.MaxValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyUIntCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckULongCoalesceTest(bool useInterpreter)
- {
- ulong?[] array1 = new ulong?[] { null, 0, 1, ulong.MaxValue };
- ulong[] array2 = new ulong[] { 0, 1, ulong.MaxValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyULongCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckUShortCoalesceTest(bool useInterpreter)
- {
- ushort?[] array1 = new ushort?[] { null, 0, 1, ushort.MaxValue };
- ushort[] array2 = new ushort[] { 0, 1, ushort.MaxValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyUShortCoalesce(array1[i], array2[j], useInterpreter);
+ public static IEnumerable<object[]> TestData()
+ {
+ foreach (bool useInterpreter in new bool[] { true, false })
+ {
+ yield return new object[] { new bool?[] { null, true, false }, new bool[] { true, false }, useInterpreter };
+ yield return new object[] { new byte?[] { null, 0, 1, byte.MaxValue }, new byte[] { 0, 1, byte.MaxValue }, useInterpreter };
+ yield return new object[] { new C[] { null, new C(), new D(), new D(0), new D(5) }, new C[] { null, new C(), new D(), new D(0), new D(5) }, useInterpreter };
+ yield return new object[] { new char?[] { null, '\0', '\b', 'A', '\uffff' }, new char[] { '\0', '\b', 'A', '\uffff' }, useInterpreter };
+ yield return new object[] { new D[] { null, new D(), new D(0), new D(5) }, new D[] { null, new D(), new D(0), new D(5) }, useInterpreter };
+ yield return new object[] { new decimal?[] { null, decimal.Zero, decimal.One, decimal.MinusOne, decimal.MinValue, decimal.MaxValue }, new decimal[] { decimal.Zero, decimal.One, decimal.MinusOne, decimal.MinValue, decimal.MaxValue }, useInterpreter };
+ yield return new object[] { new Delegate[] { null, (Func<object>)delegate () { return null; }, (Func<int, int>)delegate (int i) { return i + 1; }, (Action<object>)delegate { } }, new Delegate[] { null, (Func<object>)delegate () { return null; }, (Func<int, int>)delegate (int i) { return i + 1; }, (Action<object>)delegate { } }, useInterpreter };
+ yield return new object[] { new double?[] { null, 0, 1, -1, double.MinValue, double.MaxValue, double.Epsilon, double.NegativeInfinity, double.PositiveInfinity, double.NaN }, new double[] { 0, 1, -1, double.MinValue, double.MaxValue, double.Epsilon, double.NegativeInfinity, double.PositiveInfinity, double.NaN }, useInterpreter};
+ yield return new object[] { new E?[] { null, 0, E.A, E.B, (E)int.MaxValue, (E)int.MinValue }, new E[] { 0, E.A, E.B, (E)int.MaxValue, (E)int.MinValue }, useInterpreter };
+ yield return new object[] { new El?[] { null, 0, El.A, El.B, (El)long.MaxValue, (El)long.MinValue }, new El[] { 0, El.A, El.B, (El)long.MaxValue, (El)long.MinValue }, useInterpreter };
+ yield return new object[] { new float?[] { null, 0, 1, -1, float.MinValue, float.MaxValue, float.Epsilon, float.NegativeInfinity, float.PositiveInfinity, float.NaN }, new float[] { 0, 1, -1, float.MinValue, float.MaxValue, float.Epsilon, float.NegativeInfinity, float.PositiveInfinity, float.NaN }, useInterpreter };
+ yield return new object[] { new Func<object>[] { null, delegate () { return null; } }, new Func<object>[] { null, delegate () { return null; } }, useInterpreter };
+ yield return new object[] { new I[] { null, new C(), new D(), new D(0), new D(5) }, new I[] { null, new C(), new D(), new D(0), new D(5) }, useInterpreter };
+ yield return new object[] { new IEquatable<C>[] { null, new C(), new D(), new D(0), new D(5) }, new IEquatable<C>[] { null, new C(), new D(), new D(0), new D(5) }, useInterpreter };
+ yield return new object[] { new IEquatable<D>[] { null, new D(), new D(0), new D(5) }, new IEquatable<D>[] { null, new D(), new D(0), new D(5) }, useInterpreter };
+ yield return new object[] { new int?[] { null, 0, 1, -1, int.MinValue, int.MaxValue }, new int[] { 0, 1, -1, int.MinValue, int.MaxValue }, useInterpreter };
+ yield return new object[] { new long?[] { null, 0, 1, -1, long.MinValue, long.MaxValue }, new long[] { 0, 1, -1, long.MinValue, long.MaxValue }, useInterpreter };
+ yield return new object[] { new object[] { null, new object(), new C(), new D(3) }, new object[] { null, new object(), new C(), new D(3) }, useInterpreter };
+ yield return new object[] { new S?[] { null, default(S), new S() }, new S[] { default(S), new S() }, useInterpreter };
+ yield return new object[] { new sbyte?[] { null, 0, 1, -1, sbyte.MinValue, sbyte.MaxValue }, new sbyte[] { 0, 1, -1, sbyte.MinValue, sbyte.MaxValue }, useInterpreter };
+ yield return new object[] { new Sc?[] { null, default(Sc), new Sc(), new Sc(null) }, new Sc[] { default(Sc), new Sc(), new Sc(null) }, useInterpreter };
+ yield return new object[] { new Scs?[] { null, default(Scs), new Scs(), new Scs(null, new S()) }, new Scs[] { default(Scs), new Scs(), new Scs(null, new S()) }, useInterpreter };
+ yield return new object[] { new short?[] { null, 0, 1, -1, short.MinValue, short.MaxValue }, new short[] { 0, 1, -1, short.MinValue, short.MaxValue }, useInterpreter };
+ yield return new object[] { new Sp?[] { null, default(Sp), new Sp(), new Sp(5, 5.0) }, new Sp[] { default(Sp), new Sp(), new Sp(5, 5.0) }, useInterpreter };
+ yield return new object[] { new Ss?[] { null, default(Ss), new Ss(), new Ss(new S()) }, new Ss[] { default(Ss), new Ss(), new Ss(new S()) }, useInterpreter };
+ yield return new object[] { new string[] { null, "", "a", "foo" }, new string[] { null, "", "a", "foo" }, useInterpreter };
+ yield return new object[] { new uint?[] { null, 0, 1, uint.MaxValue }, new uint[] { 0, 1, uint.MaxValue }, useInterpreter };
+ yield return new object[] { new ulong?[] { null, 0, 1, ulong.MaxValue }, new ulong[] { 0, 1, ulong.MaxValue }, useInterpreter };
+ yield return new object[] { new ushort?[] { null, 0, 1, ushort.MaxValue }, new ushort[] { 0, 1, ushort.MaxValue }, useInterpreter };
+ yield return new object[] { new string[] { null, "", "a", "foo" }, new string[] { null, "", "a", "foo" }, useInterpreter };
+
+ yield return new object[] { new bool?[] { null, true, false }, new bool?[] { null, true, false }, useInterpreter };
+ yield return new object[] { new byte?[] { null, 0, 1, byte.MaxValue }, new byte?[] { null, 0, 1, byte.MaxValue }, useInterpreter };
+ yield return new object[] { new char?[] { null, '\0', '\b', 'A', '\uffff' }, new char?[] { null, '\0', '\b', 'A', '\uffff' }, useInterpreter };
+ yield return new object[] { new decimal?[] { null, decimal.Zero, decimal.One, decimal.MinusOne, decimal.MinValue, decimal.MaxValue }, new decimal?[] { null, decimal.Zero, decimal.One, decimal.MinusOne, decimal.MinValue, decimal.MaxValue }, useInterpreter };
+ yield return new object[] { new double?[] { null, 0, 1, -1, double.MinValue, double.MaxValue, double.Epsilon, double.NegativeInfinity, double.PositiveInfinity, double.NaN }, new double?[] { null, 0, 1, -1, double.MinValue, double.MaxValue, double.Epsilon, double.NegativeInfinity, double.PositiveInfinity, double.NaN }, useInterpreter };
+ yield return new object[] { new E?[] { null, (E)0, E.A, E.B, (E)int.MaxValue, (E)int.MinValue }, new E?[] { null, (E)0, E.A, E.B, (E)int.MaxValue, (E)int.MinValue }, useInterpreter };
+ yield return new object[] { new El?[] { null, (El)0, El.A, El.B, (El)long.MaxValue, (El)long.MinValue }, new El?[] { null, (El)0, El.A, El.B, (El)long.MaxValue, (El)long.MinValue }, useInterpreter };
+ yield return new object[] { new float?[] { null, 0, 1, -1, float.MinValue, float.MaxValue, float.Epsilon, float.NegativeInfinity, float.PositiveInfinity, float.NaN }, new float?[] { null, 0, 1, -1, float.MinValue, float.MaxValue, float.Epsilon, float.NegativeInfinity, float.PositiveInfinity, float.NaN }, useInterpreter };
+ yield return new object[] { new int?[] { null, 0, 1, -1, int.MinValue, int.MaxValue }, new int?[] { null, 0, 1, -1, int.MinValue, int.MaxValue }, useInterpreter };
+ yield return new object[] { new long?[] { null, 0, 1, -1, long.MinValue, long.MaxValue }, new long?[] { null, 0, 1, -1, long.MinValue, long.MaxValue }, useInterpreter };
+ yield return new object[] { new S?[] { null, default(S), new S() }, new S?[] { null, default(S), new S() }, useInterpreter };
+ yield return new object[] { new sbyte?[] { null, 0, 1, -1, sbyte.MinValue, sbyte.MaxValue }, new sbyte?[] { null, 0, 1, -1, sbyte.MinValue, sbyte.MaxValue }, useInterpreter };
+ yield return new object[] { new Sc?[] { null, default(Sc), new Sc(), new Sc(null) }, new Sc?[] { null, default(Sc), new Sc(), new Sc(null) }, useInterpreter };
+ yield return new object[] { new Scs?[] { null, default(Scs), new Scs(), new Scs(null, new S()) }, new Scs?[] { null, default(Scs), new Scs(), new Scs(null, new S()) }, useInterpreter };
+ yield return new object[] { new short?[] { null, 0, 1, -1, short.MinValue, short.MaxValue }, new short?[] { null, 0, 1, -1, short.MinValue, short.MaxValue }, useInterpreter };
+ yield return new object[] { new Sp?[] { null, default(Sp), new Sp(), new Sp(5, 5.0) }, new Sp?[] { null, default(Sp), new Sp(), new Sp(5, 5.0) }, useInterpreter };
+ yield return new object[] { new Ss?[] { null, default(Ss), new Ss(), new Ss(new S()) }, new Ss?[] { null, default(Ss), new Ss(), new Ss(new S()) }, useInterpreter };
+ yield return new object[] { new uint?[] { null, 0, 1, uint.MaxValue }, new uint?[] { null, 0, 1, uint.MaxValue }, useInterpreter };
+ yield return new object[] { new ulong?[] { null, 0, 1, ulong.MaxValue }, new ulong?[] { null, 0, 1, ulong.MaxValue }, useInterpreter };
+ yield return new object[] { new ushort?[] { null, 0, 1, ushort.MaxValue }, new ushort?[] { null, 0, 1, ushort.MaxValue }, useInterpreter };
+ }
+ }
+
+ [Theory]
+ [MemberData(nameof(TestData))]
+ public static void Coalesce(Array array1, Array array2, bool useInterpreter)
+ {
+ Type type1 = array1.GetType().GetElementType();
+ Type type2 = array2.GetType().GetElementType();
+ for (int i = 0; i < array1.Length; i++)
+ {
+ for (int j = 0; j < array2.Length; j++)
+ {
+ VerifyCoalesce(array1.GetValue(i), type1, array2.GetValue(j), type2, useInterpreter);
}
}
}
@@ -470,20 +135,17 @@ namespace System.Linq.Expressions.Tests
{
CheckGenericWithStructRestrictionCoalesceHelper<Scs>(useInterpreter);
}
-
- #endregion
-
- #region Generic helpers
-
+
private static void CheckGenericWithClassRestrictionCoalesceHelper<Tc>(bool useInterpreter) where Tc : class
{
Tc[] array1 = new Tc[] { null, default(Tc) };
Tc[] array2 = new Tc[] { null, default(Tc) };
+
for (int i = 0; i < array1.Length; i++)
{
for (int j = 0; j < array2.Length; j++)
{
- VerifyGenericWithClassRestrictionCoalesce<Tc>(array1[i], array2[j], useInterpreter);
+ VerifyCoalesce(array1[i], typeof(Tc), array2[j], typeof(Tc), useInterpreter);
}
}
}
@@ -496,7 +158,7 @@ namespace System.Linq.Expressions.Tests
{
for (int j = 0; j < array2.Length; j++)
{
- VerifyGenericWithSubClassRestrictionCoalesce<TC>(array1[i], array2[j], useInterpreter);
+ VerifyCoalesce(array1[i], typeof(TC), array2[j], typeof(TC), useInterpreter);
}
}
}
@@ -509,7 +171,7 @@ namespace System.Linq.Expressions.Tests
{
for (int j = 0; j < array2.Length; j++)
{
- VerifyGenericWithClassAndNewRestrictionCoalesce<Tcn>(array1[i], array2[j], useInterpreter);
+ VerifyCoalesce(array1[i], typeof(Tcn), array2[j], typeof(Tcn), useInterpreter);
}
}
}
@@ -522,7 +184,7 @@ namespace System.Linq.Expressions.Tests
{
for (int j = 0; j < array2.Length; j++)
{
- VerifyGenericWithSubClassAndNewRestrictionCoalesce<TCn>(array1[i], array2[j], useInterpreter);
+ VerifyCoalesce(array1[i], typeof(TCn), array2[j], typeof(TCn), useInterpreter);
}
}
}
@@ -535,459 +197,50 @@ namespace System.Linq.Expressions.Tests
{
for (int j = 0; j < array2.Length; j++)
{
- VerifyGenericWithStructRestrictionCoalesce<Ts>(array1[i], array2[j], useInterpreter);
+ VerifyCoalesce(array1[i], typeof(Ts?), array2[j], typeof(Ts), useInterpreter);
}
}
}
- #endregion
-
- #region Test verifiers
-
- private static void VerifyBoolCoalesce(bool? a, bool b, bool useInterpreter)
- {
- Expression<Func<bool>> e =
- Expression.Lambda<Func<bool>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(bool?)),
- Expression.Constant(b, typeof(bool))),
- Enumerable.Empty<ParameterExpression>());
- Func<bool> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyByteCoalesce(byte? a, byte b, bool useInterpreter)
- {
- Expression<Func<byte>> e =
- Expression.Lambda<Func<byte>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(byte?)),
- Expression.Constant(b, typeof(byte))),
- Enumerable.Empty<ParameterExpression>());
- Func<byte> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyCustomCoalesce(C a, C b, bool useInterpreter)
- {
- Expression<Func<C>> e =
- Expression.Lambda<Func<C>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(C)),
- Expression.Constant(b, typeof(C))),
- Enumerable.Empty<ParameterExpression>());
- Func<C> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyCharCoalesce(char? a, char b, bool useInterpreter)
- {
- Expression<Func<char>> e =
- Expression.Lambda<Func<char>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(char?)),
- Expression.Constant(b, typeof(char))),
- Enumerable.Empty<ParameterExpression>());
- Func<char> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyCustom2Coalesce(D a, D b, bool useInterpreter)
- {
- Expression<Func<D>> e =
- Expression.Lambda<Func<D>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(D)),
- Expression.Constant(b, typeof(D))),
- Enumerable.Empty<ParameterExpression>());
- Func<D> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyDecimalCoalesce(decimal? a, decimal b, bool useInterpreter)
- {
- Expression<Func<decimal>> e =
- Expression.Lambda<Func<decimal>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(decimal?)),
- Expression.Constant(b, typeof(decimal))),
- Enumerable.Empty<ParameterExpression>());
- Func<decimal> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyDelegateCoalesce(Delegate a, Delegate b, bool useInterpreter)
- {
- Expression<Func<Delegate>> e =
- Expression.Lambda<Func<Delegate>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(Delegate)),
- Expression.Constant(b, typeof(Delegate))),
- Enumerable.Empty<ParameterExpression>());
- Func<Delegate> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyDoubleCoalesce(double? a, double b, bool useInterpreter)
- {
- Expression<Func<double>> e =
- Expression.Lambda<Func<double>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(double?)),
- Expression.Constant(b, typeof(double))),
- Enumerable.Empty<ParameterExpression>());
- Func<double> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyEnumCoalesce(E? a, E b, bool useInterpreter)
- {
- Expression<Func<E>> e =
- Expression.Lambda<Func<E>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(E?)),
- Expression.Constant(b, typeof(E))),
- Enumerable.Empty<ParameterExpression>());
- Func<E> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyEnumLongCoalesce(El? a, El b, bool useInterpreter)
- {
- Expression<Func<El>> e =
- Expression.Lambda<Func<El>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(El?)),
- Expression.Constant(b, typeof(El))),
- Enumerable.Empty<ParameterExpression>());
- Func<El> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyFloatCoalesce(float? a, float b, bool useInterpreter)
- {
- Expression<Func<float>> e =
- Expression.Lambda<Func<float>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(float?)),
- Expression.Constant(b, typeof(float))),
- Enumerable.Empty<ParameterExpression>());
- Func<float> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyFuncCoalesce(Func<object> a, Func<object> b, bool useInterpreter)
- {
- Expression<Func<Func<object>>> e =
- Expression.Lambda<Func<Func<object>>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(Func<object>)),
- Expression.Constant(b, typeof(Func<object>))),
- Enumerable.Empty<ParameterExpression>());
- Func<Func<object>> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyInterfaceCoalesce(I a, I b, bool useInterpreter)
- {
- Expression<Func<I>> e =
- Expression.Lambda<Func<I>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(I)),
- Expression.Constant(b, typeof(I))),
- Enumerable.Empty<ParameterExpression>());
- Func<I> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyIEquatableCustomCoalesce(IEquatable<C> a, IEquatable<C> b, bool useInterpreter)
- {
- Expression<Func<IEquatable<C>>> e =
- Expression.Lambda<Func<IEquatable<C>>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(IEquatable<C>)),
- Expression.Constant(b, typeof(IEquatable<C>))),
- Enumerable.Empty<ParameterExpression>());
- Func<IEquatable<C>> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyIEquatableCustom2Coalesce(IEquatable<D> a, IEquatable<D> b, bool useInterpreter)
- {
- Expression<Func<IEquatable<D>>> e =
- Expression.Lambda<Func<IEquatable<D>>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(IEquatable<D>)),
- Expression.Constant(b, typeof(IEquatable<D>))),
- Enumerable.Empty<ParameterExpression>());
- Func<IEquatable<D>> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyIntCoalesce(int? a, int b, bool useInterpreter)
- {
- Expression<Func<int>> e =
- Expression.Lambda<Func<int>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(int?)),
- Expression.Constant(b, typeof(int))),
- Enumerable.Empty<ParameterExpression>());
- Func<int> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyLongCoalesce(long? a, long b, bool useInterpreter)
- {
- Expression<Func<long>> e =
- Expression.Lambda<Func<long>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(long?)),
- Expression.Constant(b, typeof(long))),
- Enumerable.Empty<ParameterExpression>());
- Func<long> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyObjectCoalesce(object a, object b, bool useInterpreter)
- {
- Expression<Func<object>> e =
- Expression.Lambda<Func<object>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(object)),
- Expression.Constant(b, typeof(object))),
- Enumerable.Empty<ParameterExpression>());
- Func<object> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyStructCoalesce(S? a, S b, bool useInterpreter)
- {
- Expression<Func<S>> e =
- Expression.Lambda<Func<S>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(S?)),
- Expression.Constant(b, typeof(S))),
- Enumerable.Empty<ParameterExpression>());
- Func<S> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifySByteCoalesce(sbyte? a, sbyte b, bool useInterpreter)
- {
- Expression<Func<sbyte>> e =
- Expression.Lambda<Func<sbyte>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(sbyte?)),
- Expression.Constant(b, typeof(sbyte))),
- Enumerable.Empty<ParameterExpression>());
- Func<sbyte> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyStructWithStringCoalesce(Sc? a, Sc b, bool useInterpreter)
- {
- Expression<Func<Sc>> e =
- Expression.Lambda<Func<Sc>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(Sc?)),
- Expression.Constant(b, typeof(Sc))),
- Enumerable.Empty<ParameterExpression>());
- Func<Sc> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyStructWithStringAndFieldCoalesce(Scs? a, Scs b, bool useInterpreter)
- {
- Expression<Func<Scs>> e =
- Expression.Lambda<Func<Scs>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(Scs?)),
- Expression.Constant(b, typeof(Scs))),
- Enumerable.Empty<ParameterExpression>());
- Func<Scs> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyShortCoalesce(short? a, short b, bool useInterpreter)
- {
- Expression<Func<short>> e =
- Expression.Lambda<Func<short>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(short?)),
- Expression.Constant(b, typeof(short))),
- Enumerable.Empty<ParameterExpression>());
- Func<short> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyStructWithTwoValuesCoalesce(Sp? a, Sp b, bool useInterpreter)
- {
- Expression<Func<Sp>> e =
- Expression.Lambda<Func<Sp>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(Sp?)),
- Expression.Constant(b, typeof(Sp))),
- Enumerable.Empty<ParameterExpression>());
- Func<Sp> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyStructWithValueCoalesce(Ss? a, Ss b, bool useInterpreter)
- {
- Expression<Func<Ss>> e =
- Expression.Lambda<Func<Ss>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(Ss?)),
- Expression.Constant(b, typeof(Ss))),
- Enumerable.Empty<ParameterExpression>());
- Func<Ss> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyStringCoalesce(string a, string b, bool useInterpreter)
- {
- Expression<Func<string>> e =
- Expression.Lambda<Func<string>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(string)),
- Expression.Constant(b, typeof(string))),
- Enumerable.Empty<ParameterExpression>());
- Func<string> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyUIntCoalesce(uint? a, uint b, bool useInterpreter)
- {
- Expression<Func<uint>> e =
- Expression.Lambda<Func<uint>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(uint?)),
- Expression.Constant(b, typeof(uint))),
- Enumerable.Empty<ParameterExpression>());
- Func<uint> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyULongCoalesce(ulong? a, ulong b, bool useInterpreter)
- {
- Expression<Func<ulong>> e =
- Expression.Lambda<Func<ulong>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(ulong?)),
- Expression.Constant(b, typeof(ulong))),
- Enumerable.Empty<ParameterExpression>());
- Func<ulong> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyUShortCoalesce(ushort? a, ushort b, bool useInterpreter)
- {
- Expression<Func<ushort>> e =
- Expression.Lambda<Func<ushort>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(ushort?)),
- Expression.Constant(b, typeof(ushort))),
- Enumerable.Empty<ParameterExpression>());
- Func<ushort> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyGenericWithClassRestrictionCoalesce<Tc>(Tc a, Tc b, bool useInterpreter) where Tc : class
+ [Theory, ClassData(typeof(CompilationTypes))]
+ public static void CheckGenericEnumWithStructRestrictionCoalesce_NullableTest(bool useInterpreter)
{
- Expression<Func<Tc>> e =
- Expression.Lambda<Func<Tc>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(Tc)),
- Expression.Constant(b, typeof(Tc))),
- Enumerable.Empty<ParameterExpression>());
- Func<Tc> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
+ CheckGenericWithStructRestrictionCoalesce_NullableHelper<E>(useInterpreter);
}
- private static void VerifyGenericWithSubClassRestrictionCoalesce<TC>(TC a, TC b, bool useInterpreter) where TC : C
+ [Theory, ClassData(typeof(CompilationTypes))]
+ public static void CheckGenericStructWithStructRestrictionCoalesce_NullableTest(bool useInterpreter)
{
- Expression<Func<TC>> e =
- Expression.Lambda<Func<TC>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(TC)),
- Expression.Constant(b, typeof(TC))),
- Enumerable.Empty<ParameterExpression>());
- Func<TC> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
+ CheckGenericWithStructRestrictionCoalesce_NullableHelper<S>(useInterpreter);
}
- private static void VerifyGenericWithClassAndNewRestrictionCoalesce<Tcn>(Tcn a, Tcn b, bool useInterpreter) where Tcn : class, new()
+ [Theory, ClassData(typeof(CompilationTypes))]
+ public static void CheckGenericStructWithStringAndFieldWithStructRestrictionCoalesce_NullableTest(bool useInterpreter)
{
- Expression<Func<Tcn>> e =
- Expression.Lambda<Func<Tcn>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(Tcn)),
- Expression.Constant(b, typeof(Tcn))),
- Enumerable.Empty<ParameterExpression>());
- Func<Tcn> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
+ CheckGenericWithStructRestrictionCoalesce_NullableHelper<Scs>(useInterpreter);
}
- private static void VerifyGenericWithSubClassAndNewRestrictionCoalesce<TCn>(TCn a, TCn b, bool useInterpreter) where TCn : C, new()
+ private static void CheckGenericWithStructRestrictionCoalesce_NullableHelper<Ts>(bool useInterpreter) where Ts : struct
{
- Expression<Func<TCn>> e =
- Expression.Lambda<Func<TCn>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(TCn)),
- Expression.Constant(b, typeof(TCn))),
- Enumerable.Empty<ParameterExpression>());
- Func<TCn> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
+ Ts?[] array = new Ts?[] { null, default(Ts), new Ts() };
+ for (int i = 0; i < array.Length; i++)
+ {
+ for (int j = 0; j < array.Length; j++)
+ {
+ VerifyCoalesce(array[i], typeof(Ts?), array[j], typeof(Ts?), useInterpreter);
+ }
+ }
}
- private static void VerifyGenericWithStructRestrictionCoalesce<Ts>(Ts? a, Ts b, bool useInterpreter) where Ts : struct
+ public static void VerifyCoalesce(object obj1, Type type1, object obj2, Type type2, bool useInterpreter)
{
- Expression<Func<Ts>> e =
- Expression.Lambda<Func<Ts>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(Ts?)),
- Expression.Constant(b, typeof(Ts))),
- Enumerable.Empty<ParameterExpression>());
- Func<Ts> f = e.Compile(useInterpreter);
+ BinaryExpression expression = Expression.Coalesce(Expression.Constant(obj1, type1), Expression.Constant(obj2, type2));
+ Delegate lambda = Expression.Lambda(expression).Compile(useInterpreter);
- Assert.Equal(a ?? b, f());
+ object expected = obj1 == null ? obj2 : obj1;
+ Assert.Equal(expected, lambda.DynamicInvoke());
}
- #endregion
-
[Fact]
public static void BasicCoalesceExpressionTest()
{
@@ -1051,5 +304,84 @@ namespace System.Linq.Expressions.Tests
Expression value = Expression.Property(null, typeof(Unreadable<string>), "WriteOnly");
Assert.Throws<ArgumentException>("right", () => Expression.Coalesce(Expression.Constant(""), value));
}
+
+ [Theory]
+ [InlineData(null, "YY")]
+ [InlineData("abc", "abcdef")]
+ public static void Conversion_String(string parameter, string expected)
+ {
+ Expression<Func<string, string>> conversion = x => x + "def";
+ ParameterExpression parameterExpression = Expression.Parameter(typeof(string));
+ BinaryExpression coalescion = Expression.Coalesce(parameterExpression, Expression.Constant("YY"), conversion);
+
+ Func<string, string> result = Expression.Lambda<Func<string, string>>(coalescion, parameterExpression).Compile();
+ Assert.Equal(expected, result(parameter));
+ }
+
+ [Theory]
+ [InlineData(null, 5)]
+ [InlineData(5, 10)]
+ public static void Conversion_NullableInt(int? parameter, int? expected)
+ {
+ Expression<Func<int?, int?>> conversion = x => x * 2;
+ ParameterExpression parameterExpression = Expression.Parameter(typeof(int?));
+ BinaryExpression coalescion = Expression.Coalesce(parameterExpression, Expression.Constant(5, typeof(int?)), conversion);
+
+ Func<int?, int?> result = Expression.Lambda<Func<int?, int?>>(coalescion, parameterExpression).Compile();
+ Assert.Equal(expected, result(parameter));
+ }
+
+ [Fact]
+ public static void Left_NonNullValueType_ThrowsInvalidOperationException()
+ {
+ Expression<Func<int, int>> conversion = x => x * 2;
+
+ Assert.Throws<InvalidOperationException>(() => Expression.Coalesce(Expression.Constant(5), Expression.Constant(5)));
+ Assert.Throws<InvalidOperationException>(() => Expression.Coalesce(Expression.Constant(5), Expression.Constant(5), conversion));
+ }
+
+ [Fact]
+ public static void RightLeft_NonEquivilentTypes_ThrowsArgumentException()
+ {
+ Assert.Throws<ArgumentException>(null, () => Expression.Coalesce(Expression.Constant("abc"), Expression.Constant(5)));
+ }
+
+ public delegate void VoidDelegate();
+
+ [Fact]
+ public static void Conversion_VoidReturnType_ThrowsArgumentException()
+ {
+ LambdaExpression conversion = Expression.Lambda(typeof(VoidDelegate), Expression.Constant(""));
+
+ Assert.Throws<ArgumentException>("conversion", () => Expression.Coalesce(Expression.Constant(""), Expression.Constant(""), conversion));
+ }
+
+ [Fact]
+ public static void Conversion_NumberOfParameters_NotOne_ThrowsArgumentException()
+ {
+ Expression<Func<int, int, int>> moreThanOne = (x, y) => x * 2;
+ Expression<Func<int>> lessThanOne = () => 2;
+
+ Assert.Throws<ArgumentException>("conversion", () => Expression.Coalesce(Expression.Constant(""), Expression.Constant(""), moreThanOne));
+ Assert.Throws<ArgumentException>("conversion", () => Expression.Coalesce(Expression.Constant(""), Expression.Constant(""), lessThanOne));
+ }
+
+ [Fact]
+ public static void Conversion_ReturnTypeNotEquivilientToRightType_ThrowsInvalidOperationException()
+ {
+ Expression<Func<int?, int>> nullableNotEquivilent = x => x ?? 5;
+ Assert.Throws<InvalidOperationException>(() => Expression.Coalesce(Expression.Constant(5, typeof(int?)), Expression.Constant(5, typeof(int?)), nullableNotEquivilent));
+
+ Expression<Func<string, bool>> stringNotEquivilent = x => x == "";
+ Assert.Throws<InvalidOperationException>(() => Expression.Coalesce(Expression.Constant(""), Expression.Constant(""), stringNotEquivilent));
+ }
+
+ [Fact]
+ public static void Conversion_ParameterTypeNotEquivilentToLeftType_ThrowsInvalidOperationException()
+ {
+ Expression<Func<bool, string>> boolNotEquivilent = x => x.ToString();
+ Assert.Throws<InvalidOperationException>(() => Expression.Coalesce(Expression.Constant(""), Expression.Constant(""), boolNotEquivilent));
+ Assert.Throws<InvalidOperationException>(() => Expression.Coalesce(Expression.Constant(0, typeof(int?)), Expression.Constant(""), boolNotEquivilent));
+ }
}
}
diff --git a/src/System.Linq.Expressions/tests/BinaryOperators/Coalesce/BinaryNullableCoalesceTests.cs b/src/System.Linq.Expressions/tests/BinaryOperators/Coalesce/BinaryNullableCoalesceTests.cs
deleted file mode 100644
index 2f8fca0fe0..0000000000
--- a/src/System.Linq.Expressions/tests/BinaryOperators/Coalesce/BinaryNullableCoalesceTests.cs
+++ /dev/null
@@ -1,608 +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 Xunit;
-
-namespace System.Linq.Expressions.Tests
-{
- public static class BinaryNullableCoalesceTests
- {
- #region Test methods
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableBoolCoalesceTest(bool useInterpreter)
- {
- bool?[] array1 = new bool?[] { null, true, false };
- bool?[] array2 = new bool?[] { null, true, false };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableBoolCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableByteCoalesceTest(bool useInterpreter)
- {
- byte?[] array1 = new byte?[] { null, 0, 1, byte.MaxValue };
- byte?[] array2 = new byte?[] { null, 0, 1, byte.MaxValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableByteCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableCharCoalesceTest(bool useInterpreter)
- {
- char?[] array1 = new char?[] { null, '\0', '\b', 'A', '\uffff' };
- char?[] array2 = new char?[] { null, '\0', '\b', 'A', '\uffff' };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableCharCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableDecimalCoalesceTest(bool useInterpreter)
- {
- decimal?[] array1 = new decimal?[] { null, decimal.Zero, decimal.One, decimal.MinusOne, decimal.MinValue, decimal.MaxValue };
- decimal?[] array2 = new decimal?[] { null, decimal.Zero, decimal.One, decimal.MinusOne, decimal.MinValue, decimal.MaxValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableDecimalCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableDoubleCoalesceTest(bool useInterpreter)
- {
- double?[] array1 = new double?[] { null, 0, 1, -1, double.MinValue, double.MaxValue, double.Epsilon, double.NegativeInfinity, double.PositiveInfinity, double.NaN };
- double?[] array2 = new double?[] { null, 0, 1, -1, double.MinValue, double.MaxValue, double.Epsilon, double.NegativeInfinity, double.PositiveInfinity, double.NaN };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableDoubleCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableEnumCoalesceTest(bool useInterpreter)
- {
- E?[] array1 = new E?[] { null, (E)0, E.A, E.B, (E)int.MaxValue, (E)int.MinValue };
- E?[] array2 = new E?[] { null, (E)0, E.A, E.B, (E)int.MaxValue, (E)int.MinValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableEnumCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableEnumLongCoalesceTest(bool useInterpreter)
- {
- El?[] array1 = new El?[] { null, (El)0, El.A, El.B, (El)long.MaxValue, (El)long.MinValue };
- El?[] array2 = new El?[] { null, (El)0, El.A, El.B, (El)long.MaxValue, (El)long.MinValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableEnumLongCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableFloatCoalesceTest(bool useInterpreter)
- {
- float?[] array1 = new float?[] { null, 0, 1, -1, float.MinValue, float.MaxValue, float.Epsilon, float.NegativeInfinity, float.PositiveInfinity, float.NaN };
- float?[] array2 = new float?[] { null, 0, 1, -1, float.MinValue, float.MaxValue, float.Epsilon, float.NegativeInfinity, float.PositiveInfinity, float.NaN };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableFloatCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableIntCoalesceTest(bool useInterpreter)
- {
- int?[] array1 = new int?[] { null, 0, 1, -1, int.MinValue, int.MaxValue };
- int?[] array2 = new int?[] { null, 0, 1, -1, int.MinValue, int.MaxValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableIntCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableLongCoalesceTest(bool useInterpreter)
- {
- long?[] array1 = new long?[] { null, 0, 1, -1, long.MinValue, long.MaxValue };
- long?[] array2 = new long?[] { null, 0, 1, -1, long.MinValue, long.MaxValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableLongCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableStructCoalesceTest(bool useInterpreter)
- {
- S?[] array1 = new S?[] { null, default(S), new S() };
- S?[] array2 = new S?[] { null, default(S), new S() };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableStructCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableSByteCoalesceTest(bool useInterpreter)
- {
- sbyte?[] array1 = new sbyte?[] { null, 0, 1, -1, sbyte.MinValue, sbyte.MaxValue };
- sbyte?[] array2 = new sbyte?[] { null, 0, 1, -1, sbyte.MinValue, sbyte.MaxValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableSByteCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableStructWithStringCoalesceTest(bool useInterpreter)
- {
- Sc?[] array1 = new Sc?[] { null, default(Sc), new Sc(), new Sc(null) };
- Sc?[] array2 = new Sc?[] { null, default(Sc), new Sc(), new Sc(null) };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableStructWithStringCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableStructWithStringAndFieldCoalesceTest(bool useInterpreter)
- {
- Scs?[] array1 = new Scs?[] { null, default(Scs), new Scs(), new Scs(null, new S()) };
- Scs?[] array2 = new Scs?[] { null, default(Scs), new Scs(), new Scs(null, new S()) };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableStructWithStringAndFieldCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableShortCoalesceTest(bool useInterpreter)
- {
- short?[] array1 = new short?[] { null, 0, 1, -1, short.MinValue, short.MaxValue };
- short?[] array2 = new short?[] { null, 0, 1, -1, short.MinValue, short.MaxValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableShortCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableStructWithTwoValuesCoalesceTest(bool useInterpreter)
- {
- Sp?[] array1 = new Sp?[] { null, default(Sp), new Sp(), new Sp(5, 5.0) };
- Sp?[] array2 = new Sp?[] { null, default(Sp), new Sp(), new Sp(5, 5.0) };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableStructWithTwoValuesCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableStructWithValueCoalesceTest(bool useInterpreter)
- {
- Ss?[] array1 = new Ss?[] { null, default(Ss), new Ss(), new Ss(new S()) };
- Ss?[] array2 = new Ss?[] { null, default(Ss), new Ss(), new Ss(new S()) };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableStructWithValueCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableUIntCoalesceTest(bool useInterpreter)
- {
- uint?[] array1 = new uint?[] { null, 0, 1, uint.MaxValue };
- uint?[] array2 = new uint?[] { null, 0, 1, uint.MaxValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableUIntCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableULongCoalesceTest(bool useInterpreter)
- {
- ulong?[] array1 = new ulong?[] { null, 0, 1, ulong.MaxValue };
- ulong?[] array2 = new ulong?[] { null, 0, 1, ulong.MaxValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableULongCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckNullableUShortCoalesceTest(bool useInterpreter)
- {
- ushort?[] array1 = new ushort?[] { null, 0, 1, ushort.MaxValue };
- ushort?[] array2 = new ushort?[] { null, 0, 1, ushort.MaxValue };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyNullableUShortCoalesce(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckGenericEnumWithStructRestrictionCoalesceTest(bool useInterpreter)
- {
- CheckGenericWithStructRestrictionCoalesceHelper<E>(useInterpreter);
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckGenericStructWithStructRestrictionCoalesceTest(bool useInterpreter)
- {
- CheckGenericWithStructRestrictionCoalesceHelper<S>(useInterpreter);
- }
-
- [Theory, ClassData(typeof(CompilationTypes))]
- public static void CheckGenericStructWithStringAndFieldWithStructRestrictionCoalesceTest(bool useInterpreter)
- {
- CheckGenericWithStructRestrictionCoalesceHelper<Scs>(useInterpreter);
- }
-
- #endregion
-
- #region Generic helpers
-
- private static void CheckGenericWithStructRestrictionCoalesceHelper<Ts>(bool useInterpreter) where Ts : struct
- {
- Ts?[] array1 = new Ts?[] { null, default(Ts), new Ts() };
- Ts?[] array2 = new Ts?[] { null, default(Ts), new Ts() };
- for (int i = 0; i < array1.Length; i++)
- {
- for (int j = 0; j < array2.Length; j++)
- {
- VerifyGenericWithStructRestrictionCoalesce<Ts>(array1[i], array2[j], useInterpreter);
- }
- }
- }
-
- #endregion
-
- #region Test verifiers
-
- private static void VerifyNullableBoolCoalesce(bool? a, bool? b, bool useInterpreter)
- {
- Expression<Func<bool?>> e =
- Expression.Lambda<Func<bool?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(bool?)),
- Expression.Constant(b, typeof(bool?))),
- Enumerable.Empty<ParameterExpression>());
- Func<bool?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableByteCoalesce(byte? a, byte? b, bool useInterpreter)
- {
- Expression<Func<byte?>> e =
- Expression.Lambda<Func<byte?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(byte?)),
- Expression.Constant(b, typeof(byte?))),
- Enumerable.Empty<ParameterExpression>());
- Func<byte?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableCharCoalesce(char? a, char? b, bool useInterpreter)
- {
- Expression<Func<char?>> e =
- Expression.Lambda<Func<char?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(char?)),
- Expression.Constant(b, typeof(char?))),
- Enumerable.Empty<ParameterExpression>());
- Func<char?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableDecimalCoalesce(decimal? a, decimal? b, bool useInterpreter)
- {
- Expression<Func<decimal?>> e =
- Expression.Lambda<Func<decimal?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(decimal?)),
- Expression.Constant(b, typeof(decimal?))),
- Enumerable.Empty<ParameterExpression>());
- Func<decimal?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableDoubleCoalesce(double? a, double? b, bool useInterpreter)
- {
- Expression<Func<double?>> e =
- Expression.Lambda<Func<double?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(double?)),
- Expression.Constant(b, typeof(double?))),
- Enumerable.Empty<ParameterExpression>());
- Func<double?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableEnumCoalesce(E? a, E? b, bool useInterpreter)
- {
- Expression<Func<E?>> e =
- Expression.Lambda<Func<E?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(E?)),
- Expression.Constant(b, typeof(E?))),
- Enumerable.Empty<ParameterExpression>());
- Func<E?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableEnumLongCoalesce(El? a, El? b, bool useInterpreter)
- {
- Expression<Func<El?>> e =
- Expression.Lambda<Func<El?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(El?)),
- Expression.Constant(b, typeof(El?))),
- Enumerable.Empty<ParameterExpression>());
- Func<El?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableFloatCoalesce(float? a, float? b, bool useInterpreter)
- {
- Expression<Func<float?>> e =
- Expression.Lambda<Func<float?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(float?)),
- Expression.Constant(b, typeof(float?))),
- Enumerable.Empty<ParameterExpression>());
- Func<float?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableIntCoalesce(int? a, int? b, bool useInterpreter)
- {
- Expression<Func<int?>> e =
- Expression.Lambda<Func<int?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(int?)),
- Expression.Constant(b, typeof(int?))),
- Enumerable.Empty<ParameterExpression>());
- Func<int?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableLongCoalesce(long? a, long? b, bool useInterpreter)
- {
- Expression<Func<long?>> e =
- Expression.Lambda<Func<long?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(long?)),
- Expression.Constant(b, typeof(long?))),
- Enumerable.Empty<ParameterExpression>());
- Func<long?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableStructCoalesce(S? a, S? b, bool useInterpreter)
- {
- Expression<Func<S?>> e =
- Expression.Lambda<Func<S?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(S?)),
- Expression.Constant(b, typeof(S?))),
- Enumerable.Empty<ParameterExpression>());
- Func<S?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableSByteCoalesce(sbyte? a, sbyte? b, bool useInterpreter)
- {
- Expression<Func<sbyte?>> e =
- Expression.Lambda<Func<sbyte?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(sbyte?)),
- Expression.Constant(b, typeof(sbyte?))),
- Enumerable.Empty<ParameterExpression>());
- Func<sbyte?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableStructWithStringCoalesce(Sc? a, Sc? b, bool useInterpreter)
- {
- Expression<Func<Sc?>> e =
- Expression.Lambda<Func<Sc?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(Sc?)),
- Expression.Constant(b, typeof(Sc?))),
- Enumerable.Empty<ParameterExpression>());
- Func<Sc?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableStructWithStringAndFieldCoalesce(Scs? a, Scs? b, bool useInterpreter)
- {
- Expression<Func<Scs?>> e =
- Expression.Lambda<Func<Scs?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(Scs?)),
- Expression.Constant(b, typeof(Scs?))),
- Enumerable.Empty<ParameterExpression>());
- Func<Scs?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableShortCoalesce(short? a, short? b, bool useInterpreter)
- {
- Expression<Func<short?>> e =
- Expression.Lambda<Func<short?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(short?)),
- Expression.Constant(b, typeof(short?))),
- Enumerable.Empty<ParameterExpression>());
- Func<short?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableStructWithTwoValuesCoalesce(Sp? a, Sp? b, bool useInterpreter)
- {
- Expression<Func<Sp?>> e =
- Expression.Lambda<Func<Sp?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(Sp?)),
- Expression.Constant(b, typeof(Sp?))),
- Enumerable.Empty<ParameterExpression>());
- Func<Sp?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableStructWithValueCoalesce(Ss? a, Ss? b, bool useInterpreter)
- {
- Expression<Func<Ss?>> e =
- Expression.Lambda<Func<Ss?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(Ss?)),
- Expression.Constant(b, typeof(Ss?))),
- Enumerable.Empty<ParameterExpression>());
- Func<Ss?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableUIntCoalesce(uint? a, uint? b, bool useInterpreter)
- {
- Expression<Func<uint?>> e =
- Expression.Lambda<Func<uint?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(uint?)),
- Expression.Constant(b, typeof(uint?))),
- Enumerable.Empty<ParameterExpression>());
- Func<uint?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableULongCoalesce(ulong? a, ulong? b, bool useInterpreter)
- {
- Expression<Func<ulong?>> e =
- Expression.Lambda<Func<ulong?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(ulong?)),
- Expression.Constant(b, typeof(ulong?))),
- Enumerable.Empty<ParameterExpression>());
- Func<ulong?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyNullableUShortCoalesce(ushort? a, ushort? b, bool useInterpreter)
- {
- Expression<Func<ushort?>> e =
- Expression.Lambda<Func<ushort?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(ushort?)),
- Expression.Constant(b, typeof(ushort?))),
- Enumerable.Empty<ParameterExpression>());
- Func<ushort?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- private static void VerifyGenericWithStructRestrictionCoalesce<Ts>(Ts? a, Ts? b, bool useInterpreter) where Ts : struct
- {
- Expression<Func<Ts?>> e =
- Expression.Lambda<Func<Ts?>>(
- Expression.Coalesce(
- Expression.Constant(a, typeof(Ts?)),
- Expression.Constant(b, typeof(Ts?))),
- Enumerable.Empty<ParameterExpression>());
- Func<Ts?> f = e.Compile(useInterpreter);
-
- Assert.Equal(a ?? b, f());
- }
-
- #endregion
- }
-}
diff --git a/src/System.Linq.Expressions/tests/Call/CallTests.cs b/src/System.Linq.Expressions/tests/Call/CallTests.cs
new file mode 100644
index 0000000000..13efcd4959
--- /dev/null
+++ b/src/System.Linq.Expressions/tests/Call/CallTests.cs
@@ -0,0 +1,229 @@
+// 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.Collections.Generic;
+using System.Reflection;
+using Xunit;
+
+namespace System.Linq.Expressions.Tests
+{
+ public static class CallTests
+ {
+ private struct Mutable
+ {
+ private int x;
+
+ public int X
+ {
+ get { return x; }
+ set { x = value; }
+ }
+
+ public int this[int i]
+ {
+ get { return x; }
+ set { x = value; }
+ }
+
+ public int Foo()
+ {
+ return x++;
+ }
+ }
+
+ private class Wrapper<T>
+ {
+ public const int Zero = 0;
+ public T Field;
+#pragma warning disable 649 // For testing purposes
+ public readonly T ReadOnlyField;
+#pragma warning restore
+ public T Property
+ {
+ get { return Field; }
+ set { Field = value; }
+ }
+ }
+
+ private static class Methods
+ {
+ public static void ByRef(ref int x) { ++x; }
+ }
+
+ [Theory]
+ [ClassData(typeof(CompilationTypes))]
+ public static void UnboxReturnsReference(bool useInterpreter)
+ {
+ var p = Expression.Parameter(typeof(object));
+ var unbox = Expression.Unbox(p, typeof(Mutable));
+ var call = Expression.Call(unbox, typeof(Mutable).GetMethod("Foo"));
+ var lambda = Expression.Lambda<Func<object, int>>(call, p).Compile(useInterpreter);
+
+ object boxed = new Mutable();
+ Assert.Equal(0, lambda(boxed));
+ Assert.Equal(1, lambda(boxed));
+ Assert.Equal(2, lambda(boxed));
+ Assert.Equal(3, lambda(boxed));
+ }
+
+ [Theory]
+ [ClassData(typeof(CompilationTypes))]
+ public static void ArrayWriteBack(bool useInterpreter)
+ {
+ var p = Expression.Parameter(typeof(Mutable[]));
+ var indexed = Expression.ArrayIndex(p, Expression.Constant(0));
+ var call = Expression.Call(indexed, typeof(Mutable).GetMethod("Foo"));
+ var lambda = Expression.Lambda<Func<Mutable[], int>>(call, p).Compile(useInterpreter);
+
+ var array = new Mutable[1];
+ Assert.Equal(0, lambda(array));
+ Assert.Equal(1, lambda(array));
+ Assert.Equal(2, lambda(array));
+ }
+
+ [Theory]
+ [ClassData(typeof(CompilationTypes))]
+ public static void MultiRankArrayWriteBack(bool useInterpreter)
+ {
+ var p = Expression.Parameter(typeof(Mutable[,]));
+ var indexed = Expression.ArrayIndex(p, Expression.Constant(0), Expression.Constant(0));
+ var call = Expression.Call(indexed, typeof(Mutable).GetMethod("Foo"));
+ var lambda = Expression.Lambda<Func<Mutable[,], int>>(call, p).Compile(useInterpreter);
+
+ var array = new Mutable[1, 1];
+ Assert.Equal(0, lambda(array));
+ Assert.Equal(1, lambda(array));
+ Assert.Equal(2, lambda(array));
+ }
+
+ [Theory]
+ [ClassData(typeof(CompilationTypes))]
+ public static void ArrayAccessWriteBack(bool useInterpreter)
+ {
+ var p = Expression.Parameter(typeof(Mutable[]));
+ var indexed = Expression.ArrayAccess(p, Expression.Constant(0));
+ var call = Expression.Call(indexed, typeof(Mutable).GetMethod("Foo"));
+ var lambda = Expression.Lambda<Func<Mutable[], int>>(call, p).Compile(useInterpreter);
+
+ var array = new Mutable[1];
+ Assert.Equal(0, lambda(array));
+ Assert.Equal(1, lambda(array));
+ Assert.Equal(2, lambda(array));
+ }
+
+ [Theory]
+ [ClassData(typeof(CompilationTypes))]
+ public static void MultiRankArrayAccessWriteBack(bool useInterpreter)
+ {
+ var p = Expression.Parameter(typeof(Mutable[,]));
+ var indexed = Expression.ArrayAccess(p, Expression.Constant(0), Expression.Constant(0));
+ var call = Expression.Call(indexed, typeof(Mutable).GetMethod("Foo"));
+ var lambda = Expression.Lambda<Func<Mutable[,], int>>(call, p).Compile(useInterpreter);
+
+ var array = new Mutable[1, 1];
+ Assert.Equal(0, lambda(array));
+ Assert.Equal(1, lambda(array));
+ Assert.Equal(2, lambda(array));
+ }
+
+ [Theory]
+ [ClassData(typeof(CompilationTypes))]
+ public static void IndexedPropertyAccessNoWriteBack(bool useInterpreter)
+ {
+ var p = Expression.Parameter(typeof(List<Mutable>));
+ var indexed = Expression.Property(p, typeof(List<Mutable>).GetProperty("Item"), Expression.Constant(0));
+ var call = Expression.Call(indexed, typeof(Mutable).GetMethod("Foo"));
+ var lambda = Expression.Lambda<Func<List<Mutable>, int>>(call, p).Compile(useInterpreter);
+
+ var list = new List<Mutable> { new Mutable() };
+ Assert.Equal(0, lambda(list));
+ Assert.Equal(0, lambda(list));
+ }
+
+ [Theory]
+ [ClassData(typeof(CompilationTypes))]
+ public static void FieldAccessWriteBack(bool useInterpreter)
+ {
+ var p = Expression.Parameter(typeof(Wrapper<Mutable>));
+ var member = Expression.Field(p, typeof(Wrapper<Mutable>).GetField("Field"));
+ var call = Expression.Call(member, typeof(Mutable).GetMethod("Foo"));
+ var lambda = Expression.Lambda<Func<Wrapper<Mutable>, int>>(call, p).Compile(useInterpreter);
+
+ var wrapper = new Wrapper<Mutable>();
+ Assert.Equal(0, lambda(wrapper));
+ Assert.Equal(1, lambda(wrapper));
+ Assert.Equal(2, lambda(wrapper));
+ }
+
+ [Theory]
+ [ClassData(typeof(CompilationTypes))]
+ public static void PropertyAccessNoWriteBack(bool useInterpreter)
+ {
+ var p = Expression.Parameter(typeof(Wrapper<Mutable>));
+ var member = Expression.Property(p, typeof(Wrapper<Mutable>).GetProperty("Property"));
+ var call = Expression.Call(member, typeof(Mutable).GetMethod("Foo"));
+ var lambda = Expression.Lambda<Func<Wrapper<Mutable>, int>>(call, p).Compile(useInterpreter);
+
+ var wrapper = new Wrapper<Mutable>();
+ Assert.Equal(0, lambda(wrapper));
+ Assert.Equal(0, lambda(wrapper));
+ }
+
+ [Theory]
+ [ClassData(typeof(CompilationTypes))]
+ public static void ReadonlyFieldAccessWriteBack(bool useInterpreter)
+ {
+ var p = Expression.Parameter(typeof(Wrapper<Mutable>));
+ var member = Expression.Field(p, typeof(Wrapper<Mutable>).GetField("ReadOnlyField"));
+ var call = Expression.Call(member, typeof(Mutable).GetMethod("Foo"));
+ var lambda = Expression.Lambda<Func<Wrapper<Mutable>, int>>(call, p).Compile(useInterpreter);
+
+ var wrapper = new Wrapper<Mutable>();
+ Assert.Equal(0, lambda(wrapper));
+ Assert.Equal(0, lambda(wrapper));
+ Assert.Equal(0, lambda(wrapper));
+ }
+
+ [Theory]
+ [ClassData(typeof(CompilationTypes))]
+ public static void ConstFieldAccessWriteBack(bool useInterpreter)
+ {
+ var member = Expression.Field(null, typeof(Wrapper<Mutable>).GetField("Zero"));
+ var call = Expression.Call(member, typeof(int).GetMethod("GetType"));
+ var lambda = Expression.Lambda<Func<Type>>(call).Compile(useInterpreter);
+
+ var wrapper = new Wrapper<Mutable>();
+ Assert.Equal(typeof(int), lambda());
+ }
+
+ [Theory]
+ [ClassData(typeof(CompilationTypes))]
+ public static void CallByRefMutableStructPropertyWriteBack(bool useInterpreter)
+ {
+ var p = Expression.Parameter(typeof(Mutable));
+ var x = Expression.Property(p, "X");
+ var call = Expression.Call(typeof(Methods).GetMethod("ByRef"), x);
+ var body = Expression.Block(call, x);
+ var lambda = Expression.Lambda<Func<Mutable, int>>(body, p).Compile(useInterpreter);
+
+ var m = new Mutable() { X = 41 };
+ Assert.Equal(42, lambda(m));
+ }
+
+ [Theory]
+ [ClassData(typeof(CompilationTypes))]
+ public static void CallByRefMutableStructIndexWriteBack(bool useInterpreter)
+ {
+ var p = Expression.Parameter(typeof(Mutable));
+ var x = Expression.MakeIndex(p, typeof(Mutable).GetProperty("Item"), new[] { Expression.Constant(0) });
+ var call = Expression.Call(typeof(Methods).GetMethod("ByRef"), x);
+ var body = Expression.Block(call, x);
+ var lambda = Expression.Lambda<Func<Mutable, int>>(body, p).Compile(useInterpreter);
+
+ var m = new Mutable() { X = 41 };
+ Assert.Equal(42, lambda(m));
+ }
+ }
+}
diff --git a/src/System.Linq.Expressions/tests/CompilerTests.cs b/src/System.Linq.Expressions/tests/CompilerTests.cs
new file mode 100644
index 0000000000..85e05c5be1
--- /dev/null
+++ b/src/System.Linq.Expressions/tests/CompilerTests.cs
@@ -0,0 +1,130 @@
+// 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.Collections.Generic;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using Xunit;
+
+namespace System.Linq.Expressions.Tests
+{
+ public static class CompilerTests
+ {
+#if FEATURE_COMPILE
+ [Fact]
+ public static void EmitConstantsToIL_NonNullableValueTypes()
+ {
+ VerifyEmitConstantsToIL((bool)true);
+
+ VerifyEmitConstantsToIL((char)'a');
+
+ VerifyEmitConstantsToIL((sbyte)42);
+ VerifyEmitConstantsToIL((byte)42);
+ VerifyEmitConstantsToIL((short)42);
+ VerifyEmitConstantsToIL((ushort)42);
+ VerifyEmitConstantsToIL((int)42);
+ VerifyEmitConstantsToIL((uint)42);
+ VerifyEmitConstantsToIL((long)42);
+ VerifyEmitConstantsToIL((ulong)42);
+
+ VerifyEmitConstantsToIL((float)3.14);
+ VerifyEmitConstantsToIL((double)3.14);
+ VerifyEmitConstantsToIL((decimal)49.95m);
+ }
+
+ [Fact]
+ public static void EmitConstantsToIL_NullableValueTypes()
+ {
+ VerifyEmitConstantsToIL((bool?)null);
+ VerifyEmitConstantsToIL((bool?)true);
+
+ VerifyEmitConstantsToIL((char?)null);
+ VerifyEmitConstantsToIL((char?)'a');
+
+ VerifyEmitConstantsToIL((sbyte?)null);
+ VerifyEmitConstantsToIL((sbyte?)42);
+ VerifyEmitConstantsToIL((byte?)null);
+ VerifyEmitConstantsToIL((byte?)42);
+ VerifyEmitConstantsToIL((short?)null);
+ VerifyEmitConstantsToIL((short?)42);
+ VerifyEmitConstantsToIL((ushort?)null);
+ VerifyEmitConstantsToIL((ushort?)42);
+ VerifyEmitConstantsToIL((int?)null);
+ VerifyEmitConstantsToIL((int?)42);
+ VerifyEmitConstantsToIL((uint?)null);
+ VerifyEmitConstantsToIL((uint?)42);
+ VerifyEmitConstantsToIL((long?)null);
+ VerifyEmitConstantsToIL((long?)42);
+ VerifyEmitConstantsToIL((ulong?)null);
+ VerifyEmitConstantsToIL((ulong?)42);
+
+ VerifyEmitConstantsToIL((float?)null);
+ VerifyEmitConstantsToIL((float?)3.14);
+ VerifyEmitConstantsToIL((double?)null);
+ VerifyEmitConstantsToIL((double?)3.14);
+ VerifyEmitConstantsToIL((decimal?)null);
+ VerifyEmitConstantsToIL((decimal?)49.95m);
+
+ VerifyEmitConstantsToIL((DateTime?)null);
+ }
+
+ [Fact]
+ public static void EmitConstantsToIL_ReferenceTypes()
+ {
+ VerifyEmitConstantsToIL((string)null);
+ VerifyEmitConstantsToIL((string)"bar");
+ }
+
+ [Fact]
+ public static void EmitConstantsToIL_Enums()
+ {
+ VerifyEmitConstantsToIL(ConstantsEnum.A);
+ VerifyEmitConstantsToIL((ConstantsEnum?)null);
+ VerifyEmitConstantsToIL((ConstantsEnum?)ConstantsEnum.A);
+ }
+
+ [Fact]
+ public static void EmitConstantsToIL_ShareReferences()
+ {
+ var o = new object();
+ VerifyEmitConstantsToIL(Expression.Equal(Expression.Constant(o), Expression.Constant(o)), 1, true);
+ }
+
+ [Fact]
+ public static void EmitConstantsToIL_LiftedToClosure()
+ {
+ VerifyEmitConstantsToIL(DateTime.Now, 1);
+ VerifyEmitConstantsToIL((DateTime?)DateTime.Now, 1);
+ }
+
+ private static void VerifyEmitConstantsToIL<T>(T value)
+ {
+ VerifyEmitConstantsToIL<T>(value, 0);
+ }
+
+ private static void VerifyEmitConstantsToIL<T>(T value, int expectedCount)
+ {
+ VerifyEmitConstantsToIL(Expression.Constant(value, typeof(T)), expectedCount, value);
+ }
+
+ private static void VerifyEmitConstantsToIL(Expression e, int expectedCount, object expectedValue)
+ {
+ var f = Expression.Lambda(e).Compile();
+
+ var c = f.Target as Closure;
+ Assert.NotNull(c);
+ Assert.Equal(expectedCount, c.Constants.Length);
+
+ var o = f.DynamicInvoke();
+ Assert.Equal(expectedValue, o);
+ }
+#endif
+ }
+
+ public enum ConstantsEnum
+ {
+ A
+ }
+} \ No newline at end of file
diff --git a/src/System.Linq.Expressions/tests/DebugInfo/DebugInfoExpressionTests.cs b/src/System.Linq.Expressions/tests/DebugInfo/DebugInfoExpressionTests.cs
new file mode 100644
index 0000000000..c7ece202a9
--- /dev/null
+++ b/src/System.Linq.Expressions/tests/DebugInfo/DebugInfoExpressionTests.cs
@@ -0,0 +1,61 @@
+// 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 Xunit;
+
+namespace System.Linq.Expressions.Tests
+{
+ public static class DebugInfoExpressionTests
+ {
+ [Theory]
+ [InlineData(1, 1, 1, 1, false)]
+ [InlineData(int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, false)]
+ [InlineData(1, 1, int.MaxValue, int.MaxValue, false)]
+ [InlineData(5, 10, 15, 20, false)]
+ [InlineData(5, 25, 15, 20, false)]
+ [InlineData(0xfeefee, 0, 0xfeefee, 0, true)]
+ public static void DebugInfo(int startLine, int startColumn, int endLine, int endColumn, bool isClear)
+ {
+ SymbolDocumentInfo document = Expression.SymbolDocument("AFile");
+ DebugInfoExpression ex = Expression.DebugInfo(document, startLine, startColumn, endLine, endColumn);
+ VerifyDebugInfoExpression(ex, document, startLine, startColumn, endLine, endColumn, isClear);
+ }
+
+ [Fact]
+ public static void DebugInfo_Invalid()
+ {
+ Assert.Throws<ArgumentNullException>("document", () => Expression.DebugInfo(null, 1, 1, 1, 1));
+
+ SymbolDocumentInfo document = Expression.SymbolDocument("AFile");
+ Assert.Throws<ArgumentOutOfRangeException>("startLine", () => Expression.DebugInfo(document, 0, 1, 1, 1));
+ Assert.Throws<ArgumentOutOfRangeException>("startColumn", () => Expression.DebugInfo(document, 1, 0, 1, 1));
+ Assert.Throws<ArgumentOutOfRangeException>("endLine", () => Expression.DebugInfo(document, 1, 1, 0, 1));
+ Assert.Throws<ArgumentOutOfRangeException>("endColumn", () => Expression.DebugInfo(document, 1, 1, 1, 0));
+
+ Assert.Throws<ArgumentException>(null, () => Expression.DebugInfo(document, 10, 1, 1, 1));
+ Assert.Throws<ArgumentException>(null, () => Expression.DebugInfo(document, 1, 10, 1, 1));
+ }
+
+ [Fact]
+ public static void ClearDebugInfo()
+ {
+ SymbolDocumentInfo document = Expression.SymbolDocument("AFile");
+ DebugInfoExpression ex = Expression.ClearDebugInfo(document);
+ VerifyDebugInfoExpression(ex, document, 0xfeefee, 0, 0xfeefee, 0, true);
+ }
+
+ private static void VerifyDebugInfoExpression(DebugInfoExpression ex, SymbolDocumentInfo document, int startLine, int startColumn, int endLine, int endColumn, bool isClear)
+ {
+ Assert.Same(document, ex.Document);
+ Assert.Equal(startLine, ex.StartLine);
+ Assert.Equal(startColumn, ex.StartColumn);
+ Assert.Equal(endLine, ex.EndLine);
+ Assert.Equal(endColumn, ex.EndColumn);
+
+ Assert.Equal(ExpressionType.DebugInfo, ex.NodeType);
+ Assert.Equal(typeof(void), ex.Type);
+ Assert.Equal(isClear, ex.IsClear);
+ }
+ }
+}
diff --git a/src/System.Linq.Expressions/tests/DebugInfo/SymbolDocumentInfoTests.cs b/src/System.Linq.Expressions/tests/DebugInfo/SymbolDocumentInfoTests.cs
new file mode 100644
index 0000000000..f462908659
--- /dev/null
+++ b/src/System.Linq.Expressions/tests/DebugInfo/SymbolDocumentInfoTests.cs
@@ -0,0 +1,65 @@
+// 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.Collections.Generic;
+using Xunit;
+
+namespace System.Linq.Expressions.Tests
+{
+ public static class SymbolDocumentInfoTests
+ {
+ public static IEnumerable<object[]> TestData()
+ {
+ Guid documentType = new Guid(0x5a869d0b, 0x6611, 0x11d3, 0xbd, 0x2a, 0, 0, 0xf8, 8, 0x49, 0xbd);
+ yield return new object[] { "", Guid.Empty, Guid.Empty, documentType };
+ yield return new object[] { " \t \r ", Guid.Empty, Guid.NewGuid(), documentType };
+ yield return new object[] { "abc", Guid.NewGuid(), Guid.NewGuid(), documentType };
+ yield return new object[] { "\uD800\uDC00", Guid.NewGuid(), Guid.NewGuid(), Guid.Empty };
+ }
+
+ [Theory]
+ [MemberData(nameof(TestData))]
+ public static void SymbolDocument(string fileName, Guid language, Guid languageVendor, Guid documentType)
+ {
+ if (documentType == new Guid(0x5a869d0b, 0x6611, 0x11d3, 0xbd, 0x2a, 0, 0, 0xf8, 8, 0x49, 0xbd))
+ {
+ if (languageVendor == Guid.Empty)
+ {
+ if (language == Guid.Empty)
+ {
+ // SymbolDocument(string)
+ SymbolDocumentInfo symbolDocument1 = Expression.SymbolDocument(fileName);
+ VerifySymbolDocumentInfo(symbolDocument1, fileName, language, languageVendor, documentType);
+ }
+ // SymbolDocument(string, Guid)
+ SymbolDocumentInfo symbolDocument2 = Expression.SymbolDocument(fileName, language);
+ VerifySymbolDocumentInfo(symbolDocument2, fileName, language, languageVendor, documentType);
+ }
+ // SymbolDocument(string, Guid)
+ SymbolDocumentInfo symbolDocument3 = Expression.SymbolDocument(fileName, language, languageVendor);
+ VerifySymbolDocumentInfo(symbolDocument3, fileName, language, languageVendor, documentType);
+ }
+ // SymbolDocument(string, Guid, Guid)
+ SymbolDocumentInfo symbolDocument4 = Expression.SymbolDocument(fileName, language, languageVendor, documentType);
+ VerifySymbolDocumentInfo(symbolDocument4, fileName, language, languageVendor, documentType);
+ }
+
+ [Fact]
+ public static void SymbolDocument_NullFileName_ThrowsArgumentNullException()
+ {
+ Assert.Throws<ArgumentNullException>("fileName", () => Expression.SymbolDocument(null));
+ Assert.Throws<ArgumentNullException>("fileName", () => Expression.SymbolDocument(null, Guid.Empty));
+ Assert.Throws<ArgumentNullException>("fileName", () => Expression.SymbolDocument(null, Guid.Empty, Guid.Empty));
+ Assert.Throws<ArgumentNullException>("fileName", () => Expression.SymbolDocument(null, Guid.Empty, Guid.Empty, Guid.Empty));
+ }
+
+ private static void VerifySymbolDocumentInfo(SymbolDocumentInfo document, string fileName, Guid language, Guid languageVendor, Guid documentType)
+ {
+ Assert.Equal(fileName, document.FileName);
+ Assert.Equal(language, document.Language);
+ Assert.Equal(languageVendor, document.LanguageVendor);
+ Assert.Equal(documentType, document.DocumentType);
+ }
+ }
+}
diff --git a/src/System.Linq.Expressions/tests/HelperTypes.cs b/src/System.Linq.Expressions/tests/HelperTypes.cs
index 4f2d22f380..2992e7f1d1 100644
--- a/src/System.Linq.Expressions/tests/HelperTypes.cs
+++ b/src/System.Linq.Expressions/tests/HelperTypes.cs
@@ -267,4 +267,24 @@ namespace System.Linq.Expressions.Tests
{
}
}
+
+ public static class Unreadable<T>
+ {
+ public static T WriteOnly { set { } }
+ }
+
+ public class GenericClass<T>
+ {
+ public void Method() { }
+ }
+
+ public class NonGenericClass
+ {
+ #pragma warning disable 0067
+ public event EventHandler Event;
+ #pragma warning restore 0067
+
+ public void GenericMethod<T>() { }
+ public static void StaticMethod() { }
+ }
}
diff --git a/src/System.Linq.Expressions/tests/IndexExpression/IndexExpressionHelpers.cs b/src/System.Linq.Expressions/tests/IndexExpression/IndexExpressionHelpers.cs
new file mode 100644
index 0000000000..6631a9b831
--- /dev/null
+++ b/src/System.Linq.Expressions/tests/IndexExpression/IndexExpressionHelpers.cs
@@ -0,0 +1,28 @@
+// 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 Xunit;
+
+namespace System.Linq.Expressions.Tests
+{
+ public static class IndexExpressionHelpers
+ {
+ internal static void AssertEqual(IndexExpression expected, IndexExpression actual)
+ {
+ Assert.Equal(expected.Object, actual.Object);
+ Assert.Equal(expected.Indexer, actual.Indexer);
+ Assert.Equal(expected.Arguments, actual.Arguments);
+ }
+
+ internal static void AssertInvokeCorrect<T>(T expected, IndexExpression expression)
+ {
+ var lambda = Expression.Lambda<Func<T>>(expression);
+
+ // Compile and evaluate with interpretation flag and without
+ // in case there are bugs in the compiler/interpreter.
+ Assert.Equal(expected, lambda.Compile(false)());
+ Assert.Equal(expected, lambda.Compile(true)());
+ }
+ }
+}
diff --git a/src/System.Linq.Expressions/tests/IndexExpression/IndexExpressionTests.cs b/src/System.Linq.Expressions/tests/IndexExpression/IndexExpressionTests.cs
new file mode 100644
index 0000000000..3f5f70c30b
--- /dev/null
+++ b/src/System.Linq.Expressions/tests/IndexExpression/IndexExpressionTests.cs
@@ -0,0 +1,55 @@
+// 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.Collections.Generic;
+using System.Reflection;
+using Xunit;
+
+namespace System.Linq.Expressions.Tests
+{
+ public class IndexExpressionTests
+ {
+ [Fact]
+ public void UpdateSameTest()
+ {
+ var instance = new SampleClassWithProperties { DefaultProperty = new List<int> { 100, 101 } };
+ IndexExpression expr = instance.DefaultIndexExpression;
+
+ IndexExpression exprUpdated = expr.Update(expr.Object, expr.Arguments);
+
+ // Has to be the same, because everything is the same.
+ Assert.Same(expr, exprUpdated);
+
+ // Invoke to check expression.
+ IndexExpressionHelpers.AssertInvokeCorrect(100, expr);
+ IndexExpressionHelpers.AssertInvokeCorrect(100, exprUpdated);
+ }
+
+ [Fact]
+ public void UpdateTest()
+ {
+ var instance = new SampleClassWithProperties
+ {
+ DefaultProperty = new List<int> { 100, 101 },
+ AlternativeProperty = new List<int> { 200, 201 }
+ };
+
+ IndexExpression expr = instance.DefaultIndexExpression;
+ MemberExpression newProperty = Expression.Property(Expression.Constant(instance),
+ typeof(SampleClassWithProperties).GetProperty(nameof(instance.AlternativeProperty)));
+ ConstantExpression[] newArguments = {Expression.Constant(1)};
+
+ IndexExpression exprUpdated = expr.Update(newProperty, newArguments);
+
+ // Replace Object and Arguments of IndexExpression.
+ IndexExpressionHelpers.AssertEqual(
+ exprUpdated,
+ Expression.MakeIndex(newProperty, instance.DefaultIndexer, newArguments));
+
+ // Invoke to check expression.
+ IndexExpressionHelpers.AssertInvokeCorrect(100, expr);
+ IndexExpressionHelpers.AssertInvokeCorrect(201, exprUpdated);
+ }
+ }
+}
diff --git a/src/System.Linq.Expressions/tests/IndexExpression/IndexExpressionVisitorTests.cs b/src/System.Linq.Expressions/tests/IndexExpression/IndexExpressionVisitorTests.cs
new file mode 100644
index 0000000000..068755b637
--- /dev/null
+++ b/src/System.Linq.Expressions/tests/IndexExpression/IndexExpressionVisitorTests.cs
@@ -0,0 +1,81 @@
+// 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.Collections.Generic;
+using System.Reflection;
+using Xunit;
+
+namespace System.Linq.Expressions.Tests
+{
+ public class IndexExpressionVisitorTests
+ {
+ private class IndexVisitor : ExpressionVisitor
+ {
+ private readonly Dictionary<Expression, Expression> _dict;
+
+ public IndexVisitor(IndexExpression expr, Expression newObject, Expression[] newArguments)
+ {
+ _dict = new Dictionary<Expression, Expression>
+ {
+ {expr.Object, newObject}
+ };
+
+ for (int i = 0; i < expr.Arguments.Count; i++)
+ {
+ _dict.Add(expr.Arguments[i], newArguments?[i]);
+ }
+ }
+
+ public override Expression Visit(Expression node)
+ {
+ Expression result;
+ return _dict.TryGetValue(node, out result) ? result : base.Visit(node);
+ }
+ }
+
+ [Fact]
+ public void RewriteObjectTest()
+ {
+ var instance = new SampleClassWithProperties
+ {
+ DefaultProperty = new List<int> { 100, 101 },
+ AlternativeProperty = new List<int> { 200, 201 }
+ };
+
+ IndexExpression expr = instance.DefaultIndexExpression;
+ MemberExpression newProperty = Expression.Property(Expression.Constant(instance),
+ typeof(SampleClassWithProperties).GetProperty(nameof(instance.AlternativeProperty)));
+
+ var visitor = new IndexVisitor(expr, newProperty, expr.Arguments.ToArray());
+ IndexExpression actual = (IndexExpression)visitor.Visit(expr);
+ IndexExpression expected = Expression.MakeIndex(newProperty, expr.Indexer, expr.Arguments);
+
+ // Object of ExpressionIndex replaced via Rewrite method call.
+ IndexExpressionHelpers.AssertEqual(expected, actual);
+
+ // Invoke to check expression.
+ IndexExpressionHelpers.AssertInvokeCorrect(100, expr);
+ IndexExpressionHelpers.AssertInvokeCorrect(200, actual);
+ }
+
+ [Fact]
+ public void RewriteArgumentsTest()
+ {
+ var instance = new SampleClassWithProperties {DefaultProperty = new List<int> {100, 101}};
+
+ IndexExpression expr = instance.DefaultIndexExpression;
+ Expression[] newArguments = {Expression.Constant(1)};
+
+ var visitor = new IndexVisitor(expr, expr.Object, newArguments);
+ IndexExpression expected = Expression.MakeIndex(expr.Object, expr.Indexer, newArguments);
+ var actual = (IndexExpression) visitor.Visit(expr);
+
+ IndexExpressionHelpers.AssertEqual(expected, actual);
+
+ // Invoke to check expression.
+ IndexExpressionHelpers.AssertInvokeCorrect(100, expr);
+ IndexExpressionHelpers.AssertInvokeCorrect(101, actual);
+ }
+ }
+}
diff --git a/src/System.Linq.Expressions/tests/IndexExpression/SampleClassWithProperties.cs b/src/System.Linq.Expressions/tests/IndexExpression/SampleClassWithProperties.cs
new file mode 100644
index 0000000000..a75fdc5a05
--- /dev/null
+++ b/src/System.Linq.Expressions/tests/IndexExpression/SampleClassWithProperties.cs
@@ -0,0 +1,27 @@
+// 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.Collections.Generic;
+using System.Reflection;
+
+namespace System.Linq.Expressions.Tests
+{
+ internal class SampleClassWithProperties
+ {
+ internal readonly PropertyInfo DefaultIndexer = typeof(List<int>).GetProperty("Item");
+ internal readonly ConstantExpression[] DefaultArguments = { Expression.Constant(0) };
+
+ internal MemberExpression DefaultPropertyExpression => Expression.Property(Expression.Constant(this),
+ typeof(SampleClassWithProperties).GetProperty(nameof(DefaultProperty)));
+
+ internal IndexExpression DefaultIndexExpression => Expression.MakeIndex(
+ DefaultPropertyExpression,
+ DefaultIndexer,
+ DefaultArguments);
+
+ public List<int> DefaultProperty { get; set; }
+
+ public List<int> AlternativeProperty { get; set; }
+ }
+}
diff --git a/src/System.Linq.Expressions/tests/Invoke/InvocationTests.cs b/src/System.Linq.Expressions/tests/Invoke/InvocationTests.cs
index 975b1c236e..0caebd087a 100644
--- a/src/System.Linq.Expressions/tests/Invoke/InvocationTests.cs
+++ b/src/System.Linq.Expressions/tests/Invoke/InvocationTests.cs
@@ -13,29 +13,6 @@ namespace System.Linq.Expressions.Tests
{
public delegate void X(X a);
- private struct Mutable
- {
- private int x;
- public int Foo()
- {
- return x++;
- }
- }
-
- private class Wrapper<T>
- {
- public const int Zero = 0;
- public T Field;
-#pragma warning disable 649 // For testing purposes
- public readonly T ReadOnlyField;
-#pragma warning restore
- public T Property
- {
- get { return Field; }
- set { Field = value; }
- }
- }
-
[Theory]
[ClassData(typeof(CompilationTypes))]
public static void SelfApplication(bool useInterpreter)
@@ -115,151 +92,5 @@ namespace System.Linq.Expressions.Tests
act();
Assert.Equal(1, holder.Function());
}
-
- [Theory]
- [ClassData(typeof(CompilationTypes))]
- public static void UnboxReturnsReference(bool useInterpreter)
- {
- var p = Expression.Parameter(typeof(object));
- var unbox = Expression.Unbox(p, typeof(Mutable));
- var call = Expression.Call(unbox, typeof(Mutable).GetMethod("Foo"));
- var lambda = Expression.Lambda<Func<object, int>>(call, p).Compile(useInterpreter);
-
- object boxed = new Mutable();
- Assert.Equal(0, lambda(boxed));
- Assert.Equal(1, lambda(boxed));
- Assert.Equal(2, lambda(boxed));
- Assert.Equal(3, lambda(boxed));
- }
-
- [Theory]
- [ClassData(typeof(CompilationTypes))]
- public static void ArrayWriteBack(bool useInterpreter)
- {
- var p = Expression.Parameter(typeof(Mutable[]));
- var indexed = Expression.ArrayIndex(p, Expression.Constant(0));
- var call = Expression.Call(indexed, typeof(Mutable).GetMethod("Foo"));
- var lambda = Expression.Lambda<Func<Mutable[], int>>(call, p).Compile(useInterpreter);
-
- var array = new Mutable[1];
- Assert.Equal(0, lambda(array));
- Assert.Equal(1, lambda(array));
- Assert.Equal(2, lambda(array));
- }
-
- [Theory]
- [ClassData(typeof(CompilationTypes))]
- public static void MultiRankArrayWriteBack(bool useInterpreter)
- {
- var p = Expression.Parameter(typeof(Mutable[,]));
- var indexed = Expression.ArrayIndex(p, Expression.Constant(0), Expression.Constant(0));
- var call = Expression.Call(indexed, typeof(Mutable).GetMethod("Foo"));
- var lambda = Expression.Lambda<Func<Mutable[,], int>>(call, p).Compile(useInterpreter);
-
- var array = new Mutable[1, 1];
- Assert.Equal(0, lambda(array));
- Assert.Equal(1, lambda(array));
- Assert.Equal(2, lambda(array));
- }
-
- [Theory]
- [ClassData(typeof(CompilationTypes))]
- public static void ArrayAccessWriteBack(bool useInterpreter)
- {
- var p = Expression.Parameter(typeof(Mutable[]));
- var indexed = Expression.ArrayAccess(p, Expression.Constant(0));
- var call = Expression.Call(indexed, typeof(Mutable).GetMethod("Foo"));
- var lambda = Expression.Lambda<Func<Mutable[], int>>(call, p).Compile(useInterpreter);
-
- var array = new Mutable[1];
- Assert.Equal(0, lambda(array));
- Assert.Equal(1, lambda(array));
- Assert.Equal(2, lambda(array));
- }
-
- [Theory]
- [ClassData(typeof(CompilationTypes))]
- public static void MultiRankArrayAccessWriteBack(bool useInterpreter)
- {
- var p = Expression.Parameter(typeof(Mutable[,]));
- var indexed = Expression.ArrayAccess(p, Expression.Constant(0), Expression.Constant(0));
- var call = Expression.Call(indexed, typeof(Mutable).GetMethod("Foo"));
- var lambda = Expression.Lambda<Func<Mutable[,], int>>(call, p).Compile(useInterpreter);
-
- var array = new Mutable[1, 1];
- Assert.Equal(0, lambda(array));
- Assert.Equal(1, lambda(array));
- Assert.Equal(2, lambda(array));
- }
-
- [Theory]
- [ClassData(typeof(CompilationTypes))]
- public static void IndexedPropertyAccessNoWriteBack(bool useInterpreter)
- {
- var p = Expression.Parameter(typeof(List<Mutable>));
- var indexed = Expression.Property(p, typeof(List<Mutable>).GetProperty("Item"), Expression.Constant(0));
- var call = Expression.Call(indexed, typeof(Mutable).GetMethod("Foo"));
- var lambda = Expression.Lambda<Func<List<Mutable>, int>>(call, p).Compile(useInterpreter);
-
- var list = new List<Mutable> { new Mutable() };
- Assert.Equal(0, lambda(list));
- Assert.Equal(0, lambda(list));
- }
-
- [Theory]
- [ClassData(typeof(CompilationTypes))]
- public static void FieldAccessWriteBack(bool useInterpreter)
- {
- var p = Expression.Parameter(typeof(Wrapper<Mutable>));
- var member = Expression.Field(p, typeof(Wrapper<Mutable>).GetField("Field"));
- var call = Expression.Call(member, typeof(Mutable).GetMethod("Foo"));
- var lambda = Expression.Lambda<Func<Wrapper<Mutable>, int>>(call, p).Compile(useInterpreter);
-
- var wrapper = new Wrapper<Mutable>();
- Assert.Equal(0, lambda(wrapper));
- Assert.Equal(1, lambda(wrapper));
- Assert.Equal(2, lambda(wrapper));
- }
-
- [Theory]
- [ClassData(typeof(CompilationTypes))]
- public static void PropertyAccessNoWriteBack(bool useInterpreter)
- {
- var p = Expression.Parameter(typeof(Wrapper<Mutable>));
- var member = Expression.Property(p, typeof(Wrapper<Mutable>).GetProperty("Property"));
- var call = Expression.Call(member, typeof(Mutable).GetMethod("Foo"));
- var lambda = Expression.Lambda<Func<Wrapper<Mutable>, int>>(call, p).Compile(useInterpreter);
-
- var wrapper = new Wrapper<Mutable>();
- Assert.Equal(0, lambda(wrapper));
- Assert.Equal(0, lambda(wrapper));
- }
-
- [Theory]
- [ClassData(typeof(CompilationTypes))]
- public static void ReadonlyFieldAccessWriteBack(bool useInterpreter)
- {
- var p = Expression.Parameter(typeof(Wrapper<Mutable>));
- var member = Expression.Field(p, typeof(Wrapper<Mutable>).GetField("ReadOnlyField"));
- var call = Expression.Call(member, typeof(Mutable).GetMethod("Foo"));
- var lambda = Expression.Lambda<Func<Wrapper<Mutable>, int>>(call, p).Compile(useInterpreter);
-
- var wrapper = new Wrapper<Mutable>();
- Assert.Equal(0, lambda(wrapper));
- Assert.Equal(0, lambda(wrapper));
- Assert.Equal(0, lambda(wrapper));
- }
-
- [Theory]
- [ClassData(typeof(CompilationTypes))]
- public static void ConstFieldAccessWriteBack(bool useInterpreter)
- {
- var member = Expression.Field(null, typeof(Wrapper<Mutable>).GetField("Zero"));
- var call = Expression.Call(member, typeof(int).GetMethod("GetType"));
- var lambda = Expression.Lambda<Func<Type>>(call).Compile(useInterpreter);
-
- var wrapper = new Wrapper<Mutable>();
- Assert.Equal(typeof(int), lambda());
- }
}
}
diff --git a/src/System.Linq.Expressions/tests/ListInit/ElementInitTests.cs b/src/System.Linq.Expressions/tests/ListInit/ElementInitTests.cs
index 15cc6cdfc3..88c2844bfd 100644
--- a/src/System.Linq.Expressions/tests/ListInit/ElementInitTests.cs
+++ b/src/System.Linq.Expressions/tests/ListInit/ElementInitTests.cs
@@ -64,15 +64,15 @@ namespace System.Linq.Expressions.Tests
[Fact]
public void NoArguments()
{
- Assert.Throws<ArgumentException>(null, () => Expression.ElementInit(typeof(List<int>).GetMethod("Add")));
- Assert.Throws<ArgumentException>(null, () => Expression.ElementInit(typeof(List<int>).GetMethod("Add"), Enumerable.Empty<Expression>()));
+ Assert.Throws<ArgumentException>("method", () => Expression.ElementInit(typeof(List<int>).GetMethod("Add")));
+ Assert.Throws<ArgumentException>("method", () => Expression.ElementInit(typeof(List<int>).GetMethod("Add"), Enumerable.Empty<Expression>()));
}
[Fact]
public void ArgumentCountWrong()
{
- Assert.Throws<ArgumentException>(null, () => Expression.ElementInit(typeof(List<int>).GetMethod("Add"), Expression.Constant(0), Expression.Constant(1)));
- Assert.Throws<ArgumentException>(null, () => Expression.ElementInit(typeof(List<int>).GetMethod("Add"), Enumerable.Repeat(Expression.Constant(0), 2)));
+ Assert.Throws<ArgumentException>("method", () => Expression.ElementInit(typeof(List<int>).GetMethod("Add"), Expression.Constant(0), Expression.Constant(1)));
+ Assert.Throws<ArgumentException>("method", () => Expression.ElementInit(typeof(List<int>).GetMethod("Add"), Enumerable.Repeat(Expression.Constant(0), 2)));
}
[Fact]
diff --git a/src/System.Linq.Expressions/tests/Member/MemberAccessTests.cs b/src/System.Linq.Expressions/tests/Member/MemberAccessTests.cs
index aff26fa93f..5622642e98 100644
--- a/src/System.Linq.Expressions/tests/Member/MemberAccessTests.cs
+++ b/src/System.Linq.Expressions/tests/Member/MemberAccessTests.cs
@@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.Reflection;
+using System.Reflection.Emit;
using Xunit;
namespace System.Linq.Expressions.Tests
@@ -200,6 +201,69 @@ namespace System.Linq.Expressions.Tests
Assert.Equal(42, f());
}
+ [Fact]
+ public static void Field_NullField_ThrowsArgumentNullException()
+ {
+ Assert.Throws<ArgumentNullException>("field", () => Expression.Field(null, (FieldInfo)null));
+ Assert.Throws<ArgumentNullException>("fieldName", () => Expression.Field(Expression.Constant(new FC()), (string)null));
+ }
+
+ [Fact]
+ public static void Field_NullType_ThrowsArgumentNullException()
+ {
+ Assert.Throws<ArgumentNullException>("type", () => Expression.Field(Expression.Constant(new FC()), null, "AField"));
+ }
+
+ [Fact]
+ public static void Field_StaticField_NonNullExpression_ThrowsArgumentException()
+ {
+ Expression expression = Expression.Constant(new FC());
+ Assert.Throws<ArgumentException>("expression", () => Expression.Field(expression, typeof(FC), nameof(FC.SI)));
+ Assert.Throws<ArgumentException>("expression", () => Expression.Field(expression, typeof(FC).GetField(nameof(FC.SI))));
+
+ Assert.Throws<ArgumentException>("expression", () => Expression.MakeMemberAccess(expression, typeof(FC).GetField(nameof(FC.SI))));
+ }
+
+ [Fact]
+ public static void Field_InstanceField_NullExpression_ThrowsArgumentException()
+ {
+ Assert.Throws<ArgumentNullException>("expression", () => Expression.Field(null, "fieldName"));
+ Assert.Throws<ArgumentException>("field", () => Expression.Field(null, typeof(FC), nameof(FC.II)));
+ Assert.Throws<ArgumentException>("field", () => Expression.Field(null, typeof(FC).GetField(nameof(FC.II))));
+
+ Assert.Throws<ArgumentException>("field", () => Expression.MakeMemberAccess(null, typeof(FC).GetField(nameof(FC.II))));
+ }
+
+ [Fact]
+ public static void Field_ExpressionNotReadable_ThrowsArgumentException()
+ {
+ Expression expression = Expression.Property(null, typeof(Unreadable<string>), nameof(Unreadable<string>.WriteOnly));
+
+ Assert.Throws<ArgumentException>("expression", () => Expression.Field(expression, "fieldName"));
+ Assert.Throws<ArgumentException>("expression", () => Expression.Field(expression, typeof(FC), nameof(FC.SI)));
+ Assert.Throws<ArgumentException>("expression", () => Expression.Field(expression, typeof(FC).GetField(nameof(FC.SI))));
+
+ Assert.Throws<ArgumentException>("expression", () => Expression.MakeMemberAccess(expression, typeof(FC).GetField(nameof(FC.SI))));
+ }
+
+ [Fact]
+ public static void Field_ExpressionNotTypeOfDeclaringType_ThrowsArgumentException()
+ {
+ Expression expression = Expression.Constant(new PC());
+
+ Assert.Throws<ArgumentException>(null, () => Expression.Field(expression, typeof(FC), nameof(FC.II)));
+ Assert.Throws<ArgumentException>(null, () => Expression.Field(expression, typeof(FC).GetField(nameof(FC.II))));
+
+ Assert.Throws<ArgumentException>(null, () => Expression.MakeMemberAccess(expression, typeof(FC).GetField(nameof(FC.II))));
+ }
+
+ [Fact]
+ public static void Field_NoSuchFieldName_ThrowsArgumentException()
+ {
+ Assert.Throws<ArgumentException>(null, () => Expression.Field(Expression.Constant(new FC()), "NoSuchField"));
+ Assert.Throws<ArgumentException>(null, () => Expression.Field(Expression.Constant(new FC()), typeof(FC), "NoSuchField"));
+ }
+
[Theory]
[ClassData(typeof(CompilationTypes))]
public static void CheckMemberAccessClassInstancePropertyTest(bool useInterpreter)
@@ -323,13 +387,154 @@ namespace System.Linq.Expressions.Tests
[Fact]
public static void AccessIndexedPropertyWithoutIndex()
{
- Assert.Throws<ArgumentException>(null, () => Expression.Property(Expression.Default(typeof(List<int>)), typeof(List<int>).GetProperty("Item")));
+ Assert.Throws<ArgumentException>("property", () => Expression.Property(Expression.Default(typeof(List<int>)), typeof(List<int>).GetProperty("Item")));
}
[Fact]
public static void AccessIndexedPropertyWithoutIndexWriteOnly()
{
- Assert.Throws<ArgumentException>(null, () => Expression.Property(Expression.Default(typeof(UnreadableIndexableClass)), typeof(UnreadableIndexableClass).GetProperty("Item")));
+ Assert.Throws<ArgumentException>("property", () => Expression.Property(Expression.Default(typeof(UnreadableIndexableClass)), typeof(UnreadableIndexableClass).GetProperty("Item")));
+ }
+
+ [Fact]
+ public static void Property_NullProperty_ThrowsArgumentNullException()
+ {
+ Assert.Throws<ArgumentNullException>("property", () => Expression.Property(null, (PropertyInfo)null));
+ Assert.Throws<ArgumentNullException>("propertyName", () => Expression.Property(Expression.Constant(new PC()), (string)null));
+ }
+
+ [Fact]
+ public static void Property_NullType_ThrowsArgumentNullException()
+ {
+ Assert.Throws<ArgumentNullException>("type", () => Expression.Property(Expression.Constant(new PC()), null, "AProperty"));
+ }
+
+ [Fact]
+ public static void Property_StaticProperty_NonNullExpression_ThrowsArgumentException()
+ {
+ Expression expression = Expression.Constant(new PC());
+ Assert.Throws<ArgumentException>("expression", () => Expression.Property(expression, typeof(PC), nameof(PC.SI)));
+ Assert.Throws<ArgumentException>("expression", () => Expression.Property(expression, typeof(PC).GetProperty(nameof(PC.SI))));
+ Assert.Throws<ArgumentException>("expression", () => Expression.Property(expression, typeof(PC).GetProperty(nameof(PC.SI)).GetGetMethod()));
+
+ Assert.Throws<ArgumentException>("expression", () => Expression.MakeMemberAccess(expression, typeof(PC).GetProperty(nameof(PC.SI))));
+ }
+
+ [Fact]
+ public static void Property_InstanceProperty_NullExpression_ThrowsArgumentException()
+ {
+ Assert.Throws<ArgumentNullException>("expression", () => Expression.Property(null, "propertyName"));
+ Assert.Throws<ArgumentException>("property", () => Expression.Property(null, typeof(PC), nameof(PC.II)));
+ Assert.Throws<ArgumentException>("property", () => Expression.Property(null, typeof(PC).GetProperty(nameof(PC.II))));
+ Assert.Throws<ArgumentException>("property", () => Expression.Property(null, typeof(PC).GetProperty(nameof(PC.II)).GetGetMethod()));
+
+ Assert.Throws<ArgumentException>("property", () => Expression.MakeMemberAccess(null, typeof(PC).GetProperty(nameof(PC.II))));
+ }
+
+ [Fact]
+ public static void Property_ExpressionNotReadable_ThrowsArgumentException()
+ {
+ Expression expression = Expression.Property(null, typeof(Unreadable<string>), nameof(Unreadable<string>.WriteOnly));
+
+ Assert.Throws<ArgumentException>("expression", () => Expression.Property(expression, "fieldName"));
+ Assert.Throws<ArgumentException>("expression", () => Expression.Property(expression, typeof(PC), nameof(PC.SI)));
+ Assert.Throws<ArgumentException>("expression", () => Expression.Property(expression, typeof(PC).GetProperty(nameof(PC.SI))));
+ Assert.Throws<ArgumentException>("expression", () => Expression.Property(expression, typeof(PC).GetProperty(nameof(PC.SI)).GetGetMethod()));
+ }
+
+ [Fact]
+ public static void Property_ExpressionNotTypeOfDeclaringType_ThrowsArgumentException()
+ {
+ Expression expression = Expression.Constant(new FC());
+
+ Assert.Throws<ArgumentException>("property", () => Expression.Property(expression, typeof(PC), nameof(PC.II)));
+ Assert.Throws<ArgumentException>("property", () => Expression.Property(expression, typeof(PC).GetProperty(nameof(PC.II))));
+ Assert.Throws<ArgumentException>("property", () => Expression.Property(expression, typeof(PC).GetProperty(nameof(PC.II)).GetGetMethod()));
+
+ Assert.Throws<ArgumentException>("property", () => Expression.MakeMemberAccess(expression, typeof(PC).GetProperty(nameof(PC.II))));
+ }
+
+ [Fact]
+ public static void Property_NoSuchPropertyName_ThrowsArgumentException()
+ {
+ Assert.Throws<ArgumentException>("propertyName", () => Expression.Property(Expression.Constant(new PC()), "NoSuchProperty"));
+ Assert.Throws<ArgumentException>("propertyName", () => Expression.Property(Expression.Constant(new PC()), typeof(PC), "NoSuchProperty"));
+ }
+
+ [Fact]
+ public static void Property_NullPropertyAccessor_ThrowsArgumentNullException()
+ {
+ Assert.Throws<ArgumentNullException>("propertyAccessor", () => Expression.Property(Expression.Constant(new PC()), (MethodInfo)null));
+ }
+
+ [Fact]
+ public static void Property_GenericPropertyAccessor_ThrowsArgumentException()
+ {
+ Assert.Throws<ArgumentException>("propertyAccessor", () => Expression.Property(null, typeof(GenericClass<>).GetMethod(nameof(GenericClass<string>.Method))));
+ Assert.Throws<ArgumentException>("propertyAccessor", () => Expression.Property(null, typeof(NonGenericClass).GetMethod(nameof(NonGenericClass.GenericMethod))));
+ }
+
+ [Fact]
+ public static void Property_PropertyAccessorNotFromProperty_ThrowsArgumentException()
+ {
+ Assert.Throws<ArgumentException>("propertyAccessor", () => Expression.Property(null, typeof(NonGenericClass).GetMethod(nameof(NonGenericClass.StaticMethod))));
+ }
+
+ [Fact]
+ public static void PropertyOrField_NullExpression_ThrowsArgumentNullException()
+ {
+ Assert.Throws<ArgumentNullException>("expression", () => Expression.PropertyOrField(null, "APropertyOrField"));
+ }
+
+ [Fact]
+ public static void PropertyOrField_ExpressionNotReadable_ThrowsArgumentNullException()
+ {
+ Expression expression = Expression.Property(null, typeof(Unreadable<string>), nameof(Unreadable<string>.WriteOnly));
+
+ Assert.Throws<ArgumentException>("expression", () => Expression.PropertyOrField(expression, "APropertyOrField"));
+ }
+
+ [Fact]
+ public static void PropertyOrField_NoSuchPropertyOrField_ThrowsArgumentException()
+ {
+ Expression expression = Expression.Constant(new PC());
+ Assert.Throws<ArgumentException>("propertyOrFieldName", () => Expression.PropertyOrField(expression, "NoSuchPropertyOrField"));
+ }
+
+ [Fact]
+ public static void MakeMemberAccess_NullMember_ThrowsArgumentNullExeption()
+ {
+ Assert.Throws<ArgumentNullException>("member", () => Expression.MakeMemberAccess(Expression.Constant(new PC()), null));
+ }
+
+ [Fact]
+ public static void MakeMemberAccess_MemberNotFieldOrProperty_ThrowsArgumentExeption()
+ {
+ MemberInfo member = typeof(NonGenericClass).GetEvent("Event");
+
+ Assert.Throws<ArgumentException>("member", () => Expression.MakeMemberAccess(Expression.Constant(new PC()), member));
+ }
+
+ [Fact]
+ public static void Property_NoGetOrSetAccessors_ThrowsArgumentException()
+ {
+ AssemblyBuilder assembly = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Name"), AssemblyBuilderAccess.Run);
+ ModuleBuilder module = assembly.DefineDynamicModule("Module");
+
+ TypeBuilder type = module.DefineType("Type");
+ PropertyBuilder property = type.DefineProperty("Property", PropertyAttributes.None, typeof(void), new Type[0]);
+
+ TypeInfo createdType = type.CreateTypeInfo();
+ PropertyInfo createdProperty = createdType.DeclaredProperties.First();
+
+ Expression expression = Expression.Constant(Activator.CreateInstance(createdType.AsType()));
+
+ Assert.Throws<ArgumentException>("property", () => Expression.Property(expression, createdProperty));
+ Assert.Throws<ArgumentException>("property", () => Expression.Property(expression, createdProperty.Name));
+
+ Assert.Throws<ArgumentException>("property", () => Expression.PropertyOrField(expression, createdProperty.Name));
+
+ Assert.Throws<ArgumentException>("property", () => Expression.MakeMemberAccess(expression, createdProperty));
}
}
}
diff --git a/src/System.Linq.Expressions/tests/New/NewTests.cs b/src/System.Linq.Expressions/tests/New/NewTests.cs
index d0e2b28cf8..fdb9450f47 100644
--- a/src/System.Linq.Expressions/tests/New/NewTests.cs
+++ b/src/System.Linq.Expressions/tests/New/NewTests.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Collections.Generic;
using System.Reflection;
using Xunit;
@@ -247,9 +248,7 @@ namespace System.Linq.Expressions.Tests
class TestPrivateDefaultConstructor
{
- private TestPrivateDefaultConstructor()
- {
- }
+ private TestPrivateDefaultConstructor() { }
public static Func<TestPrivateDefaultConstructor> GetInstanceFunc(bool useInterpreter)
{
@@ -257,22 +256,36 @@ namespace System.Linq.Expressions.Tests
return lambda.Compile(useInterpreter);
}
- public override string ToString()
- {
- return "Test instance";
- }
+ public override string ToString() => "Test instance";
+ }
+
+ [Fact]
+ public static void New_NullConstructor_ThrowsArgumentNullException()
+ {
+ Assert.Throws<ArgumentNullException>("constructor", () => Expression.New((ConstructorInfo)null));
+ Assert.Throws<ArgumentNullException>("constructor", () => Expression.New(null, new Expression[0]));
+ Assert.Throws<ArgumentNullException>("constructor", () => Expression.New(null, (IEnumerable<Expression>)new Expression[0]));
+
+ Assert.Throws<ArgumentNullException>("constructor", () => Expression.New(null, new Expression[0], new MemberInfo[0]));
+ Assert.Throws<ArgumentNullException>("constructor", () => Expression.New(null, new Expression[0], (IEnumerable<MemberInfo>)new MemberInfo[0]));
}
[Fact]
- public static void CheckNewWithStaticCtor()
+ public static void StaticConstructor_ThrowsArgumentException()
{
var cctor = typeof(StaticCtor).GetTypeInfo().DeclaredConstructors.Single(c => c.IsStatic);
+
Assert.Throws<ArgumentException>("constructor", () => Expression.New(cctor));
+ Assert.Throws<ArgumentException>("constructor", () => Expression.New(cctor, new Expression[0]));
+ Assert.Throws<ArgumentException>("constructor", () => Expression.New(cctor, (IEnumerable<Expression>)new Expression[0]));
+
+ Assert.Throws<ArgumentException>("constructor", () => Expression.New(cctor, new Expression[0], new MemberInfo[0]));
+ Assert.Throws<ArgumentException>("constructor", () => Expression.New(cctor, new Expression[0], (IEnumerable<MemberInfo>)new MemberInfo[0]));
}
[Theory]
[ClassData(typeof(CompilationTypes))]
- public static void CheckNewWithAbstractCtor(bool useInterpretation)
+ public static void Compile_AbstractCtor_ThrowsInvalidOperationExeption(bool useInterpretation)
{
var ctor = typeof(AbstractCtor).GetTypeInfo().DeclaredConstructors.Single();
var f = Expression.Lambda<Func<AbstractCtor>>(Expression.New(ctor));
@@ -280,18 +293,225 @@ namespace System.Linq.Expressions.Tests
Assert.Throws<InvalidOperationException>(() => f.Compile(useInterpretation));
}
- static class StaticCtor
+ [Fact]
+ public static void ConstructorDeclaringType_GenericTypeDefinition_ThrowsArgumentException()
+ {
+ ConstructorInfo constructor = typeof(GenericClass<>).GetConstructor(new Type[0]);
+
+ Assert.Throws<ArgumentException>("constructor", () => Expression.New(constructor));
+ Assert.Throws<ArgumentException>("constructor", () => Expression.New(constructor, new Expression[0]));
+ Assert.Throws<ArgumentException>("constructor", () => Expression.New(constructor, (IEnumerable<Expression>)new Expression[0]));
+
+ }
+
+ [Fact]
+ public static void ConstructorDeclaringType_GenericTypeDefintion_Works()
+ {
+ // Should probably throw an ArgumentException, similar to other overloads
+ ConstructorInfo constructor = typeof(GenericClass<>).GetConstructor(new Type[0]);
+
+ Expression.New(constructor, new Expression[0], new MemberInfo[0]);
+ Expression.New(constructor, new Expression[0], new MemberInfo[0]);
+ }
+
+ public static IEnumerable<object[]> ConstructorAndArguments_DifferentLengths_TestData()
+ {
+ yield return new object[] { typeof(ClassWithCtors).GetConstructor(new Type[0]), new Expression[2] };
+ yield return new object[] { typeof(ClassWithCtors).GetConstructor(new Type[] { typeof(string) }), new Expression[0] };
+ yield return new object[] { typeof(ClassWithCtors).GetConstructor(new Type[] { typeof(string) }), new Expression[2] };
+ }
+
+ [Theory]
+ [MemberData(nameof(ConstructorAndArguments_DifferentLengths_TestData))]
+ public static void ConstructorAndArguments_DifferentLengths_ThrowsArgumentException(ConstructorInfo constructor, Expression[] expressions)
{
- static StaticCtor()
+ if (expressions.Length == 0)
{
+ Assert.Throws<ArgumentException>(null, () => Expression.New(constructor));
}
+ Assert.Throws<ArgumentException>(null, () => Expression.New(constructor, expressions));
+ Assert.Throws<ArgumentException>(null, () => Expression.New(constructor, (IEnumerable<Expression>)expressions));
+
+ Assert.Throws<ArgumentException>(null, () => Expression.New(constructor, expressions, new MemberInfo[expressions.Length]));
+ Assert.Throws<ArgumentException>(null, () => Expression.New(constructor, expressions, (IEnumerable<MemberInfo>)new MemberInfo[expressions.Length]));
+ }
+
+ [Fact]
+ public static void Arguments_ExpressionNotReadable_ThrowsArgumentExeption()
+ {
+ ConstructorInfo constructor = typeof(ClassWithCtors).GetConstructor(new Type[] { typeof(string) });
+ Expression[] expressions = new Expression[] { Expression.Property(null, typeof(Unreachable<string>), nameof(Unreachable<string>.WriteOnly)) };
+
+ Assert.Throws<ArgumentException>("arguments", () => Expression.New(constructor, expressions));
+ Assert.Throws<ArgumentException>("arguments", () => Expression.New(constructor, (IEnumerable<Expression>)expressions));
+
+ Assert.Throws<ArgumentException>("arguments", () => Expression.New(constructor, expressions, new MemberInfo[1]));
+ Assert.Throws<ArgumentException>("arguments", () => Expression.New(constructor, expressions, (IEnumerable<MemberInfo>)new MemberInfo[1]));
+ }
+
+ [Fact]
+ public static void ConstructorAndArguments_IncompatibleTypes_ThrowsArgumentException()
+ {
+ ConstructorInfo constructor = typeof(ClassWithCtors).GetConstructor(new Type[] { typeof(string) });
+ Expression[] expressions = new Expression[] { Expression.Constant(5) };
+
+ Assert.Throws<ArgumentException>("arguments", () => Expression.New(constructor, expressions));
+ Assert.Throws<ArgumentException>("arguments", () => Expression.New(constructor, (IEnumerable<Expression>)expressions));
+
+ MemberInfo[] members = new MemberInfo[] { typeof(ClassWithCtors).GetProperty(nameof(ClassWithCtors.IntProperty)) };
+ Assert.Throws<ArgumentException>("arguments", () => Expression.New(constructor, expressions, members));
+ Assert.Throws<ArgumentException>("arguments", () => Expression.New(constructor, expressions, members));
+ }
+
+ public static IEnumerable<object[]> ArgumentsAndMembers_DifferentLengths_TestData()
+ {
+ yield return new object[] { typeof(ClassWithCtors).GetConstructor(new Type[0]), new Expression[0], new MemberInfo[1] };
+ yield return new object[] { typeof(ClassWithCtors).GetConstructor(new Type[] { typeof(string) }), new Expression[1], new MemberInfo[0] };
+ yield return new object[] { typeof(ClassWithCtors).GetConstructor(new Type[] { typeof(string) }), new Expression[1], new MemberInfo[2] };
+ }
+
+ [Theory]
+ [MemberData(nameof(ArgumentsAndMembers_DifferentLengths_TestData))]
+ public static void ArgumentsAndMembers_DifferentLengths_ThrowsArgumentException(ConstructorInfo constructor, Expression[] arguments, MemberInfo[] members)
+ {
+ Assert.Throws<ArgumentException>(null, () => Expression.New(constructor, arguments, members));
+ Assert.Throws<ArgumentException>(null, () => Expression.New(constructor, arguments, (IEnumerable<MemberInfo>)members));
+ }
+
+ [Fact]
+ public static void Members_MemberNotOnDeclaringType_ThrowsArgumentException()
+ {
+ ConstructorInfo constructor = typeof(ClassWithCtors).GetConstructor(new Type[] { typeof(string) });
+ Expression[] arguments = new Expression[] { Expression.Constant("hello") };
+ MemberInfo[] members = new MemberInfo[] { typeof(Unreachable<string>).GetProperty(nameof(Unreachable<string>.WriteOnly)) };
+
+ Assert.Throws<ArgumentException>("members", () => Expression.New(constructor, arguments, members));
+ Assert.Throws<ArgumentException>("members", () => Expression.New(constructor, arguments, (IEnumerable<MemberInfo>)members));
+ }
+
+ [Theory]
+ [InlineData(nameof(ClassWithCtors.s_field))]
+ [InlineData(nameof(ClassWithCtors.StaticProperty))]
+ [InlineData(nameof(ClassWithCtors.StaticMethod))]
+ public static void Members_StaticMember_ThrowsArgumentException(string memberName)
+ {
+ ConstructorInfo constructor = typeof(ClassWithCtors).GetConstructor(new Type[] { typeof(string) });
+ Expression[] arguments = new Expression[] { Expression.Constant("hello") };
+ MemberInfo[] members = new MemberInfo[] { typeof(ClassWithCtors).GetMember(memberName).First() };
+
+ Assert.Throws<ArgumentException>("members", () => Expression.New(constructor, arguments, members));
+ Assert.Throws<ArgumentException>("members", () => Expression.New(constructor, arguments, (IEnumerable<MemberInfo>)members));
+ }
+
+ [Fact]
+ public static void Members_MemberWriteOnly_ThrowsArgumentException()
+ {
+ ConstructorInfo constructor = typeof(ClassWithCtors).GetConstructor(new Type[] { typeof(string) });
+ Expression[] arguments = new Expression[] { Expression.Constant("hello") };
+ MemberInfo[] members = new MemberInfo[] { typeof(ClassWithCtors).GetProperty(nameof(ClassWithCtors.WriteOnlyProperty)) };
+
+ Assert.Throws<ArgumentException>("members", () => Expression.New(constructor, arguments, members));
+ Assert.Throws<ArgumentException>("members", () => Expression.New(constructor, arguments, (IEnumerable<MemberInfo>)members));
+ }
+
+ [Fact]
+ public static void Members_MemberNotPropertyAccessor_ThrowsArgumentException()
+ {
+ ConstructorInfo constructor = typeof(ClassWithCtors).GetConstructor(new Type[] { typeof(string) });
+ Expression[] arguments = new Expression[] { Expression.Constant("hello") };
+ MemberInfo[] members = new MemberInfo[] { typeof(ClassWithCtors).GetMethod(nameof(ClassWithCtors.InstanceMethod)) };
+
+ Assert.Throws<ArgumentException>("members", () => Expression.New(constructor, arguments, members));
+ Assert.Throws<ArgumentException>("members", () => Expression.New(constructor, arguments, (IEnumerable<MemberInfo>)members));
+ }
+
+ [Fact]
+ public static void Members_MemberNotFieldPropertyOrMethod_ThrowsArgumentException()
+ {
+ ConstructorInfo constructor = typeof(ClassWithCtors).GetConstructor(new Type[] { typeof(string) });
+ Expression[] arguments = new Expression[] { Expression.Constant("hello") };
+ MemberInfo[] members = new MemberInfo[] { constructor };
+
+ Assert.Throws<ArgumentException>("members", () => Expression.New(constructor, arguments, members));
+ Assert.Throws<ArgumentException>("members", () => Expression.New(constructor, arguments, (IEnumerable<MemberInfo>)members));
+ }
+
+ [Fact]
+ public static void Members_ArgumentTypeAndMemberTypeDontMatch_ThrowsArgumentException()
+ {
+ ConstructorInfo constructor = typeof(ClassWithCtors).GetConstructor(new Type[] { typeof(string) });
+ Expression[] arguments = new Expression[] { Expression.Constant("hello") };
+ MemberInfo[] members = new MemberInfo[] { typeof(ClassWithCtors).GetField(nameof(ClassWithCtors._field)) };
+
+ Assert.Throws<ArgumentException>(null, () => Expression.New(constructor, arguments, members));
+ Assert.Throws<ArgumentException>(null, () => Expression.New(constructor, arguments, (IEnumerable<MemberInfo>)members));
+ }
+
+ [Fact]
+ public static void Type_Null_ThrowsArgumentNullException()
+ {
+ Assert.Throws<ArgumentNullException>("type", () => Expression.New((Type)null));
+ }
+
+ public static IEnumerable<object[]> Type_InvalidType_TestData()
+ {
+ yield return new object[] { typeof(void) };
+ yield return new object[] { typeof(int).MakeByRefType() };
+ yield return new object[] { typeof(StaticCtor) };
+ yield return new object[] { typeof(ClassWithNoDefaultCtor) };
+ }
+
+ [Theory]
+ [MemberData(nameof(Type_InvalidType_TestData))]
+ [InlineData(typeof(int*))]
+ public static void Type_InvalidType_ThrowsArgumentException(Type type)
+ {
+ Assert.Throws<ArgumentException>("type", () => Expression.New(type));
+ }
+
+ static class StaticCtor
+ {
+ static StaticCtor() { }
}
abstract class AbstractCtor
{
- public AbstractCtor()
- {
- }
+ public AbstractCtor() { }
+ }
+
+ class GenericClass<T>
+ {
+ public GenericClass() { }
+ }
+
+ class ClassWithCtors
+ {
+ public ClassWithCtors() { }
+ public ClassWithCtors(string obj) { }
+
+ public string StringProperty { get; set; }
+ public int IntProperty { get; set; }
+ public int WriteOnlyProperty { set { } }
+
+#pragma warning disable 0649
+ public int _field;
+ public static int s_field;
+#pragma warning restore 0649
+
+ public static string StaticProperty { get; set; }
+ public static void StaticMethod() { }
+
+ public void InstanceMethod() { }
+ }
+
+ class ClassWithNoDefaultCtor
+ {
+ public ClassWithNoDefaultCtor(string s) { }
+ }
+
+ static class Unreachable<T>
+ {
+ public static T WriteOnly { set { } }
}
}
}
diff --git a/src/System.Linq.Expressions/tests/Switch/SwitchTests.cs b/src/System.Linq.Expressions/tests/Switch/SwitchTests.cs
index b2d5196ee4..0bd77c5d8e 100644
--- a/src/System.Linq.Expressions/tests/Switch/SwitchTests.cs
+++ b/src/System.Linq.Expressions/tests/Switch/SwitchTests.cs
@@ -371,12 +371,12 @@ namespace System.Linq.Expressions.Tests
}
[Theory, MemberData(nameof(ComparisonsWithInvalidParmeterCounts))]
- public void InvalidComparisonMethodParameterCount(MethodInfo comparer)
+ public void InvalidComparisonMethodParameterCount(MethodInfo comparison)
{
- Assert.Throws<ArgumentException>(null, () => Expression.Switch(Expression.Constant(0), Expression.Empty(), comparer));
- Assert.Throws<ArgumentException>(null, () => Expression.Switch(Expression.Constant(0), Expression.Empty(), comparer, Enumerable.Empty<SwitchCase>()));
- Assert.Throws<ArgumentException>(null, () => Expression.Switch(typeof(int), Expression.Constant(0), Expression.Constant(1), comparer));
- Assert.Throws<ArgumentException>(null, () => Expression.Switch(typeof(int), Expression.Constant(0), Expression.Constant(1), comparer, Enumerable.Empty<SwitchCase>()));
+ Assert.Throws<ArgumentException>("comparison", () => Expression.Switch(Expression.Constant(0), Expression.Empty(), comparison));
+ Assert.Throws<ArgumentException>("comparison", () => Expression.Switch(Expression.Constant(0), Expression.Empty(), comparison, Enumerable.Empty<SwitchCase>()));
+ Assert.Throws<ArgumentException>("comparison", () => Expression.Switch(typeof(int), Expression.Constant(0), Expression.Constant(1), comparison));
+ Assert.Throws<ArgumentException>("comparison", () => Expression.Switch(typeof(int), Expression.Constant(0), Expression.Constant(1), comparison, Enumerable.Empty<SwitchCase>()));
}
[Fact]
diff --git a/src/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj b/src/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj
index e431d15630..23674296fc 100644
--- a/src/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj
+++ b/src/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
@@ -12,6 +12,8 @@
<OutputType>Library</OutputType>
<AssemblyName>System.Linq.Expressions.Tests</AssemblyName>
<RootNamespace>System.Linq.Expressions.Tests</RootNamespace>
+ <IsInterpreting Condition="'$(PackageTargetFramework)' == 'netcore50'">true</IsInterpreting>
+ <DefineConstants Condition=" '$(IsInterpreting)' != 'true' ">$(DefineConstants);FEATURE_COMPILE</DefineConstants>
<DefineConstants Condition=" '$(FeatureInterpret)' == 'true' ">$(DefineConstants);FEATURE_INTERPRET</DefineConstants>
<KeepAllProjectReferences>true</KeepAllProjectReferences>
<NugetTargetMoniker>.NETStandard,Version=v1.6</NugetTargetMoniker>
@@ -25,6 +27,7 @@
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="CompilerTests.cs" />
<Compile Include="Array\ArrayAccessTests.cs" />
<Compile Include="Array\ArrayArrayIndexTests.cs" />
<Compile Include="Array\ArrayArrayLengthTests.cs" />
@@ -60,7 +63,6 @@
<Compile Include="BinaryOperators\Bitwise\BinaryNullableOrTests.cs" />
<Compile Include="BinaryOperators\Bitwise\BinaryOrTests.cs" />
<Compile Include="BinaryOperators\Coalesce\BinaryCoalesceTests.cs" />
- <Compile Include="BinaryOperators\Coalesce\BinaryNullableCoalesceTests.cs" />
<Compile Include="BinaryOperators\Comparison\BinaryEqualTests.cs" />
<Compile Include="BinaryOperators\Comparison\BinaryGreaterThanOrEqualTests.cs" />
<Compile Include="BinaryOperators\Comparison\BinaryGreaterThanTests.cs" />
@@ -85,6 +87,7 @@
<Compile Include="Block\ParameterBlockTests.cs" />
<Compile Include="Block\SharedBlockTests.cs" />
<Compile Include="Call\CallFactoryTests.cs" />
+ <Compile Include="Call\CallTests.cs" />
<Compile Include="Cast\AsNullable.cs" />
<Compile Include="Cast\AsTests.cs" />
<Compile Include="Cast\CastNullableTests.cs" />
@@ -97,6 +100,8 @@
<Compile Include="Constant\ConstantTests.cs" />
<Compile Include="Convert\ConvertCheckedTests.cs" />
<Compile Include="Convert\ConvertTests.cs" />
+ <Compile Include="DebugInfo\DebugInfoExpressionTests.cs" />
+ <Compile Include="DebugInfo\SymbolDocumentInfoTests.cs" />
<Compile Include="Default\DefaultTests.cs" />
<Compile Include="DelegateType\ActionTypeTests.cs" />
<Compile Include="DelegateType\DelegateCreationTests.cs" />
@@ -111,6 +116,10 @@
<Compile Include="Goto\MakeGoto.cs" />
<Compile Include="Goto\Return.cs" />
<Compile Include="HelperTypes.cs" />
+ <Compile Include="IndexExpression\IndexExpressionHelpers.cs" />
+ <Compile Include="IndexExpression\IndexExpressionVisitorTests.cs" />
+ <Compile Include="IndexExpression\SampleClassWithProperties.cs" />
+ <Compile Include="IndexExpression\IndexExpressionTests.cs" />
<Compile Include="Invoke\InvocationTests.cs" />
<Compile Include="Invoke\InvokeFactoryTests.cs" />
<Compile Include="Label\LabelTargetTests.cs" />
@@ -217,8 +226,5 @@
<Name>System.Linq.Expressions</Name>
</ProjectReference>
</ItemGroup>
- <ItemGroup>
- <Folder Include="Visitor\" />
- </ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project> \ No newline at end of file
diff --git a/src/System.Linq.Expressions/tests/Unary/IncDecAssign/PostDecrementAssignTests.cs b/src/System.Linq.Expressions/tests/Unary/IncDecAssign/PostDecrementAssignTests.cs
index 5dc44bfa59..8bbc480884 100644
--- a/src/System.Linq.Expressions/tests/Unary/IncDecAssign/PostDecrementAssignTests.cs
+++ b/src/System.Linq.Expressions/tests/Unary/IncDecAssign/PostDecrementAssignTests.cs
@@ -179,7 +179,7 @@ namespace System.Linq.Expressions.Tests
{
Expression variable = Expression.Variable(typeof(string));
MethodInfo method = typeof(object).GetTypeInfo().GetDeclaredMethod("ReferenceEquals");
- Assert.Throws<ArgumentException>(null, () => Expression.PostDecrementAssign(variable, method));
+ Assert.Throws<ArgumentException>("method", () => Expression.PostDecrementAssign(variable, method));
}
[Fact]
diff --git a/src/System.Linq.Expressions/tests/Unary/IncDecAssign/PostIncrementAssignTests.cs b/src/System.Linq.Expressions/tests/Unary/IncDecAssign/PostIncrementAssignTests.cs
index 4830da0245..8406bbedfb 100644
--- a/src/System.Linq.Expressions/tests/Unary/IncDecAssign/PostIncrementAssignTests.cs
+++ b/src/System.Linq.Expressions/tests/Unary/IncDecAssign/PostIncrementAssignTests.cs
@@ -179,7 +179,7 @@ namespace System.Linq.Expressions.Tests
{
Expression variable = Expression.Variable(typeof(string));
MethodInfo method = typeof(object).GetTypeInfo().GetDeclaredMethod("ReferenceEquals");
- Assert.Throws<ArgumentException>(null, () => Expression.PostIncrementAssign(variable, method));
+ Assert.Throws<ArgumentException>("method", () => Expression.PostIncrementAssign(variable, method));
}
[Fact]
diff --git a/src/System.Linq.Expressions/tests/Unary/IncDecAssign/PreDecrementAssignTests.cs b/src/System.Linq.Expressions/tests/Unary/IncDecAssign/PreDecrementAssignTests.cs
index 0426c255ed..006e8a7a2f 100644
--- a/src/System.Linq.Expressions/tests/Unary/IncDecAssign/PreDecrementAssignTests.cs
+++ b/src/System.Linq.Expressions/tests/Unary/IncDecAssign/PreDecrementAssignTests.cs
@@ -179,7 +179,7 @@ namespace System.Linq.Expressions.Tests
{
Expression variable = Expression.Variable(typeof(string));
MethodInfo method = typeof(object).GetTypeInfo().GetDeclaredMethod("ReferenceEquals");
- Assert.Throws<ArgumentException>(null, () => Expression.PreDecrementAssign(variable, method));
+ Assert.Throws<ArgumentException>("method", () => Expression.PreDecrementAssign(variable, method));
}
[Fact]
diff --git a/src/System.Linq.Expressions/tests/Unary/IncDecAssign/PreIncrementAssignTests.cs b/src/System.Linq.Expressions/tests/Unary/IncDecAssign/PreIncrementAssignTests.cs
index cb65b477ae..d687e25324 100644
--- a/src/System.Linq.Expressions/tests/Unary/IncDecAssign/PreIncrementAssignTests.cs
+++ b/src/System.Linq.Expressions/tests/Unary/IncDecAssign/PreIncrementAssignTests.cs
@@ -179,7 +179,7 @@ namespace System.Linq.Expressions.Tests
{
Expression variable = Expression.Variable(typeof(string));
MethodInfo method = typeof(object).GetTypeInfo().GetDeclaredMethod("ReferenceEquals");
- Assert.Throws<ArgumentException>(null, () => Expression.PreIncrementAssign(variable, method));
+ Assert.Throws<ArgumentException>("method", () => Expression.PreIncrementAssign(variable, method));
}
[Fact]
diff --git a/src/System.Linq.Expressions/tests/Visitor/VisitorTests.cs b/src/System.Linq.Expressions/tests/Visitor/VisitorTests.cs
index 5650779c2e..6e8cf01820 100644
--- a/src/System.Linq.Expressions/tests/Visitor/VisitorTests.cs
+++ b/src/System.Linq.Expressions/tests/Visitor/VisitorTests.cs
@@ -197,7 +197,7 @@ namespace System.Linq.Expressions.Tests
[Fact]
public void VisitCollectionReturnSameIfChildrenUnchanged()
{
- var collection = new List<Expression> { Expression.Constant(0), Expression.Constant(2) }.AsReadOnly();
+ var collection = new List<Expression> { Expression.Constant(0), Expression.Constant(2), Expression.DebugInfo(Expression.SymbolDocument("fileName"), 1, 1, 1, 1) }.AsReadOnly();
Assert.Same(collection, new DefaultVisitor().Visit(collection));
}
@@ -339,5 +339,12 @@ namespace System.Linq.Expressions.Tests
var instance = (ConstantExpression)call.Object;
Assert.Same(list, instance.Value);
}
+
+ [Fact]
+ public void Visit_DebugInfoExpression_DoesNothing()
+ {
+ DebugInfoExpression expression = Expression.DebugInfo(Expression.SymbolDocument("fileName"), 1, 1, 1, 1);
+ Assert.Same(expression, new DefaultVisitor().Visit(expression));
+ }
}
}
diff --git a/src/System.Linq.Parallel/dir.props b/src/System.Linq.Parallel/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Linq.Parallel/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Linq.Parallel/pkg/System.Linq.Parallel.pkgproj b/src/System.Linq.Parallel/pkg/System.Linq.Parallel.pkgproj
index 8f0f92ee5a..a9f23f0cd2 100644
--- a/src/System.Linq.Parallel/pkg/System.Linq.Parallel.pkgproj
+++ b/src/System.Linq.Parallel/pkg/System.Linq.Parallel.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Linq.Parallel.csproj">
diff --git a/src/System.Linq.Parallel/pkg/ValidationSuppression.txt b/src/System.Linq.Parallel/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Linq.Parallel/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Linq.Parallel/ref/System.Linq.Parallel.csproj b/src/System.Linq.Parallel/ref/System.Linq.Parallel.csproj
index 745244c158..ac57364764 100644
--- a/src/System.Linq.Parallel/ref/System.Linq.Parallel.csproj
+++ b/src/System.Linq.Parallel/ref/System.Linq.Parallel.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Linq.Parallel/src/System.Linq.Parallel.csproj b/src/System.Linq.Parallel/src/System.Linq.Parallel.csproj
index bb92d2e6a4..715c35ca60 100644
--- a/src/System.Linq.Parallel/src/System.Linq.Parallel.csproj
+++ b/src/System.Linq.Parallel/src/System.Linq.Parallel.csproj
@@ -4,11 +4,9 @@
<PropertyGroup>
<ProjectGuid>{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}</ProjectGuid>
<AssemblyName>System.Linq.Parallel</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Linq.Queryable/dir.props b/src/System.Linq.Queryable/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Linq.Queryable/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Linq.Queryable/pkg/System.Linq.Queryable.pkgproj b/src/System.Linq.Queryable/pkg/System.Linq.Queryable.pkgproj
index ec89b81007..96a5487679 100644
--- a/src/System.Linq.Queryable/pkg/System.Linq.Queryable.pkgproj
+++ b/src/System.Linq.Queryable/pkg/System.Linq.Queryable.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Linq.Queryable.csproj">
diff --git a/src/System.Linq.Queryable/pkg/ValidationSuppression.txt b/src/System.Linq.Queryable/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Linq.Queryable/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Linq.Queryable/ref/System.Linq.Queryable.csproj b/src/System.Linq.Queryable/ref/System.Linq.Queryable.csproj
index 6571c14efd..4df9c9b917 100644
--- a/src/System.Linq.Queryable/ref/System.Linq.Queryable.csproj
+++ b/src/System.Linq.Queryable/ref/System.Linq.Queryable.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Linq.Queryable/src/System.Linq.Queryable.csproj b/src/System.Linq.Queryable/src/System.Linq.Queryable.csproj
index 44c4355906..f0e681ac92 100644
--- a/src/System.Linq.Queryable/src/System.Linq.Queryable.csproj
+++ b/src/System.Linq.Queryable/src/System.Linq.Queryable.csproj
@@ -4,11 +4,9 @@
<PropertyGroup>
<ProjectGuid>{BE12B753-C130-4B68-86E3-877F1AEE52C0}</ProjectGuid>
<AssemblyName>System.Linq.Queryable</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<RootNamespace>System.Linq.Queryable</RootNamespace>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Linq/dir.props b/src/System.Linq/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.Linq/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Linq/ref/4.0.0/System.Linq.depproj b/src/System.Linq/ref/4.0.0/System.Linq.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Linq/ref/4.0.0/System.Linq.depproj
+++ b/src/System.Linq/ref/4.0.0/System.Linq.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Linq/ref/System.Linq.csproj b/src/System.Linq/ref/System.Linq.csproj
index 7d14fd9522..e1fee888ce 100644
--- a/src/System.Linq/ref/System.Linq.csproj
+++ b/src/System.Linq/ref/System.Linq.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.6</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.6</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Linq/src/System.Linq.csproj b/src/System.Linq/src/System.Linq.csproj
index 81422c7516..b5151db380 100644
--- a/src/System.Linq/src/System.Linq.csproj
+++ b/src/System.Linq/src/System.Linq.csproj
@@ -4,12 +4,10 @@
<PropertyGroup>
<ProjectGuid>{CA488507-3B6E-4494-B7BE-7B4EEEB2C4D1}</ProjectGuid>
<AssemblyName>System.Linq</AssemblyName>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<RootNamespace>System.Linq</RootNamespace>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net463'">true</IsPartialFacadeAssembly>
<!-- The following line needs to be removed once we have a targeting pack for 4.6.3 -->
<TargetingPackNugetPackageId Condition="'$(TargetGroup)' == 'net463'">Microsoft.TargetingPack.NETFramework.v4.6.1</TargetingPackNugetPackageId>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.6</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.6</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Linq/src/System/Linq/Union.cs b/src/System.Linq/src/System/Linq/Union.cs
index c960f2101b..635b603e2c 100644
--- a/src/System.Linq/src/System/Linq/Union.cs
+++ b/src/System.Linq/src/System/Linq/Union.cs
@@ -234,7 +234,6 @@ namespace System.Linq
public UnionIteratorN(UnionIterator<TSource> previous, IEnumerable<TSource> next, int nextIndex)
: base(previous._comparer)
{
- Debug.Assert(previous != null);
Debug.Assert(next != null);
Debug.Assert(nextIndex > 1);
_previous = previous;
diff --git a/src/System.Net.Http.Rtc/dir.props b/src/System.Net.Http.Rtc/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Net.Http.Rtc/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Net.Http.Rtc/ref/System.Net.Http.Rtc.csproj b/src/System.Net.Http.Rtc/ref/System.Net.Http.Rtc.csproj
index 8b5e62d7cb..1f8016f7ec 100644
--- a/src/System.Net.Http.Rtc/ref/System.Net.Http.Rtc.csproj
+++ b/src/System.Net.Http.Rtc/ref/System.Net.Http.Rtc.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Net.Http.Rtc/src/System.Net.Http.Rtc.csproj b/src/System.Net.Http.Rtc/src/System.Net.Http.Rtc.csproj
index 8ecd5516b2..681eb182bc 100644
--- a/src/System.Net.Http.Rtc/src/System.Net.Http.Rtc.csproj
+++ b/src/System.Net.Http.Rtc/src/System.Net.Http.Rtc.csproj
@@ -6,8 +6,6 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Net.Http.Rtc</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.1</PackageTargetFramework>
</PropertyGroup>
<!-- Help VS understand available configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Windows_netcore50_Debug|AnyCPU'" />
diff --git a/src/System.Net.Http.WinHttpHandler/dir.props b/src/System.Net.Http.WinHttpHandler/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Net.Http.WinHttpHandler/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Net.Http.WinHttpHandler/ref/System.Net.Http.WinHttpHandler.csproj b/src/System.Net.Http.WinHttpHandler/ref/System.Net.Http.WinHttpHandler.csproj
index 5e35af4aae..9aa19b0413 100644
--- a/src/System.Net.Http.WinHttpHandler/ref/System.Net.Http.WinHttpHandler.csproj
+++ b/src/System.Net.Http.WinHttpHandler/ref/System.Net.Http.WinHttpHandler.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj b/src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj
index 691a0852a4..5c41d6279a 100644
--- a/src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj
+++ b/src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj
@@ -10,8 +10,6 @@
<ProjectGuid>{F75E3008-0562-42DF-BE72-C1384F12157E}</ProjectGuid>
<OutputType>Library</OutputType>
<AssemblyName>System.Net.Http.WinHttpHandler</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<GeneratePlatformNotSupportedAssembly Condition="'$(TargetsUnix)' == 'true'">true</GeneratePlatformNotSupportedAssembly>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
@@ -19,6 +17,14 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Windows_Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Windows_Release|AnyCPU'" />
<Import Project="System.Net.Http.WinHttpHandler.msbuild" Condition="'$(TargetsWindows)' == 'true'" />
+ <ItemGroup Condition="'$(TargetGroup)' == 'net46'">
+ <!-- Need to compile it here since the NET46 target here is building against System.Runtime whereas the
+ the list of other files in System.Net.Http.WinHttpHandler.msbuild is also used by System.Net.Http
+ library and the NET46 target there uses framework assembly references instead. -->
+ <CompileItem Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeHandleZeroOrMinusOneIsInvalid.cs" />
+ <CompileItem Include="$(CommonPath)\System\Net\HttpStatusDescription.cs" />
+ <CompileItem Include="$(CommonPath)\System\Net\HttpVersion.cs" />
+ </ItemGroup>
<!-- For source files to be shown within the visual tree in Solution Explorer, the items must be
included directly in the project file. We have the *.msbuild define the Compile items in a made
up item called CompileItem and then just include it here. -->
diff --git a/src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.msbuild b/src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.msbuild
index c7fd325a15..a8762004a6 100644
--- a/src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.msbuild
+++ b/src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.msbuild
@@ -13,14 +13,11 @@
<CompileItem Include="$(CommonPath)\Interop\Windows\winhttp\Interop.SafeWinHttpHandle.cs" />
<CompileItem Include="$(CommonPath)\Interop\Windows\winhttp\Interop.winhttp_types.cs" />
<CompileItem Include="$(CommonPath)\Interop\Windows\winhttp\Interop.winhttp.cs" />
- <CompileItem Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeHandleZeroOrMinusOneIsInvalid.cs" />
<CompileItem Include="$(CommonPath)\System\CharArrayHelpers.cs" />
<CompileItem Include="$(CommonPath)\System\StringExtensions.cs" />
<CompileItem Include="$(CommonPath)\System\Diagnostics\ExceptionExtensions.cs" />
<CompileItem Include="$(CommonPath)\System\Net\HttpKnownHeaderNames.cs" />
<CompileItem Include="$(CommonPath)\System\Net\HttpKnownHeaderNames.TryGetHeaderName.cs" />
- <CompileItem Include="$(CommonPath)\System\Net\HttpStatusDescription.cs" />
- <CompileItem Include="$(CommonPath)\System\Net\HttpVersion.cs" />
<CompileItem Include="$(CommonPath)\System\Net\UriScheme.cs" />
<CompileItem Include="$(CommonPath)\System\Net\SecurityProtocol.cs" />
<CompileItem Include="$(CommonPath)\System\Net\Http\HttpHandlerDefaults.cs" />
@@ -42,4 +39,9 @@
<CompileItem Include="$(MSBuildThisFileDirectory)\System\Net\Http\WinHttpTransportContext.cs" />
<CompileItem Include="$(MSBuildThisFileDirectory)\System\Net\Http\WinInetProxyHelper.cs" />
</ItemGroup>
+ <ItemGroup Condition="'$(TargetGroup)' != 'net46'">
+ <CompileItem Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeHandleZeroOrMinusOneIsInvalid.cs" />
+ <CompileItem Include="$(CommonPath)\System\Net\HttpStatusDescription.cs" />
+ <CompileItem Include="$(CommonPath)\System\Net\HttpVersion.cs" />
+ </ItemGroup>
</Project>
diff --git a/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs b/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs
index 2a928df7ef..62ed42f1b6 100644
--- a/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs
+++ b/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs
@@ -47,6 +47,13 @@ namespace System.Net.Http
public class WinHttpHandler : HttpMessageHandler
#endif
{
+#if NET46
+ internal static readonly Version HttpVersion20 = new Version(2, 0);
+ internal static readonly Version HttpVersionUnknown = new Version(0, 0);
+#else
+ internal static Version HttpVersion20 => HttpVersion.Version20;
+ internal static Version HttpVersionUnknown => HttpVersion.Unknown;
+#endif
private static readonly TimeSpan s_maxTimeout = TimeSpan.FromMilliseconds(int.MaxValue);
private object _lockObject = new object();
@@ -794,6 +801,15 @@ namespace System.Net.Http
httpVersion = "HTTP/1.1";
}
+ // Turn off additional URI reserved character escaping (percent-encoding). This matches
+ // .NET Framework behavior. System.Uri establishes the baseline rules for percent-encoding
+ // of reserved characters.
+ uint flags = Interop.WinHttp.WINHTTP_FLAG_ESCAPE_DISABLE;
+ if (secureConnection)
+ {
+ flags |= Interop.WinHttp.WINHTTP_FLAG_SECURE;
+ }
+
// Create an HTTP request handle.
state.RequestHandle = Interop.WinHttp.WinHttpOpenRequest(
connectHandle,
@@ -802,7 +818,7 @@ namespace System.Net.Http
httpVersion,
Interop.WinHttp.WINHTTP_NO_REFERER,
Interop.WinHttp.WINHTTP_DEFAULT_ACCEPT_TYPES,
- secureConnection ? Interop.WinHttp.WINHTTP_FLAG_SECURE : 0);
+ flags);
ThrowOnInvalidHandle(state.RequestHandle);
state.RequestHandle.SetParentHandle(connectHandle);
@@ -960,6 +976,7 @@ namespace System.Net.Http
SetRequestHandleClientCertificateOptions(state.RequestHandle, state.RequestMessage.RequestUri);
SetRequestHandleCredentialsOptions(state);
SetRequestHandleBufferingOptions(state.RequestHandle);
+ SetRequestHandleHttp2Options(state.RequestHandle, state.RequestMessage.Version);
}
private void SetRequestHandleProxyOptions(WinHttpRequestState state)
@@ -1177,6 +1194,27 @@ namespace System.Net.Http
SetWinHttpOption(requestHandle, Interop.WinHttp.WINHTTP_OPTION_MAX_RESPONSE_DRAIN_SIZE, ref optionData);
}
+ private void SetRequestHandleHttp2Options(SafeWinHttpHandle requestHandle, Version requestVersion)
+ {
+ Debug.Assert(requestHandle != null);
+ if (requestVersion == HttpVersion20)
+ {
+ WinHttpTraceHelper.Trace("WinHttpHandler.SetRequestHandleHttp2Options: setting HTTP/2 option");
+ uint optionData = Interop.WinHttp.WINHTTP_PROTOCOL_FLAG_HTTP2;
+ if (Interop.WinHttp.WinHttpSetOption(
+ requestHandle,
+ Interop.WinHttp.WINHTTP_OPTION_ENABLE_HTTP_PROTOCOL,
+ ref optionData))
+ {
+ WinHttpTraceHelper.Trace("WinHttpHandler.SetRequestHandleHttp2Options: HTTP/2 option supported");
+ }
+ else
+ {
+ WinHttpTraceHelper.Trace("WinHttpHandler.SetRequestHandleHttp2Options: HTTP/2 option not supported");
+ }
+ }
+ }
+
private void SetWinHttpOption(SafeWinHttpHandle handle, uint option, ref uint optionData)
{
Debug.Assert(handle != null);
diff --git a/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpResponseParser.cs b/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpResponseParser.cs
index a4282ba1d7..2b5c3b3a95 100644
--- a/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpResponseParser.cs
+++ b/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpResponseParser.cs
@@ -36,11 +36,18 @@ namespace System.Net.Http
// Get HTTP version, status code, reason phrase from the response headers.
- int versionLength = GetResponseHeader(requestHandle, Interop.WinHttp.WINHTTP_QUERY_VERSION, buffer);
- response.Version =
- CharArrayHelpers.EqualsOrdinalAsciiIgnoreCase("HTTP/1.1", buffer, 0, versionLength) ? HttpVersion.Version11 :
- CharArrayHelpers.EqualsOrdinalAsciiIgnoreCase("HTTP/1.0", buffer, 0, versionLength) ? HttpVersion.Version10 :
- HttpVersion.Unknown;
+ if (IsResponseHttp2(requestHandle))
+ {
+ response.Version = WinHttpHandler.HttpVersion20;
+ }
+ else
+ {
+ int versionLength = GetResponseHeader(requestHandle, Interop.WinHttp.WINHTTP_QUERY_VERSION, buffer);
+ response.Version =
+ CharArrayHelpers.EqualsOrdinalAsciiIgnoreCase("HTTP/1.1", buffer, 0, versionLength) ? HttpVersion.Version11 :
+ CharArrayHelpers.EqualsOrdinalAsciiIgnoreCase("HTTP/1.0", buffer, 0, versionLength) ? HttpVersion.Version10 :
+ WinHttpHandler.HttpVersionUnknown;
+ }
response.StatusCode = (HttpStatusCode)GetResponseHeaderNumberInfo(
requestHandle,
@@ -330,5 +337,26 @@ namespace System.Net.Http
}
}
}
+
+ private static bool IsResponseHttp2(SafeWinHttpHandle requestHandle)
+ {
+ uint data = 0;
+ uint dataSize = sizeof(uint);
+
+ if (Interop.WinHttp.WinHttpQueryOption(
+ requestHandle,
+ Interop.WinHttp.WINHTTP_OPTION_HTTP_PROTOCOL_USED,
+ ref data,
+ ref dataSize))
+ {
+ if ((data & Interop.WinHttp.WINHTTP_PROTOCOL_FLAG_HTTP2) != 0)
+ {
+ WinHttpTraceHelper.Trace("WinHttpHandler.IsResponseHttp2: return true");
+ return true;
+ }
+ }
+
+ return false;
+ }
}
}
diff --git a/src/System.Net.Http.WinHttpHandler/tests/FunctionalTests/WinHttpHandlerTest.cs b/src/System.Net.Http.WinHttpHandler/tests/FunctionalTests/WinHttpHandlerTest.cs
index a53248d306..3c423542ca 100644
--- a/src/System.Net.Http.WinHttpHandler/tests/FunctionalTests/WinHttpHandlerTest.cs
+++ b/src/System.Net.Http.WinHttpHandler/tests/FunctionalTests/WinHttpHandlerTest.cs
@@ -22,7 +22,7 @@ namespace System.Net.Http.WinHttpHandlerFunctional.Tests
{
// TODO: This is a placeholder until GitHub Issue #2383 gets resolved.
private const string SlowServer = "http://httpbin.org/drip?numbytes=1&duration=1&delay=40&code=200";
-
+
private readonly ITestOutputHelper _output;
public WinHttpHandlerTest(ITestOutputHelper output)
diff --git a/src/System.Net.Http.WinHttpHandler/tests/UnitTests/FakeInterop.cs b/src/System.Net.Http.WinHttpHandler/tests/UnitTests/FakeInterop.cs
index 516e342d4e..2cb478e0b5 100644
--- a/src/System.Net.Http.WinHttpHandler/tests/UnitTests/FakeInterop.cs
+++ b/src/System.Net.Http.WinHttpHandler/tests/UnitTests/FakeInterop.cs
@@ -388,6 +388,15 @@ internal static partial class Interop
return true;
}
+ public static bool WinHttpQueryOption(
+ SafeWinHttpHandle handle,
+ uint option,
+ ref uint buffer,
+ ref uint bufferSize)
+ {
+ return true;
+ }
+
public static bool WinHttpWriteData(
SafeWinHttpHandle requestHandle,
IntPtr buffer,
diff --git a/src/System.Net.Http/dir.props b/src/System.Net.Http/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.Net.Http/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Net.Http/pkg/ValidationSuppression.txt b/src/System.Net.Http/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Net.Http/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Net.Http/ref/4.0/System.Net.Http.depproj b/src/System.Net.Http/ref/4.0/System.Net.Http.depproj
index 68310c336b..975a89a61c 100644
--- a/src/System.Net.Http/ref/4.0/System.Net.Http.depproj
+++ b/src/System.Net.Http/ref/4.0/System.Net.Http.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Net.Http/ref/System.Net.Http.csproj b/src/System.Net.Http/ref/System.Net.Http.csproj
index da99c5e86b..f9ec5699c1 100644
--- a/src/System.Net.Http/ref/System.Net.Http.csproj
+++ b/src/System.Net.Http/ref/System.Net.Http.csproj
@@ -2,19 +2,11 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
+ <PackageTargetFramework>netstandard1.3;net46</PackageTargetFramework>
</PropertyGroup>
<ItemGroup>
- <PackageDestination Include="ref/netstandard1.3">
- <TargetFramework>netstandard1.3</TargetFramework>
- </PackageDestination>
- <PackageDestination Include="ref/net46">
- <TargetFramework>net46</TargetFramework>
- </PackageDestination>
- </ItemGroup>
- <ItemGroup>
<Compile Include="System.Net.Http.cs" />
</ItemGroup>
<ItemGroup>
diff --git a/src/System.Net.Http/src/System.Net.Http.builds b/src/System.Net.Http/src/System.Net.Http.builds
index dd01e2c3ca..7742775e24 100644
--- a/src/System.Net.Http/src/System.Net.Http.builds
+++ b/src/System.Net.Http/src/System.Net.Http.builds
@@ -12,6 +12,10 @@
<OSGroup>Windows_NT</OSGroup>
<TargetGroup>netcore50</TargetGroup>
</Project>
+ <Project Include="System.Net.Http.csproj">
+ <OSGroup>Windows_NT</OSGroup>
+ <TargetGroup>net46</TargetGroup>
+ </Project>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
</Project>
diff --git a/src/System.Net.Http/src/System.Net.Http.csproj b/src/System.Net.Http/src/System.Net.Http.csproj
index 623cafbf1f..f8440d54e3 100644
--- a/src/System.Net.Http/src/System.Net.Http.csproj
+++ b/src/System.Net.Http/src/System.Net.Http.csproj
@@ -10,9 +10,9 @@
<ProjectGuid>{1D422B1D-D7C4-41B9-862D-EB3D98DF37DE}</ProjectGuid>
<OutputType>Library</OutputType>
<AssemblyName>System.Net.Http</AssemblyName>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<WindowsRID>win</WindowsRID>
- <PackageTargetFramework Condition="'$(TargetsUnix)' == 'true'">netstandard1.6</PackageTargetFramework>
+ <!-- Suppress warnings for type conflicts between SR in partial facade and mscorlib -->
+ <NoWarn>0436</NoWarn>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
<NuGetTargetMoniker Condition="'$(TargetsUnix)' == 'true'">.NETStandard,Version=v1.6</NuGetTargetMoniker>
</PropertyGroup>
@@ -20,17 +20,6 @@
<ProjectJson>unix/project.json</ProjectJson>
<ProjectLockJson>unix/project.lock.json</ProjectLockJson>
</PropertyGroup>
- <ItemGroup Condition="'$(TargetGroup)' == '' AND '$(TargetsWindows)' == 'true'">
- <PackageDestination Include="runtimes/$(PackageTargetRuntime)/lib/netstandard1.3">
- <TargetFramework>netstandard1.3</TargetFramework>
- </PackageDestination>
- <PackageDestination Include="runtimes/$(PackageTargetRuntime)/lib/net46">
- <TargetFramework>net46</TargetFramework>
- </PackageDestination>
- <PackageDestination Include="lib/net46">
- <TargetFramework>net46</TargetFramework>
- </PackageDestination>
- </ItemGroup>
<!-- Help VS understand available configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Unix_Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Unix_Release|AnyCPU'" />
@@ -112,14 +101,7 @@
<Compile Include="System\Net\Http\Headers\ViaHeaderValue.cs" />
<Compile Include="System\Net\Http\Headers\WarningHeaderValue.cs" />
<!-- TODO #5715: Must be moved to the Common/System/Net folder -->
- <Compile Include="Internal\ICloneable.cs" />
- <Compile Include="Internal\MailAddress.cs" />
- <Compile Include="Internal\Mail\DomainLiteralReader.cs" />
<Compile Include="Internal\Mail\DotAtomReader.cs" />
- <Compile Include="Internal\Mail\MailAddressParser.cs" />
- <Compile Include="Internal\Mail\MailBnfHelper.cs" />
- <Compile Include="Internal\Mail\QuotedPairReader.cs" />
- <Compile Include="Internal\Mail\QuotedStringFormatReader.cs" />
<Compile Include="Internal\Mail\WhitespaceReader.cs" />
<Compile Include="$(CommonPath)\System\Net\Logging\LoggingHash.cs">
<Link>Common\System\Net\Logging\LoggingHash.cs</Link>
@@ -131,12 +113,26 @@
<Link>Common\System\Net\Logging\NetEventSource.cs</Link>
</Compile>
</ItemGroup>
- <ItemGroup Condition=" '$(TargetsWindows)' == 'true' And '$(TargetGroup)' == '' ">
+ <ItemGroup Condition=" '$(TargetsWindows)' == 'true' And '$(TargetGroup)' != 'netcore50' ">
<Compile Include="System\Net\Http\HttpClientHandler.Windows.cs" />
</ItemGroup>
+ <ItemGroup Condition=" '$(TargetsWindows)' != 'true' Or '$(TargetGroup)' != 'net46' ">
+ <!-- TODO #5715: Must be moved to the Common/System/Net folder -->
+ <Compile Include="Internal\ICloneable.cs" />
+ <Compile Include="Internal\MailAddress.cs" />
+ <Compile Include="Internal\Mail\DomainLiteralReader.cs" />
+ <Compile Include="Internal\Mail\MailAddressParser.cs" />
+ <Compile Include="Internal\Mail\MailBnfHelper.cs" />
+ <Compile Include="Internal\Mail\QuotedPairReader.cs" />
+ <Compile Include="Internal\Mail\QuotedStringFormatReader.cs" />
+ </ItemGroup>
<PropertyGroup Condition=" '$(TargetsWindows)' == 'true' And '$(TargetGroup)' == '' ">
<DefineConstants>$(DefineConstants);HTTP_DLL</DefineConstants>
</PropertyGroup>
+ <PropertyGroup Condition=" '$(TargetsWindows)' == 'true' And '$(TargetGroup)' == 'net46' ">
+ <DefineConstants>$(DefineConstants);HTTP_DLL;NET46</DefineConstants>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
<!-- Compile the WinHttpHandler implementation into the System.Net.Http.dll binary. This is a
temporary solution to remove the cycle dependency between HttpClient and WinHttpHandler.
As part of that, we need to define HTTP_DLL in order to compile the 'protected' SendAsync()
@@ -144,11 +140,11 @@
HttpMessageHandler.cs. We also use the HTTP_DLL define to change public classes into
internal ones to remove confusion if someone looks at the implementation dlls. They are
public in the separate WinHttpHandler.dll binary. -->
- <Import Project="..\..\System.Net.Http.WinHttpHandler\src\System.Net.Http.WinHttpHandler.msbuild" Condition="'$(TargetsWindows)' == 'true' And '$(TargetGroup)' == ''" />
+ <Import Project="..\..\System.Net.Http.WinHttpHandler\src\System.Net.Http.WinHttpHandler.msbuild" Condition="'$(TargetsWindows)' == 'true' And '$(TargetGroup)' != 'netcore50'" />
<!-- For source files to be shown within the visual tree in Solution Explorer, the items must be
included directly in the project file. We have the *.msbuild define the Compile items in a made
up item called CompileItem and then just include it here. -->
- <ItemGroup Condition=" '$(TargetsWindows)' == 'true' And '$(TargetGroup)' == '' ">
+ <ItemGroup Condition=" '$(TargetsWindows)' == 'true' And '$(TargetGroup)' != 'netcore50' ">
<Compile Include="@(CompileItem)" />
</ItemGroup>
<PropertyGroup Condition=" '$(TargetsUnix)' == 'true' ">
@@ -348,6 +344,12 @@
<Compile Include="netcore50\System\Net\HttpHandlerToFilter.cs" />
<Compile Include="netcore50\System\Net\HttpClientHandler.cs" />
</ItemGroup>
+ <ItemGroup Condition="'$(TargetGroup)' == 'net46'">
+ <TargetingPackReference Include="mscorlib" />
+ <TargetingPackReference Include="System" />
+ <TargetingPackReference Include="System.Core" />
+ <TargetingPackReference Include="System.Runtime" />
+ </ItemGroup>
<ItemGroup>
<None Include="project.json" />
</ItemGroup>
diff --git a/src/System.Net.Http/src/System/Net/Http/HttpContent.cs b/src/System.Net.Http/src/System/Net/Http/HttpContent.cs
index a913be7b6b..099baab945 100644
--- a/src/System.Net.Http/src/System/Net/Http/HttpContent.cs
+++ b/src/System.Net.Http/src/System/Net/Http/HttpContent.cs
@@ -142,6 +142,9 @@ namespace System.Net.Http
internal bool TryGetBuffer(out ArraySegment<byte> buffer)
{
+#if NET46
+ buffer = default(ArraySegment<byte>);
+#endif
return _bufferedContent != null && _bufferedContent.TryGetBuffer(out buffer);
}
diff --git a/src/System.Net.Http/src/project.json b/src/System.Net.Http/src/project.json
index a6a494b379..e556f77bd2 100644
--- a/src/System.Net.Http/src/project.json
+++ b/src/System.Net.Http/src/project.json
@@ -27,6 +27,11 @@
"System.Threading": "4.0.0",
"System.Threading.Tasks": "4.0.10"
}
- }
+ },
+ "net46": {
+ "dependencies": {
+ "Microsoft.TargetingPack.NETFramework.v4.6": "1.0.1"
+ }
+ }
}
}
diff --git a/src/System.Net.Http/tests/FunctionalTests/CancellationTest.cs b/src/System.Net.Http/tests/FunctionalTests/CancellationTest.cs
index c1876e9b74..a5b4c72397 100644
--- a/src/System.Net.Http/tests/FunctionalTests/CancellationTest.cs
+++ b/src/System.Net.Http/tests/FunctionalTests/CancellationTest.cs
@@ -55,6 +55,8 @@ namespace System.Net.Http.Functional.Tests
await Task.Delay(1000);
triggerRequestCancel.SetResult(true); // allow request to cancel
await triggerResponseWrite.Task; // pause until we're released
+
+ return null;
});
var stopwatch = Stopwatch.StartNew();
@@ -104,6 +106,8 @@ namespace System.Net.Http.Functional.Tests
(startResponseBody ? "20 bytes of the body" : ""));
await triggerResponseWrite.Task; // pause until we're released
+
+ return null;
});
using (HttpResponseMessage response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead))
diff --git a/src/System.Net.Http/tests/FunctionalTests/FakeDiagnosticSourceListenerObserver.cs b/src/System.Net.Http/tests/FunctionalTests/FakeDiagnosticSourceListenerObserver.cs
index 20e0a93c0f..07c09d249a 100644
--- a/src/System.Net.Http/tests/FunctionalTests/FakeDiagnosticSourceListenerObserver.cs
+++ b/src/System.Net.Http/tests/FunctionalTests/FakeDiagnosticSourceListenerObserver.cs
@@ -1,4 +1,8 @@
-using System.Collections.Generic;
+// 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.Collections.Generic;
using System.Diagnostics;
namespace System.Net.Http.Functional.Tests
diff --git a/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ClientCertificates.cs b/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ClientCertificates.cs
index 792bc27da5..d37183d215 100644
--- a/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ClientCertificates.cs
+++ b/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ClientCertificates.cs
@@ -93,6 +93,7 @@ namespace System.Net.Http.Functional.Tests
SslStream sslStream = Assert.IsType<SslStream>(stream);
Assert.Equal(cert, sslStream.RemoteCertificate);
await LoopbackServer.ReadWriteAcceptedAsync(socket, reader, writer);
+ return null;
}, options));
};
diff --git a/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.MaxResponseHeadersLength.cs b/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.MaxResponseHeadersLength.cs
index f144f07ccd..28c30f4777 100644
--- a/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.MaxResponseHeadersLength.cs
+++ b/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.MaxResponseHeadersLength.cs
@@ -91,6 +91,8 @@ namespace System.Net.Http.Functional.Tests
{
await Assert.ThrowsAsync<HttpRequestException>(() => getAsync);
}
+
+ return null;
});
}
});
diff --git a/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.cs b/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.cs
index f29f05e607..7af23fd065 100644
--- a/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.cs
+++ b/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.cs
@@ -159,6 +159,7 @@ namespace System.Net.Http.Functional.Tests
{
Assert.Equal(SslProtocols.Tls12, Assert.IsType<SslStream>(stream).SslProtocol);
await LoopbackServer.ReadWriteAcceptedAsync(s, reader, writer);
+ return null;
}, options));
}, options);
}
diff --git a/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs b/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs
index a372b1b385..c6865a4eee 100644
--- a/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs
+++ b/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs
@@ -50,6 +50,7 @@ namespace System.Net.Http.Functional.Tests
hops:1) },
};
public readonly static object[][] Http2Servers = Configuration.Http.Http2Servers;
+ public readonly static object[][] Http2NoPushServers = Configuration.Http.Http2NoPushServers;
public readonly static object[][] RedirectStatusCodes = {
new object[] { 300 },
@@ -67,7 +68,9 @@ namespace System.Net.Http.Functional.Tests
GetMethods("GET", "POST", "PUT", "DELETE", "OPTIONS", "CUSTOM1");
public readonly static IEnumerable<object[]> HttpMethodsThatDontAllowContent =
GetMethods("HEAD", "TRACE");
-
+
+ private static bool IsWindows10Version1607OrGreater => PlatformDetection.IsWindows10Version1607OrGreater;
+
private static IEnumerable<object[]> GetMethods(params string[] methods)
{
foreach (string method in methods)
@@ -834,6 +837,8 @@ namespace System.Net.Http.Functional.Tests
Assert.True(bytesRead < buffer.Length, "bytesRead should be less than buffer.Length");
}
}
+
+ return null;
});
}
});
@@ -854,6 +859,7 @@ namespace System.Net.Http.Functional.Tests
Task server1 = LoopbackServer.AcceptSocketAsync(socket1, async (s, stream, reader, writer) =>
{
await unblockServers.Task;
+ return null;
});
// Second server connects and sends some but not all headers
@@ -862,6 +868,7 @@ namespace System.Net.Http.Functional.Tests
while (!string.IsNullOrEmpty(await reader.ReadLineAsync())) ;
await writer.WriteAsync($"HTTP/1.1 200 OK\r\n");
await unblockServers.Task;
+ return null;
});
// Third server connects and sends all headers and some but not all of the body
@@ -873,6 +880,7 @@ namespace System.Net.Http.Functional.Tests
await unblockServers.Task;
await writer.WriteAsync("1234567890");
s.Shutdown(SocketShutdown.Send);
+ return null;
});
// Make three requests
@@ -1215,6 +1223,8 @@ namespace System.Net.Http.Functional.Tests
Assert.True(contentDisposed, "Expected request content to be disposed");
Assert.Equal("abcdefghij", await response.Content.ReadAsStringAsync());
}
+
+ return null;
});
});
}
@@ -1276,6 +1286,8 @@ namespace System.Net.Http.Functional.Tests
Assert.True(contentDisposed, "Expected request content to be disposed");
Assert.Equal("abcdefghij", await response.Content.ReadAsStringAsync());
}
+
+ return null;
});
});
}
@@ -1490,6 +1502,7 @@ namespace System.Net.Http.Functional.Tests
}
[Theory, MemberData(nameof(Http2Servers))]
+ [ActiveIssue(10958, PlatformID.Windows)]
public async Task SendAsync_RequestVersion20_ResponseVersion20IfHttp2Supported(Uri server)
{
// We don't currently have a good way to test whether HTTP/2 is supported without
@@ -1533,6 +1546,24 @@ namespace System.Net.Http.Functional.Tests
}
}
+ [ConditionalTheory(nameof(IsWindows10Version1607OrGreater)), MemberData(nameof(Http2NoPushServers))]
+ public async Task SendAsync_RequestVersion20_ResponseVersion20(Uri server)
+ {
+ _output.WriteLine(server.AbsoluteUri.ToString());
+ var request = new HttpRequestMessage(HttpMethod.Get, server);
+ request.Version = new Version(2, 0);
+
+ var handler = new HttpClientHandler();
+ using (var client = new HttpClient(handler))
+ {
+ using (HttpResponseMessage response = await client.SendAsync(request))
+ {
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+ Assert.Equal(new Version(2, 0), response.Version);
+ }
+ }
+ }
+
private async Task<Version> SendRequestAndGetRequestVersionAsync(Version requestVersion)
{
Version receivedRequestVersion = null;
@@ -1546,36 +1577,27 @@ namespace System.Net.Http.Functional.Tests
{
Task<HttpResponseMessage> getResponse = client.SendAsync(request);
- await LoopbackServer.AcceptSocketAsync(server, async (s, stream, reader, writer) =>
- {
- string statusLine = reader.ReadLine();
- while (!string.IsNullOrEmpty(reader.ReadLine())) ;
-
- if (statusLine.Contains("/1.0"))
- {
- receivedRequestVersion = new Version(1, 0);
- }
- else if (statusLine.Contains("/1.1"))
- {
- receivedRequestVersion = new Version(1, 1);
- }
- else
- {
- Assert.True(false, "Invalid HTTP request version");
- }
-
- await writer.WriteAsync(
- $"HTTP/1.1 200 OK\r\n" +
- $"Date: {DateTimeOffset.UtcNow:R}\r\n" +
- "Content-Length: 0\r\n" +
- "\r\n");
- s.Shutdown(SocketShutdown.Send);
- });
+ List<string> receivedRequest = await LoopbackServer.ReadRequestAndSendResponseAsync(server);
using (HttpResponseMessage response = await getResponse)
{
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
+
+ string statusLine = receivedRequest[0];
+ if (statusLine.Contains("/1.0"))
+ {
+ receivedRequestVersion = new Version(1, 0);
+ }
+ else if (statusLine.Contains("/1.1"))
+ {
+ receivedRequestVersion = new Version(1, 1);
+ }
+ else
+ {
+ Assert.True(false, "Invalid HTTP request version");
+ }
+
}
});
@@ -1676,5 +1698,32 @@ namespace System.Net.Http.Functional.Tests
}
}
#endregion
+
+ #region Uri wire transmission encoding tests
+ [Fact]
+ public async Task SendRequest_UriPathHasReservedChars_ServerReceivedExpectedPath()
+ {
+ await LoopbackServer.CreateServerAsync(async (server, rootUrl) =>
+ {
+ var uri = new Uri($"http://{rootUrl.Host}:{rootUrl.Port}/test[]");
+ _output.WriteLine(uri.AbsoluteUri.ToString());
+ var request = new HttpRequestMessage(HttpMethod.Get, uri);
+ string statusLine = string.Empty;
+
+ using (var client = new HttpClient())
+ {
+ Task<HttpResponseMessage> getResponse = client.SendAsync(request);
+
+ List<string> receivedRequest = await LoopbackServer.ReadRequestAndSendResponseAsync(server);
+
+ using (HttpResponseMessage response = await getResponse)
+ {
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+ Assert.True(receivedRequest[0].Contains(uri.PathAndQuery), $"statusLine should contain {uri.PathAndQuery}");
+ }
+ }
+ });
+ }
+ #endregion
}
}
diff --git a/src/System.Net.Http/tests/FunctionalTests/HttpClientMiniStressTest.cs b/src/System.Net.Http/tests/FunctionalTests/HttpClientMiniStressTest.cs
index 15b446f0ee..1976120b00 100644
--- a/src/System.Net.Http/tests/FunctionalTests/HttpClientMiniStressTest.cs
+++ b/src/System.Net.Http/tests/FunctionalTests/HttpClientMiniStressTest.cs
@@ -127,7 +127,7 @@ namespace System.Net.Http.Functional.Tests
writer.Write(responseText);
s.Shutdown(SocketShutdown.Send);
- return Task.CompletedTask;
+ return Task.FromResult<List<string>>(null);
}).GetAwaiter().GetResult();
getAsync.GetAwaiter().GetResult().Dispose();
@@ -147,6 +147,8 @@ namespace System.Net.Http.Functional.Tests
await writer.WriteAsync(responseText).ConfigureAwait(false);
s.Shutdown(SocketShutdown.Send);
+
+ return null;
});
(await getAsync.ConfigureAwait(false)).Dispose();
@@ -175,6 +177,8 @@ namespace System.Net.Http.Functional.Tests
await writer.WriteAsync(responseText).ConfigureAwait(false);
s.Shutdown(SocketShutdown.Send);
+
+ return null;
});
(await postAsync.ConfigureAwait(false)).Dispose();
@@ -204,6 +208,8 @@ namespace System.Net.Http.Functional.Tests
GC.Collect();
return !wr.IsAlive;
}, 10 * 1000), "Response object should have been collected");
+
+ return null;
});
}
});
diff --git a/src/System.Net.Http/tests/FunctionalTests/prerequisites/BasicAuthModule.cs b/src/System.Net.Http/tests/FunctionalTests/prerequisites/BasicAuthModule.cs
index d20ef5468b..25d6b395b3 100644
--- a/src/System.Net.Http/tests/FunctionalTests/prerequisites/BasicAuthModule.cs
+++ b/src/System.Net.Http/tests/FunctionalTests/prerequisites/BasicAuthModule.cs
@@ -1,3 +1,7 @@
+// 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.Web;
diff --git a/src/System.Net.NameResolution/dir.props b/src/System.Net.NameResolution/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Net.NameResolution/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Net.NameResolution/ref/System.Net.NameResolution.csproj b/src/System.Net.NameResolution/ref/System.Net.NameResolution.csproj
index 4c52311a89..9f01886633 100644
--- a/src/System.Net.NameResolution/ref/System.Net.NameResolution.csproj
+++ b/src/System.Net.NameResolution/ref/System.Net.NameResolution.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Net.NameResolution/src/System.Net.NameResolution.csproj b/src/System.Net.NameResolution/src/System.Net.NameResolution.csproj
index 1dfb5eb919..d9c6f4b23c 100644
--- a/src/System.Net.NameResolution/src/System.Net.NameResolution.csproj
+++ b/src/System.Net.NameResolution/src/System.Net.NameResolution.csproj
@@ -6,13 +6,11 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Net.NameResolution</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<ProjectGuid>{1714448C-211E-48C1-8B7E-4EE667D336A1}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
<EnableWinRT Condition="'$(TargetGroup)' == 'netcore50'">true</EnableWinRT>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<PropertyGroup Condition="'$(EnableWinRT)' != 'true'">
diff --git a/src/System.Net.NetworkInformation/dir.props b/src/System.Net.NetworkInformation/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.Net.NetworkInformation/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Net.NetworkInformation/ref/4.0.0/System.Net.NetworkInformation.depproj b/src/System.Net.NetworkInformation/ref/4.0.0/System.Net.NetworkInformation.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Net.NetworkInformation/ref/4.0.0/System.Net.NetworkInformation.depproj
+++ b/src/System.Net.NetworkInformation/ref/4.0.0/System.Net.NetworkInformation.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Net.NetworkInformation/ref/System.Net.NetworkInformation.csproj b/src/System.Net.NetworkInformation/ref/System.Net.NetworkInformation.csproj
index aa76e8dfcc..456b5e5a7f 100644
--- a/src/System.Net.NetworkInformation/ref/System.Net.NetworkInformation.csproj
+++ b/src/System.Net.NetworkInformation/ref/System.Net.NetworkInformation.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj b/src/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj
index 9fec62b179..fcdb723fc5 100644
--- a/src/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj
+++ b/src/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj
@@ -6,13 +6,10 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Net.NetworkInformation</AssemblyName>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
<ProjectGuid>{3CA89D6C-F8D1-4813-9775-F8D249686E31}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<EnableWinRT Condition="'$(TargetGroup)' == 'netcore50'">true</EnableWinRT>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
- <PackageTargetFramework Condition="'$(TargetsWindows)' == 'true' AND '$(EnableWinRT)' == 'true'">netcore50</PackageTargetFramework>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPAddressInformationCollection.cs b/src/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPAddressInformationCollection.cs
index 3c6500ac71..064bc7b11b 100644
--- a/src/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPAddressInformationCollection.cs
+++ b/src/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPAddressInformationCollection.cs
@@ -19,7 +19,6 @@ namespace System.Net.NetworkInformation
_addresses.CopyTo(array, offset);
}
- /// <include file='doc\HttpListenerPrefixCollection.uex' path='docs/doc[@for="HttpListenerPrefixCollection.Count"]/*' />
public virtual int Count
{
get
diff --git a/src/System.Net.NetworkInformation/src/System/Net/NetworkInformation/LinuxNetworkInterface.cs b/src/System.Net.NetworkInformation/src/System/Net/NetworkInformation/LinuxNetworkInterface.cs
index 7a056f4e33..05c0d1ab68 100644
--- a/src/System.Net.NetworkInformation/src/System/Net/NetworkInformation/LinuxNetworkInterface.cs
+++ b/src/System.Net.NetworkInformation/src/System/Net/NetworkInformation/LinuxNetworkInterface.cs
@@ -29,24 +29,36 @@ namespace System.Net.NetworkInformation
public unsafe static NetworkInterface[] GetLinuxNetworkInterfaces()
{
Dictionary<string, LinuxNetworkInterface> interfacesByName = new Dictionary<string, LinuxNetworkInterface>();
- Interop.Sys.EnumerateInterfaceAddresses(
- (name, ipAddr, maskAddr) =>
- {
- LinuxNetworkInterface lni = GetOrCreate(interfacesByName, name);
- lni.ProcessIpv4Address(ipAddr, maskAddr);
- },
- (name, ipAddr, scopeId) =>
+ const int MaxTries = 3;
+ for (int attempt = 0; attempt < MaxTries; attempt++)
+ {
+ int result = Interop.Sys.EnumerateInterfaceAddresses(
+ (name, ipAddr, maskAddr) =>
+ {
+ LinuxNetworkInterface lni = GetOrCreate(interfacesByName, name);
+ lni.ProcessIpv4Address(ipAddr, maskAddr);
+ },
+ (name, ipAddr, scopeId) =>
+ {
+ LinuxNetworkInterface lni = GetOrCreate(interfacesByName, name);
+ lni.ProcessIpv6Address( ipAddr, *scopeId);
+ },
+ (name, llAddr) =>
+ {
+ LinuxNetworkInterface lni = GetOrCreate(interfacesByName, name);
+ lni.ProcessLinkLayerAddress(llAddr);
+ });
+ if (result == 0)
{
- LinuxNetworkInterface lni = GetOrCreate(interfacesByName, name);
- lni.ProcessIpv6Address( ipAddr, *scopeId);
- },
- (name, llAddr) =>
+ return interfacesByName.Values.ToArray();
+ }
+ else
{
- LinuxNetworkInterface lni = GetOrCreate(interfacesByName, name);
- lni.ProcessLinkLayerAddress(llAddr);
- });
+ interfacesByName.Clear();
+ }
+ }
- return interfacesByName.Values.ToArray();
+ throw new NetworkInformationException(SR.net_PInvokeError);
}
/// <summary>
diff --git a/src/System.Net.NetworkInformation/src/System/Net/NetworkInformation/OsxNetworkInterface.cs b/src/System.Net.NetworkInformation/src/System/Net/NetworkInformation/OsxNetworkInterface.cs
index c8774eba19..6a0d4ef2d2 100644
--- a/src/System.Net.NetworkInformation/src/System/Net/NetworkInformation/OsxNetworkInterface.cs
+++ b/src/System.Net.NetworkInformation/src/System/Net/NetworkInformation/OsxNetworkInterface.cs
@@ -27,27 +27,36 @@ namespace System.Net.NetworkInformation
public unsafe static NetworkInterface[] GetOsxNetworkInterfaces()
{
Dictionary<string, OsxNetworkInterface> interfacesByName = new Dictionary<string, OsxNetworkInterface>();
- if (Interop.Sys.EnumerateInterfaceAddresses(
- (name, ipAddr, maskAddr) =>
- {
- OsxNetworkInterface oni = GetOrCreate(interfacesByName, name);
- oni.ProcessIpv4Address(ipAddr, maskAddr);
- },
- (name, ipAddr, scopeId) =>
+ const int MaxTries = 3;
+ for (int attempt = 0; attempt < MaxTries; attempt++)
+ {
+ int result = Interop.Sys.EnumerateInterfaceAddresses(
+ (name, ipAddr, maskAddr) =>
+ {
+ OsxNetworkInterface oni = GetOrCreate(interfacesByName, name);
+ oni.ProcessIpv4Address(ipAddr, maskAddr);
+ },
+ (name, ipAddr, scopeId) =>
+ {
+ OsxNetworkInterface oni = GetOrCreate(interfacesByName, name);
+ oni.ProcessIpv6Address( ipAddr, *scopeId);
+ },
+ (name, llAddr) =>
+ {
+ OsxNetworkInterface oni = GetOrCreate(interfacesByName, name);
+ oni.ProcessLinkLayerAddress(llAddr);
+ });
+ if (result == 0)
{
- OsxNetworkInterface oni = GetOrCreate(interfacesByName, name);
- oni.ProcessIpv6Address(ipAddr, *scopeId);
- },
- (name, llAddr) =>
+ return interfacesByName.Values.ToArray();
+ }
+ else
{
- OsxNetworkInterface oni = GetOrCreate(interfacesByName, name);
- oni.ProcessLinkLayerAddress(llAddr);
- }) != 0)
- {
- throw new NetworkInformationException(SR.net_PInvokeError);
+ interfacesByName.Clear();
+ }
}
- return interfacesByName.Values.ToArray();
+ throw new NetworkInformationException(SR.net_PInvokeError);
}
/// <summary>
diff --git a/src/System.Net.Ping/dir.props b/src/System.Net.Ping/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Net.Ping/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Net.Ping/ref/System.Net.Ping.csproj b/src/System.Net.Ping/ref/System.Net.Ping.csproj
index 2ffa5e18f4..a56222b454 100644
--- a/src/System.Net.Ping/ref/System.Net.Ping.csproj
+++ b/src/System.Net.Ping/ref/System.Net.Ping.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Net.Ping/src/System.Net.Ping.csproj b/src/System.Net.Ping/src/System.Net.Ping.csproj
index f78270b0cf..fe8f56aa51 100644
--- a/src/System.Net.Ping/src/System.Net.Ping.csproj
+++ b/src/System.Net.Ping/src/System.Net.Ping.csproj
@@ -6,13 +6,11 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Net.Ping</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<ProjectGuid>{85FD05E8-A4B1-4B89-ABED-33AFD200CABD}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);FEATURE_CORECLR</DefineConstants>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NugetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NugetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Net.Primitives/dir.props b/src/System.Net.Primitives/dir.props
new file mode 100644
index 0000000000..d16ef39bdb
--- /dev/null
+++ b/src/System.Net.Primitives/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.12.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Net.Primitives/pkg/System.Net.Primitives.pkgproj b/src/System.Net.Primitives/pkg/System.Net.Primitives.pkgproj
index 6c6cf7ddf6..2907f85e3c 100644
--- a/src/System.Net.Primitives/pkg/System.Net.Primitives.pkgproj
+++ b/src/System.Net.Primitives/pkg/System.Net.Primitives.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.12.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\3.9.0\System.Net.Primitives.depproj">
diff --git a/src/System.Net.Primitives/pkg/ValidationSuppression.txt b/src/System.Net.Primitives/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Net.Primitives/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Net.Primitives/ref/3.9.0/System.Net.Primitives.depproj b/src/System.Net.Primitives/ref/3.9.0/System.Net.Primitives.depproj
index b0ee27b58c..7f6f6c25c5 100644
--- a/src/System.Net.Primitives/ref/3.9.0/System.Net.Primitives.depproj
+++ b/src/System.Net.Primitives/ref/3.9.0/System.Net.Primitives.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>3.9.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Net.Primitives/ref/4.0.0/System.Net.Primitives.depproj b/src/System.Net.Primitives/ref/4.0.0/System.Net.Primitives.depproj
index 29f2b6abda..5df1469c14 100644
--- a/src/System.Net.Primitives/ref/4.0.0/System.Net.Primitives.depproj
+++ b/src/System.Net.Primitives/ref/4.0.0/System.Net.Primitives.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Net.Primitives/ref/System.Net.Primitives.csproj b/src/System.Net.Primitives/ref/System.Net.Primitives.csproj
index 2d49bd575c..47ecd54038 100644
--- a/src/System.Net.Primitives/ref/System.Net.Primitives.csproj
+++ b/src/System.Net.Primitives/ref/System.Net.Primitives.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Net.Primitives/src/System.Net.Primitives.csproj b/src/System.Net.Primitives/src/System.Net.Primitives.csproj
index 0373fd072e..e67562ff7b 100644
--- a/src/System.Net.Primitives/src/System.Net.Primitives.csproj
+++ b/src/System.Net.Primitives/src/System.Net.Primitives.csproj
@@ -6,14 +6,11 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Net.Primitives</AssemblyName>
- <AssemblyVersion>4.0.12.0</AssemblyVersion>
<OutputType>Library</OutputType>
<ProjectGuid>{8772BC91-7B55-49B9-94FA-4B1BE5BEAB55}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<EnableWinRT Condition="'$(TargetGroup)' == 'netcore50'">true</EnableWinRT>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
- <PackageTargetFramework Condition="'$(TargetsWindows)' == 'true' AND '$(EnableWinRT)' == 'true'">netcore50</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<PropertyGroup Condition="'$(EnableWinRT)' != 'true' AND '$(TargetGroup)' == ''">
diff --git a/src/System.Net.Primitives/tests/PerformanceTests/System.Net.Primitives.Performance.Tests.csproj b/src/System.Net.Primitives/tests/PerformanceTests/System.Net.Primitives.Performance.Tests.csproj
index 789021ac08..203ab886e8 100644
--- a/src/System.Net.Primitives/tests/PerformanceTests/System.Net.Primitives.Performance.Tests.csproj
+++ b/src/System.Net.Primitives/tests/PerformanceTests/System.Net.Primitives.Performance.Tests.csproj
@@ -10,7 +10,7 @@
<ProjectGuid>{86256B36-4C78-4A71-A80A-CCA35C4AE758}</ProjectGuid>
<OutputType>Library</OutputType>
<IncludePerformanceTests>true</IncludePerformanceTests>
- <AssemblyName>System.Collections.NonGeneric.Performance.Tests</AssemblyName>
+ <AssemblyName>System.Net.Primitives.Performance.Tests</AssemblyName>
<NugetTargetMoniker>.NETStandard,Version=v1.3</NugetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Net.Requests/dir.props b/src/System.Net.Requests/dir.props
new file mode 100644
index 0000000000..d16ef39bdb
--- /dev/null
+++ b/src/System.Net.Requests/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.12.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Net.Requests/pkg/System.Net.Requests.pkgproj b/src/System.Net.Requests/pkg/System.Net.Requests.pkgproj
index 97fce60d65..723e9d6bfb 100644
--- a/src/System.Net.Requests/pkg/System.Net.Requests.pkgproj
+++ b/src/System.Net.Requests/pkg/System.Net.Requests.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.12.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\3.9.0\System.Net.Requests.depproj">
diff --git a/src/System.Net.Requests/pkg/ValidationSuppression.txt b/src/System.Net.Requests/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Net.Requests/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Net.Requests/ref/3.9.0/System.Net.Requests.depproj b/src/System.Net.Requests/ref/3.9.0/System.Net.Requests.depproj
index b0ee27b58c..7f6f6c25c5 100644
--- a/src/System.Net.Requests/ref/3.9.0/System.Net.Requests.depproj
+++ b/src/System.Net.Requests/ref/3.9.0/System.Net.Requests.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>3.9.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Net.Requests/ref/4.0.0/System.Net.Requests.depproj b/src/System.Net.Requests/ref/4.0.0/System.Net.Requests.depproj
index 29f2b6abda..5df1469c14 100644
--- a/src/System.Net.Requests/ref/4.0.0/System.Net.Requests.depproj
+++ b/src/System.Net.Requests/ref/4.0.0/System.Net.Requests.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Net.Requests/ref/System.Net.Requests.csproj b/src/System.Net.Requests/ref/System.Net.Requests.csproj
index 9efeacfaf5..8f7f52e901 100644
--- a/src/System.Net.Requests/ref/System.Net.Requests.csproj
+++ b/src/System.Net.Requests/ref/System.Net.Requests.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Net.Requests/src/System.Net.Requests.csproj b/src/System.Net.Requests/src/System.Net.Requests.csproj
index 4801bc2f38..0f7bdafca1 100644
--- a/src/System.Net.Requests/src/System.Net.Requests.csproj
+++ b/src/System.Net.Requests/src/System.Net.Requests.csproj
@@ -8,11 +8,9 @@
<ProjectGuid>{5EE76DCC-9FD5-47FD-AB45-BD0F0857740F}</ProjectGuid>
<RootNamespace>System.Net.Requests</RootNamespace>
<AssemblyName>System.Net.Requests</AssemblyName>
- <AssemblyVersion>4.0.12.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Net.Requests/tests/WebRequestTest.cs b/src/System.Net.Requests/tests/WebRequestTest.cs
index 1a3aec7877..a969145866 100644
--- a/src/System.Net.Requests/tests/WebRequestTest.cs
+++ b/src/System.Net.Requests/tests/WebRequestTest.cs
@@ -8,18 +8,25 @@ namespace System.Net.Tests
{
public class WebRequestTest
{
+ static WebRequestTest()
+ {
+ // Capture the value of DefaultWebProxy before any tests run.
+ // This lets us test the default value without imposing test
+ // ordering constraints which aren't natively supported by xunit.
+ initialDefaultWebProxy = WebRequest.DefaultWebProxy;
+ initialDefaultWebProxyCredentials = initialDefaultWebProxy.Credentials;
+ }
+
private readonly NetworkCredential _explicitCredentials = new NetworkCredential("user", "password", "domain");
+ private static IWebProxy initialDefaultWebProxy;
+ private static ICredentials initialDefaultWebProxyCredentials;
[Fact]
public void DefaultWebProxy_VerifyDefaults_Success()
{
- IWebProxy proxy = WebRequest.DefaultWebProxy;
- Assert.NotNull(proxy);
+ Assert.NotNull(initialDefaultWebProxy);
- // Since WebRequest.DefaultWebProxy is a static property, the initial default value for
- // Credentials is only null iff. no other test method in the test process has changed
- // the value in a prior test.
- Assert.Null(proxy.Credentials);
+ Assert.Null(initialDefaultWebProxyCredentials);
}
[Fact]
diff --git a/src/System.Net.Security/dir.props b/src/System.Net.Security/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Net.Security/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Net.Security/ref/System.Net.Security.csproj b/src/System.Net.Security/ref/System.Net.Security.csproj
index 29d99fd5b3..76a87b2810 100644
--- a/src/System.Net.Security/ref/System.Net.Security.csproj
+++ b/src/System.Net.Security/ref/System.Net.Security.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Net.Security/src/System.Net.Security.csproj b/src/System.Net.Security/src/System.Net.Security.csproj
index 3b12824f72..c80a0ebd0c 100644
--- a/src/System.Net.Security/src/System.Net.Security.csproj
+++ b/src/System.Net.Security/src/System.Net.Security.csproj
@@ -6,14 +6,11 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Net.Security</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<ProjectGuid>{89F37791-6254-4D60-AB96-ACD3CCA0E771}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);FEATURE_CORECLR</DefineConstants>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
- <PackageTargetFramework Condition="'$(TargetsUnix)' == 'true'">netstandard1.6</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
<NuGetTargetMoniker Condition="'$(TargetsUnix)' == 'true'">.NETStandard,Version=v1.6</NuGetTargetMoniker>
</PropertyGroup>
@@ -370,4 +367,4 @@
<None Include="project.json" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs b/src/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs
index b95c912230..4374ff73f3 100644
--- a/src/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs
+++ b/src/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs
@@ -53,6 +53,7 @@ namespace System.Net.Security.Tests
});
}
+ [ActiveIssue(11170, Xunit.PlatformID.OSX)]
[Theory]
[MemberData(nameof(ProtocolMismatchData))]
public async Task ServerAsyncAuthenticate_MismatchProtocols_Fails(
diff --git a/src/System.Net.Security/tests/FunctionalTests/UnixGssFakeNegotiateStream.cs b/src/System.Net.Security/tests/FunctionalTests/UnixGssFakeNegotiateStream.cs
index fdbb4a32ca..12ba9eb580 100644
--- a/src/System.Net.Security/tests/FunctionalTests/UnixGssFakeNegotiateStream.cs
+++ b/src/System.Net.Security/tests/FunctionalTests/UnixGssFakeNegotiateStream.cs
@@ -1,3 +1,7 @@
+// 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.Diagnostics;
using System.IO;
diff --git a/src/System.Net.Security/tests/FunctionalTests/UnixGssFakeStreamFramer.cs b/src/System.Net.Security/tests/FunctionalTests/UnixGssFakeStreamFramer.cs
index 76ed04a2ff..e8cf86fb6d 100644
--- a/src/System.Net.Security/tests/FunctionalTests/UnixGssFakeStreamFramer.cs
+++ b/src/System.Net.Security/tests/FunctionalTests/UnixGssFakeStreamFramer.cs
@@ -1,3 +1,7 @@
+// 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.IO;
using System.Threading.Tasks;
diff --git a/src/System.Net.Sockets/dir.props b/src/System.Net.Sockets/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.Net.Sockets/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Net.Sockets/ref/System.Net.Sockets.csproj b/src/System.Net.Sockets/ref/System.Net.Sockets.csproj
index 1b79ef9ca4..76fe5df15c 100644
--- a/src/System.Net.Sockets/ref/System.Net.Sockets.csproj
+++ b/src/System.Net.Sockets/ref/System.Net.Sockets.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Net.Sockets/src/System.Net.Sockets.csproj b/src/System.Net.Sockets/src/System.Net.Sockets.csproj
index e1ea82269a..3bf64d010f 100644
--- a/src/System.Net.Sockets/src/System.Net.Sockets.csproj
+++ b/src/System.Net.Sockets/src/System.Net.Sockets.csproj
@@ -6,13 +6,10 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Net.Sockets</AssemblyName>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<ProjectGuid>{43311AFB-D7C4-4E5A-B1DE-855407F90D1B}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
<EnableWinRT Condition="'$(TargetGroup)' == 'netcore50'">true</EnableWinRT>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(TargetsWindows)' == 'true' AND '$(EnableWinRT)' == 'true'">netcore50</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetsWindows)' == 'true' AND '$(TargetGroup)' == ''">
diff --git a/src/System.Net.WebHeaderCollection/dir.props b/src/System.Net.WebHeaderCollection/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Net.WebHeaderCollection/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Net.WebHeaderCollection/pkg/System.Net.WebHeaderCollection.pkgproj b/src/System.Net.WebHeaderCollection/pkg/System.Net.WebHeaderCollection.pkgproj
index 9bf08ad454..61c64eca60 100644
--- a/src/System.Net.WebHeaderCollection/pkg/System.Net.WebHeaderCollection.pkgproj
+++ b/src/System.Net.WebHeaderCollection/pkg/System.Net.WebHeaderCollection.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Net.WebHeaderCollection.csproj">
diff --git a/src/System.Net.WebHeaderCollection/pkg/ValidationSuppression.txt b/src/System.Net.WebHeaderCollection/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Net.WebHeaderCollection/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Net.WebHeaderCollection/ref/System.Net.WebHeaderCollection.csproj b/src/System.Net.WebHeaderCollection/ref/System.Net.WebHeaderCollection.csproj
index 8efe87e604..c6fcc1fec3 100644
--- a/src/System.Net.WebHeaderCollection/ref/System.Net.WebHeaderCollection.csproj
+++ b/src/System.Net.WebHeaderCollection/ref/System.Net.WebHeaderCollection.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Net.WebHeaderCollection/src/System.Net.WebHeaderCollection.csproj b/src/System.Net.WebHeaderCollection/src/System.Net.WebHeaderCollection.csproj
index 4b58ffaac5..f9523d271e 100644
--- a/src/System.Net.WebHeaderCollection/src/System.Net.WebHeaderCollection.csproj
+++ b/src/System.Net.WebHeaderCollection/src/System.Net.WebHeaderCollection.csproj
@@ -4,10 +4,8 @@
<PropertyGroup>
<ProjectGuid>{5EE76DCC-9FD5-47FD-AB45-BD0F0857740F}</ProjectGuid>
<AssemblyName>System.Net.WebHeaderCollection</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Net.WebSockets.Client/dir.props b/src/System.Net.WebSockets.Client/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Net.WebSockets.Client/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Net.WebSockets.Client/ref/System.Net.WebSockets.Client.csproj b/src/System.Net.WebSockets.Client/ref/System.Net.WebSockets.Client.csproj
index aabb787477..cb36eed990 100644
--- a/src/System.Net.WebSockets.Client/ref/System.Net.WebSockets.Client.csproj
+++ b/src/System.Net.WebSockets.Client/ref/System.Net.WebSockets.Client.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Net.WebSockets.Client/src/System.Net.WebSockets.Client.csproj b/src/System.Net.WebSockets.Client/src/System.Net.WebSockets.Client.csproj
index 939100d6cb..05d248b915 100644
--- a/src/System.Net.WebSockets.Client/src/System.Net.WebSockets.Client.csproj
+++ b/src/System.Net.WebSockets.Client/src/System.Net.WebSockets.Client.csproj
@@ -5,13 +5,11 @@
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<ProjectGuid>{B8AD98AE-84C3-4313-B3F1-EE8BD5BFF69B}</ProjectGuid>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<EnableWinRT Condition="'$(TargetGroup)' == 'netcore50'">true</EnableWinRT>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
<!-- // uncomment to use the managed "unix" implementation on Windows
<TargetsWindows Condition="'$(TargetGroup)' == ''">false</TargetsWindows>
diff --git a/src/System.Net.WebSockets/dir.props b/src/System.Net.WebSockets/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Net.WebSockets/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Net.WebSockets/ref/System.Net.WebSockets.csproj b/src/System.Net.WebSockets/ref/System.Net.WebSockets.csproj
index c50775d44f..e90483b106 100644
--- a/src/System.Net.WebSockets/ref/System.Net.WebSockets.csproj
+++ b/src/System.Net.WebSockets/ref/System.Net.WebSockets.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Net.WebSockets/src/System.Net.WebSockets.csproj b/src/System.Net.WebSockets/src/System.Net.WebSockets.csproj
index 9c0ec2d526..18611666b2 100644
--- a/src/System.Net.WebSockets/src/System.Net.WebSockets.csproj
+++ b/src/System.Net.WebSockets/src/System.Net.WebSockets.csproj
@@ -4,10 +4,8 @@
<PropertyGroup>
<ProjectGuid>{B0C83201-EC32-4E8D-9DE4-EEF41E052DA1}</ProjectGuid>
<AssemblyName>System.Net.WebSockets</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Net.WebSockets/src/System/Net/WebSockets/WebSocketException.cs b/src/System.Net.WebSockets/src/System/Net/WebSockets/WebSocketException.cs
index f2a5163d41..79cbd23bf7 100644
--- a/src/System.Net.WebSockets/src/System/Net/WebSockets/WebSocketException.cs
+++ b/src/System.Net.WebSockets/src/System/Net/WebSockets/WebSocketException.cs
@@ -162,7 +162,10 @@ namespace System.Net.WebSockets
// as the Exception..ctor() throws on setting HResult to 0. The default for HResult is -2147467259.
private void SetErrorCodeOnError(int nativeError)
{
- HResult = nativeError;
+ if (!Succeeded(nativeError))
+ {
+ HResult = nativeError;
+ }
}
private static bool Succeeded(int hr)
diff --git a/src/System.Net.WebSockets/tests/WebSocketExceptionTests.cs b/src/System.Net.WebSockets/tests/WebSocketExceptionTests.cs
index d00ea840dd..d40a371257 100644
--- a/src/System.Net.WebSockets/tests/WebSocketExceptionTests.cs
+++ b/src/System.Net.WebSockets/tests/WebSocketExceptionTests.cs
@@ -24,19 +24,19 @@ namespace System.Net.WebSockets.Tests
};
public static object[][] NativeErrorData = {
- new object[] { 0, WebSocketError.Success },
- new object[] { -2147467259, WebSocketError.NativeError },
+ new object[] { 0, WebSocketError.Success, unchecked((int)0x80004005) },
+ new object[] { -2147467259, WebSocketError.NativeError, -2147467259},
};
public static object[][] UnrelatedErrorData =
- ErrorData.SelectMany(wse => NativeErrorData.Select(ne => new object[] { wse[0], ne[0] })).ToArray();
+ ErrorData.SelectMany(wse => NativeErrorData.Select(ne => new object[] { wse[0], ne[0], ne[2] })).ToArray();
[Theory, MemberData(nameof(ErrorData))]
public void ConstructorTests_WebSocketError_Success(WebSocketError error)
{
var wse = new WebSocketException(error);
- Assert.Equal(wse.WebSocketErrorCode, error);
- Assert.NotEqual(wse.Message, "");
+ Assert.Equal(error, wse.WebSocketErrorCode);
+ Assert.NotEqual("", wse.Message);
Assert.Null(wse.InnerException);
}
@@ -45,8 +45,8 @@ namespace System.Net.WebSockets.Tests
{
const string Message = "Message";
var wse = new WebSocketException(error, Message);
- Assert.Equal(wse.WebSocketErrorCode, error);
- Assert.Equal(wse.Message, Message);
+ Assert.Equal(error, wse.WebSocketErrorCode);
+ Assert.Equal(Message, wse.Message);
Assert.Null(wse.InnerException);
}
@@ -55,9 +55,9 @@ namespace System.Net.WebSockets.Tests
{
var inner = new Exception();
var wse = new WebSocketException(error, inner);
- Assert.Equal(wse.WebSocketErrorCode, error);
- Assert.NotEqual(wse.Message, "");
- Assert.Equal(wse.InnerException, inner);
+ Assert.Equal(error, wse.WebSocketErrorCode);
+ Assert.NotEqual("", wse.Message);
+ Assert.Same(inner, wse.InnerException);
}
[Theory, MemberData(nameof(ErrorData))]
@@ -66,104 +66,106 @@ namespace System.Net.WebSockets.Tests
const string Message = "Message";
var inner = new Exception();
var wse = new WebSocketException(error, Message, inner);
- Assert.Equal(wse.WebSocketErrorCode, error);
- Assert.Equal(wse.Message, Message);
- Assert.Equal(wse.InnerException, inner);
+ Assert.Equal(error, wse.WebSocketErrorCode);
+ Assert.Equal(Message, wse.Message);
+ Assert.Same(inner, wse.InnerException);
}
[Theory, MemberData(nameof(NativeErrorData))]
- public void ConstructorTests_NativeError_Success(int nativeError, WebSocketError webSocketError)
+ public void ConstructorTests_NativeError_Success(int nativeError, WebSocketError webSocketError, int expectedHResult)
{
var wse = new WebSocketException(nativeError);
- Assert.Equal(wse.HResult, nativeError);
- Assert.Equal(wse.WebSocketErrorCode, webSocketError);
- Assert.NotEqual(wse.Message, "");
+ Assert.Equal(expectedHResult, wse.HResult);
+ Assert.Equal(webSocketError, wse.WebSocketErrorCode);
+ Assert.NotEqual("", wse.Message);
Assert.Null(wse.InnerException);
}
[Theory, MemberData(nameof(NativeErrorData))]
- public void ConstructorTests_NativeError_Message_Success(int nativeError, WebSocketError webSocketError)
+ public void ConstructorTests_NativeError_Message_Success(int nativeError, WebSocketError webSocketError, int expectedHResult)
{
const string Message = "Message";
var wse = new WebSocketException(nativeError, Message);
- Assert.Equal(wse.HResult, nativeError);
- Assert.Equal(wse.WebSocketErrorCode, webSocketError);
- Assert.Equal(wse.Message, Message);
+ Assert.Equal(expectedHResult, wse.HResult);
+ Assert.Equal(webSocketError, wse.WebSocketErrorCode);
+ Assert.Equal(Message, wse.Message);
Assert.Null(wse.InnerException);
}
[Theory, MemberData(nameof(NativeErrorData))]
- public void ConstructorTests_NativeError_Exception_Success(int nativeError, WebSocketError webSocketError)
+ public void ConstructorTests_NativeError_Exception_Success(int nativeError, WebSocketError webSocketError, int expectedHResult)
{
var inner = new Exception();
var wse = new WebSocketException(nativeError, inner);
- Assert.Equal(wse.HResult, nativeError);
- Assert.Equal(wse.WebSocketErrorCode, webSocketError);
- Assert.NotEqual(wse.Message, "");
- Assert.Equal(wse.InnerException, inner);
+ Assert.Equal(expectedHResult, wse.HResult);
+ Assert.Equal(webSocketError, wse.WebSocketErrorCode);
+ Assert.NotEqual("", wse.Message);
+ Assert.Same(inner, wse.InnerException);
}
[Theory, MemberData(nameof(UnrelatedErrorData))]
- public void ConstructorTests_WebSocketError_NativeError_Success(int nativeError, WebSocketError error)
+ public void ConstructorTests_WebSocketError_NativeError_Success(int nativeError, WebSocketError error, int expectedHResult)
{
var wse = new WebSocketException(error, nativeError);
- Assert.Equal(wse.HResult, nativeError);
- Assert.Equal(wse.WebSocketErrorCode, error);
- Assert.NotEqual(wse.Message, "");
+ Assert.Equal(expectedHResult, wse.HResult);
+ Assert.Equal(error, wse.WebSocketErrorCode);
+ Assert.NotEqual("", wse.Message);
Assert.Null(wse.InnerException);
}
[Theory, MemberData(nameof(UnrelatedErrorData))]
- public void ConstructorTests_WebSocketError_NativeError_Message_Success(int nativeError, WebSocketError error)
+ public void ConstructorTests_WebSocketError_NativeError_Message_Success(int nativeError, WebSocketError error, int expectedHResult)
{
const string Message = "Message";
var wse = new WebSocketException(error, nativeError, Message);
- Assert.Equal(wse.HResult, nativeError);
- Assert.Equal(wse.WebSocketErrorCode, error);
- Assert.Equal(wse.Message, Message);
+ Assert.Equal(expectedHResult, wse.HResult);
+ Assert.Equal(error, wse.WebSocketErrorCode);
+ Assert.Equal(Message, wse.Message);
Assert.Null(wse.InnerException);
}
[Theory, MemberData(nameof(UnrelatedErrorData))]
- public void ConstructorTests_WebSocketError_NativeError_Exception_Success(int nativeError, WebSocketError error)
+ public void ConstructorTests_WebSocketError_NativeError_Exception_Success(int nativeError, WebSocketError error, int expectedHResult)
{
var inner = new Exception();
var wse = new WebSocketException(error, nativeError, inner);
- Assert.Equal(wse.HResult, nativeError);
- Assert.Equal(wse.WebSocketErrorCode, error);
- Assert.NotEqual(wse.Message, "");
- Assert.Equal(wse.InnerException, inner);
+ Assert.Equal(expectedHResult, wse.HResult);
+ Assert.Equal(error, wse.WebSocketErrorCode);
+ Assert.NotEqual("", wse.Message);
+ Assert.Same(inner, wse.InnerException);
}
[Theory, MemberData(nameof(UnrelatedErrorData))]
- public void ConstructorTests_WebSocketError_NativeError_Message_Exception_Success(int nativeError, WebSocketError error)
+ public void ConstructorTests_WebSocketError_NativeError_Message_Exception_Success(int nativeError, WebSocketError error, int expectedHResult)
{
const string Message = "Message";
var inner = new Exception();
var wse = new WebSocketException(error, nativeError, Message, inner);
- Assert.Equal(wse.HResult, nativeError);
- Assert.Equal(wse.WebSocketErrorCode, error);
- Assert.Equal(wse.Message, Message);
- Assert.Equal(wse.InnerException, inner);
+ Assert.Equal(expectedHResult, wse.HResult);
+ Assert.Equal(error, wse.WebSocketErrorCode);
+ Assert.Equal(Message, wse.Message);
+ Assert.Same(inner, wse.InnerException);
}
+ [Fact]
public void ConstructorTests_Message_Success()
{
const string Message = "Message";
var wse = new WebSocketException(Message);
- Assert.Equal(wse.WebSocketErrorCode, WebSocketError.Success);
- Assert.Equal(wse.Message, Message);
+ Assert.Equal(WebSocketError.Success, wse.WebSocketErrorCode);
+ Assert.Equal(Message, wse.Message);
Assert.Null(wse.InnerException);
}
+ [Fact]
public void ConstructorTests_Message_Exception_Success()
{
const string Message = "Message";
var inner = new Exception();
var wse = new WebSocketException(Message, inner);
- Assert.Equal(wse.WebSocketErrorCode, WebSocketError.Success);
- Assert.Equal(wse.Message, Message);
- Assert.Equal(wse.InnerException, inner);
+ Assert.Equal(WebSocketError.Success, wse.WebSocketErrorCode);
+ Assert.Equal(Message, wse.Message);
+ Assert.Same(inner, wse.InnerException);
}
}
}
diff --git a/src/System.Numerics.Vectors.WindowsRuntime/dir.props b/src/System.Numerics.Vectors.WindowsRuntime/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Numerics.Vectors.WindowsRuntime/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Numerics.Vectors.WindowsRuntime/pkg/System.Numerics.Vectors.WindowsRuntime.pkgproj b/src/System.Numerics.Vectors.WindowsRuntime/pkg/System.Numerics.Vectors.WindowsRuntime.pkgproj
index aaefe0d73b..c887f73baa 100644
--- a/src/System.Numerics.Vectors.WindowsRuntime/pkg/System.Numerics.Vectors.WindowsRuntime.pkgproj
+++ b/src/System.Numerics.Vectors.WindowsRuntime/pkg/System.Numerics.Vectors.WindowsRuntime.pkgproj
@@ -7,6 +7,11 @@
<SupportedFramework>uap10.0</SupportedFramework>
</ProjectReference>
</ItemGroup>
-
+ <ItemGroup>
+ <!-- This package is only supported on UWP and intentionally does not expose a netstandard reference assembly -->
+ <ValidatePackageSuppression Include="SuppressNETStandardInference">
+ <Value>UAP,Version=v10.1;UAP,Version=v10.0</Value>
+ </ValidatePackageSuppression>
+ </ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project> \ No newline at end of file
diff --git a/src/System.Numerics.Vectors.WindowsRuntime/pkg/ValidationSuppression.txt b/src/System.Numerics.Vectors.WindowsRuntime/pkg/ValidationSuppression.txt
deleted file mode 100644
index 90950ade95..0000000000
--- a/src/System.Numerics.Vectors.WindowsRuntime/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1 +0,0 @@
-SuppressNETStandardInference=UAP,Version=v10.1;UAP,Version=v10.0 \ No newline at end of file
diff --git a/src/System.Numerics.Vectors.WindowsRuntime/src/System.Numerics.Vectors.WindowsRuntime.csproj b/src/System.Numerics.Vectors.WindowsRuntime/src/System.Numerics.Vectors.WindowsRuntime.csproj
index 2c94f0497a..872db3a42c 100644
--- a/src/System.Numerics.Vectors.WindowsRuntime/src/System.Numerics.Vectors.WindowsRuntime.csproj
+++ b/src/System.Numerics.Vectors.WindowsRuntime/src/System.Numerics.Vectors.WindowsRuntime.csproj
@@ -6,10 +6,8 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>System.Numerics</RootNamespace>
<AssemblyName>System.Numerics.Vectors.WindowsRuntime</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <PackageTargetFramework>uap10.0</PackageTargetFramework>
- <NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETCore,Version=v5.0</NuGetTargetMoniker>
+ <NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">UAP,Version=v10.0</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcore50_Debug|AnyCPU'" />
diff --git a/src/System.Numerics.Vectors.WindowsRuntime/src/project.json b/src/System.Numerics.Vectors.WindowsRuntime/src/project.json
index ea27a0bc58..d5ba370dd7 100644
--- a/src/System.Numerics.Vectors.WindowsRuntime/src/project.json
+++ b/src/System.Numerics.Vectors.WindowsRuntime/src/project.json
@@ -7,7 +7,7 @@
"System.Runtime.WindowsRuntime": "4.0.10"
},
"frameworks": {
- "netcore50": {}
+ "uap10.0": {}
},
"runtimes": {
"win8-x86": {},
diff --git a/src/System.Numerics.Vectors/dir.props b/src/System.Numerics.Vectors/dir.props
new file mode 100644
index 0000000000..0e3e20c392
--- /dev/null
+++ b/src/System.Numerics.Vectors/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Numerics.Vectors/ref/4.0.0/System.Numerics.Vectors.depproj b/src/System.Numerics.Vectors/ref/4.0.0/System.Numerics.Vectors.depproj
index 936df44f24..1681b96d7d 100644
--- a/src/System.Numerics.Vectors/ref/4.0.0/System.Numerics.Vectors.depproj
+++ b/src/System.Numerics.Vectors/ref/4.0.0/System.Numerics.Vectors.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Numerics.Vectors/ref/System.Numerics.Vectors.csproj b/src/System.Numerics.Vectors/ref/System.Numerics.Vectors.csproj
index 3fe40c373e..f4e45fadb6 100644
--- a/src/System.Numerics.Vectors/ref/System.Numerics.Vectors.csproj
+++ b/src/System.Numerics.Vectors/ref/System.Numerics.Vectors.csproj
@@ -2,10 +2,8 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.2.0</AssemblyVersion>
<OutputType>Library</OutputType>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="System.Numerics.Vectors.cs" />
diff --git a/src/System.Numerics.Vectors/src/System.Numerics.Vectors.csproj b/src/System.Numerics.Vectors/src/System.Numerics.Vectors.csproj
index 54e48ed2c0..0d80adbfab 100644
--- a/src/System.Numerics.Vectors/src/System.Numerics.Vectors.csproj
+++ b/src/System.Numerics.Vectors/src/System.Numerics.Vectors.csproj
@@ -5,19 +5,13 @@
<ProjectGuid>{53134B0C-0D57-481B-B84E-D1991E8D54FF}</ProjectGuid>
<RootNamespace>System.Numerics</RootNamespace>
<AssemblyName>System.Numerics.Vectors</AssemblyName>
- <AssemblyVersion>4.1.2.0</AssemblyVersion>
<DocumentationFile>$(OutputPath)System.Numerics.Vectors.xml</DocumentationFile>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net46'">true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
+ <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.0;portable-net45+win8+wp8+wpa81</PackageTargetFramework>
</PropertyGroup>
- <ItemGroup Condition="'$(PackageTargetFramework)' == ''">
- <PackageDestination Include="lib/netstandard1.0">
- <TargetFramework>netstandard1.0</TargetFramework>
- </PackageDestination>
- <PackageDestination Include="lib/portable-net45+win8+wp8+wpa81">
- <TargetFramework>portable-net45+win8+wp8+wpa81</TargetFramework>
- </PackageDestination>
+ <ItemGroup Condition="'$(TargetGroup)' == ''">
<!-- Use the documentation file generated by this project for the reference assembly.
This needs to be kept in sync with all of the PackageTargetFrameworks used by
the reference assembly projects. -->
@@ -26,8 +20,6 @@
<IsReferenceAsset>true</IsReferenceAsset>
</FilesToPackage>
</ItemGroup>
- <ItemGroup>
- </ItemGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
diff --git a/src/System.ObjectModel/dir.props b/src/System.ObjectModel/dir.props
new file mode 100644
index 0000000000..5fb0f02455
--- /dev/null
+++ b/src/System.ObjectModel/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.13.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.ObjectModel/pkg/System.ObjectModel.pkgproj b/src/System.ObjectModel/pkg/System.ObjectModel.pkgproj
index 5977192804..2819b16183 100644
--- a/src/System.ObjectModel/pkg/System.ObjectModel.pkgproj
+++ b/src/System.ObjectModel/pkg/System.ObjectModel.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.13.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\4.0.0\System.ObjectModel.depproj">
diff --git a/src/System.ObjectModel/pkg/ValidationSuppression.txt b/src/System.ObjectModel/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.ObjectModel/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.ObjectModel/ref/4.0.0/System.ObjectModel.depproj b/src/System.ObjectModel/ref/4.0.0/System.ObjectModel.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.ObjectModel/ref/4.0.0/System.ObjectModel.depproj
+++ b/src/System.ObjectModel/ref/4.0.0/System.ObjectModel.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.ObjectModel/ref/System.ObjectModel.csproj b/src/System.ObjectModel/ref/System.ObjectModel.csproj
index dc8669c85c..54241e14d7 100644
--- a/src/System.ObjectModel/ref/System.ObjectModel.csproj
+++ b/src/System.ObjectModel/ref/System.ObjectModel.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.ObjectModel/src/System.ObjectModel.csproj b/src/System.ObjectModel/src/System.ObjectModel.csproj
index 6ad9f48336..75ab4cb80a 100644
--- a/src/System.ObjectModel/src/System.ObjectModel.csproj
+++ b/src/System.ObjectModel/src/System.ObjectModel.csproj
@@ -4,11 +4,9 @@
<PropertyGroup>
<ProjectGuid>{F24D3391-2928-4E83-AADE-A4461E5CAE50}</ProjectGuid>
<AssemblyName>System.ObjectModel</AssemblyName>
- <AssemblyVersion>4.0.13.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Private.DataContractSerialization/dir.props b/src/System.Private.DataContractSerialization/dir.props
new file mode 100644
index 0000000000..0e3e20c392
--- /dev/null
+++ b/src/System.Private.DataContractSerialization/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Private.DataContractSerialization/pkg/System.Private.DataContractSerialization.pkgproj b/src/System.Private.DataContractSerialization/pkg/System.Private.DataContractSerialization.pkgproj
index e4befd3253..ea4c1625d1 100644
--- a/src/System.Private.DataContractSerialization/pkg/System.Private.DataContractSerialization.pkgproj
+++ b/src/System.Private.DataContractSerialization/pkg/System.Private.DataContractSerialization.pkgproj
@@ -2,8 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <!-- Ideally we'd harvest this from the runtime dependencies -->
- <Version>4.1.2</Version>
<PreventImplementationReference>true</PreventImplementationReference>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Private.DataContractSerialization/src/System.Private.DataContractSerialization.csproj b/src/System.Private.DataContractSerialization/src/System.Private.DataContractSerialization.csproj
index 08719a2617..2745b68c97 100644
--- a/src/System.Private.DataContractSerialization/src/System.Private.DataContractSerialization.csproj
+++ b/src/System.Private.DataContractSerialization/src/System.Private.DataContractSerialization.csproj
@@ -3,7 +3,6 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Private.DataContractSerialization</AssemblyName>
- <AssemblyVersion>4.1.2.0</AssemblyVersion>
<RootNamespace>System.Private.DataContractSerialization</RootNamespace>
<NoWarn>$(NoWarn);1634;1691;649</NoWarn>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -12,7 +11,6 @@
<DebugSymbols>true</DebugSymbols>
<PlatformTarget>AnyCPU</PlatformTarget>
<DefineConstants Condition="'$(TargetGroup)'=='netcore50aot'">$(DefineConstants);NET_NATIVE</DefineConstants>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<!-- We do not want to block reflection for this assembly -->
<BlockReflectionAttribute Condition="'$(TargetGroup)'=='netcore50aot'">false</BlockReflectionAttribute>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
diff --git a/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContract.cs b/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContract.cs
index 2a7dae8551..c09a0cfeec 100644
--- a/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContract.cs
+++ b/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContract.cs
@@ -274,7 +274,11 @@ namespace System.Runtime.Serialization
set { _helper.UnderlyingType = value; }
}
- public Type OriginalUnderlyingType { get; set; }
+ public Type OriginalUnderlyingType
+ {
+ get { return _helper.OriginalUnderlyingType; }
+ set { _helper.OriginalUnderlyingType = value; }
+ }
public virtual bool IsBuiltInDataContract
{
@@ -538,6 +542,7 @@ namespace System.Runtime.Serialization
private static object s_clrTypeStringsLock = new object();
private Type _underlyingType;
+ private Type _originalUnderlyingType;
private bool _isReference;
private bool _isValueType;
private XmlQualifiedName _stableName;
@@ -674,7 +679,9 @@ namespace System.Runtime.Serialization
{
if (type == null)
type = Type.GetTypeFromHandle(typeHandle);
+
type = UnwrapNullableType(type);
+ var originalType = type;
type = GetDataContractAdapterTypeForGeneratedAssembly(type);
dataContract = DataContract.GetDataContractFromGeneratedAssembly(type);
@@ -710,6 +717,15 @@ namespace System.Runtime.Serialization
ThrowInvalidDataContractException(SR.Format(SR.TypeNotSerializable, type), type);
}
dataContract = new ClassDataContract(type);
+ if (type != originalType)
+ {
+ var originalDataContract = new ClassDataContract(originalType);
+ if (dataContract.StableName != originalDataContract.StableName)
+ {
+ // for non-DC types, type adapters will not have the same stable name (contract name).
+ dataContract.StableName = originalDataContract.StableName;
+ }
+ }
}
}
}
@@ -785,6 +801,16 @@ namespace System.Runtime.Serialization
return type;
}
+ // Maps adapted types back to the original type
+ // Any change to this method should be reflected in GetDataContractAdapterType
+ internal static Type GetDataContractOriginalType(Type type)
+ {
+ if (type == Globals.TypeOfDateTimeOffsetAdapter)
+ {
+ return Globals.TypeOfDateTimeOffset;
+ }
+ return type;
+ }
private static RuntimeTypeHandle GetDataContractAdapterTypeHandle(RuntimeTypeHandle typeHandle)
{
if (Globals.TypeOfDateTimeOffset.TypeHandle.Equals(typeHandle))
@@ -1086,6 +1112,21 @@ namespace System.Runtime.Serialization
set { _underlyingType = value; }
}
+ internal Type OriginalUnderlyingType
+ {
+ get
+ {
+ if (_originalUnderlyingType == null)
+ {
+ _originalUnderlyingType = GetDataContractOriginalType(this._underlyingType);
+ }
+ return _originalUnderlyingType;
+ }
+ set
+ {
+ _originalUnderlyingType = value;
+ }
+ }
internal virtual bool IsBuiltInDataContract
{
get
diff --git a/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlObjectSerializerWriteContext.cs b/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlObjectSerializerWriteContext.cs
index 6d4e14c739..c73ee13a3b 100644
--- a/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlObjectSerializerWriteContext.cs
+++ b/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlObjectSerializerWriteContext.cs
@@ -621,20 +621,20 @@ namespace System.Runtime.Serialization
protected virtual bool WriteTypeInfo(XmlWriterDelegator writer, DataContract contract, DataContract declaredContract)
{
- if (XmlObjectSerializer.IsContractDeclared(contract, declaredContract))
+ if (!XmlObjectSerializer.IsContractDeclared(contract, declaredContract))
{
- return false;
- }
- bool hasResolver = DataContractResolver != null;
- if (hasResolver)
- {
- WriteResolvedTypeInfo(writer, contract.UnderlyingType, declaredContract.UnderlyingType);
- }
- else
- {
- WriteTypeInfo(writer, contract.Name, contract.Namespace);
+ if (DataContractResolver == null)
+ {
+ WriteTypeInfo(writer, contract.Name, contract.Namespace);
+ return true;
+ }
+ else
+ {
+ WriteResolvedTypeInfo(writer, contract.OriginalUnderlyingType, declaredContract.OriginalUnderlyingType);
+ return false;
+ }
}
- return hasResolver;
+ return false;
}
protected virtual void WriteTypeInfo(XmlWriterDelegator writer, string dataContractName, string dataContractNamespace)
diff --git a/src/System.Private.Uri/dir.props b/src/System.Private.Uri/dir.props
new file mode 100644
index 0000000000..c218f90328
--- /dev/null
+++ b/src/System.Private.Uri/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.3.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Private.Uri/pkg/System.Private.Uri.pkgproj b/src/System.Private.Uri/pkg/System.Private.Uri.pkgproj
index ee756f1953..e3f2ec8742 100644
--- a/src/System.Private.Uri/pkg/System.Private.Uri.pkgproj
+++ b/src/System.Private.Uri/pkg/System.Private.Uri.pkgproj
@@ -2,8 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <!-- Ideally we'd harvest this from the runtime dependencies -->
- <Version>4.0.3</Version>
<!-- The Unix implementations place the asset in a generation folder,
however the assembly won't reference any generation-based contracts -->
<SkipGenerationCheck>true</SkipGenerationCheck>
diff --git a/src/System.Private.Uri/src/System.Private.Uri.csproj b/src/System.Private.Uri/src/System.Private.Uri.csproj
index ce2f2cad55..5f0adf7d2a 100644
--- a/src/System.Private.Uri/src/System.Private.Uri.csproj
+++ b/src/System.Private.Uri/src/System.Private.Uri.csproj
@@ -7,12 +7,10 @@
<PropertyGroup>
<ProjectGuid>{4AC5343E-6E31-4BA5-A795-0493AE7E9008}</ProjectGuid>
<AssemblyName>System.Private.Uri</AssemblyName>
- <AssemblyVersion>4.0.3.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);INTERNAL_GLOBALIZATION_EXTENSIONS</DefineConstants>
<!-- Suppress warnings for type conflicts between SafeFileHandle in partial facade and mscorlib -->
<NoWarn>0436</NoWarn>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)'==''">netstandard1.0</PackageTargetFramework>
<SkipCommonResourcesIncludes Condition="'$(TargetGroup)'=='netcore50aot' Or '$(TargetGroup)'=='netstandard13aot'">true</SkipCommonResourcesIncludes>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.Private.Uri/src/System/DomainNameHelper.cs b/src/System.Private.Uri/src/System/DomainNameHelper.cs
index 628028643d..0231c3a9c3 100644
--- a/src/System.Private.Uri/src/System/DomainNameHelper.cs
+++ b/src/System.Private.Uri/src/System/DomainNameHelper.cs
@@ -324,7 +324,7 @@ namespace System
{
// just lowercase for ascii
string unescapedHostname = new string(hostname, start, end - start);
- return ((unescapedHostname != null) ? unescapedHostname.ToLowerInvariant() : null);
+ return unescapedHostname.ToLowerInvariant();
}
else
{
diff --git a/src/System.Private.Uri/src/System/UriBuilder.cs b/src/System.Private.Uri/src/System/UriBuilder.cs
index a84f33c39f..0126fa4854 100644
--- a/src/System.Private.Uri/src/System/UriBuilder.cs
+++ b/src/System.Private.Uri/src/System/UriBuilder.cs
@@ -179,7 +179,7 @@ namespace System
{
value = string.Empty;
}
- if (value.Length > 0)
+ if (value.Length > 0 && value[0] != '#')
{
value = '#' + value;
}
diff --git a/src/System.Private.Uri/tests/FunctionalTests/UriBuilderTests.cs b/src/System.Private.Uri/tests/FunctionalTests/UriBuilderTests.cs
index 2d8b8d5025..7347a69f5f 100644
--- a/src/System.Private.Uri/tests/FunctionalTests/UriBuilderTests.cs
+++ b/src/System.Private.Uri/tests/FunctionalTests/UriBuilderTests.cs
@@ -290,7 +290,8 @@ namespace System.PrivateUri.Tests
[Theory]
[InlineData("fragment", "#fragment")]
- [InlineData("#fragment", "##fragment")]
+ [InlineData("#fragment", "#fragment")]
+ [InlineData("#", "#")]
[InlineData("", "")]
[InlineData(null, "")]
public void Fragment_Get_Set(string value, string expected)
diff --git a/src/System.Private.Xml/src/System/Xml/NameTable.cs b/src/System.Private.Xml/src/System/Xml/NameTable.cs
index ad1e417cbf..75f1ce482c 100644
--- a/src/System.Private.Xml/src/System/Xml/NameTable.cs
+++ b/src/System.Private.Xml/src/System/Xml/NameTable.cs
@@ -6,7 +6,6 @@ using System;
namespace System.Xml
{
- /// <include file='doc\NameTable.uex' path='docs/doc[@for="NameTable"]/*' />
/// <devdoc>
/// <para>
/// XmlNameTable implemented as a simple hash table.
@@ -41,8 +40,6 @@ namespace System.Xml
//
// Constructor
- //
- /// <include file='doc\NameTable.uex' path='docs/doc[@for="NameTable.NameTable"]/*' />
/// <devdoc>
/// Public constructor.
/// </devdoc>
@@ -55,8 +52,6 @@ namespace System.Xml
//
// XmlNameTable public methods
- //
- /// <include file='doc\NameTable.uex' path='docs/doc[@for="NameTable.Add"]/*' />
/// <devdoc>
/// Add the given string to the NameTable or return
/// the existing string if it is already in the NameTable.
@@ -93,7 +88,6 @@ namespace System.Xml
return AddEntry(key, hashCode);
}
- /// <include file='doc\NameTable.uex' path='docs/doc[@for="NameTable.Add1"]/*' />
/// <devdoc>
/// Add the given string to the NameTable or return
/// the existing string if it is already in the NameTable.
@@ -127,7 +121,6 @@ namespace System.Xml
return AddEntry(new string(key, start, len), hashCode);
}
- /// <include file='doc\NameTable.uex' path='docs/doc[@for="NameTable.Get"]/*' />
/// <devdoc>
/// Find the matching string in the NameTable.
/// </devdoc>
@@ -164,7 +157,6 @@ namespace System.Xml
return null;
}
- /// <include file='doc\NameTable.uex' path='docs/doc[@for="NameTable.Get1"]/*' />
/// <devdoc>
/// Find the matching string atom given a range of
/// characters.
diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlAnyAttributeAttribute.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlAnyAttributeAttribute.cs
index 5d68f06004..0058c9e366 100644
--- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlAnyAttributeAttribute.cs
+++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlAnyAttributeAttribute.cs
@@ -8,14 +8,12 @@ using System.Xml.Schema;
namespace System.Xml.Serialization
{
- /// <include file='doc\XmlAnyAttributeAttribute.uex' path='docs/doc[@for="XmlAnyAttributeAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = false)]
public class XmlAnyAttributeAttribute : System.Attribute
{
- /// <include file='doc\XmlAnyAttributeAttribute.uex' path='docs/doc[@for="XmlAnyAttributeAttribute.XmlAnyAttributeAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlAnyElementAttribute.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlAnyElementAttribute.cs
index 2553d8510f..f0cf76f245 100644
--- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlAnyElementAttribute.cs
+++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlAnyElementAttribute.cs
@@ -8,7 +8,6 @@ using System.Xml.Schema;
namespace System.Xml.Serialization
{
- /// <include file='doc\XmlAnyElementAttribute.uex' path='docs/doc[@for="XmlAnyElementAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -20,7 +19,6 @@ namespace System.Xml.Serialization
private int _order = -1;
private bool _nsSpecified = false;
- /// <include file='doc\XmlAnyElementAttribute.uex' path='docs/doc[@for="XmlAnyElementAttribute.XmlAnyElementAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -28,7 +26,6 @@ namespace System.Xml.Serialization
{
}
- /// <include file='doc\XmlAnyElementAttribute.uex' path='docs/doc[@for="XmlAnyElementAttribute.XmlAnyElementAttribute1"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -37,7 +34,6 @@ namespace System.Xml.Serialization
_name = name;
}
- /// <include file='doc\XmlAnyElementAttribute.uex' path='docs/doc[@for="XmlAnyElementAttribute.XmlAnyElementAttribute2"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -48,7 +44,6 @@ namespace System.Xml.Serialization
_nsSpecified = true;
}
- /// <include file='doc\XmlAnyElementAttribute.uex' path='docs/doc[@for="XmlAnyElementAttribute.Name"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -58,7 +53,6 @@ namespace System.Xml.Serialization
set { _name = value; }
}
- /// <include file='doc\XmlAnyElementAttribute.uex' path='docs/doc[@for="XmlAnyElementAttribute.Namespace"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -72,7 +66,6 @@ namespace System.Xml.Serialization
}
}
- /// <include file='doc\XmlAnyElementAttribute.uex' path='docs/doc[@for="XmlAnyElementAttribute.Order"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlArrayAttribute.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlArrayAttribute.cs
index 287127578a..79e983bade 100644
--- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlArrayAttribute.cs
+++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlArrayAttribute.cs
@@ -8,7 +8,6 @@ using System.Xml.Schema;
namespace System.Xml.Serialization
{
- /// <include file='doc\XmlArrayAttribute.uex' path='docs/doc[@for="XmlArrayAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -21,7 +20,6 @@ namespace System.Xml.Serialization
private XmlSchemaForm _form = XmlSchemaForm.None;
private int _order = -1;
- /// <include file='doc\XmlArrayAttribute.uex' path='docs/doc[@for="XmlArrayAttribute.XmlArrayAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -29,7 +27,6 @@ namespace System.Xml.Serialization
{
}
- /// <include file='doc\XmlArrayAttribute.uex' path='docs/doc[@for="XmlArrayAttribute.XmlArrayAttribute1"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -38,7 +35,6 @@ namespace System.Xml.Serialization
_elementName = elementName;
}
- /// <include file='doc\XmlArrayAttribute.uex' path='docs/doc[@for="XmlArrayAttribute.ElementName"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -48,7 +44,6 @@ namespace System.Xml.Serialization
set { _elementName = value; }
}
- /// <include file='doc\XmlArrayAttribute.uex' path='docs/doc[@for="XmlArrayAttribute.Namespace"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -58,7 +53,6 @@ namespace System.Xml.Serialization
set { _ns = value; }
}
- /// <include file='doc\XmlArrayAttribute.uex' path='docs/doc[@for="XmlArrayAttribute.IsNullable"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -68,7 +62,6 @@ namespace System.Xml.Serialization
set { _nullable = value; }
}
- /// <include file='doc\XmlArrayAttribute.uex' path='docs/doc[@for="XmlArrayAttribute.Form"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -78,7 +71,6 @@ namespace System.Xml.Serialization
set { _form = value; }
}
- /// <include file='doc\XmlArrayAttribute.uex' path='docs/doc[@for="XmlArrayAttribute.Order"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlArrayItemAttribute.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlArrayItemAttribute.cs
index a6d9d5557e..cdbcd8125a 100644
--- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlArrayItemAttribute.cs
+++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlArrayItemAttribute.cs
@@ -8,7 +8,6 @@ using System.Xml.Schema;
namespace System.Xml.Serialization
{
- /// <include file='doc\XmlArrayItemAttribute.uex' path='docs/doc[@for="XmlArrayItemAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -24,7 +23,6 @@ namespace System.Xml.Serialization
private XmlSchemaForm _form = XmlSchemaForm.None;
private int _nestingLevel;
- /// <include file='doc\XmlArrayItemAttribute.uex' path='docs/doc[@for="XmlArrayItemAttribute.XmlArrayItemAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -32,7 +30,6 @@ namespace System.Xml.Serialization
{
}
- /// <include file='doc\XmlArrayItemAttribute.uex' path='docs/doc[@for="XmlArrayItemAttribute.XmlArrayItemAttribute1"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -41,7 +38,6 @@ namespace System.Xml.Serialization
_elementName = elementName;
}
- /// <include file='doc\XmlArrayItemAttribute.uex' path='docs/doc[@for="XmlArrayItemAttribute.XmlArrayItemAttribute2"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -50,7 +46,6 @@ namespace System.Xml.Serialization
_type = type;
}
- /// <include file='doc\XmlArrayItemAttribute.uex' path='docs/doc[@for="XmlArrayItemAttribute.XmlArrayItemAttribute3"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -60,7 +55,6 @@ namespace System.Xml.Serialization
_type = type;
}
- /// <include file='doc\XmlArrayItemAttribute.uex' path='docs/doc[@for="XmlArrayItemAttribute.Type"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -70,7 +64,6 @@ namespace System.Xml.Serialization
set { _type = value; }
}
- /// <include file='doc\XmlArrayItemAttribute.uex' path='docs/doc[@for="XmlArrayItemAttribute.ElementName"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -80,7 +73,6 @@ namespace System.Xml.Serialization
set { _elementName = value; }
}
- /// <include file='doc\XmlArrayItemAttribute.uex' path='docs/doc[@for="XmlArrayItemAttribute.Namespace"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -90,14 +82,12 @@ namespace System.Xml.Serialization
set { _ns = value; }
}
- /// <include file='doc\XmlArrayItemAttribute.uex' path='docs/doc[@for="XmlArrayItemAttribute.NestingLevel"]/*' />
public int NestingLevel
{
get { return _nestingLevel; }
set { _nestingLevel = value; }
}
- /// <include file='doc\XmlArrayItemAttribute.uex' path='docs/doc[@for="XmlArrayItemAttribute.DataType"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -107,7 +97,6 @@ namespace System.Xml.Serialization
set { _dataType = value; }
}
- /// <include file='doc\XmlArrayItemAttribute.uex' path='docs/doc[@for="XmlArrayItemAttribute.IsNullable"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -122,7 +111,6 @@ namespace System.Xml.Serialization
get { return _nullableSpecified; }
}
- /// <include file='doc\XmlArrayItemAttribute.uex' path='docs/doc[@for="XmlArrayItemAttribute.Form"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlAttributeAttribute.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlAttributeAttribute.cs
index 1d470797f6..0e894c01a4 100644
--- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlAttributeAttribute.cs
+++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlAttributeAttribute.cs
@@ -8,7 +8,6 @@ using System.Xml.Schema;
namespace System.Xml.Serialization
{
- /// <include file='doc\XmlAttributeAttribute.uex' path='docs/doc[@for="XmlAttributeAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -21,7 +20,6 @@ namespace System.Xml.Serialization
private string _dataType;
private XmlSchemaForm _form = XmlSchemaForm.None;
- /// <include file='doc\XmlAttributeAttribute.uex' path='docs/doc[@for="XmlAttributeAttribute.XmlAttributeAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -29,7 +27,6 @@ namespace System.Xml.Serialization
{
}
- /// <include file='doc\XmlAttributeAttribute.uex' path='docs/doc[@for="XmlAttributeAttribute.XmlAttributeAttribute1"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -38,7 +35,6 @@ namespace System.Xml.Serialization
_attributeName = attributeName;
}
- /// <include file='doc\XmlAttributeAttribute.uex' path='docs/doc[@for="XmlAttributeAttribute.XmlAttributeAttribute2"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -47,7 +43,6 @@ namespace System.Xml.Serialization
_type = type;
}
- /// <include file='doc\XmlAttributeAttribute.uex' path='docs/doc[@for="XmlAttributeAttribute.XmlAttributeAttribute3"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -57,7 +52,6 @@ namespace System.Xml.Serialization
_type = type;
}
- /// <include file='doc\XmlAttributeAttribute.uex' path='docs/doc[@for="XmlAttributeAttribute.Type"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -67,7 +61,6 @@ namespace System.Xml.Serialization
set { _type = value; }
}
- /// <include file='doc\XmlAttributeAttribute.uex' path='docs/doc[@for="XmlAttributeAttribute.AttributeName"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -77,7 +70,6 @@ namespace System.Xml.Serialization
set { _attributeName = value; }
}
- /// <include file='doc\XmlAttributeAttribute.uex' path='docs/doc[@for="XmlAttributeAttribute.Namespace"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -87,7 +79,6 @@ namespace System.Xml.Serialization
set { _ns = value; }
}
- /// <include file='doc\XmlAttributeAttribute.uex' path='docs/doc[@for="XmlAttributeAttribute.DataType"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -97,7 +88,6 @@ namespace System.Xml.Serialization
set { _dataType = value; }
}
- /// <include file='doc\XmlAttributeAttribute.uex' path='docs/doc[@for="XmlAttributeAttribute.Form"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlAttributeOverrides.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlAttributeOverrides.cs
index dbfb7e4cd4..2c0465d99b 100644
--- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlAttributeOverrides.cs
+++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlAttributeOverrides.cs
@@ -12,7 +12,6 @@ namespace System.Xml.Serialization
using System.ComponentModel;
using System.Collections.Generic;
- /// <include file='doc\XmlAttributeOverrides.uex' path='docs/doc[@for="XmlAttributeOverrides"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -20,7 +19,6 @@ namespace System.Xml.Serialization
{
private readonly Dictionary<Type, Dictionary<string, XmlAttributes>> _types = new Dictionary<Type, Dictionary<string, XmlAttributes>>();
- /// <include file='doc\XmlAttributeOverrides.uex' path='docs/doc[@for="XmlAttributeOverrides.Add"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -29,7 +27,6 @@ namespace System.Xml.Serialization
Add(type, string.Empty, attributes);
}
- /// <include file='doc\XmlAttributeOverrides.uex' path='docs/doc[@for="XmlAttributeOverrides.Add1"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -48,7 +45,6 @@ namespace System.Xml.Serialization
members.Add(member, attributes);
}
- /// <include file='doc\XmlAttributeOverrides.uex' path='docs/doc[@for="XmlAttributeOverrides.this"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -60,7 +56,6 @@ namespace System.Xml.Serialization
}
}
- /// <include file='doc\XmlAttributeOverrides.uex' path='docs/doc[@for="XmlAttributeOverrides.this1"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlChoiceIdentifierAttribute.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlChoiceIdentifierAttribute.cs
index caedbaefc4..b9cfeef6c8 100644
--- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlChoiceIdentifierAttribute.cs
+++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlChoiceIdentifierAttribute.cs
@@ -9,7 +9,6 @@ using System.Reflection;
namespace System.Xml.Serialization
{
- /// <include file='doc\XmlChoiceIdentifierAttribute.uex' path='docs/doc[@for="XmlChoiceIdentifierAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -19,7 +18,6 @@ namespace System.Xml.Serialization
private string _name;
private MemberInfo _memberInfo;
- /// <include file='doc\XmlChoiceIdentifierAttribute.uex' path='docs/doc[@for="XmlChoiceIdentifierAttribute.XmlChoiceIdentifierAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -27,7 +25,6 @@ namespace System.Xml.Serialization
{
}
- /// <include file='doc\XmlChoiceIdentifierAttribute.uex' path='docs/doc[@for="XmlChoiceIdentifierAttribute.XmlChoiceIdentifierAttribute1"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -36,7 +33,6 @@ namespace System.Xml.Serialization
_name = name;
}
- /// <include file='doc\XmlChoiceIdentifierAttribute.uex' path='docs/doc[@for="XmlChoiceIdentifierAttribute.Name"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlElementAttribute.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlElementAttribute.cs
index ec82cdac75..8f1ffc42fa 100644
--- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlElementAttribute.cs
+++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlElementAttribute.cs
@@ -8,7 +8,6 @@ using System.Xml.Schema;
namespace System.Xml.Serialization
{
- /// <include file='doc\XmlElementAttribute.uex' path='docs/doc[@for="XmlElementAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -24,7 +23,6 @@ namespace System.Xml.Serialization
private XmlSchemaForm _form = XmlSchemaForm.None;
private int _order = -1;
- /// <include file='doc\XmlElementAttribute.uex' path='docs/doc[@for="XmlElementAttribute.XmlElementAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -32,7 +30,6 @@ namespace System.Xml.Serialization
{
}
- /// <include file='doc\XmlElementAttribute.uex' path='docs/doc[@for="XmlElementAttribute.XmlElementAttribute1"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -41,7 +38,6 @@ namespace System.Xml.Serialization
_elementName = elementName;
}
- /// <include file='doc\XmlElementAttribute.uex' path='docs/doc[@for="XmlElementAttribute.XmlElementAttribute2"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -50,7 +46,6 @@ namespace System.Xml.Serialization
_type = type;
}
- /// <include file='doc\XmlElementAttribute.uex' path='docs/doc[@for="XmlElementAttribute.XmlElementAttribute3"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -60,7 +55,6 @@ namespace System.Xml.Serialization
_type = type;
}
- /// <include file='doc\XmlElementAttribute.uex' path='docs/doc[@for="XmlElementAttribute.Type"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -70,7 +64,6 @@ namespace System.Xml.Serialization
set { _type = value; }
}
- /// <include file='doc\XmlElementAttribute.uex' path='docs/doc[@for="XmlElementAttribute.ElementName"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -80,7 +73,6 @@ namespace System.Xml.Serialization
set { _elementName = value; }
}
- /// <include file='doc\XmlElementAttribute.uex' path='docs/doc[@for="XmlElementAttribute.Namespace"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -90,7 +82,6 @@ namespace System.Xml.Serialization
set { _ns = value; }
}
- /// <include file='doc\XmlElementAttribute.uex' path='docs/doc[@for="XmlElementAttribute.DataType"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -100,7 +91,6 @@ namespace System.Xml.Serialization
set { _dataType = value; }
}
- /// <include file='doc\XmlElementAttribute.uex' path='docs/doc[@for="XmlElementAttribute.IsNullable"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -119,7 +109,6 @@ namespace System.Xml.Serialization
get { return _nullableSpecified; }
}
- /// <include file='doc\XmlElementAttribute.uex' path='docs/doc[@for="XmlElementAttribute.Form"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -129,7 +118,6 @@ namespace System.Xml.Serialization
set { _form = value; }
}
- /// <include file='doc\XmlElementAttribute.uex' path='docs/doc[@for="XmlElementAttribute.Order"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlEnumAttribute.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlEnumAttribute.cs
index f1a678fe56..6774f29623 100644
--- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlEnumAttribute.cs
+++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlEnumAttribute.cs
@@ -7,7 +7,6 @@ using System;
namespace System.Xml.Serialization
{
- /// <include file='doc\XmlEnumAttribute.uex' path='docs/doc[@for="XmlEnumAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -16,7 +15,6 @@ namespace System.Xml.Serialization
{
private string _name;
- /// <include file='doc\XmlEnumAttribute.uex' path='docs/doc[@for="XmlEnumAttribute.XmlEnumAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -24,7 +22,6 @@ namespace System.Xml.Serialization
{
}
- /// <include file='doc\XmlEnumAttribute.uex' path='docs/doc[@for="XmlEnumAttribute.XmlEnumAttribute1"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -33,7 +30,6 @@ namespace System.Xml.Serialization
_name = name;
}
- /// <include file='doc\XmlEnumAttribute.uex' path='docs/doc[@for="XmlEnumAttribute.Name"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlIgnoreAttribute.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlIgnoreAttribute.cs
index e4985292a6..fa2b00864f 100644
--- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlIgnoreAttribute.cs
+++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlIgnoreAttribute.cs
@@ -7,14 +7,12 @@ using System;
namespace System.Xml.Serialization
{
- /// <include file='doc\XmlIgnoreAttribute.uex' path='docs/doc[@for="XmlIgnoreAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
public class XmlIgnoreAttribute : System.Attribute
{
- /// <include file='doc\XmlIgnoreAttribute.uex' path='docs/doc[@for="XmlIgnoreAttribute.XmlIgnoreAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlIncludeAttribute.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlIncludeAttribute.cs
index be789cad54..11d43c2899 100644
--- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlIncludeAttribute.cs
+++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlIncludeAttribute.cs
@@ -7,7 +7,6 @@ using System;
namespace System.Xml.Serialization
{
- /// <include file='doc\XmlIncludeAttribute.uex' path='docs/doc[@for="XmlIncludeAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -16,7 +15,6 @@ namespace System.Xml.Serialization
{
private Type _type;
- /// <include file='doc\XmlIncludeAttribute.uex' path='docs/doc[@for="XmlIncludeAttribute.XmlIncludeAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -25,7 +23,6 @@ namespace System.Xml.Serialization
_type = type;
}
- /// <include file='doc\XmlIncludeAttribute.uex' path='docs/doc[@for="XmlIncludeAttribute.Type"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlMembersMapping.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlMembersMapping.cs
index bcdc70d543..d9ba799d2d 100644
--- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlMembersMapping.cs
+++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlMembersMapping.cs
@@ -9,7 +9,6 @@ using System.Text;
namespace System.Xml.Serialization
{
- /// <include file='doc\XmlMembersMapping.uex' path='docs/doc[@for="XmlMembersMapping"]/*' />
///<internalonly/>
/// <devdoc>
/// <para>[To be supplied.]</para>
@@ -36,7 +35,6 @@ namespace System.Xml.Serialization
SetKeyInternal(key.ToString());
}
- /// <include file='doc\XmlMembersMapping.uex' path='docs/doc[@for="XmlMembersMapping.TypeName"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -45,7 +43,6 @@ namespace System.Xml.Serialization
get { return Accessor.Mapping.TypeName; }
}
- /// <include file='doc\XmlMembersMapping.uex' path='docs/doc[@for="XmlMembersMapping.TypeNamespace"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -54,7 +51,6 @@ namespace System.Xml.Serialization
get { return Accessor.Mapping.Namespace; }
}
- /// <include file='doc\XmlMembersMapping.uex' path='docs/doc[@for="XmlMembersMapping.this"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -63,7 +59,6 @@ namespace System.Xml.Serialization
get { return _mappings[index]; }
}
- /// <include file='doc\XmlMembersMapping.uex' path='docs/doc[@for="XmlMembersMapping.Count"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlNamespaceDeclarationsAttribute.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlNamespaceDeclarationsAttribute.cs
index ac7312cc1a..dc71e2d7d8 100644
--- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlNamespaceDeclarationsAttribute.cs
+++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlNamespaceDeclarationsAttribute.cs
@@ -8,14 +8,12 @@ using System.Xml.Schema;
namespace System.Xml.Serialization
{
- /// <include file='doc\XmlNamespaceDeclarationsAttribute.uex' path='docs/doc[@for="XmlNamespaceDeclarationsAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = false)]
public class XmlNamespaceDeclarationsAttribute : System.Attribute
{
- /// <include file='doc\XmlNamespaceDeclarationsAttribute.uex' path='docs/doc[@for="XmlNamespaceDeclarationsAttribute.XmlNamespaceDeclarationsAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlRootAttribute.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlRootAttribute.cs
index 19120d3906..a6eb22cfdd 100644
--- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlRootAttribute.cs
+++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlRootAttribute.cs
@@ -12,7 +12,6 @@ using System.Xml.Schema;
namespace System.Xml.Serialization
{
- /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -25,7 +24,6 @@ namespace System.Xml.Serialization
private bool _nullable = true;
private bool _nullableSpecified;
- /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute.XmlRootAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -33,7 +31,6 @@ namespace System.Xml.Serialization
{
}
- /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute.XmlRootAttribute1"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -42,7 +39,6 @@ namespace System.Xml.Serialization
_elementName = elementName;
}
- /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute.ElementName"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -52,7 +48,6 @@ namespace System.Xml.Serialization
set { _elementName = value; }
}
- /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute.Namespace"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -62,7 +57,6 @@ namespace System.Xml.Serialization
set { _ns = value; }
}
- /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute.DataType"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -72,7 +66,6 @@ namespace System.Xml.Serialization
set { _dataType = value; }
}
- /// <include file='doc\XmlRootAttribute.uex' path='docs/doc[@for="XmlRootAttribute.IsNullable"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlTextAttribute.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlTextAttribute.cs
index 4aa453f6bb..a3b4064df1 100644
--- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlTextAttribute.cs
+++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlTextAttribute.cs
@@ -7,7 +7,6 @@ using System;
namespace System.Xml.Serialization
{
- /// <include file='doc\XmlTextAttribute.uex' path='docs/doc[@for="XmlTextAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -17,7 +16,6 @@ namespace System.Xml.Serialization
private Type _type;
private string _dataType;
- /// <include file='doc\XmlTextAttribute.uex' path='docs/doc[@for="XmlTextAttribute.XmlTextAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -25,7 +23,6 @@ namespace System.Xml.Serialization
{
}
- /// <include file='doc\XmlTextAttribute.uex' path='docs/doc[@for="XmlTextAttribute.XmlTextAttribute1"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -34,7 +31,6 @@ namespace System.Xml.Serialization
_type = type;
}
- /// <include file='doc\XmlTextAttribute.uex' path='docs/doc[@for="XmlTextAttribute.Type"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -44,7 +40,6 @@ namespace System.Xml.Serialization
set { _type = value; }
}
- /// <include file='doc\XmlTextAttribute.uex' path='docs/doc[@for="XmlTextAttribute.DataType"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlTypeAttribute.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlTypeAttribute.cs
index d413cc3ace..205b4ca4fb 100644
--- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlTypeAttribute.cs
+++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlTypeAttribute.cs
@@ -7,7 +7,6 @@ using System;
namespace System.Xml.Serialization
{
- /// <include file='doc\XmlTypeAttribute.uex' path='docs/doc[@for="XmlTypeAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -19,7 +18,6 @@ namespace System.Xml.Serialization
private string _ns;
private string _typeName;
- /// <include file='doc\XmlTypeAttribute.uex' path='docs/doc[@for="XmlTypeAttribute.XmlTypeAttribute"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -27,7 +25,6 @@ namespace System.Xml.Serialization
{
}
- /// <include file='doc\XmlTypeAttribute.uex' path='docs/doc[@for="XmlTypeAttribute.XmlTypeAttribute1"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -36,7 +33,6 @@ namespace System.Xml.Serialization
_typeName = typeName;
}
- /// <include file='doc\XmlTypeAttribute.uex' path='docs/doc[@for="XmlTypeAttribute.AnonymousType"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -46,7 +42,6 @@ namespace System.Xml.Serialization
set { _anonymousType = value; }
}
- /// <include file='doc\XmlTypeAttribute.uex' path='docs/doc[@for="XmlTypeAttribute.IncludeInSchema"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -56,7 +51,6 @@ namespace System.Xml.Serialization
set { _includeInSchema = value; }
}
- /// <include file='doc\XmlTypeAttribute.uex' path='docs/doc[@for="XmlTypeAttribute.TypeName"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -66,7 +60,6 @@ namespace System.Xml.Serialization
set { _typeName = value; }
}
- /// <include file='doc\XmlTypeAttribute.uex' path='docs/doc[@for="XmlTypeAttribute.Namespace"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/src/System.Private.Xml/src/System/Xml/Serialization/XmlTypeMapping.cs b/src/System.Private.Xml/src/System/Xml/Serialization/XmlTypeMapping.cs
index 1d700f654b..ead21258e2 100644
--- a/src/System.Private.Xml/src/System/Xml/Serialization/XmlTypeMapping.cs
+++ b/src/System.Private.Xml/src/System/Xml/Serialization/XmlTypeMapping.cs
@@ -8,7 +8,6 @@ using System;
namespace System.Xml.Serialization
{
- /// <include file='doc\XmlTypeMapping.uex' path='docs/doc[@for="XmlTypeMapping"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -23,7 +22,6 @@ namespace System.Xml.Serialization
get { return Accessor.Mapping; }
}
- /// <include file='doc\XmlTypeMapping.uex' path='docs/doc[@for="XmlTypeMapping.TypeName"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -35,7 +33,6 @@ namespace System.Xml.Serialization
}
}
- /// <include file='doc\XmlTypeMapping.uex' path='docs/doc[@for="XmlTypeMapping.TypeFullName"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -47,7 +44,6 @@ namespace System.Xml.Serialization
}
}
- /// <include file='doc\XmlTypeMapping.uex' path='docs/doc[@for="XmlTypeMapping.XsdTypeName"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
@@ -59,7 +55,6 @@ namespace System.Xml.Serialization
}
}
- /// <include file='doc\XmlTypeMapping.uex' path='docs/doc[@for="XmlTypeMapping.XsdTypeNamespace"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/src/System.Private.Xml/src/System/Xml/XmlNameTable.cs b/src/System.Private.Xml/src/System/Xml/XmlNameTable.cs
index fa376333cb..75fd584a46 100644
--- a/src/System.Private.Xml/src/System/Xml/XmlNameTable.cs
+++ b/src/System.Private.Xml/src/System/Xml/XmlNameTable.cs
@@ -4,7 +4,6 @@
namespace System.Xml
{
- /// <include file='doc\XmlNameTable.uex' path='docs/doc[@for="XmlNameTable"]/*' />
/// <devdoc>
/// <para> Table of atomized string objects. This provides an
/// efficient means for the XML parser to use the same string object for all
@@ -14,14 +13,12 @@ namespace System.Xml
/// </devdoc>
public abstract class XmlNameTable
{
- /// <include file='doc\XmlNameTable.uex' path='docs/doc[@for="XmlNameTable.Get"]/*' />
/// <devdoc>
/// <para>Gets the atomized String object containing the same
/// chars as the specified range of chars in the given char array.</para>
/// </devdoc>
public abstract String Get(char[] array, int offset, int length);
- /// <include file='doc\XmlNameTable.uex' path='docs/doc[@for="XmlNameTable.Get1"]/*' />
/// <devdoc>
/// <para>
/// Gets the atomized String object containing the same
@@ -30,14 +27,12 @@ namespace System.Xml
/// </devdoc>
public abstract String Get(String array);
- /// <include file='doc\XmlNameTable.uex' path='docs/doc[@for="XmlNameTable.Add"]/*' />
/// <devdoc>
/// <para>Creates a new atom for the characters at the specified range
/// of characters in the specified string.</para>
/// </devdoc>
public abstract String Add(char[] array, int offset, int length);
- /// <include file='doc\XmlNameTable.uex' path='docs/doc[@for="XmlNameTable.Add1"]/*' />
/// <devdoc>
/// <para>
/// Creates a new atom for the specified string.
diff --git a/src/System.Private.Xml/src/System/Xml/XmlNamespaceScope.cs b/src/System.Private.Xml/src/System/Xml/XmlNamespaceScope.cs
index 79a29fc01e..e1ef27e99c 100644
--- a/src/System.Private.Xml/src/System/Xml/XmlNamespaceScope.cs
+++ b/src/System.Private.Xml/src/System/Xml/XmlNamespaceScope.cs
@@ -4,25 +4,21 @@
namespace System.Xml
{
- /// <include file='doc\XmlNamespaceScope.uex' path='docs/doc[@for="XmlNamespaceScope"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public enum XmlNamespaceScope
{
- /// <include file='doc\XmlNamespaceScope.uex' path='docs/doc[@for="XmlNamespaceScope.All"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
All,
- /// <include file='doc\XmlNamespaceScope.uex' path='docs/doc[@for="XmlNamespaceScope.ExcludeXml"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
ExcludeXml,
- /// <include file='doc\XmlNamespaceScope.uex' path='docs/doc[@for="XmlNamespaceScope.Local"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/src/System.Private.Xml/src/System/Xml/XmlNodeOrder.cs b/src/System.Private.Xml/src/System/Xml/XmlNodeOrder.cs
index f7f2a5795e..89b802a604 100644
--- a/src/System.Private.Xml/src/System/Xml/XmlNodeOrder.cs
+++ b/src/System.Private.Xml/src/System/Xml/XmlNodeOrder.cs
@@ -4,16 +4,11 @@
namespace System.Xml
{
- /// <include file='doc\XmlNodeOrder.uex' path='docs/doc[@for="XmlNodeOrder"]/*' />
public enum XmlNodeOrder
{
- /// <include file='doc\XmlNodeOrder.uex' path='docs/doc[@for="XmlNodeOrder.Before"]/*' />
Before,
- /// <include file='doc\XmlNodeOrder.uex' path='docs/doc[@for="XmlNodeOrder.After"]/*' />
After,
- /// <include file='doc\XmlNodeOrder.uex' path='docs/doc[@for="XmlNodeOrder.Same"]/*' />
Same,
- /// <include file='doc\XmlNodeOrder.uex' path='docs/doc[@for="XmlNodeOrder.Unknown"]/*' />
Unknown
}
}
diff --git a/src/System.Private.Xml/src/System/Xml/XmlNodeType.cs b/src/System.Private.Xml/src/System/Xml/XmlNodeType.cs
index 4717abb5bd..1bd324dc02 100644
--- a/src/System.Private.Xml/src/System/Xml/XmlNodeType.cs
+++ b/src/System.Private.Xml/src/System/Xml/XmlNodeType.cs
@@ -4,19 +4,16 @@
namespace System.Xml
{
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType"]/*' />
/// <devdoc>
/// Specifies the type of node.
/// </devdoc>
public enum XmlNodeType
{
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType.None"]/*' />
/// <devdoc>
/// For XPathNavigator, cursor is not positioned
/// on a node.
/// </devdoc>
None,
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType.Element"]/*' />
/// <devdoc>
/// <para>
/// An Element.
@@ -30,7 +27,6 @@ namespace System.Xml
/// DocumentFragment, EntityReference, and Element nodes.
/// </devdoc>
Element,
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType.Attribute"]/*' />
/// <devdoc>
/// <para>
/// An
@@ -46,7 +42,6 @@ namespace System.Xml
/// </para>
/// </devdoc>
Attribute,
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType.Text"]/*' />
/// <devdoc>
/// <para>
/// The
@@ -59,7 +54,6 @@ namespace System.Xml
/// </para>
/// </devdoc>
Text,
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType.CDATA"]/*' />
/// <devdoc>
/// A CDATA section.
/// Example XML: &lt;![CDATA[my escaped text]]&gt;
@@ -69,7 +63,6 @@ namespace System.Xml
/// EntityReference, and Element nodes.
/// </devdoc>
CDATA,
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType.EntityReference"]/*' />
/// <devdoc>
/// <para>A reference to an entity.</para>
/// <para>Example XML: &amp;foo;</para>
@@ -80,7 +73,6 @@ namespace System.Xml
/// Element, and EntityReference nodes.</para>
/// </devdoc>
EntityReference,
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType.Entity"]/*' />
/// <devdoc>
/// <para>An entity declaration.</para>
/// <para>Example XML: &lt;!ENTITY ...&gt;</para>
@@ -89,7 +81,6 @@ namespace System.Xml
/// child of the DocumentType node.</para>
/// </devdoc>
Entity,
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType.ProcessingInstruction"]/*' />
/// <devdoc>
/// <para>
/// A processing instruction (PI).
@@ -104,7 +95,6 @@ namespace System.Xml
/// </para>
/// </devdoc>
ProcessingInstruction,
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType.Comment"]/*' />
/// <devdoc>
/// <para>
/// A Comment.
@@ -119,7 +109,6 @@ namespace System.Xml
/// </para>
/// </devdoc>
Comment,
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType.Document"]/*' />
/// <devdoc>
/// <para>
/// A document object, which, as the root of the document tree, provides access
@@ -132,7 +121,6 @@ namespace System.Xml
/// </para>
/// </devdoc>
Document,
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType.DocumentType"]/*' />
/// <devdoc>
/// <para>
/// The document type declaration, indicated by the &lt;!DOCTYPE&gt; tag.
@@ -146,7 +134,6 @@ namespace System.Xml
/// </para>
/// </devdoc>
DocumentType,
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType.DocumentFragment"]/*' />
/// <devdoc>
/// <para>
/// A document fragment.
@@ -160,7 +147,6 @@ namespace System.Xml
/// </para>
/// </devdoc>
DocumentFragment,
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType.Notation"]/*' />
/// <devdoc>
/// <para>
/// A notation in the document type declaration.
@@ -174,34 +160,29 @@ namespace System.Xml
/// </para>
/// </devdoc>
Notation,
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType.Whitespace"]/*' />
/// <devdoc>
/// <para>
/// Whitespace between markup.
/// </para>
/// </devdoc>
Whitespace,
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType.SignificantWhitespace"]/*' />
/// <devdoc>
/// <para>
/// Whitespace between markup in a mixed content model.
/// </para>
/// </devdoc>
SignificantWhitespace,
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType.EndElement"]/*' />
/// <devdoc>
/// <para>Returned when XmlReader gets to the end of an element.</para>
/// <para>Example XML: &lt;/foo&gt;</para>
/// </devdoc>
EndElement,
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType.EndEntity"]/*' />
/// <devdoc>
/// <para>Returned when XmlReader gets to the end of the entity
/// replacement as a result of a call to <see cref='System.Xml.XmlReader.ResolveEntity'/>
/// .</para>
/// </devdoc>
EndEntity,
- /// <include file='doc\XmlNodeType.uex' path='docs/doc[@for="XmlNodeType.XmlDeclaration"]/*' />
/// <devdoc>
/// <para>
/// The XML declaration node..
diff --git a/src/System.Reflection.Context/dir.props b/src/System.Reflection.Context/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Reflection.Context/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Reflection.Context/pkg/System.Reflection.Context.pkgproj b/src/System.Reflection.Context/pkg/System.Reflection.Context.pkgproj
index 4b5415d0ae..0e8d693cf0 100644
--- a/src/System.Reflection.Context/pkg/System.Reflection.Context.pkgproj
+++ b/src/System.Reflection.Context/pkg/System.Reflection.Context.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Reflection.Context.csproj">
diff --git a/src/System.Reflection.Context/pkg/ValidationSuppression.txt b/src/System.Reflection.Context/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Reflection.Context/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Reflection.Context/ref/System.Reflection.Context.csproj b/src/System.Reflection.Context/ref/System.Reflection.Context.csproj
index d5b151f99f..0e47be35c8 100644
--- a/src/System.Reflection.Context/ref/System.Reflection.Context.csproj
+++ b/src/System.Reflection.Context/ref/System.Reflection.Context.csproj
@@ -5,7 +5,6 @@
<UseECMAKey Condition="'$(UseECMAKey)' == ''">true</UseECMAKey>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Reflection.Context/src/System.Reflection.Context.csproj b/src/System.Reflection.Context/src/System.Reflection.Context.csproj
index 2bfe58c379..f98aab3f76 100644
--- a/src/System.Reflection.Context/src/System.Reflection.Context.csproj
+++ b/src/System.Reflection.Context/src/System.Reflection.Context.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<UseECMAKey Condition="'$(UseECMAKey)' == ''">true</UseECMAKey>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
<ProjectGuid>{404DB891-B5AF-41E6-B89D-29E3F4573C4F}</ProjectGuid>
<!-- only supported by desktop CLR -->
diff --git a/src/System.Reflection.DispatchProxy/dir.props b/src/System.Reflection.DispatchProxy/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Reflection.DispatchProxy/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Reflection.DispatchProxy/ref/System.Reflection.DispatchProxy.csproj b/src/System.Reflection.DispatchProxy/ref/System.Reflection.DispatchProxy.csproj
index c2d03c11f6..0183c9fa89 100644
--- a/src/System.Reflection.DispatchProxy/ref/System.Reflection.DispatchProxy.csproj
+++ b/src/System.Reflection.DispatchProxy/ref/System.Reflection.DispatchProxy.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<ProjectGuid>{7DF3C428-AAD6-41C7-98E6-6CACFD5C391E}</ProjectGuid>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Reflection.DispatchProxy/src/System.Reflection.DispatchProxy.csproj b/src/System.Reflection.DispatchProxy/src/System.Reflection.DispatchProxy.csproj
index 3905f72f9d..8335477b19 100644
--- a/src/System.Reflection.DispatchProxy/src/System.Reflection.DispatchProxy.csproj
+++ b/src/System.Reflection.DispatchProxy/src/System.Reflection.DispatchProxy.csproj
@@ -4,11 +4,9 @@
<PropertyGroup>
<ProjectGuid>{1E689C1B-690C-4799-BDE9-6E7990585894}</ProjectGuid>
<AssemblyName>System.Reflection.DispatchProxy</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'netcore50aot'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'netcore50aot'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Reflection.Emit.ILGeneration/dir.props b/src/System.Reflection.Emit.ILGeneration/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Reflection.Emit.ILGeneration/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Reflection.Emit.ILGeneration/pkg/System.Reflection.Emit.ILGeneration.pkgproj b/src/System.Reflection.Emit.ILGeneration/pkg/System.Reflection.Emit.ILGeneration.pkgproj
index 6552140e67..710a314d64 100644
--- a/src/System.Reflection.Emit.ILGeneration/pkg/System.Reflection.Emit.ILGeneration.pkgproj
+++ b/src/System.Reflection.Emit.ILGeneration/pkg/System.Reflection.Emit.ILGeneration.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Reflection.Emit.ILGeneration.csproj">
@@ -20,5 +17,11 @@
<TargetPath>runtimes/aot/lib/netcore50</TargetPath>
</File>
</ItemGroup>
+ <ItemGroup>
+ <!-- This package is only supported for CoreCLR RIDs for UWP -->
+ <ValidatePackageSuppression Include="PermitImplementation">
+ <Value>.NETCore,Version=v5.0/win10-x86;.NETCore,Version=v5.0/win10-x64;.NETCore,Version=v5.0/win10-arm;UAP,Version=v10.0/win10-x86;UAP,Version=v10.0/win10-x64;UAP,Version=v10.0/win10-arm;UAP,Version=v10.1/win10-x86;UAP,Version=v10.1/win10-x64;UAP,Version=v10.1/win10-arm</Value>
+ </ValidatePackageSuppression>
+ </ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project> \ No newline at end of file
diff --git a/src/System.Reflection.Emit.ILGeneration/pkg/ValidationSuppression.txt b/src/System.Reflection.Emit.ILGeneration/pkg/ValidationSuppression.txt
deleted file mode 100644
index cf5e82cd09..0000000000
--- a/src/System.Reflection.Emit.ILGeneration/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-PermitImplementation=.NETCore,Version=v5.0/win10-x86;.NETCore,Version=v5.0/win10-x64;.NETCore,Version=v5.0/win10-arm;UAP,Version=v10.0/win10-x86;UAP,Version=v10.0/win10-x64;UAP,Version=v10.0/win10-arm;UAP,Version=v10.1/win10-x86;UAP,Version=v10.1/win10-x64;UAP,Version=v10.1/win10-arm
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Reflection.Emit.ILGeneration/ref/System.Reflection.Emit.ILGeneration.csproj b/src/System.Reflection.Emit.ILGeneration/ref/System.Reflection.Emit.ILGeneration.csproj
index 5d256b0268..45988796ef 100644
--- a/src/System.Reflection.Emit.ILGeneration/ref/System.Reflection.Emit.ILGeneration.csproj
+++ b/src/System.Reflection.Emit.ILGeneration/ref/System.Reflection.Emit.ILGeneration.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Reflection.Emit.ILGeneration/src/System.Reflection.Emit.ILGeneration.csproj b/src/System.Reflection.Emit.ILGeneration/src/System.Reflection.Emit.ILGeneration.csproj
index 6e848af91e..bcbfd3575b 100644
--- a/src/System.Reflection.Emit.ILGeneration/src/System.Reflection.Emit.ILGeneration.csproj
+++ b/src/System.Reflection.Emit.ILGeneration/src/System.Reflection.Emit.ILGeneration.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Reflection.Emit.ILGeneration</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Reflection.Emit.Lightweight/dir.props b/src/System.Reflection.Emit.Lightweight/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Reflection.Emit.Lightweight/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Reflection.Emit.Lightweight/pkg/System.Reflection.Emit.Lightweight.pkgproj b/src/System.Reflection.Emit.Lightweight/pkg/System.Reflection.Emit.Lightweight.pkgproj
index 930062f817..fc3ef30fcd 100644
--- a/src/System.Reflection.Emit.Lightweight/pkg/System.Reflection.Emit.Lightweight.pkgproj
+++ b/src/System.Reflection.Emit.Lightweight/pkg/System.Reflection.Emit.Lightweight.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Reflection.Emit.Lightweight.csproj">
@@ -25,5 +22,11 @@
<TargetPath>runtimes/aot/lib/netcore50</TargetPath>
</File>
</ItemGroup>
+ <ItemGroup>
+ <!-- This package is only supported for CoreCLR RIDs for UWP -->
+ <ValidatePackageSuppression Include="PermitImplementation">
+ <Value>.NETCore,Version=v5.0/win10-x86;.NETCore,Version=v5.0/win10-x64;.NETCore,Version=v5.0/win10-arm;UAP,Version=v10.0/win10-x86;UAP,Version=v10.0/win10-x64;UAP,Version=v10.0/win10-arm;UAP,Version=v10.1/win10-x86;UAP,Version=v10.1/win10-x64;UAP,Version=v10.1/win10-arm</Value>
+ </ValidatePackageSuppression>
+ </ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project> \ No newline at end of file
diff --git a/src/System.Reflection.Emit.Lightweight/pkg/ValidationSuppression.txt b/src/System.Reflection.Emit.Lightweight/pkg/ValidationSuppression.txt
deleted file mode 100644
index cf5e82cd09..0000000000
--- a/src/System.Reflection.Emit.Lightweight/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-PermitImplementation=.NETCore,Version=v5.0/win10-x86;.NETCore,Version=v5.0/win10-x64;.NETCore,Version=v5.0/win10-arm;UAP,Version=v10.0/win10-x86;UAP,Version=v10.0/win10-x64;UAP,Version=v10.0/win10-arm;UAP,Version=v10.1/win10-x86;UAP,Version=v10.1/win10-x64;UAP,Version=v10.1/win10-arm
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Reflection.Emit.Lightweight/ref/System.Reflection.Emit.Lightweight.csproj b/src/System.Reflection.Emit.Lightweight/ref/System.Reflection.Emit.Lightweight.csproj
index ddbe4b858f..8b33172deb 100644
--- a/src/System.Reflection.Emit.Lightweight/ref/System.Reflection.Emit.Lightweight.csproj
+++ b/src/System.Reflection.Emit.Lightweight/ref/System.Reflection.Emit.Lightweight.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Reflection.Emit.Lightweight/src/System.Reflection.Emit.Lightweight.csproj b/src/System.Reflection.Emit.Lightweight/src/System.Reflection.Emit.Lightweight.csproj
index d2f6dc35c8..3f10534c11 100644
--- a/src/System.Reflection.Emit.Lightweight/src/System.Reflection.Emit.Lightweight.csproj
+++ b/src/System.Reflection.Emit.Lightweight/src/System.Reflection.Emit.Lightweight.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Reflection.Emit.Lightweight</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Reflection.Emit/dir.props b/src/System.Reflection.Emit/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Reflection.Emit/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Reflection.Emit/pkg/System.Reflection.Emit.pkgproj b/src/System.Reflection.Emit/pkg/System.Reflection.Emit.pkgproj
index 9f8775596e..1d37abd1b5 100644
--- a/src/System.Reflection.Emit/pkg/System.Reflection.Emit.pkgproj
+++ b/src/System.Reflection.Emit/pkg/System.Reflection.Emit.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Reflection.Emit.csproj">
diff --git a/src/System.Reflection.Emit/pkg/ValidationSuppression.txt b/src/System.Reflection.Emit/pkg/ValidationSuppression.txt
deleted file mode 100644
index bca0428041..0000000000
--- a/src/System.Reflection.Emit/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-PermitImplementation=.NETCore,Version=v5.0/win10-x86;.NETCore,Version=v5.0/win10-x64;.NETCore,Version=v5.0/win10-arm
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Reflection.Emit/ref/System.Reflection.Emit.csproj b/src/System.Reflection.Emit/ref/System.Reflection.Emit.csproj
index d313ac4a61..605b3dd80c 100644
--- a/src/System.Reflection.Emit/ref/System.Reflection.Emit.csproj
+++ b/src/System.Reflection.Emit/ref/System.Reflection.Emit.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Reflection.Emit/src/System.Reflection.Emit.csproj b/src/System.Reflection.Emit/src/System.Reflection.Emit.csproj
index 38e791dd0e..822e586afa 100644
--- a/src/System.Reflection.Emit/src/System.Reflection.Emit.csproj
+++ b/src/System.Reflection.Emit/src/System.Reflection.Emit.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Reflection.Emit</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Reflection.Emit/tests/AssemblyBuilderTests.cs b/src/System.Reflection.Emit/tests/AssemblyBuilderTests.cs
index b78f6c71b0..e1428b8cb3 100644
--- a/src/System.Reflection.Emit/tests/AssemblyBuilderTests.cs
+++ b/src/System.Reflection.Emit/tests/AssemblyBuilderTests.cs
@@ -24,22 +24,98 @@ namespace System.Reflection.Emit.Tests
public class AssemblyTests
{
+ public static IEnumerable<object[]> DefineDynamicAssembly_TestData()
+ {
+ foreach (AssemblyBuilderAccess access in new AssemblyBuilderAccess[] { AssemblyBuilderAccess.Run, AssemblyBuilderAccess.RunAndCollect })
+ {
+ yield return new object[] { new AssemblyName("TestName") { Version = new Version(0, 0, 0, 0) }, access };
+ yield return new object[] { new AssemblyName("testname") { Version = new Version(1, 2, 3, 4) }, access };
+ yield return new object[] { new AssemblyName("class") { Version = new Version(0, 0, 0, 0) }, access };
+ yield return new object[] { new AssemblyName("\uD800\uDC00") { Version = new Version(0, 0, 0, 0) }, access };
+ }
+ }
+
+ [Theory]
+ [MemberData(nameof(DefineDynamicAssembly_TestData))]
+ public void DefineDynamicAssembly_AssemblyName_AssemblyBuilderAccess(AssemblyName name, AssemblyBuilderAccess access)
+ {
+ AssemblyBuilder assembly = AssemblyBuilder.DefineDynamicAssembly(name, access);
+ VerifyAssemblyBuilder(assembly, name, new CustomAttributeBuilder[0]);
+ }
+
+ public static IEnumerable<object[]> DefineDynamicAssembly_CustomAttributes_TestData()
+ {
+ foreach (object[] data in DefineDynamicAssembly_TestData())
+ {
+ yield return new object[] { data[0], data[1], null };
+ yield return new object[] { data[0], data[1], new CustomAttributeBuilder[0] };
+
+ ConstructorInfo constructor = typeof(IntClassAttribute).GetConstructor(new Type[] { typeof(int) });
+ yield return new object[] { data[0], data[1], new CustomAttributeBuilder[] { new CustomAttributeBuilder(constructor, new object[] { 10 }) } };
+ }
+ }
+
+ [Theory]
+ [MemberData(nameof(DefineDynamicAssembly_CustomAttributes_TestData))]
+ public void DefineDynamicAssembly_AssemblyName_AssemblyBuilderAccess_CustomAttributeBuilder(AssemblyName name, AssemblyBuilderAccess access, IEnumerable<CustomAttributeBuilder> attributes)
+ {
+ AssemblyBuilder assembly = AssemblyBuilder.DefineDynamicAssembly(name, access, attributes);
+ VerifyAssemblyBuilder(assembly, name, attributes);
+ }
+
[Fact]
- public void DefineDynamicModule()
+ public void DefineDynamicAssembly_NullName_ThrowsArgumentNullException()
{
- AssemblyBuilder assembly = Helpers.DynamicAssembly();
- ModuleBuilder module = assembly.DefineDynamicModule("Module1");
- TypeBuilder type = module.DefineType("HelloWorld", TypeAttributes.Public);
- ConstructorBuilder constructor = type.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, new Type[0]);
- ILGenerator ilGenerator = constructor.GetILGenerator();
- ilGenerator.Emit(OpCodes.Ldarg_1);
+ Assert.Throws<ArgumentNullException>("name", () => AssemblyBuilder.DefineDynamicAssembly(null, AssemblyBuilderAccess.Run));
+ Assert.Throws<ArgumentNullException>("name", () => AssemblyBuilder.DefineDynamicAssembly(null, AssemblyBuilderAccess.Run, new CustomAttributeBuilder[0]));
+ }
+
+ [Theory]
+ [InlineData((AssemblyBuilderAccess)0)] // No such case
+ [InlineData((AssemblyBuilderAccess)10)] // No such case
+ [InlineData((AssemblyBuilderAccess)2)] // Save (not supported)
+ [InlineData((AssemblyBuilderAccess)2 | AssemblyBuilderAccess.Run)] // RunAndSave (not supported)
+ [InlineData((AssemblyBuilderAccess)6)] // ReflectionOnly (not supported)
+ public void DefineDynamicAssembly_InvalidAccess_ThrowsArgumentException(AssemblyBuilderAccess access)
+ {
+ Assert.Throws<ArgumentException>("access", () => AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Name"), access));
+ Assert.Throws<ArgumentException>("access", () => AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Name"), access, new CustomAttributeBuilder[0]));
}
[Fact]
- public void DefineDynamicModule_LargeName()
+ public void DefineDynamicAssembly_NameIsCopy()
+ {
+ AssemblyName name = new AssemblyName("Name") { Version = new Version(0, 0, 0, 0) };
+ AssemblyBuilder assembly = AssemblyBuilder.DefineDynamicAssembly(name, AssemblyBuilderAccess.Run);
+ Assert.Equal(name.ToString(), assembly.FullName);
+
+ name.Name = "NewName";
+ Assert.NotEqual(name.ToString(), assembly.FullName);
+ }
+
+ public static IEnumerable<object[]> DefineDynamicModule_TestData()
+ {
+ yield return new object[] { "Module" };
+ yield return new object[] { "module" };
+ yield return new object[] { "class" };
+ yield return new object[] { "\uD800\uDC00" };
+ yield return new object[] { new string('a', 259) };
+ }
+
+ [Theory]
+ [MemberData(nameof(DefineDynamicModule_TestData))]
+ public void DefineDynamicModule(string name)
{
AssemblyBuilder assembly = Helpers.DynamicAssembly();
- ModuleBuilder module = assembly.DefineDynamicModule(new string('a', 259));
+ ModuleBuilder module = assembly.DefineDynamicModule(name);
+
+ Assert.Same(assembly, module.Assembly);
+ Assert.Empty(module.CustomAttributes);
+
+ Assert.Equal("<In Memory Module>", module.Name);
+ Assert.Equal("RefEmit_InMemoryManifestModule", module.FullyQualifiedName);
+
+ Assert.Same(module, assembly.GetDynamicModule(module.FullyQualifiedName));
}
[Theory]
@@ -57,7 +133,7 @@ namespace System.Reflection.Emit.Tests
{
AssemblyBuilder assembly = Helpers.DynamicAssembly();
ModuleBuilder mb = assembly.DefineDynamicModule("module1");
- Assert.Throws<InvalidOperationException>(() => { ModuleBuilder mb2 = assembly.DefineDynamicModule("module2"); });
+ Assert.Throws<InvalidOperationException>(() => assembly.DefineDynamicModule("module2"));
}
[Fact]
@@ -74,13 +150,48 @@ namespace System.Reflection.Emit.Tests
Assert.Throws<NotSupportedException>(() => assembly.GetManifestResourceStream(""));
}
+ [Fact]
+ public void GetManifestResourceInfo_ThrowsNotSupportedException()
+ {
+ AssemblyBuilder assembly = Helpers.DynamicAssembly();
+ Assert.Throws<NotSupportedException>(() => assembly.GetManifestResourceInfo(""));
+ }
[Fact]
- public void SetCustomAttribute_ConstructorBuidler_ByteArray()
+ public void ExportedTypes_ThrowsNotSupportedException()
{
- AssemblyBuilder assembly = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("PT1"), AssemblyBuilderAccess.Run);
+ AssemblyBuilder assembly = Helpers.DynamicAssembly();
+ Assert.Throws<NotSupportedException>(() => assembly.ExportedTypes);
+ Assert.Throws<NotSupportedException>(() => assembly.GetExportedTypes());
+ }
+
+ [Theory]
+ [InlineData("testmodule")]
+ [InlineData("\0test")]
+ public void GetDynamicModule_NoSuchModule_ReturnsNull(string name)
+ {
+ AssemblyBuilder assembly = Helpers.DynamicAssembly();
+ assembly.DefineDynamicModule("TestModule");
+
+ Assert.Null(assembly.GetDynamicModule(name));
+ }
+
+ [Fact]
+ public void GetDynamicModule_InvalidName_ThrowsArgumentException()
+ {
+ AssemblyBuilder assembly = Helpers.DynamicAssembly();
+ Assert.Throws<ArgumentNullException>("name", () => assembly.GetDynamicModule(null));
+ Assert.Throws<ArgumentException>("name", () => assembly.GetDynamicModule(""));
+ }
+
+ [Theory]
+ [InlineData(AssemblyBuilderAccess.Run)]
+ [InlineData(AssemblyBuilderAccess.RunAndCollect)]
+ public void SetCustomAttribute_ConstructorBuidler_ByteArray(AssemblyBuilderAccess access)
+ {
+ AssemblyBuilder assembly = Helpers.DynamicAssembly(access: access);
ConstructorInfo constructor = typeof(BoolAllAttribute).GetConstructor(new Type[] { typeof(bool) });
- assembly.SetCustomAttribute(constructor, new byte[] { 01, 00, 01 });
+ assembly.SetCustomAttribute(constructor, new byte[] { 1, 0, 1 });
IEnumerable<Attribute> attributes = assembly.GetCustomAttributes();
Assert.IsType<BoolAllAttribute>(attributes.First());
@@ -89,7 +200,7 @@ namespace System.Reflection.Emit.Tests
[Fact]
public void SetCustomAttribute_ConstructorBuidler_ByteArray_NullConstructorBuilder_ThrowsArgumentNullException()
{
- AssemblyBuilder assembly = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("NT1"), AssemblyBuilderAccess.Run);
+ AssemblyBuilder assembly = Helpers.DynamicAssembly();
Assert.Throws<ArgumentNullException>("con", () => assembly.SetCustomAttribute(null, new byte[0]));
}
@@ -97,14 +208,16 @@ namespace System.Reflection.Emit.Tests
public void SetCustomAttribute_ConstructorBuidler_ByteArray_NullByteArray_ThrowsArgumentNullException()
{
AssemblyBuilder assembly = Helpers.DynamicAssembly();
- ConstructorInfo constructor = typeof(DateTime).GetConstructor(new Type[0]);
- Assert.Throws<ArgumentNullException>("con", () => assembly.SetCustomAttribute(constructor, null));
+ ConstructorInfo constructor = typeof(IntAllAttribute).GetConstructor(new Type[] { typeof(int) });
+ Assert.Throws<ArgumentNullException>("binaryAttribute", () => assembly.SetCustomAttribute(constructor, null));
}
- [Fact]
- public void SetCustomAttribute_CustomAttributeBuilder()
+ [Theory]
+ [InlineData(AssemblyBuilderAccess.Run)]
+ [InlineData(AssemblyBuilderAccess.RunAndCollect)]
+ public void SetCustomAttribute_CustomAttributeBuilder(AssemblyBuilderAccess access)
{
- AssemblyBuilder assembly = Helpers.DynamicAssembly();
+ AssemblyBuilder assembly = Helpers.DynamicAssembly(access: access);
ConstructorInfo constructor = typeof(IntClassAttribute).GetConstructor(new Type[] { typeof(int) });
CustomAttributeBuilder attributeBuilder = new CustomAttributeBuilder(constructor, new object[] { 5 });
assembly.SetCustomAttribute(attributeBuilder);
@@ -119,5 +232,46 @@ namespace System.Reflection.Emit.Tests
AssemblyBuilder assembly = Helpers.DynamicAssembly();
Assert.Throws<ArgumentNullException>("customBuilder", () => assembly.SetCustomAttribute(null));
}
+
+ public static IEnumerable<object[]> Equals_TestData()
+ {
+ AssemblyBuilder assembly = Helpers.DynamicAssembly(name: "Name1");
+ yield return new object[] { assembly, assembly, true };
+ yield return new object[] { assembly, Helpers.DynamicAssembly("Name1"), false };
+ yield return new object[] { assembly, Helpers.DynamicAssembly("Name2"), false };
+ yield return new object[] { assembly, Helpers.DynamicAssembly("Name1", access: AssemblyBuilderAccess.RunAndCollect), false };
+
+ yield return new object[] { assembly, new object(), false };
+ yield return new object[] { assembly, null, false };
+ }
+
+ [Theory]
+ [MemberData(nameof(Equals_TestData))]
+ public void Equals(AssemblyBuilder assembly, object obj, bool expected)
+ {
+ Assert.Equal(expected, assembly.Equals(obj));
+ if (obj is AssemblyBuilder)
+ {
+ Assert.Equal(expected, assembly.GetHashCode().Equals(obj.GetHashCode()));
+ }
+ }
+
+ public static void VerifyAssemblyBuilder(AssemblyBuilder assembly, AssemblyName name, IEnumerable<CustomAttributeBuilder> attributes)
+ {
+ Assert.Equal(name.ToString(), assembly.FullName);
+ Assert.Equal(name.ToString(), assembly.GetName().ToString());
+
+ Assert.True(assembly.IsDynamic);
+
+ Assert.Equal(attributes?.Count() ?? 0, assembly.CustomAttributes.Count());
+
+ Assert.Equal(1, assembly.Modules.Count());
+ Module module = assembly.Modules.First();
+ Assert.NotEmpty(module.Name);
+ Assert.Equal(assembly.Modules, assembly.GetModules());
+
+ Assert.Empty(assembly.DefinedTypes);
+ Assert.Empty(assembly.GetTypes());
+ }
}
}
diff --git a/src/System.Reflection.Emit/tests/ConstructorBuilder/ConstructorBuilderSetCustomAttribute.cs b/src/System.Reflection.Emit/tests/ConstructorBuilder/ConstructorBuilderSetCustomAttribute.cs
index 148420f96d..c22ea0e43a 100644
--- a/src/System.Reflection.Emit/tests/ConstructorBuilder/ConstructorBuilderSetCustomAttribute.cs
+++ b/src/System.Reflection.Emit/tests/ConstructorBuilder/ConstructorBuilderSetCustomAttribute.cs
@@ -16,15 +16,22 @@ namespace System.Reflection.Emit.Tests
ConstructorBuilder constructor = type.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, new Type[] { typeof(int) });
ConstructorInfo attributeConstructor = typeof(IntAllAttribute).GetConstructor(new Type[] { typeof(int) });
- constructor.SetCustomAttribute(attributeConstructor, new byte[] { 01, 00, 05, 00, 00, 00 });
+ constructor.SetCustomAttribute(attributeConstructor, new byte[] { 1, 0, 5, 0, 0, 0 });
+ constructor.GetILGenerator().Emit(OpCodes.Ret);
+
+ Type createdType = type.CreateTypeInfo().AsType();
+ ConstructorInfo createdConstructor = createdType.GetConstructor(new Type[] { typeof(int) });
+ Attribute[] attributes = createdConstructor.GetCustomAttributes().ToArray();
+ IntAllAttribute attribute = Assert.IsType<IntAllAttribute>(attributes[0]);
+ Assert.Equal(5, attribute._i);
}
[Fact]
public void SetCustomAttribute_ConstructorBuilder_ByteArray_NullConstructorBuilder_ThrowsArgumentNullException()
{
TypeBuilder type = Helpers.DynamicType(TypeAttributes.Public);
- ConstructorBuilder constructor = type.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, new Type[] { typeof(int) });
- Assert.Throws<ArgumentNullException>("con", () => constructor.SetCustomAttribute(null, new byte[] { 01, 00, 05, 00, 00, 00 }));
+ ConstructorBuilder constructor = type.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, new Type[0]);
+ Assert.Throws<ArgumentNullException>("con", () => constructor.SetCustomAttribute(null, new byte[0]));
}
[Fact]
@@ -35,8 +42,8 @@ namespace System.Reflection.Emit.Tests
ILGenerator ilGenerator = constructor.GetILGenerator();
ilGenerator.Emit(OpCodes.Ldarg_1);
- ConstructorInfo attributeConstructor = typeof(IntAllAttribute).GetConstructor(new Type[1] { typeof(int) });
- CustomAttributeBuilder attributeBuilder = new CustomAttributeBuilder(attributeConstructor, new object[1] { 2 });
+ ConstructorInfo attributeConstructor = typeof(IntAllAttribute).GetConstructor(new Type[] { typeof(int) });
+ CustomAttributeBuilder attributeBuilder = new CustomAttributeBuilder(attributeConstructor, new object[] { 2 });
constructor.SetCustomAttribute(attributeBuilder);
Type createdType = type.CreateTypeInfo().AsType();
@@ -58,5 +65,21 @@ namespace System.Reflection.Emit.Tests
Assert.Throws<ArgumentNullException>("customBuilder", () => constructor.SetCustomAttribute(null));
}
+
+ [Fact]
+ public void GetCustomAttributes_ThrowsNotSupportedException()
+ {
+ TypeBuilder type = Helpers.DynamicType(TypeAttributes.Public);
+ ConstructorBuilder constructor = type.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, new Type[0]);
+ Assert.Throws<NotSupportedException>(() => constructor.GetCustomAttributes());
+ }
+
+ [Fact]
+ public void IsDefined_ThrowsNotSupportedException()
+ {
+ TypeBuilder type = Helpers.DynamicType(TypeAttributes.Public);
+ ConstructorBuilder constructor = type.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, new Type[0]);
+ Assert.Throws<NotSupportedException>(() => constructor.IsDefined(typeof(IntAllAttribute)));
+ }
}
}
diff --git a/src/System.Reflection.Emit/tests/EnumBuilder/EnumBuilder.Methods.Tests.cs b/src/System.Reflection.Emit/tests/EnumBuilder/EnumBuilder.Methods.Tests.cs
index 970ebac13a..4333ea8634 100644
--- a/src/System.Reflection.Emit/tests/EnumBuilder/EnumBuilder.Methods.Tests.cs
+++ b/src/System.Reflection.Emit/tests/EnumBuilder/EnumBuilder.Methods.Tests.cs
@@ -21,6 +21,15 @@ namespace System.Reflection.Emit.Tests
}
[Fact]
+ public void IsAssignableFrom()
+ {
+ EnumBuilder enumBuilder = Helpers.DynamicEnum(TypeAttributes.Public, typeof(int));
+ Assert.False(enumBuilder.IsAssignableFrom(null));
+ Assert.True(enumBuilder.IsAssignableFrom(typeof(int).GetTypeInfo()));
+ Assert.False(enumBuilder.IsAssignableFrom(typeof(short).GetTypeInfo()));
+ }
+
+ [Fact]
public void GetElementType_ThrowsNotSupportedException()
{
EnumBuilder enumBuilder = Helpers.DynamicEnum(TypeAttributes.Public, typeof(int));
diff --git a/src/System.Reflection.Emit/tests/EnumBuilder/EnumBuilder.Properties.Tests.cs b/src/System.Reflection.Emit/tests/EnumBuilder/EnumBuilder.Properties.Tests.cs
index 8ef4dba21b..79fd603d7e 100644
--- a/src/System.Reflection.Emit/tests/EnumBuilder/EnumBuilder.Properties.Tests.cs
+++ b/src/System.Reflection.Emit/tests/EnumBuilder/EnumBuilder.Properties.Tests.cs
@@ -9,46 +9,6 @@ namespace System.Reflection.Emit.Tests
public class EnumBuilderPropertyTests
{
[Fact]
- public void Assembly()
- {
- AssemblyBuilder assembly = Helpers.DynamicAssembly();
- ModuleBuilder module = assembly.DefineDynamicModule("TestModule");
- EnumBuilder enumBuilder = module.DefineEnum("TestEnum", TypeAttributes.Public, typeof(int));
- Assert.Equal(assembly, enumBuilder.Assembly);
- }
-
- [Fact]
- public void AssemblyQualifiedName()
- {
- AssemblyBuilder assembly = Helpers.DynamicAssembly();
- ModuleBuilder module = assembly.DefineDynamicModule("TestModule");
- EnumBuilder enumBuilder = module.DefineEnum("TestEnum", TypeAttributes.Public, typeof(int));
- Assert.Equal("TestEnum, " + assembly.FullName, enumBuilder.AssemblyQualifiedName);
- }
-
- [Fact]
- public void BaseType()
- {
- EnumBuilder enumBuilder = Helpers.DynamicEnum(TypeAttributes.Public, typeof(int));
- Assert.Equal(typeof(Enum), enumBuilder.BaseType);
- }
-
- [Fact]
- public void DeclaringType()
- {
- EnumBuilder enumBuilder = Helpers.DynamicEnum(TypeAttributes.Public, typeof(int));
- Assert.Null(enumBuilder.DeclaringType);
- }
-
- [Fact]
- public void FullName()
- {
- EnumBuilder enumBuilder = Helpers.DynamicEnum(TypeAttributes.Public, typeof(int), enumName: "TestEnum");
- enumBuilder.AsType();
- Assert.Equal("TestEnum", enumBuilder.FullName);
- }
-
- [Fact]
public void Guid_TypeCreated()
{
EnumBuilder enumBuilder = Helpers.DynamicEnum(TypeAttributes.Public, typeof(int));
@@ -64,22 +24,6 @@ namespace System.Reflection.Emit.Tests
}
[Fact]
- public void Module()
- {
- ModuleBuilder module = Helpers.DynamicModule();
- EnumBuilder enumBuilder = module.DefineEnum("TestEnum", TypeAttributes.Public, typeof(int));
- Assert.Equal(module, enumBuilder.Module);
- }
-
- [Fact]
- public void Name()
- {
- EnumBuilder enumBuilder = Helpers.DynamicEnum(TypeAttributes.Public, typeof(int), enumName: "TestEnum");
- enumBuilder.AsType();
- Assert.Equal("TestEnum", enumBuilder.Name);
- }
-
- [Fact]
public void Namespace()
{
EnumBuilder enumBuilder = Helpers.DynamicEnum(TypeAttributes.Public, typeof(int));
@@ -94,12 +38,5 @@ namespace System.Reflection.Emit.Tests
enumBuilder.AsType();
Assert.Equal(typeof(int), enumBuilder.UnderlyingField.FieldType);
}
-
- [Fact]
- public void UnderlyingField_TypeNotCreated()
- {
- EnumBuilder enumBuilder = Helpers.DynamicEnum(TypeAttributes.Public, typeof(int));
- Assert.Equal(typeof(int), enumBuilder.UnderlyingField.FieldType);
- }
}
}
diff --git a/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs b/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs
index 9d97816eb5..1a2b0e53ab 100644
--- a/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs
+++ b/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs
@@ -12,22 +12,45 @@ namespace System.Reflection.Emit.Tests
private static Type[] s_builtInIntegerTypes = new Type[] { typeof(byte), typeof(sbyte), typeof(short), typeof(ushort),
typeof(int), typeof(uint), typeof(long), typeof(ulong) };
- [Theory]
- [MemberData(nameof(VisibilityAttributes), true)]
- public void DefineEnum_ValueType(TypeAttributes visibility)
+ public static IEnumerable<object[]> DefineEnum_TestData()
{
- foreach (Type integerType in s_builtInIntegerTypes)
+ foreach (string name in new string[] { "TestEnum", "testenum", "enum", "\uD800\uDC00", "a\0b\0c" })
{
- ModuleBuilder module = Helpers.DynamicModule();
- EnumBuilder enumBuilder = module.DefineEnum("MyEnum", visibility, integerType);
- Assert.True(enumBuilder.IsEnum);
- Assert.Equal("MyEnum", enumBuilder.FullName);
-
- enumBuilder.CreateTypeInfo().AsType();
+ foreach (object[] attributesData in VisibilityAttributes(true))
+ {
+ foreach (Type underlyingType in s_builtInIntegerTypes)
+ {
+ yield return new object[] { name, attributesData[0], underlyingType };
+ }
+ }
}
}
[Theory]
+ [MemberData(nameof(DefineEnum_TestData))]
+ public void DefineEnum_ValueType(string name, TypeAttributes visibility, Type underlyingType)
+ {
+ ModuleBuilder module = Helpers.DynamicModule();
+ EnumBuilder enumBuilder = module.DefineEnum(name, visibility, underlyingType);
+ Assert.True(enumBuilder.IsEnum);
+
+ Assert.Same(module.Assembly, enumBuilder.Assembly);
+ Assert.Same(module, enumBuilder.Module);
+
+ Assert.Equal(name, enumBuilder.Name);
+ Assert.Equal(Helpers.GetFullName(name), enumBuilder.FullName);
+ Assert.Equal(enumBuilder.FullName + ", " + module.Assembly.FullName, enumBuilder.AssemblyQualifiedName);
+
+ Assert.Equal(typeof(Enum), enumBuilder.BaseType);
+ Assert.Equal(null, enumBuilder.DeclaringType);
+
+ Assert.True(enumBuilder.Attributes.HasFlag(visibility));
+ Assert.Equal(underlyingType, enumBuilder.UnderlyingField.FieldType);
+
+ enumBuilder.CreateTypeInfo().AsType();
+ }
+
+ [Theory]
[MemberData(nameof(VisibilityAttributes), false)]
public void DefineEnum_NonVisibilityAttributes_ThrowsArgumentException(TypeAttributes visibility)
{
@@ -158,18 +181,5 @@ namespace System.Reflection.Emit.Tests
return (visibility & ~TypeAttributes.VisibilityMask) != 0;
}
}
-
- private void VerificationHelperNegative(string name, TypeAttributes myTypeAttribute, Type mytype, bool flag)
- {
- ModuleBuilder myModuleBuilder = Helpers.DynamicModule();
- Assert.Throws<ArgumentException>(() =>
- {
- EnumBuilder myEnumBuilder = myModuleBuilder.DefineEnum(name, myTypeAttribute, mytype);
- if (!flag)
- {
- myEnumBuilder = myModuleBuilder.DefineEnum(name, myTypeAttribute, typeof(int));
- }
- });
- }
}
}
diff --git a/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineType.cs b/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineType.cs
index 25df5527af..433ffea8cf 100644
--- a/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineType.cs
+++ b/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineType.cs
@@ -2,47 +2,95 @@
// 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.Collections.Generic;
using Xunit;
namespace System.Reflection.Emit.Tests
{
public class ModuleBuilderDefineType
{
- [Fact]
- public void DefineType_String()
+ public static IEnumerable<object[]> TestData()
{
- ModuleBuilder module = Helpers.DynamicModule();
- TypeBuilder type = module.DefineType("TestType");
- Type createdType = type.CreateTypeInfo().AsType();
- Assert.Equal("TestType", createdType.Name);
- }
-
- [Theory]
- [InlineData(TypeAttributes.NotPublic)]
- [InlineData(TypeAttributes.Interface | TypeAttributes.Abstract)]
- [InlineData(TypeAttributes.Class)]
- public void DefineType_String_TypeAttributes(TypeAttributes attributes)
- {
- ModuleBuilder module = Helpers.DynamicModule();
- TypeBuilder type = module.DefineType("TestType", attributes);
+ foreach (string name in new string[] { "TestName", "testname", "class", "\uD800\uDC00", "a\0b\0c" })
+ {
+ foreach (TypeAttributes attributes in new TypeAttributes[] { TypeAttributes.NotPublic, TypeAttributes.Interface | TypeAttributes.Abstract, TypeAttributes.Class })
+ {
+ foreach (Type parent in new Type[] { null, typeof(ModuleBuilderDefineType) })
+ {
+ foreach (PackingSize packingSize in new PackingSize[] { PackingSize.Unspecified, PackingSize.Size1 })
+ {
+ foreach (int size in new int[] { 0, -1, 1 })
+ {
+ yield return new object[] { name, attributes, parent, packingSize, size, new Type[0] };
+ }
+ }
- Type createdType = type.CreateTypeInfo().AsType();
- Assert.Equal("TestType", createdType.Name);
- Assert.Equal(attributes, createdType.GetTypeInfo().Attributes);
+ yield return new object[] { name, attributes, parent, PackingSize.Unspecified, 0, null };
+ yield return new object[] { name, attributes, parent, PackingSize.Unspecified, 0, new Type[] { typeof(IComparable) } };
+ }
+ }
+ }
}
[Theory]
- [InlineData(TypeAttributes.NotPublic)]
- [InlineData(TypeAttributes.Class)]
- public void DefineType_String_TypeAttributes_Type(TypeAttributes attributes)
+ [MemberData(nameof(TestData))]
+ public void DefineType(string name, TypeAttributes attributes, Type parent, PackingSize packingSize, int typesize, Type[] implementedInterfaces)
{
- ModuleBuilder module = Helpers.DynamicModule();
- TypeBuilder type = module.DefineType("TestType", attributes, typeof(ModuleBuilderDefineType));
+ bool isDefaultImplementedInterfaces = implementedInterfaces?.Length == 0;
+ bool isDefaultPackingSize = packingSize == PackingSize.Unspecified;
+ bool isDefaultSize = typesize == 0;
+ bool isDefaultParent = parent == null;
+ bool isDefaultAttributes = attributes == TypeAttributes.NotPublic;
+
+ Action<TypeBuilder, Module> verify = (type, module) =>
+ {
+ Type baseType = attributes.HasFlag(TypeAttributes.Abstract) && parent == null ? null : (parent ?? typeof(object));
+ Helpers.VerifyType(type, module, null, name, attributes, baseType, typesize, packingSize, implementedInterfaces);
+ };
- Type createdType = type.CreateTypeInfo().AsType();
- Assert.Equal("TestType", createdType.Name);
- Assert.Equal(attributes, createdType.GetTypeInfo().Attributes);
- Assert.Equal(typeof(ModuleBuilderDefineType), createdType.GetTypeInfo().BaseType);
+ if (isDefaultImplementedInterfaces)
+ {
+ if (isDefaultSize && isDefaultPackingSize)
+ {
+ if (isDefaultParent)
+ {
+ if (isDefaultAttributes)
+ {
+ // Use DefineType(string)
+ ModuleBuilder module1 = Helpers.DynamicModule();
+ verify(module1.DefineType(name), module1);
+ }
+ // Use DefineType(string, TypeAttributes)
+ ModuleBuilder module2 = Helpers.DynamicModule();
+ verify(module2.DefineType(name, attributes), module2);
+ }
+ // Use DefineType(string, TypeAttributes, Type)
+ ModuleBuilder module3 = Helpers.DynamicModule();
+ verify(module3.DefineType(name, attributes, parent), module3);
+ }
+ else if (isDefaultSize)
+ {
+ // Use DefineType(string, TypeAttributes, Type, PackingSize)
+ ModuleBuilder module4 = Helpers.DynamicModule();
+ verify(module4.DefineType(name, attributes, parent, packingSize), module4);
+ }
+ else if (isDefaultPackingSize)
+ {
+ // Use DefineType(string, TypeAttributes, Type, int)
+ ModuleBuilder module5 = Helpers.DynamicModule();
+ verify(module5.DefineType(name, attributes, parent, typesize), module5);
+ }
+ // Use DefineType(string, TypeAttributes, Type, PackingSize, int)
+ ModuleBuilder module6 = Helpers.DynamicModule();
+ verify(module6.DefineType(name, attributes, parent, packingSize, typesize), module6);
+ }
+ else
+ {
+ // Use DefineType(string, TypeAttributes, Type, Type[])
+ Assert.True(isDefaultSize && isDefaultPackingSize); // Sanity check
+ ModuleBuilder module7 = Helpers.DynamicModule();
+ verify(module7.DefineType(name, attributes, parent, implementedInterfaces), module7);
+ }
}
[Fact]
@@ -66,6 +114,12 @@ namespace System.Reflection.Emit.Tests
Assert.Throws<ArgumentNullException>("fullname", () => module.DefineType(null));
Assert.Throws<ArgumentNullException>("fullname", () => module.DefineType(null, TypeAttributes.NotPublic));
Assert.Throws<ArgumentNullException>("fullname", () => module.DefineType(null, TypeAttributes.NotPublic, typeof(ModuleBuilderDefineType)));
+
+ Assert.Throws<ArgumentNullException>("fullname", () => module.DefineType(null, TypeAttributes.NotPublic, typeof(ModuleBuilderDefineType), PackingSize.Unspecified));
+ Assert.Throws<ArgumentNullException>("fullname", () => module.DefineType(null, TypeAttributes.NotPublic, typeof(ModuleBuilderDefineType), 0));
+ Assert.Throws<ArgumentNullException>("fullname", () => module.DefineType(null, TypeAttributes.NotPublic, typeof(ModuleBuilderDefineType), PackingSize.Unspecified, 0));
+
+ Assert.Throws<ArgumentNullException>("fullname", () => module.DefineType(null, TypeAttributes.NotPublic, typeof(ModuleBuilderDefineType), new Type[0]));
}
[Fact]
@@ -76,6 +130,12 @@ namespace System.Reflection.Emit.Tests
Assert.Throws<ArgumentException>(null, () => module.DefineType("TestType"));
Assert.Throws<ArgumentException>(null, () => module.DefineType("TestType", TypeAttributes.NotPublic));
Assert.Throws<ArgumentException>(null, () => module.DefineType("TestType", TypeAttributes.NotPublic, typeof(ModuleBuilderDefineType)));
+
+ Assert.Throws<ArgumentException>(null, () => module.DefineType("TestType", TypeAttributes.NotPublic, typeof(ModuleBuilderDefineType), PackingSize.Unspecified));
+ Assert.Throws<ArgumentException>(null, () => module.DefineType("TestType", TypeAttributes.NotPublic, typeof(ModuleBuilderDefineType), 0));
+ Assert.Throws<ArgumentException>(null, () => module.DefineType("TestType", TypeAttributes.NotPublic, typeof(ModuleBuilderDefineType), PackingSize.Unspecified, 0));
+
+ Assert.Throws<ArgumentException>(null, () => module.DefineType("TestType", TypeAttributes.NotPublic, typeof(ModuleBuilderDefineType), new Type[0]));
}
[Fact]
diff --git a/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderGetArrayMethod.cs b/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderGetArrayMethod.cs
index e09c659d65..71d2ec6ad8 100644
--- a/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderGetArrayMethod.cs
+++ b/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderGetArrayMethod.cs
@@ -108,12 +108,14 @@ namespace System.Reflection.Emit.Tests
}
[Fact]
- public void GetArrayMethod_NullArgument_ThrowsArgumentNullException()
+ public void GetArrayMethod_InvalidArgument_ThrowsArgumentException()
{
ModuleBuilder module = Helpers.DynamicModule();
Assert.Throws<ArgumentNullException>("arrayClass", () => module.GetArrayMethod(null, "TestMethod", CallingConventions.Standard, typeof(void), new Type[0]));
+
Assert.Throws<ArgumentNullException>("methodName", () => module.GetArrayMethod(typeof(string[]), null, CallingConventions.Standard, typeof(void), new Type[0]));
+ Assert.Throws<ArgumentException>("methodName", () => module.GetArrayMethod(typeof(string[]), "", CallingConventions.Standard, typeof(void), new Type[0]));
Assert.Throws<ArgumentNullException>("argument", () => module.GetArrayMethod(typeof(string[]), "TestMethod", CallingConventions.Standard, typeof(void), new Type[] { null }));
}
diff --git a/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderSetCustomAttribute.cs b/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderSetCustomAttribute.cs
index 24385a643d..0b0d227ecc 100644
--- a/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderSetCustomAttribute.cs
+++ b/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderSetCustomAttribute.cs
@@ -26,8 +26,17 @@ namespace System.Reflection.Emit.Tests
public void SetCustomAttribute_ConstructorInfo_ByteArray_NullConstructor_ThrowsArgumentNullException()
{
ModuleBuilder module = Helpers.DynamicModule();
- Assert.Throws<ArgumentNullException>("con", () => module.SetCustomAttribute(null, new byte[] { 01, 00, 05, 00, 00, 00 }));
+ Assert.Throws<ArgumentNullException>("con", () => module.SetCustomAttribute(null, new byte[0]));
}
+
+ [Fact]
+ public void SetCustomAttribute_ConstructorInfo_ByteArray_NullBinaryAttribute_ThrowsArgumentNullException()
+ {
+ ModuleBuilder module = Helpers.DynamicModule();
+ ConstructorInfo constructor = typeof(IntAllAttribute).GetConstructor(new Type[] { typeof(int) });
+ Assert.Throws<ArgumentNullException>("binaryAttribute", () => module.SetCustomAttribute(constructor, null));
+ }
+
[Fact]
public void SetCustomAttribute_CustomAttributeBuilder()
{
diff --git a/src/System.Reflection.Emit/tests/System.Reflection.Emit.Tests.csproj b/src/System.Reflection.Emit/tests/System.Reflection.Emit.Tests.csproj
index 1b9c44db3e..d3c349d3de 100644
--- a/src/System.Reflection.Emit/tests/System.Reflection.Emit.Tests.csproj
+++ b/src/System.Reflection.Emit/tests/System.Reflection.Emit.Tests.csproj
@@ -113,12 +113,10 @@
<Compile Include="PropertyBuilder\PropertyBuilderSetSetMethod.cs" />
<Compile Include="PropertyBuilder\PropertyBuilderSetValue.cs" />
<Compile Include="TypeBuilder\TypeBuilderAddInterfaceImplementaion.cs" />
- <Compile Include="TypeBuilder\TypeBuilderAssembly.cs" />
<Compile Include="TypeBuilder\TypeBuilderAssemblyQualifiedName.cs" />
<Compile Include="TypeBuilder\TypeBuilderBaseType.cs" />
<Compile Include="TypeBuilder\TypeBuilderCreateType.cs" />
<Compile Include="TypeBuilder\TypeBuilderDeclaringMethod.cs" />
- <Compile Include="TypeBuilder\TypeBuilderDeclaringType.cs" />
<Compile Include="TypeBuilder\TypeBuilderDefineConstructor.cs" />
<Compile Include="TypeBuilder\TypeBuilderDefineDefaultConstructor.cs" />
<Compile Include="TypeBuilder\TypeBuilderDefineEvent.cs" />
@@ -126,7 +124,6 @@
<Compile Include="TypeBuilder\TypeBuilderDefineNestedType.cs" />
<Compile Include="TypeBuilder\TypeBuilderDefineProperty.cs" />
<Compile Include="TypeBuilder\TypeBuilderDefineTypeInitializer.cs" />
- <Compile Include="TypeBuilder\TypeBuilderFullName.cs" />
<Compile Include="TypeBuilder\TypeBuilderGenericParameterAttributes.cs" />
<Compile Include="TypeBuilder\TypeBuilderGenericParameterPosition.cs" />
<Compile Include="TypeBuilder\TypeBuilderGetConstructor.cs" />
diff --git a/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderAssembly.cs b/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderAssembly.cs
deleted file mode 100644
index 48fcba1505..0000000000
--- a/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderAssembly.cs
+++ /dev/null
@@ -1,21 +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 Xunit;
-
-namespace System.Reflection.Emit.Tests
-{
- public class TypeBuilderAssembly
- {
- [Fact]
- public void Assembly()
- {
- AssemblyBuilder assembly = Helpers.DynamicAssembly();
- ModuleBuilder module = assembly.DefineDynamicModule("TestModule");
- TypeBuilder type = module.DefineType("TestType");
-
- Assert.Same(assembly, type.Assembly);
- }
- }
-}
diff --git a/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDeclaringType.cs b/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDeclaringType.cs
deleted file mode 100644
index f9dfbaef4c..0000000000
--- a/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDeclaringType.cs
+++ /dev/null
@@ -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 Xunit;
-
-namespace System.Reflection.Emit.Tests
-{
- public class TypeBuilderDeclaringType
- {
- [Fact]
- public void DeclaringType_RootClass_ReturnsNull()
- {
- TypeBuilder type = Helpers.DynamicType(TypeAttributes.NotPublic);
- Assert.Null(type.DeclaringType);
- }
-
- [Fact]
- public void DeclaringType_NestedClass_ReturnsNull()
- {
- TypeBuilder type = Helpers.DynamicType(TypeAttributes.NotPublic);
- TypeBuilder nestedType = type.DefineNestedType("NestedType");
- Assert.Equal(type.Name, nestedType.DeclaringType.Name);
- }
- }
-}
diff --git a/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineConstructor.cs b/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineConstructor.cs
index 2896207a20..1b3666f75e 100644
--- a/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineConstructor.cs
+++ b/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineConstructor.cs
@@ -38,6 +38,11 @@ namespace System.Reflection.Emit.Tests
FieldBuilder fieldBuilderB = type.DefineField("TestField", typeof(int), FieldAttributes.Private);
ConstructorBuilder ctorBuilder = type.DefineConstructor(methodAttributes, callingConvention, parameterTypes);
+ Assert.Equal(type.Module, ctorBuilder.Module);
+ Assert.Equal(type.AsType(), ctorBuilder.DeclaringType);
+ Assert.Throws<NotSupportedException>(() => ctorBuilder.Invoke(null));
+ Assert.Throws<NotSupportedException>(() => ctorBuilder.Invoke(null, null));
+
ILGenerator ctorIlGenerator = ctorBuilder.GetILGenerator();
if (parameterTypes.Length != 0)
diff --git a/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineNestedType.cs b/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineNestedType.cs
index 3eeaa89fa9..2b93dca552 100644
--- a/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineNestedType.cs
+++ b/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineNestedType.cs
@@ -37,12 +37,7 @@ namespace System.Reflection.Emit.Tests
{
TypeBuilder type = Helpers.DynamicType(TypeAttributes.NotPublic);
TypeBuilder nestedType = type.DefineNestedType(name);
- Assert.Equal(name, nestedType.Name);
- Assert.Equal(TypeAttributes.AutoLayout | TypeAttributes.AnsiClass | TypeAttributes.Class | TypeAttributes.NestedPrivate, nestedType.Attributes);
- Assert.Equal(typeof(object), nestedType.BaseType);
- Assert.Equal(0, nestedType.Size);
- Assert.Equal(PackingSize.Unspecified, nestedType.PackingSize);
- Assert.Empty(nestedType.ImplementedInterfaces);
+ Helpers.VerifyType(nestedType, type.Module, type, name, TypeAttributes.AutoLayout | TypeAttributes.AnsiClass | TypeAttributes.Class | TypeAttributes.NestedPrivate, typeof(object), 0, PackingSize.Unspecified, new Type[0]);
}
[Theory]
@@ -58,10 +53,7 @@ namespace System.Reflection.Emit.Tests
TypeAttributes noBaseTypeAttributes = TypeAttributes.AutoLayout | TypeAttributes.AnsiClass | TypeAttributes.Class | TypeAttributes.NestedPublic | TypeAttributes.ClassSemanticsMask | TypeAttributes.Abstract;
Type expectedBaseType = attributes == noBaseTypeAttributes ? null : typeof(object);
- Assert.Equal(expectedBaseType, nestedType.BaseType);
- Assert.Equal(0, nestedType.Size);
- Assert.Equal(PackingSize.Unspecified, nestedType.PackingSize);
- Assert.Empty(nestedType.ImplementedInterfaces);
+ Helpers.VerifyType(nestedType, type.Module, type, name, attributes, expectedBaseType, 0, PackingSize.Unspecified, new Type[0]);
}
}
@@ -74,12 +66,7 @@ namespace System.Reflection.Emit.Tests
foreach (string name in new string[] { "abc", "a\0b\0cd" })
{
TypeBuilder nestedType = type.DefineNestedType(name, attributes, parent);
- Assert.Equal(name, nestedType.Name);
- Assert.Equal(attributes, nestedType.Attributes);
- Assert.Equal(parent, nestedType.BaseType);
- Assert.Equal(0, nestedType.Size);
- Assert.Equal(PackingSize.Unspecified, nestedType.PackingSize);
- Assert.Empty(nestedType.ImplementedInterfaces);
+ Helpers.VerifyType(nestedType, type.Module, type, name, attributes, parent, 0, PackingSize.Unspecified, new Type[0]);
}
}
@@ -94,12 +81,7 @@ namespace System.Reflection.Emit.Tests
foreach (string name in new string[] { "abc", "a\0b\0cd" })
{
TypeBuilder nestedType = type.DefineNestedType(name, attributes, parent, size);
- Assert.Equal(name, nestedType.Name);
- Assert.Equal(attributes, nestedType.Attributes);
- Assert.Equal(parent, nestedType.BaseType);
- Assert.Equal(size, nestedType.Size);
- Assert.Equal(PackingSize.Unspecified, nestedType.PackingSize);
- Assert.Empty(nestedType.ImplementedInterfaces);
+ Helpers.VerifyType(nestedType, type.Module, type, name, attributes, parent, size, PackingSize.Unspecified, new Type[0]);
}
}
}
@@ -115,12 +97,7 @@ namespace System.Reflection.Emit.Tests
foreach (string name in new string[] { "abc", "a\0b\0cd" })
{
TypeBuilder nestedType = type.DefineNestedType(name, attributes, parent, packagingSize);
- Assert.Equal(name, nestedType.Name);
- Assert.Equal(attributes, nestedType.Attributes);
- Assert.Equal(parent, nestedType.BaseType);
- Assert.Equal(0, nestedType.Size);
- Assert.Equal(packagingSize, nestedType.PackingSize);
- Assert.Empty(nestedType.ImplementedInterfaces);
+ Helpers.VerifyType(nestedType, type.Module, type, name, attributes, parent, 0, packagingSize, new Type[0]);
}
}
}
@@ -134,12 +111,7 @@ namespace System.Reflection.Emit.Tests
foreach (string name in new string[] { "abc", "a\0b\0cd" })
{
TypeBuilder nestedType = type.DefineNestedType(name, attributes, parent, new Type[] { typeof(IComparable) });
- Assert.Equal(name, nestedType.Name);
- Assert.Equal(attributes, nestedType.Attributes);
- Assert.Equal(parent, nestedType.BaseType);
- Assert.Equal(0, nestedType.Size);
- Assert.Equal(PackingSize.Unspecified, nestedType.PackingSize);
- Assert.Equal(new Type[] { typeof(IComparable) }, nestedType.ImplementedInterfaces);
+ Helpers.VerifyType(nestedType, type.Module, type, name, attributes, parent, 0, PackingSize.Unspecified, new Type[] { typeof(IComparable) });
}
}
diff --git a/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderFullName.cs b/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderFullName.cs
deleted file mode 100644
index cf76301f5c..0000000000
--- a/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderFullName.cs
+++ /dev/null
@@ -1,29 +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 Xunit;
-
-namespace System.Reflection.Emit.Tests
-{
- public class TypeBuilderFullName
- {
- [Theory]
- [InlineData("TestType")]
- [InlineData("testype")]
- [InlineData("Test Type")]
- public void FullName(string typeName)
- {
- TypeBuilder type = Helpers.DynamicType(TypeAttributes.NotPublic, typeName: typeName);
- Assert.Equal(typeName, type.FullName);
- }
-
- [Fact]
- public void FullName_NestedType()
- {
- TypeBuilder type = Helpers.DynamicType(TypeAttributes.NotPublic, typeName: "Parent");
- TypeBuilder nestedType = type.DefineNestedType("Nested");
- Assert.Equal("Parent+Nested", nestedType.FullName);
- }
- }
-}
diff --git a/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderMakeGenericType.cs b/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderMakeGenericType.cs
index 45d27b3953..b0c3478d52 100644
--- a/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderMakeGenericType.cs
+++ b/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderMakeGenericType.cs
@@ -14,7 +14,8 @@ namespace System.Reflection.Emit.Tests
string mscorlibFullName = typeof(int).GetTypeInfo().Assembly.FullName;
yield return new object[] { new string[] { "U", "T" }, new Type[] { typeof(string), typeof(int) }, "TestType[[System.String, " + mscorlibFullName + "],[System.Int32, " + mscorlibFullName + "]]" };
- yield return new object[] { new string[] { "U", "T" }, new Type[] { typeof(MakeGenericTypeClass), typeof(MakeGenericTypeInterface) }, "TestType[[System.Reflection.Emit.Tests.MakeGenericTypeClass, System.Reflection.Emit.Tests, Version=999.999.999.999, Culture=neutral, PublicKeyToken=9d77cc7ad39b68eb],[System.Reflection.Emit.Tests.MakeGenericTypeInterface, System.Reflection.Emit.Tests, Version=999.999.999.999, Culture=neutral, PublicKeyToken=9d77cc7ad39b68eb]]" };
+ string thisAssemblyFullName = typeof(TypeBuilderMakeGenericType).GetTypeInfo().Assembly.FullName;
+ yield return new object[] { new string[] { "U", "T" }, new Type[] { typeof(MakeGenericTypeClass), typeof(MakeGenericTypeInterface) }, "TestType[[System.Reflection.Emit.Tests.MakeGenericTypeClass, " + thisAssemblyFullName + "],[System.Reflection.Emit.Tests.MakeGenericTypeInterface, " + thisAssemblyFullName + "]]" };
yield return new object[] { new string[] { "U" }, new Type[] { typeof(string) }, "TestType[[System.String, " + mscorlibFullName + "]]" };
}
diff --git a/src/System.Reflection.Emit/tests/Utilities.cs b/src/System.Reflection.Emit/tests/Utilities.cs
index f5754f0d22..3caf4a9623 100644
--- a/src/System.Reflection.Emit/tests/Utilities.cs
+++ b/src/System.Reflection.Emit/tests/Utilities.cs
@@ -2,7 +2,9 @@
// 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.Reflection.Emit;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using Xunit;
namespace System.Reflection.Emit.Tests
{
@@ -17,10 +19,10 @@ namespace System.Reflection.Emit.Tests
public static class Helpers
{
- public static AssemblyBuilder DynamicAssembly(string name = "TestAssembly")
+ public static AssemblyBuilder DynamicAssembly(string name = "TestAssembly", AssemblyBuilderAccess access = AssemblyBuilderAccess.Run)
{
AssemblyName assemblyName = new AssemblyName(name);
- return AssemblyBuilder.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
+ return AssemblyBuilder.DefineDynamicAssembly(assemblyName, access);
}
public static ModuleBuilder DynamicModule(string assemblyName = "TestAssembly", string moduleName = "TestModule")
@@ -37,5 +39,53 @@ namespace System.Reflection.Emit.Tests
{
return DynamicModule(assemblyName, moduleName).DefineEnum(enumName, visibility, underlyingType);
}
+
+ public static void VerifyType(TypeBuilder type, Module module, TypeBuilder declaringType, string name, TypeAttributes attributes, Type baseType, int size, PackingSize packingSize, Type[] implementedInterfaces)
+ {
+ Assert.Same(module, type.Module);
+ Assert.Same(module.Assembly, type.Assembly);
+
+ Assert.Equal(name, type.Name);
+ if (declaringType == null)
+ {
+ Assert.Equal(GetFullName(name), type.FullName);
+ }
+ else
+ {
+ Assert.Equal(GetFullName(declaringType.Name) + "+" + GetFullName(type.Name), type.FullName);
+ }
+
+ Assert.Equal(attributes, type.Attributes);
+
+ Assert.Equal(declaringType?.AsType(), type.DeclaringType);
+ Assert.Equal(baseType, type.BaseType);
+
+ Assert.Equal(size, type.Size);
+ Assert.Equal(packingSize, type.PackingSize);
+
+ Assert.Equal(implementedInterfaces ?? new Type[0], type.ImplementedInterfaces);
+
+ if (declaringType == null && !type.IsInterface && (implementedInterfaces == null || implementedInterfaces.Length == 0))
+ {
+ Type createdType = type.CreateTypeInfo().AsType();
+ Assert.Equal(createdType, module.GetType(name, false, false));
+ Assert.Equal(createdType, module.GetType(name, true, false));
+
+ // [ActiveIssue(10989, PlatformID.AnyUnix)]
+ // Assert.Equal(createdType, module.GetType(name, true, true));
+ // Assert.Equal(createdType, module.GetType(name.ToLowerInvariant(), true, true));
+ // Assert.Equal(createdType, module.GetType(name.ToUpperInvariant(), true, true));
+ }
+ }
+
+ public static string GetFullName(string name)
+ {
+ int nullTerminatorIndex = name.IndexOf('\0');
+ if (nullTerminatorIndex >= 0)
+ {
+ return name.Substring(0, nullTerminatorIndex);
+ }
+ return name;
+ }
}
}
diff --git a/src/System.Reflection.Extensions/dir.props b/src/System.Reflection.Extensions/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Reflection.Extensions/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Reflection.Extensions/pkg/System.Reflection.Extensions.pkgproj b/src/System.Reflection.Extensions/pkg/System.Reflection.Extensions.pkgproj
index 5da42b4d4c..fc61447455 100644
--- a/src/System.Reflection.Extensions/pkg/System.Reflection.Extensions.pkgproj
+++ b/src/System.Reflection.Extensions/pkg/System.Reflection.Extensions.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Reflection.Extensions.csproj">
diff --git a/src/System.Reflection.Extensions/pkg/ValidationSuppression.txt b/src/System.Reflection.Extensions/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Reflection.Extensions/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Reflection.Extensions/pkg/aot/System.Reflection.Extensions.pkgproj b/src/System.Reflection.Extensions/pkg/aot/System.Reflection.Extensions.pkgproj
index 138978ee69..c4425aacc9 100644
--- a/src/System.Reflection.Extensions/pkg/aot/System.Reflection.Extensions.pkgproj
+++ b/src/System.Reflection.Extensions/pkg/aot/System.Reflection.Extensions.pkgproj
@@ -3,7 +3,6 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2</Version>
<PackageTargetRuntime>aot</PackageTargetRuntime>
<PreventImplementationReference>true</PreventImplementationReference>
</PropertyGroup>
diff --git a/src/System.Reflection.Extensions/ref/System.Reflection.Extensions.csproj b/src/System.Reflection.Extensions/ref/System.Reflection.Extensions.csproj
index 16b92ea63f..8efc92a5ad 100644
--- a/src/System.Reflection.Extensions/ref/System.Reflection.Extensions.csproj
+++ b/src/System.Reflection.Extensions/ref/System.Reflection.Extensions.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Reflection.Extensions/src/System.Reflection.Extensions.csproj b/src/System.Reflection.Extensions/src/System.Reflection.Extensions.csproj
index 5c37049d4e..06595d8621 100644
--- a/src/System.Reflection.Extensions/src/System.Reflection.Extensions.csproj
+++ b/src/System.Reflection.Extensions/src/System.Reflection.Extensions.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Reflection.Extensions</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Reflection.Metadata/dir.props b/src/System.Reflection.Metadata/dir.props
new file mode 100644
index 0000000000..cbdd699174
--- /dev/null
+++ b/src/System.Reflection.Metadata/dir.props
@@ -0,0 +1,8 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <PackageVersion>1.4.1</PackageVersion>
+ <AssemblyVersion>1.4.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md b/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md
index efab08e20c..4d2993160b 100644
--- a/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md
+++ b/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md
@@ -424,7 +424,7 @@ _start-offset_ shall point to the starting byte of an instruction of the MoveNex
_start-offset_ + _length_ shall point to the starting byte of an instruction or be equal to the size of the IL stream of the MoveNext method of the state machine type.
##### <a name="DynamicLocalVariables"></a>Dynamic Local Variables (C# compiler)
-Parent: LocalVariables or LocalConstant
+Parent: LocalVariable or LocalConstant
Kind: {83C563C4-B4F3-47D5-B824-BA5441477EA8}
@@ -432,7 +432,7 @@ Structure:
Blob ::= bit-sequence
-A sequence of bits for a local variable or constant whose type contains _dynamic_ type (e.g. dynamic, dynamic[], List<dynamic> etc.) that describes which System.Object types encoded in the metadata signature of the local type were specified as _dynamic_ in source code.
+A sequence of bits for a local variable or constant whose type contains _dynamic_ type (e.g. ```dynamic```, ```dynamic[]```, ```List<dynamic>``` etc.) that describes which System.Object types encoded in the metadata signature of the local type were specified as _dynamic_ in source code.
Bits of the sequence are grouped by 8. If the sequence length is not a multiple of 8 it is padded by 0 bit to the closest multiple of 8. Each group of 8 bits is encoded as a byte whose least significant bit is the first bit of the group and the highest significant bit is the 8th bit of the group. The sequence is encoded as a sequence of bytes representing these groups. Trailing zero bytes may be omitted.
diff --git a/src/System.Reflection.Metadata/src/Resources/Strings.resx b/src/System.Reflection.Metadata/src/Resources/Strings.resx
index 2e50538292..a237252c53 100644
--- a/src/System.Reflection.Metadata/src/Resources/Strings.resx
+++ b/src/System.Reflection.Metadata/src/Resources/Strings.resx
@@ -354,9 +354,6 @@
<data name="UnexpectedEmbeddedPortablePdbDataSignature" xml:space="preserve">
<value>Unexpected Embedded Portable PDB data signature value.</value>
</data>
- <data name="InvalidPathPadding" xml:space="preserve">
- <value>The path must be padded with NUL characters.</value>
- </data>
<data name="UnexpectedSignatureHeader" xml:space="preserve">
<value>Expected signature header for '{0}', but found '{1}' (0x{2:x2}).</value>
</data>
@@ -375,8 +372,8 @@
<data name="NotTypeDefOrRefOrSpecHandle" xml:space="preserve">
<value>Specified handle is not a TypeDefinitionHandle, TypeRefererenceHandle, or TypeSpecificationHandle.</value>
</data>
- <data name="NotCodeViewEntry" xml:space="preserve">
- <value>The Debug directory was not of type CodeView.</value>
+ <data name="UnexpectedDebugDirectoryType" xml:space="preserve">
+ <value>The Debug directory was not of type {0}.</value>
</data>
<data name="HeapSizeLimitExceeded" xml:space="preserve">
<value>The limit on the size of {0} heap has been exceeded.</value>
diff --git a/src/System.Reflection.Metadata/src/System.Reflection.Metadata.csproj b/src/System.Reflection.Metadata/src/System.Reflection.Metadata.csproj
index 7e88802477..ba498fe6dc 100644
--- a/src/System.Reflection.Metadata/src/System.Reflection.Metadata.csproj
+++ b/src/System.Reflection.Metadata/src/System.Reflection.Metadata.csproj
@@ -12,19 +12,10 @@
<NoWarn>1591</NoWarn>
<CLSCompliant>false</CLSCompliant>
<!-- rev'ed to 1.4.1 so that we can drop pre-release down to beta -->
- <AssemblyVersion>1.4.1.0</AssemblyVersion>
<DefineConstants>$(DefineConstants)</DefineConstants>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
+ <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.1;portable-net45+win8</PackageTargetFramework>
</PropertyGroup>
- <ItemGroup>
- <PackageDestination Include="lib/netstandard1.1">
- <TargetFramework>netstandard1.1</TargetFramework>
- </PackageDestination>
- <!-- Support targets that were supported in previous package versions -->
- <PackageDestination Include="lib/portable-net45+win8">
- <TargetFramework>portable-net45+win8</TargetFramework>
- </PackageDestination>
- </ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget>
<Optimize>false</Optimize>
@@ -38,6 +29,7 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="System\Reflection\Internal\Utilities\ExceptionUtilities.cs" />
+ <Compile Include="System\Reflection\Internal\Utilities\PathUtilities.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\Encoding\FunctionPointerAttributes.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\Encoding\MethodBodyStreamEncoder.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\Encoding\MethodBodyAttributes.cs" />
@@ -45,6 +37,10 @@
<Compile Include="System\Reflection\Metadata\Ecma335\MetadataRootBuilder.cs" />
<Compile Include="System\Reflection\Metadata\Ecma335\SerializedMetadataHeaps.cs" />
<Compile Include="System\Reflection\Metadata\EntityHandle.cs" />
+ <Compile Include="System\Reflection\Metadata\Internal\VirtualHeap.cs" />
+ <Compile Include="System\Reflection\Metadata\Internal\GuidHeap.cs" />
+ <Compile Include="System\Reflection\Metadata\Internal\BlobHeap.cs" />
+ <Compile Include="System\Reflection\Metadata\Internal\StringHeap.cs" />
<Compile Include="System\Reflection\Metadata\PooledBlobBuilder.cs" />
<Compile Include="System\Reflection\Metadata\Blob.cs" />
<Compile Include="System\Reflection\Metadata\BlobWriter.cs" />
@@ -164,7 +160,7 @@
<Compile Include="System\Reflection\Metadata\Internal\HasDeclSecurityTag.cs" />
<Compile Include="System\Reflection\Metadata\Internal\HasFieldMarshalTag.cs" />
<Compile Include="System\Reflection\Metadata\Internal\HasSemanticsTag.cs" />
- <Compile Include="System\Reflection\Metadata\Internal\Heaps.cs" />
+ <Compile Include="System\Reflection\Metadata\Internal\UserStringHeap.cs" />
<Compile Include="System\Reflection\Metadata\Internal\ImplementationTag.cs" />
<Compile Include="System\Reflection\Metadata\Internal\MemberForwardedTag.cs" />
<Compile Include="System\Reflection\Metadata\Internal\MemberRefParentTag.cs" />
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/AbstractMemoryBlock.cs b/src/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/AbstractMemoryBlock.cs
index d82c89181f..5acb31c82a 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/AbstractMemoryBlock.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/AbstractMemoryBlock.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.Collections.Immutable;
+using System.Reflection.Metadata;
namespace System.Reflection.Internal
{
@@ -21,6 +22,8 @@ namespace System.Reflection.Internal
/// </summary>
public abstract int Size { get; }
+ public unsafe BlobReader GetReader() => new BlobReader(Pointer, Size);
+
/// <summary>
/// Returns the content of the entire memory block.
/// </summary>
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/PathUtilities.cs b/src/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/PathUtilities.cs
new file mode 100644
index 0000000000..806e0c81ae
--- /dev/null
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/PathUtilities.cs
@@ -0,0 +1,82 @@
+// 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.Diagnostics;
+using System.IO;
+
+namespace System.Reflection.Metadata
+{
+ internal static class PathUtilities
+ {
+ private const char DirectorySeparatorChar = '\\';
+ private const char AltDirectorySeparatorChar = '/';
+ private const char VolumeSeparatorChar = ':';
+
+ private static string s_platformSpecificDirectorySeparator;
+
+ private static string PlatformSpecificDirectorySeparator
+ {
+ get
+ {
+ if (s_platformSpecificDirectorySeparator == null)
+ {
+ // '*' is a valid char on Unix-based FS
+ s_platformSpecificDirectorySeparator =
+ (Array.IndexOf(Path.GetInvalidFileNameChars(), '*') >= 0 ? DirectorySeparatorChar : AltDirectorySeparatorChar).ToString();
+ }
+
+ return s_platformSpecificDirectorySeparator;
+ }
+ }
+
+ /// <summary>
+ /// Returns the position in given path where the file name starts.
+ /// </summary>
+ /// <returns>-1 if path is null.</returns>
+ internal static int IndexOfFileName(string path)
+ {
+ if (path == null)
+ {
+ return -1;
+ }
+
+ for (int i = path.Length - 1; i >= 0; i--)
+ {
+ char ch = path[i];
+ if (ch == DirectorySeparatorChar || ch == AltDirectorySeparatorChar || ch == VolumeSeparatorChar)
+ {
+ return i + 1;
+ }
+ }
+
+ return 0;
+ }
+
+ /// <summary>
+ /// Get file name from path.
+ /// </summary>
+ /// <remarks>Unlike <see cref="System.IO.Path.GetFileName"/> doesn't check for invalid path characters.</remarks>
+ internal static string GetFileName(string path, bool includeExtension = true)
+ {
+ int fileNameStart = IndexOfFileName(path);
+ return (fileNameStart <= 0) ? path : path.Substring(fileNameStart);
+ }
+
+ internal static string CombinePathWithRelativePath(string root, string relativePath)
+ {
+ if (root.Length == 0)
+ {
+ return relativePath;
+ }
+
+ char c = root[root.Length - 1];
+ if (c == DirectorySeparatorChar || c == AltDirectorySeparatorChar || c == VolumeSeparatorChar)
+ {
+ return root + relativePath;
+ }
+
+ return root + PlatformSpecificDirectorySeparator + relativePath;
+ }
+ }
+}
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobBuilder.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobBuilder.cs
index e5796059cd..b14470f05f 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobBuilder.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobBuilder.cs
@@ -13,7 +13,7 @@ using System.Runtime.InteropServices;
namespace System.Reflection.Metadata
{
[DebuggerDisplay("{GetDebuggerDisplay(),nq}")]
- public unsafe partial class BlobBuilder
+ public partial class BlobBuilder
{
// The implementation is akin to StringBuilder.
// The differences:
@@ -746,7 +746,7 @@ namespace System.Reflection.Metadata
/// <exception cref="ArgumentNullException"><paramref name="buffer"/> is null.</exception>
/// <exception cref="InvalidOperationException">Builder is not writable, it has been linked with another one.</exception>
- public unsafe void WriteBytes(byte[] buffer)
+ public void WriteBytes(byte[] buffer)
{
WriteBytes(buffer, 0, buffer?.Length ?? 0);
}
@@ -937,7 +937,7 @@ namespace System.Reflection.Metadata
/// </summary>
/// <exception cref="ArgumentNullException"><paramref name="value"/> is null.</exception>
/// <exception cref="InvalidOperationException">Builder is not writable, it has been linked with another one.</exception>
- public void WriteUTF16(char[] value)
+ public unsafe void WriteUTF16(char[] value)
{
if (value == null)
{
@@ -965,7 +965,7 @@ namespace System.Reflection.Metadata
/// </summary>
/// <exception cref="ArgumentNullException"><paramref name="value"/> is null.</exception>
/// <exception cref="InvalidOperationException">Builder is not writable, it has been linked with another one.</exception>
- public void WriteUTF16(string value)
+ public unsafe void WriteUTF16(string value)
{
if (value == null)
{
@@ -1044,7 +1044,7 @@ namespace System.Reflection.Metadata
WriteUTF8(value, 0, value.Length, allowUnpairedSurrogates, prependSize: false);
}
- internal void WriteUTF8(string str, int start, int length, bool allowUnpairedSurrogates, bool prependSize)
+ internal unsafe void WriteUTF8(string str, int start, int length, bool allowUnpairedSurrogates, bool prependSize)
{
Debug.Assert(start >= 0);
Debug.Assert(length >= 0);
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobReader.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobReader.cs
index 4c23c89a65..7dfb6b5949 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobReader.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobReader.cs
@@ -25,7 +25,15 @@ namespace System.Reflection.Metadata
private byte* _currentPointer;
- public unsafe BlobReader(byte* buffer, int length)
+ /// <summary>
+ /// Creates a reader of the specified memory block.
+ /// </summary>
+ /// <param name="buffer">Pointer to the start of the memory block.</param>
+ /// <param name="length">Length in bytes of the memory block.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="buffer"/> is null and <paramref name="length"/> is greater than zero.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="length"/> is negative.</exception>
+ /// <exception cref="PlatformNotSupportedException">The current platform is not little-endian.</exception>
+ public BlobReader(byte* buffer, int length)
: this(MemoryBlock.CreateChecked(buffer, length))
{
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/MetadataReaderExtensions.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/MetadataReaderExtensions.cs
index f57972a2b6..c6fe64065d 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/MetadataReaderExtensions.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/MetadataReaderExtensions.cs
@@ -232,16 +232,16 @@ namespace System.Reflection.Metadata.Ecma335
switch (heapIndex)
{
case HeapIndex.UserString:
- return reader.UserStringStream.Block;
+ return reader.UserStringHeap.Block;
case HeapIndex.String:
- return reader.StringStream.Block;
+ return reader.StringHeap.Block;
case HeapIndex.Blob:
- return reader.BlobStream.Block;
+ return reader.BlobHeap.Block;
case HeapIndex.Guid:
- return reader.GuidStream.Block;
+ return reader.GuidHeap.Block;
default:
throw new ArgumentOutOfRangeException(nameof(heapIndex));
@@ -259,7 +259,7 @@ namespace System.Reflection.Metadata.Ecma335
Throw.ArgumentNull(nameof(reader));
}
- return reader.UserStringStream.GetNextHandle(handle);
+ return reader.UserStringHeap.GetNextHandle(handle);
}
/// <summary>
@@ -273,7 +273,7 @@ namespace System.Reflection.Metadata.Ecma335
Throw.ArgumentNull(nameof(reader));
}
- return reader.BlobStream.GetNextHandle(handle);
+ return reader.BlobHeap.GetNextHandle(handle);
}
/// <summary>
@@ -287,7 +287,7 @@ namespace System.Reflection.Metadata.Ecma335
Throw.ArgumentNull(nameof(reader));
}
- return reader.StringStream.GetNextHandle(handle);
+ return reader.StringHeap.GetNextHandle(handle);
}
/// <summary>
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/BlobHeap.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/BlobHeap.cs
new file mode 100644
index 0000000000..15837aa0f1
--- /dev/null
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/BlobHeap.cs
@@ -0,0 +1,267 @@
+// 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.Reflection.Internal;
+using System.Threading;
+
+namespace System.Reflection.Metadata.Ecma335
+{
+ internal struct BlobHeap
+ {
+ private static byte[][] s_virtualValues;
+
+ internal readonly MemoryBlock Block;
+ private VirtualHeap _lazyVirtualHeap;
+
+ internal BlobHeap(MemoryBlock block, MetadataKind metadataKind)
+ {
+ _lazyVirtualHeap = null;
+ Block = block;
+
+ if (s_virtualValues == null && metadataKind != MetadataKind.Ecma335)
+ {
+ var blobs = new byte[(int)BlobHandle.VirtualIndex.Count][];
+
+ blobs[(int)BlobHandle.VirtualIndex.ContractPublicKeyToken] = new byte[]
+ {
+ 0xB0, 0x3F, 0x5F, 0x7F, 0x11, 0xD5, 0x0A, 0x3A
+ };
+
+ blobs[(int)BlobHandle.VirtualIndex.ContractPublicKey] = new byte[]
+ {
+ 0x00, 0x24, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x00,
+ 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x31, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x07, 0xD1, 0xFA, 0x57, 0xC4, 0xAE, 0xD9, 0xF0, 0xA3, 0x2E, 0x84, 0xAA, 0x0F, 0xAE, 0xFD, 0x0D,
+ 0xE9, 0xE8, 0xFD, 0x6A, 0xEC, 0x8F, 0x87, 0xFB, 0x03, 0x76, 0x6C, 0x83, 0x4C, 0x99, 0x92, 0x1E,
+ 0xB2, 0x3B, 0xE7, 0x9A, 0xD9, 0xD5, 0xDC, 0xC1, 0xDD, 0x9A, 0xD2, 0x36, 0x13, 0x21, 0x02, 0x90,
+ 0x0B, 0x72, 0x3C, 0xF9, 0x80, 0x95, 0x7F, 0xC4, 0xE1, 0x77, 0x10, 0x8F, 0xC6, 0x07, 0x77, 0x4F,
+ 0x29, 0xE8, 0x32, 0x0E, 0x92, 0xEA, 0x05, 0xEC, 0xE4, 0xE8, 0x21, 0xC0, 0xA5, 0xEF, 0xE8, 0xF1,
+ 0x64, 0x5C, 0x4C, 0x0C, 0x93, 0xC1, 0xAB, 0x99, 0x28, 0x5D, 0x62, 0x2C, 0xAA, 0x65, 0x2C, 0x1D,
+ 0xFA, 0xD6, 0x3D, 0x74, 0x5D, 0x6F, 0x2D, 0xE5, 0xF1, 0x7E, 0x5E, 0xAF, 0x0F, 0xC4, 0x96, 0x3D,
+ 0x26, 0x1C, 0x8A, 0x12, 0x43, 0x65, 0x18, 0x20, 0x6D, 0xC0, 0x93, 0x34, 0x4D, 0x5A, 0xD2, 0x93
+ };
+
+ blobs[(int)BlobHandle.VirtualIndex.AttributeUsage_AllowSingle] = new byte[]
+ {
+ // preamble:
+ 0x01, 0x00,
+ // target (template parameter):
+ 0x00, 0x00, 0x00, 0x00,
+ // named arg count:
+ 0x01, 0x00,
+ // SERIALIZATION_TYPE_PROPERTY
+ 0x54,
+ // ELEMENT_TYPE_BOOLEAN
+ 0x02,
+ // "AllowMultiple".Length
+ 0x0D,
+ // "AllowMultiple"
+ 0x41, 0x6C, 0x6C, 0x6F, 0x77, 0x4D, 0x75, 0x6C, 0x74, 0x69, 0x70, 0x6C, 0x65,
+ // false
+ 0x00
+ };
+
+ blobs[(int)BlobHandle.VirtualIndex.AttributeUsage_AllowMultiple] = new byte[]
+ {
+ // preamble:
+ 0x01, 0x00,
+ // target (template parameter):
+ 0x00, 0x00, 0x00, 0x00,
+ // named arg count:
+ 0x01, 0x00,
+ // SERIALIZATION_TYPE_PROPERTY
+ 0x54,
+ // ELEMENT_TYPE_BOOLEAN
+ 0x02,
+ // "AllowMultiple".Length
+ 0x0D,
+ // "AllowMultiple"
+ 0x41, 0x6C, 0x6C, 0x6F, 0x77, 0x4D, 0x75, 0x6C, 0x74, 0x69, 0x70, 0x6C, 0x65,
+ // true
+ 0x01
+ };
+
+ s_virtualValues = blobs;
+ }
+ }
+
+ internal byte[] GetBytes(BlobHandle handle)
+ {
+ if (handle.IsVirtual)
+ {
+ // consider: if we returned an ImmutableArray we wouldn't need to copy
+ return GetVirtualBlobBytes(handle, unique: true);
+ }
+
+ int offset = handle.GetHeapOffset();
+ int bytesRead;
+ int numberOfBytes = Block.PeekCompressedInteger(offset, out bytesRead);
+ if (numberOfBytes == BlobReader.InvalidCompressedInteger)
+ {
+ return EmptyArray<byte>.Instance;
+ }
+
+ return Block.PeekBytes(offset + bytesRead, numberOfBytes);
+ }
+
+ internal MemoryBlock GetMemoryBlock(BlobHandle handle)
+ {
+ if (handle.IsVirtual)
+ {
+ return GetVirtualHandleMemoryBlock(handle);
+ }
+
+ int offset, size;
+ Block.PeekHeapValueOffsetAndSize(handle.GetHeapOffset(), out offset, out size);
+ return Block.GetMemoryBlockAt(offset, size);
+ }
+
+ private MemoryBlock GetVirtualHandleMemoryBlock(BlobHandle handle)
+ {
+ var heap = VirtualHeap.GetOrCreateVirtualHeap(ref _lazyVirtualHeap);
+
+ VirtualHeapBlob virtualBlob;
+ lock (heap)
+ {
+ if (!heap.Table.TryGetValue(handle.RawValue, out virtualBlob))
+ {
+ virtualBlob = new VirtualHeapBlob(GetVirtualBlobBytes(handle, unique: false));
+ heap.Table.Add(handle.RawValue, virtualBlob);
+ }
+ }
+
+ return virtualBlob.GetMemoryBlock();
+ }
+
+ internal BlobReader GetBlobReader(BlobHandle handle)
+ {
+ return new BlobReader(GetMemoryBlock(handle));
+ }
+
+ internal BlobHandle GetNextHandle(BlobHandle handle)
+ {
+ if (handle.IsVirtual)
+ {
+ return default(BlobHandle);
+ }
+
+ int offset, size;
+ if (!Block.PeekHeapValueOffsetAndSize(handle.GetHeapOffset(), out offset, out size))
+ {
+ return default(BlobHandle);
+ }
+
+ int nextIndex = offset + size;
+ if (nextIndex >= Block.Length)
+ {
+ return default(BlobHandle);
+ }
+
+ return BlobHandle.FromOffset(nextIndex);
+ }
+
+ internal byte[] GetVirtualBlobBytes(BlobHandle handle, bool unique)
+ {
+ BlobHandle.VirtualIndex index = handle.GetVirtualIndex();
+ byte[] result = s_virtualValues[(int)index];
+
+ switch (index)
+ {
+ case BlobHandle.VirtualIndex.AttributeUsage_AllowMultiple:
+ case BlobHandle.VirtualIndex.AttributeUsage_AllowSingle:
+ result = (byte[])result.Clone();
+ handle.SubstituteTemplateParameters(result);
+ break;
+
+ default:
+ if (unique)
+ {
+ result = (byte[])result.Clone();
+ }
+ break;
+ }
+
+ return result;
+ }
+
+ public string GetDocumentName(DocumentNameBlobHandle handle)
+ {
+ var blobReader = GetBlobReader(handle);
+
+ // Spec: separator is an ASCII encoded character in range [0x01, 0x7F], or byte 0 to represent an empty separator.
+ int separator = blobReader.ReadByte();
+ if (separator > 0x7f)
+ {
+ throw new BadImageFormatException(string.Format(SR.InvalidDocumentName, separator));
+ }
+
+ var pooledBuilder = PooledStringBuilder.GetInstance();
+ var builder = pooledBuilder.Builder;
+ bool isFirstPart = true;
+ while (blobReader.RemainingBytes > 0)
+ {
+ if (separator != 0 && !isFirstPart)
+ {
+ builder.Append((char)separator);
+ }
+
+ var partReader = GetBlobReader(blobReader.ReadBlobHandle());
+
+ // TODO: avoid allocating temp string (https://github.com/dotnet/corefx/issues/2102)
+ builder.Append(partReader.ReadUTF8(partReader.Length));
+ isFirstPart = false;
+ }
+
+ return pooledBuilder.ToStringAndFree();
+ }
+
+ internal bool DocumentNameEquals(DocumentNameBlobHandle handle, string other, bool ignoreCase)
+ {
+ var blobReader = GetBlobReader(handle);
+
+ // Spec: separator is an ASCII encoded character in range [0x01, 0x7F], or byte 0 to represent an empty separator.
+ int separator = blobReader.ReadByte();
+ if (separator > 0x7f)
+ {
+ return false;
+ }
+
+ int ignoreCaseMask = StringUtils.IgnoreCaseMask(ignoreCase);
+ int otherIndex = 0;
+ bool isFirstPart = true;
+ while (blobReader.RemainingBytes > 0)
+ {
+ if (separator != 0 && !isFirstPart)
+ {
+ if (otherIndex == other.Length || !StringUtils.IsEqualAscii(other[otherIndex], separator, ignoreCaseMask))
+ {
+ return false;
+ }
+
+ otherIndex++;
+ }
+
+ var partBlock = GetMemoryBlock(blobReader.ReadBlobHandle());
+
+ int firstDifferenceIndex;
+ var result = partBlock.Utf8NullTerminatedFastCompare(0, other, otherIndex, out firstDifferenceIndex, terminator: '\0', ignoreCase: ignoreCase);
+ if (result == MemoryBlock.FastComparisonResult.Inconclusive)
+ {
+ return GetDocumentName(handle).Equals(other, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
+ }
+
+ if (result == MemoryBlock.FastComparisonResult.Unequal ||
+ firstDifferenceIndex - otherIndex != partBlock.Length)
+ {
+ return false;
+ }
+
+ otherIndex = firstDifferenceIndex;
+ isFirstPart = false;
+ }
+
+ return otherIndex == other.Length;
+ }
+ }
+}
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/GuidHeap.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/GuidHeap.cs
new file mode 100644
index 0000000000..484dac901a
--- /dev/null
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/GuidHeap.cs
@@ -0,0 +1,30 @@
+// 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.Reflection.Internal;
+
+namespace System.Reflection.Metadata.Ecma335
+{
+ internal struct GuidHeap
+ {
+ internal readonly MemoryBlock Block;
+
+ public GuidHeap(MemoryBlock block)
+ {
+ this.Block = block;
+ }
+
+ internal Guid GetGuid(GuidHandle handle)
+ {
+ if (handle.IsNil)
+ {
+ return default(Guid);
+ }
+
+ // Metadata Spec: The Guid heap is an array of GUIDs, each 16 bytes wide.
+ // Its first element is numbered 1, its second 2, and so on.
+ return this.Block.PeekGuid((handle.Index - 1) * BlobUtilities.SizeOfGuid);
+ }
+ }
+}
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/Heaps.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/Heaps.cs
deleted file mode 100644
index ad7fa3ab1f..0000000000
--- a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/Heaps.cs
+++ /dev/null
@@ -1,633 +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.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-using System.Threading;
-using System.Reflection.Internal;
-
-namespace System.Reflection.Metadata.Ecma335
-{
- internal struct StringStreamReader
- {
- private static string[] s_virtualValues;
-
- internal readonly MemoryBlock Block;
-
- internal StringStreamReader(MemoryBlock block, MetadataKind metadataKind)
- {
- if (s_virtualValues == null && metadataKind != MetadataKind.Ecma335)
- {
- // Note:
- // Virtual values shall not contain surrogates, otherwise StartsWith might be inconsistent
- // when comparing to a text that ends with a high surrogate.
-
- var values = new string[(int)StringHandle.VirtualIndex.Count];
- values[(int)StringHandle.VirtualIndex.System_Runtime_WindowsRuntime] = "System.Runtime.WindowsRuntime";
- values[(int)StringHandle.VirtualIndex.System_Runtime] = "System.Runtime";
- values[(int)StringHandle.VirtualIndex.System_ObjectModel] = "System.ObjectModel";
- values[(int)StringHandle.VirtualIndex.System_Runtime_WindowsRuntime_UI_Xaml] = "System.Runtime.WindowsRuntime.UI.Xaml";
- values[(int)StringHandle.VirtualIndex.System_Runtime_InteropServices_WindowsRuntime] = "System.Runtime.InteropServices.WindowsRuntime";
- values[(int)StringHandle.VirtualIndex.System_Numerics_Vectors] = "System.Numerics.Vectors";
-
- values[(int)StringHandle.VirtualIndex.Dispose] = "Dispose";
-
- values[(int)StringHandle.VirtualIndex.AttributeTargets] = "AttributeTargets";
- values[(int)StringHandle.VirtualIndex.AttributeUsageAttribute] = "AttributeUsageAttribute";
- values[(int)StringHandle.VirtualIndex.Color] = "Color";
- values[(int)StringHandle.VirtualIndex.CornerRadius] = "CornerRadius";
- values[(int)StringHandle.VirtualIndex.DateTimeOffset] = "DateTimeOffset";
- values[(int)StringHandle.VirtualIndex.Duration] = "Duration";
- values[(int)StringHandle.VirtualIndex.DurationType] = "DurationType";
- values[(int)StringHandle.VirtualIndex.EventHandler1] = "EventHandler`1";
- values[(int)StringHandle.VirtualIndex.EventRegistrationToken] = "EventRegistrationToken";
- values[(int)StringHandle.VirtualIndex.Exception] = "Exception";
- values[(int)StringHandle.VirtualIndex.GeneratorPosition] = "GeneratorPosition";
- values[(int)StringHandle.VirtualIndex.GridLength] = "GridLength";
- values[(int)StringHandle.VirtualIndex.GridUnitType] = "GridUnitType";
- values[(int)StringHandle.VirtualIndex.ICommand] = "ICommand";
- values[(int)StringHandle.VirtualIndex.IDictionary2] = "IDictionary`2";
- values[(int)StringHandle.VirtualIndex.IDisposable] = "IDisposable";
- values[(int)StringHandle.VirtualIndex.IEnumerable] = "IEnumerable";
- values[(int)StringHandle.VirtualIndex.IEnumerable1] = "IEnumerable`1";
- values[(int)StringHandle.VirtualIndex.IList] = "IList";
- values[(int)StringHandle.VirtualIndex.IList1] = "IList`1";
- values[(int)StringHandle.VirtualIndex.INotifyCollectionChanged] = "INotifyCollectionChanged";
- values[(int)StringHandle.VirtualIndex.INotifyPropertyChanged] = "INotifyPropertyChanged";
- values[(int)StringHandle.VirtualIndex.IReadOnlyDictionary2] = "IReadOnlyDictionary`2";
- values[(int)StringHandle.VirtualIndex.IReadOnlyList1] = "IReadOnlyList`1";
- values[(int)StringHandle.VirtualIndex.KeyTime] = "KeyTime";
- values[(int)StringHandle.VirtualIndex.KeyValuePair2] = "KeyValuePair`2";
- values[(int)StringHandle.VirtualIndex.Matrix] = "Matrix";
- values[(int)StringHandle.VirtualIndex.Matrix3D] = "Matrix3D";
- values[(int)StringHandle.VirtualIndex.Matrix3x2] = "Matrix3x2";
- values[(int)StringHandle.VirtualIndex.Matrix4x4] = "Matrix4x4";
- values[(int)StringHandle.VirtualIndex.NotifyCollectionChangedAction] = "NotifyCollectionChangedAction";
- values[(int)StringHandle.VirtualIndex.NotifyCollectionChangedEventArgs] = "NotifyCollectionChangedEventArgs";
- values[(int)StringHandle.VirtualIndex.NotifyCollectionChangedEventHandler] = "NotifyCollectionChangedEventHandler";
- values[(int)StringHandle.VirtualIndex.Nullable1] = "Nullable`1";
- values[(int)StringHandle.VirtualIndex.Plane] = "Plane";
- values[(int)StringHandle.VirtualIndex.Point] = "Point";
- values[(int)StringHandle.VirtualIndex.PropertyChangedEventArgs] = "PropertyChangedEventArgs";
- values[(int)StringHandle.VirtualIndex.PropertyChangedEventHandler] = "PropertyChangedEventHandler";
- values[(int)StringHandle.VirtualIndex.Quaternion] = "Quaternion";
- values[(int)StringHandle.VirtualIndex.Rect] = "Rect";
- values[(int)StringHandle.VirtualIndex.RepeatBehavior] = "RepeatBehavior";
- values[(int)StringHandle.VirtualIndex.RepeatBehaviorType] = "RepeatBehaviorType";
- values[(int)StringHandle.VirtualIndex.Size] = "Size";
- values[(int)StringHandle.VirtualIndex.System] = "System";
- values[(int)StringHandle.VirtualIndex.System_Collections] = "System.Collections";
- values[(int)StringHandle.VirtualIndex.System_Collections_Generic] = "System.Collections.Generic";
- values[(int)StringHandle.VirtualIndex.System_Collections_Specialized] = "System.Collections.Specialized";
- values[(int)StringHandle.VirtualIndex.System_ComponentModel] = "System.ComponentModel";
- values[(int)StringHandle.VirtualIndex.System_Numerics] = "System.Numerics";
- values[(int)StringHandle.VirtualIndex.System_Windows_Input] = "System.Windows.Input";
- values[(int)StringHandle.VirtualIndex.Thickness] = "Thickness";
- values[(int)StringHandle.VirtualIndex.TimeSpan] = "TimeSpan";
- values[(int)StringHandle.VirtualIndex.Type] = "Type";
- values[(int)StringHandle.VirtualIndex.Uri] = "Uri";
- values[(int)StringHandle.VirtualIndex.Vector2] = "Vector2";
- values[(int)StringHandle.VirtualIndex.Vector3] = "Vector3";
- values[(int)StringHandle.VirtualIndex.Vector4] = "Vector4";
- values[(int)StringHandle.VirtualIndex.Windows_Foundation] = "Windows.Foundation";
- values[(int)StringHandle.VirtualIndex.Windows_UI] = "Windows.UI";
- values[(int)StringHandle.VirtualIndex.Windows_UI_Xaml] = "Windows.UI.Xaml";
- values[(int)StringHandle.VirtualIndex.Windows_UI_Xaml_Controls_Primitives] = "Windows.UI.Xaml.Controls.Primitives";
- values[(int)StringHandle.VirtualIndex.Windows_UI_Xaml_Media] = "Windows.UI.Xaml.Media";
- values[(int)StringHandle.VirtualIndex.Windows_UI_Xaml_Media_Animation] = "Windows.UI.Xaml.Media.Animation";
- values[(int)StringHandle.VirtualIndex.Windows_UI_Xaml_Media_Media3D] = "Windows.UI.Xaml.Media.Media3D";
-
- s_virtualValues = values;
- AssertFilled();
- }
-
- this.Block = TrimEnd(block);
- }
-
- [Conditional("DEBUG")]
- private static void AssertFilled()
- {
- for (int i = 0; i < s_virtualValues.Length; i++)
- {
- Debug.Assert(s_virtualValues[i] != null, "Missing virtual value for StringHandle.VirtualIndex." + (StringHandle.VirtualIndex)i);
- }
- }
-
- // Trims the alignment padding of the heap.
- // See StgStringPool::InitOnMem in ndp\clr\src\Utilcode\StgPool.cpp.
-
- // This is especially important for EnC.
- private static MemoryBlock TrimEnd(MemoryBlock block)
- {
- if (block.Length == 0)
- {
- return block;
- }
-
- int i = block.Length - 1;
- while (i >= 0 && block.PeekByte(i) == 0)
- {
- i--;
- }
-
- // this shouldn't happen in valid metadata:
- if (i == block.Length - 1)
- {
- return block;
- }
-
- // +1 for terminating \0
- return block.GetMemoryBlockAt(0, i + 2);
- }
-
-
- internal string GetVirtualValue(StringHandle.VirtualIndex index)
- {
- return s_virtualValues[(int)index];
- }
-
- internal string GetString(StringHandle handle, MetadataStringDecoder utf8Decoder)
- {
- byte[] prefix;
-
- if (handle.IsVirtual)
- {
- switch (handle.StringKind)
- {
- case StringKind.Virtual:
- return s_virtualValues[(int)handle.GetVirtualIndex()];
-
- case StringKind.WinRTPrefixed:
- prefix = MetadataReader.WinRTPrefix;
- break;
-
- default:
- Debug.Assert(false, "We should not get here");
- return null;
- }
- }
- else
- {
- prefix = null;
- }
-
- int bytesRead;
- char otherTerminator = handle.StringKind == StringKind.DotTerminated ? '.' : '\0';
- return this.Block.PeekUtf8NullTerminated(handle.GetHeapOffset(), prefix, utf8Decoder, out bytesRead, otherTerminator);
- }
-
- internal StringHandle GetNextHandle(StringHandle handle)
- {
- if (handle.IsVirtual)
- {
- return default(StringHandle);
- }
-
- int terminator = this.Block.IndexOf(0, handle.GetHeapOffset());
- if (terminator == -1 || terminator == Block.Length - 1)
- {
- return default(StringHandle);
- }
-
- return StringHandle.FromOffset(terminator + 1);
- }
-
- internal bool Equals(StringHandle handle, string value, MetadataStringDecoder utf8Decoder, bool ignoreCase)
- {
- Debug.Assert(value != null);
-
- if (handle.IsVirtual)
- {
- // TODO: This can allocate unnecessarily for <WinRT> prefixed handles.
- return string.Equals(GetString(handle, utf8Decoder), value, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
- }
-
- if (handle.IsNil)
- {
- return value.Length == 0;
- }
-
- char otherTerminator = handle.StringKind == StringKind.DotTerminated ? '.' : '\0';
- return this.Block.Utf8NullTerminatedEquals(handle.GetHeapOffset(), value, utf8Decoder, otherTerminator, ignoreCase);
- }
-
- internal bool StartsWith(StringHandle handle, string value, MetadataStringDecoder utf8Decoder, bool ignoreCase)
- {
- Debug.Assert(value != null);
-
- if (handle.IsVirtual)
- {
- // TODO: This can allocate unnecessarily for <WinRT> prefixed handles.
- return GetString(handle, utf8Decoder).StartsWith(value, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
- }
-
- if (handle.IsNil)
- {
- return value.Length == 0;
- }
-
- char otherTerminator = handle.StringKind == StringKind.DotTerminated ? '.' : '\0';
- return this.Block.Utf8NullTerminatedStartsWith(handle.GetHeapOffset(), value, utf8Decoder, otherTerminator, ignoreCase);
- }
-
- /// <summary>
- /// Returns true if the given raw (non-virtual) handle represents the same string as given ASCII string.
- /// </summary>
- internal bool EqualsRaw(StringHandle rawHandle, string asciiString)
- {
- Debug.Assert(!rawHandle.IsVirtual);
- Debug.Assert(rawHandle.StringKind != StringKind.DotTerminated, "Not supported");
- return this.Block.CompareUtf8NullTerminatedStringWithAsciiString(rawHandle.GetHeapOffset(), asciiString) == 0;
- }
-
- /// <summary>
- /// Returns the heap index of the given ASCII character or -1 if not found prior null terminator or end of heap.
- /// </summary>
- internal int IndexOfRaw(int startIndex, char asciiChar)
- {
- Debug.Assert(asciiChar != 0 && asciiChar <= 0x7f);
- return this.Block.Utf8NullTerminatedOffsetOfAsciiChar(startIndex, asciiChar);
- }
-
- /// <summary>
- /// Returns true if the given raw (non-virtual) handle represents a string that starts with given ASCII prefix.
- /// </summary>
- internal bool StartsWithRaw(StringHandle rawHandle, string asciiPrefix)
- {
- Debug.Assert(!rawHandle.IsVirtual);
- Debug.Assert(rawHandle.StringKind != StringKind.DotTerminated, "Not supported");
- return this.Block.Utf8NullTerminatedStringStartsWithAsciiPrefix(rawHandle.GetHeapOffset(), asciiPrefix);
- }
-
- /// <summary>
- /// Equivalent to Array.BinarySearch, searches for given raw (non-virtual) handle in given array of ASCII strings.
- /// </summary>
- internal int BinarySearchRaw(string[] asciiKeys, StringHandle rawHandle)
- {
- Debug.Assert(!rawHandle.IsVirtual);
- Debug.Assert(rawHandle.StringKind != StringKind.DotTerminated, "Not supported");
- return this.Block.BinarySearch(asciiKeys, rawHandle.GetHeapOffset());
- }
- }
-
- internal unsafe struct BlobStreamReader
- {
- private struct VirtualHeapBlob
- {
- public readonly GCHandle Pinned;
- public readonly byte[] Array;
-
- public VirtualHeapBlob(byte[] array)
- {
- Pinned = GCHandle.Alloc(array, GCHandleType.Pinned);
- Array = array;
- }
- }
-
- // Container for virtual heap blobs that unpins handles on finalization.
- // This is not handled via dispose because the only resource is managed memory.
- private sealed class VirtualHeapBlobTable
- {
- public readonly Dictionary<BlobHandle, VirtualHeapBlob> Table;
-
- public VirtualHeapBlobTable()
- {
- Table = new Dictionary<BlobHandle, VirtualHeapBlob>();
- }
-
- ~VirtualHeapBlobTable()
- {
- if (Table != null)
- {
- foreach (var blob in Table.Values)
- {
- blob.Pinned.Free();
- }
- }
- }
- }
-
- // Since the number of virtual blobs we need is small (the number of attribute classes in .winmd files)
- // we can create a pinned handle for each of them.
- // If we needed many more blobs we could create and pin a single byte[] and allocate blobs there.
- private VirtualHeapBlobTable _lazyVirtualHeapBlobs;
- private static byte[][] s_virtualHeapBlobs;
-
- internal readonly MemoryBlock Block;
-
- internal BlobStreamReader(MemoryBlock block, MetadataKind metadataKind)
- {
- _lazyVirtualHeapBlobs = null;
- this.Block = block;
-
- if (s_virtualHeapBlobs == null && metadataKind != MetadataKind.Ecma335)
- {
- var blobs = new byte[(int)BlobHandle.VirtualIndex.Count][];
-
- blobs[(int)BlobHandle.VirtualIndex.ContractPublicKeyToken] = new byte[]
- {
- 0xB0, 0x3F, 0x5F, 0x7F, 0x11, 0xD5, 0x0A, 0x3A
- };
-
- blobs[(int)BlobHandle.VirtualIndex.ContractPublicKey] = new byte[]
- {
- 0x00, 0x24, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x00,
- 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x31, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
- 0x07, 0xD1, 0xFA, 0x57, 0xC4, 0xAE, 0xD9, 0xF0, 0xA3, 0x2E, 0x84, 0xAA, 0x0F, 0xAE, 0xFD, 0x0D,
- 0xE9, 0xE8, 0xFD, 0x6A, 0xEC, 0x8F, 0x87, 0xFB, 0x03, 0x76, 0x6C, 0x83, 0x4C, 0x99, 0x92, 0x1E,
- 0xB2, 0x3B, 0xE7, 0x9A, 0xD9, 0xD5, 0xDC, 0xC1, 0xDD, 0x9A, 0xD2, 0x36, 0x13, 0x21, 0x02, 0x90,
- 0x0B, 0x72, 0x3C, 0xF9, 0x80, 0x95, 0x7F, 0xC4, 0xE1, 0x77, 0x10, 0x8F, 0xC6, 0x07, 0x77, 0x4F,
- 0x29, 0xE8, 0x32, 0x0E, 0x92, 0xEA, 0x05, 0xEC, 0xE4, 0xE8, 0x21, 0xC0, 0xA5, 0xEF, 0xE8, 0xF1,
- 0x64, 0x5C, 0x4C, 0x0C, 0x93, 0xC1, 0xAB, 0x99, 0x28, 0x5D, 0x62, 0x2C, 0xAA, 0x65, 0x2C, 0x1D,
- 0xFA, 0xD6, 0x3D, 0x74, 0x5D, 0x6F, 0x2D, 0xE5, 0xF1, 0x7E, 0x5E, 0xAF, 0x0F, 0xC4, 0x96, 0x3D,
- 0x26, 0x1C, 0x8A, 0x12, 0x43, 0x65, 0x18, 0x20, 0x6D, 0xC0, 0x93, 0x34, 0x4D, 0x5A, 0xD2, 0x93
- };
-
- blobs[(int)BlobHandle.VirtualIndex.AttributeUsage_AllowSingle] = new byte[]
- {
- // preamble:
- 0x01, 0x00,
- // target (template parameter):
- 0x00, 0x00, 0x00, 0x00,
- // named arg count:
- 0x01, 0x00,
- // SERIALIZATION_TYPE_PROPERTY
- 0x54,
- // ELEMENT_TYPE_BOOLEAN
- 0x02,
- // "AllowMultiple".Length
- 0x0D,
- // "AllowMultiple"
- 0x41, 0x6C, 0x6C, 0x6F, 0x77, 0x4D, 0x75, 0x6C, 0x74, 0x69, 0x70, 0x6C, 0x65,
- // false
- 0x00
- };
-
- blobs[(int)BlobHandle.VirtualIndex.AttributeUsage_AllowMultiple] = new byte[]
- {
- // preamble:
- 0x01, 0x00,
- // target (template parameter):
- 0x00, 0x00, 0x00, 0x00,
- // named arg count:
- 0x01, 0x00,
- // SERIALIZATION_TYPE_PROPERTY
- 0x54,
- // ELEMENT_TYPE_BOOLEAN
- 0x02,
- // "AllowMultiple".Length
- 0x0D,
- // "AllowMultiple"
- 0x41, 0x6C, 0x6C, 0x6F, 0x77, 0x4D, 0x75, 0x6C, 0x74, 0x69, 0x70, 0x6C, 0x65,
- // true
- 0x01
- };
-
- s_virtualHeapBlobs = blobs;
- }
- }
-
- internal byte[] GetBytes(BlobHandle handle)
- {
- if (handle.IsVirtual)
- {
- // consider: if we returned an ImmutableArray we wouldn't need to copy
- return GetVirtualBlobArray(handle, unique: true);
- }
-
- int offset = handle.GetHeapOffset();
- int bytesRead;
- int numberOfBytes = this.Block.PeekCompressedInteger(offset, out bytesRead);
- if (numberOfBytes == BlobReader.InvalidCompressedInteger)
- {
- return EmptyArray<byte>.Instance;
- }
-
- return this.Block.PeekBytes(offset + bytesRead, numberOfBytes);
- }
-
- internal MemoryBlock GetMemoryBlock(BlobHandle handle)
- {
- if (handle.IsVirtual)
- {
- if (_lazyVirtualHeapBlobs == null)
- {
- Interlocked.CompareExchange(ref _lazyVirtualHeapBlobs, new VirtualHeapBlobTable(), null);
- }
-
- int index = (int)handle.GetVirtualIndex();
- int length = s_virtualHeapBlobs[index].Length;
-
- VirtualHeapBlob virtualBlob;
- lock (_lazyVirtualHeapBlobs)
- {
- if (!_lazyVirtualHeapBlobs.Table.TryGetValue(handle, out virtualBlob))
- {
- virtualBlob = new VirtualHeapBlob(GetVirtualBlobArray(handle, unique: false));
- _lazyVirtualHeapBlobs.Table.Add(handle, virtualBlob);
- }
- }
-
- return new MemoryBlock((byte*)virtualBlob.Pinned.AddrOfPinnedObject(), length);
- }
-
- int offset, size;
- Block.PeekHeapValueOffsetAndSize(handle.GetHeapOffset(), out offset, out size);
- return this.Block.GetMemoryBlockAt(offset, size);
- }
-
- internal BlobReader GetBlobReader(BlobHandle handle)
- {
- return new BlobReader(GetMemoryBlock(handle));
- }
-
- internal BlobHandle GetNextHandle(BlobHandle handle)
- {
- if (handle.IsVirtual)
- {
- return default(BlobHandle);
- }
-
- int offset, size;
- if (!Block.PeekHeapValueOffsetAndSize(handle.GetHeapOffset(), out offset, out size))
- {
- return default(BlobHandle);
- }
-
- int nextIndex = offset + size;
- if (nextIndex >= Block.Length)
- {
- return default(BlobHandle);
- }
-
- return BlobHandle.FromOffset(nextIndex);
- }
-
- internal byte[] GetVirtualBlobArray(BlobHandle handle, bool unique)
- {
- BlobHandle.VirtualIndex index = handle.GetVirtualIndex();
- byte[] result = s_virtualHeapBlobs[(int)index];
-
- switch (index)
- {
- case BlobHandle.VirtualIndex.AttributeUsage_AllowMultiple:
- case BlobHandle.VirtualIndex.AttributeUsage_AllowSingle:
- result = (byte[])result.Clone();
- handle.SubstituteTemplateParameters(result);
- break;
-
- default:
- if (unique)
- {
- result = (byte[])result.Clone();
- }
- break;
- }
-
- return result;
- }
-
- public string GetDocumentName(DocumentNameBlobHandle handle)
- {
- var blobReader = GetBlobReader(handle);
-
- // Spec: separator is an ASCII encoded character in range [0x01, 0x7F], or byte 0 to represent an empty separator.
- int separator = blobReader.ReadByte();
- if (separator > 0x7f)
- {
- throw new BadImageFormatException(string.Format(SR.InvalidDocumentName, separator));
- }
-
- var pooledBuilder = PooledStringBuilder.GetInstance();
- var builder = pooledBuilder.Builder;
- bool isFirstPart = true;
- while (blobReader.RemainingBytes > 0)
- {
- if (separator != 0 && !isFirstPart)
- {
- builder.Append((char)separator);
- }
-
- var partReader = GetBlobReader(blobReader.ReadBlobHandle());
-
- // TODO: avoid allocating temp string (https://github.com/dotnet/corefx/issues/2102)
- builder.Append(partReader.ReadUTF8(partReader.Length));
- isFirstPart = false;
- }
-
- return pooledBuilder.ToStringAndFree();
- }
-
- internal bool DocumentNameEquals(DocumentNameBlobHandle handle, string other, bool ignoreCase)
- {
- var blobReader = GetBlobReader(handle);
-
- // Spec: separator is an ASCII encoded character in range [0x01, 0x7F], or byte 0 to represent an empty separator.
- int separator = blobReader.ReadByte();
- if (separator > 0x7f)
- {
- return false;
- }
-
- int ignoreCaseMask = StringUtils.IgnoreCaseMask(ignoreCase);
- int otherIndex = 0;
- bool isFirstPart = true;
- while (blobReader.RemainingBytes > 0)
- {
- if (separator != 0 && !isFirstPart)
- {
- if (otherIndex == other.Length || !StringUtils.IsEqualAscii(other[otherIndex], separator, ignoreCaseMask))
- {
- return false;
- }
-
- otherIndex++;
- }
-
- var partBlock = GetMemoryBlock(blobReader.ReadBlobHandle());
-
- int firstDifferenceIndex;
- var result = partBlock.Utf8NullTerminatedFastCompare(0, other, otherIndex, out firstDifferenceIndex, terminator: '\0', ignoreCase: ignoreCase);
- if (result == MemoryBlock.FastComparisonResult.Inconclusive)
- {
- return GetDocumentName(handle).Equals(other, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
- }
-
- if (result == MemoryBlock.FastComparisonResult.Unequal ||
- firstDifferenceIndex - otherIndex != partBlock.Length)
- {
- return false;
- }
-
- otherIndex = firstDifferenceIndex;
- isFirstPart = false;
- }
-
- return otherIndex == other.Length;
- }
- }
-
- internal struct GuidStreamReader
- {
- internal readonly MemoryBlock Block;
-
- public GuidStreamReader(MemoryBlock block)
- {
- this.Block = block;
- }
-
- internal Guid GetGuid(GuidHandle handle)
- {
- if (handle.IsNil)
- {
- return default(Guid);
- }
-
- // Metadata Spec: The Guid heap is an array of GUIDs, each 16 bytes wide.
- // Its first element is numbered 1, its second 2, and so on.
- return this.Block.PeekGuid((handle.Index - 1) * BlobUtilities.SizeOfGuid);
- }
- }
-
- internal struct UserStringStreamReader
- {
- internal readonly MemoryBlock Block;
-
- public UserStringStreamReader(MemoryBlock block)
- {
- this.Block = block;
- }
-
- internal string GetString(UserStringHandle handle)
- {
- int offset, size;
- if (!Block.PeekHeapValueOffsetAndSize(handle.GetHeapOffset(), out offset, out size))
- {
- return string.Empty;
- }
-
- // Spec: Furthermore, there is an additional terminal byte (so all byte counts are odd, not even).
- // The size in the blob header is the length of the string in bytes + 1.
- return this.Block.PeekUtf16(offset, size & ~1);
- }
-
- internal UserStringHandle GetNextHandle(UserStringHandle handle)
- {
- int offset, size;
- if (!Block.PeekHeapValueOffsetAndSize(handle.GetHeapOffset(), out offset, out size))
- {
- return default(UserStringHandle);
- }
-
- int nextIndex = offset + size;
- if (nextIndex >= Block.Length)
- {
- return default(UserStringHandle);
- }
-
- return UserStringHandle.FromOffset(nextIndex);
- }
- }
-}
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/NamespaceCache.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/NamespaceCache.cs
index 0f0b8ac666..72125d9cf7 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/NamespaceCache.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/NamespaceCache.cs
@@ -82,7 +82,7 @@ namespace System.Reflection.Metadata.Ecma335
int currentSegment = 0;
while (currentSegment < segmentIndex)
{
- int currentIndex = _metadataReader.StringStream.IndexOfRaw(lastFoundIndex + 1, '.');
+ int currentIndex = _metadataReader.StringHeap.IndexOfRaw(lastFoundIndex + 1, '.');
if (currentIndex == -1)
{
break;
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/StringHeap.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/StringHeap.cs
new file mode 100644
index 0000000000..d23953839b
--- /dev/null
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/StringHeap.cs
@@ -0,0 +1,342 @@
+// 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.Diagnostics;
+using System.Reflection.Internal;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading;
+
+namespace System.Reflection.Metadata.Ecma335
+{
+ internal struct StringHeap
+ {
+ private static string[] s_virtualValues;
+
+ internal readonly MemoryBlock Block;
+ private VirtualHeap _lazyVirtualHeap;
+
+ internal StringHeap(MemoryBlock block, MetadataKind metadataKind)
+ {
+ _lazyVirtualHeap = null;
+
+ if (s_virtualValues == null && metadataKind != MetadataKind.Ecma335)
+ {
+ // Note:
+ // Virtual values shall not contain surrogates, otherwise StartsWith might be inconsistent
+ // when comparing to a text that ends with a high surrogate.
+
+ var values = new string[(int)StringHandle.VirtualIndex.Count];
+ values[(int)StringHandle.VirtualIndex.System_Runtime_WindowsRuntime] = "System.Runtime.WindowsRuntime";
+ values[(int)StringHandle.VirtualIndex.System_Runtime] = "System.Runtime";
+ values[(int)StringHandle.VirtualIndex.System_ObjectModel] = "System.ObjectModel";
+ values[(int)StringHandle.VirtualIndex.System_Runtime_WindowsRuntime_UI_Xaml] = "System.Runtime.WindowsRuntime.UI.Xaml";
+ values[(int)StringHandle.VirtualIndex.System_Runtime_InteropServices_WindowsRuntime] = "System.Runtime.InteropServices.WindowsRuntime";
+ values[(int)StringHandle.VirtualIndex.System_Numerics_Vectors] = "System.Numerics.Vectors";
+
+ values[(int)StringHandle.VirtualIndex.Dispose] = "Dispose";
+
+ values[(int)StringHandle.VirtualIndex.AttributeTargets] = "AttributeTargets";
+ values[(int)StringHandle.VirtualIndex.AttributeUsageAttribute] = "AttributeUsageAttribute";
+ values[(int)StringHandle.VirtualIndex.Color] = "Color";
+ values[(int)StringHandle.VirtualIndex.CornerRadius] = "CornerRadius";
+ values[(int)StringHandle.VirtualIndex.DateTimeOffset] = "DateTimeOffset";
+ values[(int)StringHandle.VirtualIndex.Duration] = "Duration";
+ values[(int)StringHandle.VirtualIndex.DurationType] = "DurationType";
+ values[(int)StringHandle.VirtualIndex.EventHandler1] = "EventHandler`1";
+ values[(int)StringHandle.VirtualIndex.EventRegistrationToken] = "EventRegistrationToken";
+ values[(int)StringHandle.VirtualIndex.Exception] = "Exception";
+ values[(int)StringHandle.VirtualIndex.GeneratorPosition] = "GeneratorPosition";
+ values[(int)StringHandle.VirtualIndex.GridLength] = "GridLength";
+ values[(int)StringHandle.VirtualIndex.GridUnitType] = "GridUnitType";
+ values[(int)StringHandle.VirtualIndex.ICommand] = "ICommand";
+ values[(int)StringHandle.VirtualIndex.IDictionary2] = "IDictionary`2";
+ values[(int)StringHandle.VirtualIndex.IDisposable] = "IDisposable";
+ values[(int)StringHandle.VirtualIndex.IEnumerable] = "IEnumerable";
+ values[(int)StringHandle.VirtualIndex.IEnumerable1] = "IEnumerable`1";
+ values[(int)StringHandle.VirtualIndex.IList] = "IList";
+ values[(int)StringHandle.VirtualIndex.IList1] = "IList`1";
+ values[(int)StringHandle.VirtualIndex.INotifyCollectionChanged] = "INotifyCollectionChanged";
+ values[(int)StringHandle.VirtualIndex.INotifyPropertyChanged] = "INotifyPropertyChanged";
+ values[(int)StringHandle.VirtualIndex.IReadOnlyDictionary2] = "IReadOnlyDictionary`2";
+ values[(int)StringHandle.VirtualIndex.IReadOnlyList1] = "IReadOnlyList`1";
+ values[(int)StringHandle.VirtualIndex.KeyTime] = "KeyTime";
+ values[(int)StringHandle.VirtualIndex.KeyValuePair2] = "KeyValuePair`2";
+ values[(int)StringHandle.VirtualIndex.Matrix] = "Matrix";
+ values[(int)StringHandle.VirtualIndex.Matrix3D] = "Matrix3D";
+ values[(int)StringHandle.VirtualIndex.Matrix3x2] = "Matrix3x2";
+ values[(int)StringHandle.VirtualIndex.Matrix4x4] = "Matrix4x4";
+ values[(int)StringHandle.VirtualIndex.NotifyCollectionChangedAction] = "NotifyCollectionChangedAction";
+ values[(int)StringHandle.VirtualIndex.NotifyCollectionChangedEventArgs] = "NotifyCollectionChangedEventArgs";
+ values[(int)StringHandle.VirtualIndex.NotifyCollectionChangedEventHandler] = "NotifyCollectionChangedEventHandler";
+ values[(int)StringHandle.VirtualIndex.Nullable1] = "Nullable`1";
+ values[(int)StringHandle.VirtualIndex.Plane] = "Plane";
+ values[(int)StringHandle.VirtualIndex.Point] = "Point";
+ values[(int)StringHandle.VirtualIndex.PropertyChangedEventArgs] = "PropertyChangedEventArgs";
+ values[(int)StringHandle.VirtualIndex.PropertyChangedEventHandler] = "PropertyChangedEventHandler";
+ values[(int)StringHandle.VirtualIndex.Quaternion] = "Quaternion";
+ values[(int)StringHandle.VirtualIndex.Rect] = "Rect";
+ values[(int)StringHandle.VirtualIndex.RepeatBehavior] = "RepeatBehavior";
+ values[(int)StringHandle.VirtualIndex.RepeatBehaviorType] = "RepeatBehaviorType";
+ values[(int)StringHandle.VirtualIndex.Size] = "Size";
+ values[(int)StringHandle.VirtualIndex.System] = "System";
+ values[(int)StringHandle.VirtualIndex.System_Collections] = "System.Collections";
+ values[(int)StringHandle.VirtualIndex.System_Collections_Generic] = "System.Collections.Generic";
+ values[(int)StringHandle.VirtualIndex.System_Collections_Specialized] = "System.Collections.Specialized";
+ values[(int)StringHandle.VirtualIndex.System_ComponentModel] = "System.ComponentModel";
+ values[(int)StringHandle.VirtualIndex.System_Numerics] = "System.Numerics";
+ values[(int)StringHandle.VirtualIndex.System_Windows_Input] = "System.Windows.Input";
+ values[(int)StringHandle.VirtualIndex.Thickness] = "Thickness";
+ values[(int)StringHandle.VirtualIndex.TimeSpan] = "TimeSpan";
+ values[(int)StringHandle.VirtualIndex.Type] = "Type";
+ values[(int)StringHandle.VirtualIndex.Uri] = "Uri";
+ values[(int)StringHandle.VirtualIndex.Vector2] = "Vector2";
+ values[(int)StringHandle.VirtualIndex.Vector3] = "Vector3";
+ values[(int)StringHandle.VirtualIndex.Vector4] = "Vector4";
+ values[(int)StringHandle.VirtualIndex.Windows_Foundation] = "Windows.Foundation";
+ values[(int)StringHandle.VirtualIndex.Windows_UI] = "Windows.UI";
+ values[(int)StringHandle.VirtualIndex.Windows_UI_Xaml] = "Windows.UI.Xaml";
+ values[(int)StringHandle.VirtualIndex.Windows_UI_Xaml_Controls_Primitives] = "Windows.UI.Xaml.Controls.Primitives";
+ values[(int)StringHandle.VirtualIndex.Windows_UI_Xaml_Media] = "Windows.UI.Xaml.Media";
+ values[(int)StringHandle.VirtualIndex.Windows_UI_Xaml_Media_Animation] = "Windows.UI.Xaml.Media.Animation";
+ values[(int)StringHandle.VirtualIndex.Windows_UI_Xaml_Media_Media3D] = "Windows.UI.Xaml.Media.Media3D";
+
+ s_virtualValues = values;
+ AssertFilled();
+ }
+
+ this.Block = TrimEnd(block);
+ }
+
+ [Conditional("DEBUG")]
+ private static void AssertFilled()
+ {
+ for (int i = 0; i < s_virtualValues.Length; i++)
+ {
+ Debug.Assert(s_virtualValues[i] != null, "Missing virtual value for StringHandle.VirtualIndex." + (StringHandle.VirtualIndex)i);
+ }
+ }
+
+ // Trims the alignment padding of the heap.
+ // See StgStringPool::InitOnMem in ndp\clr\src\Utilcode\StgPool.cpp.
+
+ // This is especially important for EnC.
+ private static MemoryBlock TrimEnd(MemoryBlock block)
+ {
+ if (block.Length == 0)
+ {
+ return block;
+ }
+
+ int i = block.Length - 1;
+ while (i >= 0 && block.PeekByte(i) == 0)
+ {
+ i--;
+ }
+
+ // this shouldn't happen in valid metadata:
+ if (i == block.Length - 1)
+ {
+ return block;
+ }
+
+ // +1 for terminating \0
+ return block.GetMemoryBlockAt(0, i + 2);
+ }
+
+ internal string GetString(StringHandle handle, MetadataStringDecoder utf8Decoder)
+ {
+ return handle.IsVirtual ? GetVirtualHandleString(handle, utf8Decoder) : GetNonVirtualString(handle, utf8Decoder, prefixOpt: null);
+ }
+
+ internal MemoryBlock GetMemoryBlock(StringHandle handle)
+ {
+ return handle.IsVirtual ? GetVirtualHandleMemoryBlock(handle) : GetNonVirtualStringMemoryBlock(handle);
+ }
+
+ internal static string GetVirtualString(StringHandle.VirtualIndex index)
+ {
+ return s_virtualValues[(int)index];
+ }
+
+ private string GetNonVirtualString(StringHandle handle, MetadataStringDecoder utf8Decoder, byte[] prefixOpt)
+ {
+ Debug.Assert(handle.StringKind != StringKind.Virtual);
+
+ int bytesRead;
+ char otherTerminator = handle.StringKind == StringKind.DotTerminated ? '.' : '\0';
+ return Block.PeekUtf8NullTerminated(handle.GetHeapOffset(), prefixOpt, utf8Decoder, out bytesRead, otherTerminator);
+ }
+
+ private unsafe MemoryBlock GetNonVirtualStringMemoryBlock(StringHandle handle)
+ {
+ Debug.Assert(handle.StringKind != StringKind.Virtual);
+
+ int bytesRead;
+ char otherTerminator = handle.StringKind == StringKind.DotTerminated ? '.' : '\0';
+ int offset = handle.GetHeapOffset();
+ int length = Block.GetUtf8NullTerminatedLength(offset, out bytesRead, otherTerminator);
+
+ return new MemoryBlock(Block.Pointer + offset, length);
+ }
+
+ private unsafe byte[] GetNonVirtualStringBytes(StringHandle handle, byte[] prefix)
+ {
+ Debug.Assert(handle.StringKind != StringKind.Virtual);
+
+ var block = GetNonVirtualStringMemoryBlock(handle);
+ var bytes = new byte[prefix.Length + block.Length];
+ Buffer.BlockCopy(prefix, 0, bytes, 0, prefix.Length);
+ Marshal.Copy((IntPtr)block.Pointer, bytes, prefix.Length, block.Length);
+ return bytes;
+ }
+
+ private string GetVirtualHandleString(StringHandle handle, MetadataStringDecoder utf8Decoder)
+ {
+ Debug.Assert(handle.IsVirtual);
+
+ switch (handle.StringKind)
+ {
+ case StringKind.Virtual:
+ return GetVirtualString(handle.GetVirtualIndex());
+
+ case StringKind.WinRTPrefixed:
+ return GetNonVirtualString(handle, utf8Decoder, MetadataReader.WinRTPrefix);
+ }
+
+ throw ExceptionUtilities.UnexpectedValue(handle.StringKind);
+ }
+
+ private MemoryBlock GetVirtualHandleMemoryBlock(StringHandle handle)
+ {
+ Debug.Assert(handle.IsVirtual);
+ var heap = VirtualHeap.GetOrCreateVirtualHeap(ref _lazyVirtualHeap);
+
+ VirtualHeapBlob virtualBlob;
+ lock (heap)
+ {
+ if (!heap.Table.TryGetValue(handle.RawValue, out virtualBlob))
+ {
+ byte[] bytes;
+ switch (handle.StringKind)
+ {
+ case StringKind.Virtual:
+ bytes = Encoding.UTF8.GetBytes(GetVirtualString(handle.GetVirtualIndex()));
+ break;
+
+ case StringKind.WinRTPrefixed:
+ bytes = GetNonVirtualStringBytes(handle, MetadataReader.WinRTPrefix);
+ break;
+
+ default:
+ throw ExceptionUtilities.UnexpectedValue(handle.StringKind);
+ }
+
+ virtualBlob = new VirtualHeapBlob(bytes);
+ heap.Table.Add(handle.RawValue, virtualBlob);
+ }
+ }
+
+ return virtualBlob.GetMemoryBlock();
+ }
+
+ internal BlobReader GetBlobReader(StringHandle handle)
+ {
+ return new BlobReader(GetMemoryBlock(handle));
+ }
+
+ internal StringHandle GetNextHandle(StringHandle handle)
+ {
+ if (handle.IsVirtual)
+ {
+ return default(StringHandle);
+ }
+
+ int terminator = this.Block.IndexOf(0, handle.GetHeapOffset());
+ if (terminator == -1 || terminator == Block.Length - 1)
+ {
+ return default(StringHandle);
+ }
+
+ return StringHandle.FromOffset(terminator + 1);
+ }
+
+ internal bool Equals(StringHandle handle, string value, MetadataStringDecoder utf8Decoder, bool ignoreCase)
+ {
+ Debug.Assert(value != null);
+
+ if (handle.IsVirtual)
+ {
+ // TODO: This can allocate unnecessarily for <WinRT> prefixed handles.
+ return string.Equals(GetString(handle, utf8Decoder), value, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
+ }
+
+ if (handle.IsNil)
+ {
+ return value.Length == 0;
+ }
+
+ char otherTerminator = handle.StringKind == StringKind.DotTerminated ? '.' : '\0';
+ return this.Block.Utf8NullTerminatedEquals(handle.GetHeapOffset(), value, utf8Decoder, otherTerminator, ignoreCase);
+ }
+
+ internal bool StartsWith(StringHandle handle, string value, MetadataStringDecoder utf8Decoder, bool ignoreCase)
+ {
+ Debug.Assert(value != null);
+
+ if (handle.IsVirtual)
+ {
+ // TODO: This can allocate unnecessarily for <WinRT> prefixed handles.
+ return GetString(handle, utf8Decoder).StartsWith(value, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
+ }
+
+ if (handle.IsNil)
+ {
+ return value.Length == 0;
+ }
+
+ char otherTerminator = handle.StringKind == StringKind.DotTerminated ? '.' : '\0';
+ return this.Block.Utf8NullTerminatedStartsWith(handle.GetHeapOffset(), value, utf8Decoder, otherTerminator, ignoreCase);
+ }
+
+ /// <summary>
+ /// Returns true if the given raw (non-virtual) handle represents the same string as given ASCII string.
+ /// </summary>
+ internal bool EqualsRaw(StringHandle rawHandle, string asciiString)
+ {
+ Debug.Assert(!rawHandle.IsVirtual);
+ Debug.Assert(rawHandle.StringKind != StringKind.DotTerminated, "Not supported");
+ return this.Block.CompareUtf8NullTerminatedStringWithAsciiString(rawHandle.GetHeapOffset(), asciiString) == 0;
+ }
+
+ /// <summary>
+ /// Returns the heap index of the given ASCII character or -1 if not found prior null terminator or end of heap.
+ /// </summary>
+ internal int IndexOfRaw(int startIndex, char asciiChar)
+ {
+ Debug.Assert(asciiChar != 0 && asciiChar <= 0x7f);
+ return this.Block.Utf8NullTerminatedOffsetOfAsciiChar(startIndex, asciiChar);
+ }
+
+ /// <summary>
+ /// Returns true if the given raw (non-virtual) handle represents a string that starts with given ASCII prefix.
+ /// </summary>
+ internal bool StartsWithRaw(StringHandle rawHandle, string asciiPrefix)
+ {
+ Debug.Assert(!rawHandle.IsVirtual);
+ Debug.Assert(rawHandle.StringKind != StringKind.DotTerminated, "Not supported");
+ return this.Block.Utf8NullTerminatedStringStartsWithAsciiPrefix(rawHandle.GetHeapOffset(), asciiPrefix);
+ }
+
+ /// <summary>
+ /// Equivalent to Array.BinarySearch, searches for given raw (non-virtual) handle in given array of ASCII strings.
+ /// </summary>
+ internal int BinarySearchRaw(string[] asciiKeys, StringHandle rawHandle)
+ {
+ Debug.Assert(!rawHandle.IsVirtual);
+ Debug.Assert(rawHandle.StringKind != StringKind.DotTerminated, "Not supported");
+ return this.Block.BinarySearch(asciiKeys, rawHandle.GetHeapOffset());
+ }
+ }
+}
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/UserStringHeap.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/UserStringHeap.cs
new file mode 100644
index 0000000000..ae97afccb5
--- /dev/null
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/UserStringHeap.cs
@@ -0,0 +1,48 @@
+// 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.Reflection.Internal;
+
+namespace System.Reflection.Metadata.Ecma335
+{
+ internal struct UserStringHeap
+ {
+ internal readonly MemoryBlock Block;
+
+ public UserStringHeap(MemoryBlock block)
+ {
+ this.Block = block;
+ }
+
+ internal string GetString(UserStringHandle handle)
+ {
+ int offset, size;
+ if (!Block.PeekHeapValueOffsetAndSize(handle.GetHeapOffset(), out offset, out size))
+ {
+ return string.Empty;
+ }
+
+ // Spec: Furthermore, there is an additional terminal byte (so all byte counts are odd, not even).
+ // The size in the blob header is the length of the string in bytes + 1.
+ return Block.PeekUtf16(offset, size & ~1);
+ }
+
+ internal UserStringHandle GetNextHandle(UserStringHandle handle)
+ {
+ int offset, size;
+ if (!Block.PeekHeapValueOffsetAndSize(handle.GetHeapOffset(), out offset, out size))
+ {
+ return default(UserStringHandle);
+ }
+
+ int nextIndex = offset + size;
+ if (nextIndex >= Block.Length)
+ {
+ return default(UserStringHandle);
+ }
+
+ return UserStringHandle.FromOffset(nextIndex);
+ }
+ }
+}
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/VirtualHeap.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/VirtualHeap.cs
new file mode 100644
index 0000000000..48e7e8a714
--- /dev/null
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/VirtualHeap.cs
@@ -0,0 +1,71 @@
+// 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.Collections.Generic;
+using System.Reflection.Internal;
+using System.Runtime.InteropServices;
+using System.Threading;
+
+namespace System.Reflection.Metadata.Ecma335
+{
+ internal struct VirtualHeapBlob
+ {
+ private GCHandle _pinned;
+ private readonly byte[] _array;
+
+ public VirtualHeapBlob(byte[] array)
+ {
+ _pinned = GCHandle.Alloc(array, GCHandleType.Pinned);
+ _array = array;
+ }
+
+ public unsafe MemoryBlock GetMemoryBlock()
+ {
+ return new MemoryBlock((byte*)_pinned.AddrOfPinnedObject(), _array.Length);
+ }
+
+ public void Free()
+ {
+ _pinned.Free();
+ }
+ }
+
+ // Container for virtual heap blobs that unpins handles on finalization.
+ // This is not handled via dispose because the only resource is managed memory
+ // and we don't have user visible disposable object that could own this memory.
+ //
+ // Since the number of virtual blobs we need is small (the number of attribute classes in .winmd files)
+ // we can create a pinned handle for each of them.
+ // If we needed many more blobs we could create and pin a single byte[] and allocate blobs there.
+ internal sealed class VirtualHeap
+ {
+ public readonly Dictionary<uint, VirtualHeapBlob> Table;
+
+ private VirtualHeap()
+ {
+ Table = new Dictionary<uint, VirtualHeapBlob>();
+ }
+
+ ~VirtualHeap()
+ {
+ if (Table != null)
+ {
+ foreach (var blob in Table.Values)
+ {
+ blob.Free();
+ }
+ }
+ }
+
+ internal static VirtualHeap GetOrCreateVirtualHeap(ref VirtualHeap lazyHeap)
+ {
+ if (lazyHeap == null)
+ {
+ Interlocked.CompareExchange(ref lazyHeap, new VirtualHeap(), null);
+ }
+
+ return lazyHeap;
+ }
+ }
+}
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReader.WinMD.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReader.WinMD.cs
index 5d241a8453..2294ae6fb7 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReader.WinMD.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReader.WinMD.cs
@@ -64,20 +64,20 @@ namespace System.Reflection.Metadata
StringHandle name = TypeDefTable.GetName(typeDef);
- int index = StringStream.BinarySearchRaw(s_projectedTypeNames, name);
+ int index = StringHeap.BinarySearchRaw(s_projectedTypeNames, name);
if (index < 0)
{
return TypeDefTreatment.None;
}
StringHandle namespaceName = TypeDefTable.GetNamespace(typeDef);
- if (StringStream.EqualsRaw(namespaceName, StringStream.GetVirtualValue(s_projectionInfos[index].ClrNamespace)))
+ if (StringHeap.EqualsRaw(namespaceName, StringHeap.GetVirtualString(s_projectionInfos[index].ClrNamespace)))
{
return s_projectionInfos[index].Treatment;
}
// TODO: we can avoid this comparison if info.DotNetNamespace == info.WinRtNamespace
- if (StringStream.EqualsRaw(namespaceName, s_projectionInfos[index].WinRTNamespace))
+ if (StringHeap.EqualsRaw(namespaceName, s_projectionInfos[index].WinRTNamespace))
{
return s_projectionInfos[index].Treatment | TypeDefTreatment.MarkInternalFlag;
}
@@ -89,8 +89,8 @@ namespace System.Reflection.Metadata
{
InitializeProjectedTypes();
- int index = StringStream.BinarySearchRaw(s_projectedTypeNames, TypeRefTable.GetName(typeRef));
- if (index >= 0 && StringStream.EqualsRaw(TypeRefTable.GetNamespace(typeRef), s_projectionInfos[index].WinRTNamespace))
+ int index = StringHeap.BinarySearchRaw(s_projectedTypeNames, TypeRefTable.GetName(typeRef));
+ if (index >= 0 && StringHeap.EqualsRaw(TypeRefTable.GetNamespace(typeRef), s_projectionInfos[index].WinRTNamespace))
{
isIDisposable = s_projectionInfos[index].IsIDisposable;
return index;
@@ -317,7 +317,7 @@ namespace System.Reflection.Metadata
return false;
}
- return StringStream.StartsWithRaw(TypeDefTable.GetName(typeDef), ClrPrefix);
+ return StringHeap.StartsWithRaw(TypeDefTable.GetName(typeDef), ClrPrefix);
}
#endregion
@@ -342,16 +342,16 @@ namespace System.Reflection.Metadata
private TypeRefTreatment GetSpecialTypeRefTreatment(TypeReferenceHandle handle)
{
- if (StringStream.EqualsRaw(TypeRefTable.GetNamespace(handle), "System"))
+ if (StringHeap.EqualsRaw(TypeRefTable.GetNamespace(handle), "System"))
{
StringHandle name = TypeRefTable.GetName(handle);
- if (StringStream.EqualsRaw(name, "MulticastDelegate"))
+ if (StringHeap.EqualsRaw(name, "MulticastDelegate"))
{
return TypeRefTreatment.SystemDelegate;
}
- if (StringStream.EqualsRaw(name, "Attribute"))
+ if (StringHeap.EqualsRaw(name, "Attribute"))
{
return TypeRefTreatment.SystemAttribute;
}
@@ -362,14 +362,14 @@ namespace System.Reflection.Metadata
private bool IsSystemAttribute(TypeReferenceHandle handle)
{
- return StringStream.EqualsRaw(TypeRefTable.GetNamespace(handle), "System") &&
- StringStream.EqualsRaw(TypeRefTable.GetName(handle), "Attribute");
+ return StringHeap.EqualsRaw(TypeRefTable.GetNamespace(handle), "System") &&
+ StringHeap.EqualsRaw(TypeRefTable.GetName(handle), "Attribute");
}
private bool IsSystemEnum(TypeReferenceHandle handle)
{
- return StringStream.EqualsRaw(TypeRefTable.GetNamespace(handle), "System") &&
- StringStream.EqualsRaw(TypeRefTable.GetName(handle), "Enum");
+ return StringHeap.EqualsRaw(TypeRefTable.GetNamespace(handle), "System") &&
+ StringHeap.EqualsRaw(TypeRefTable.GetName(handle), "Enum");
}
private bool NeedsWinRTPrefix(TypeAttributes flags, EntityHandle extends)
@@ -386,12 +386,12 @@ namespace System.Reflection.Metadata
// Check if the type is a delegate, struct, or attribute
TypeReferenceHandle extendsRefHandle = (TypeReferenceHandle)extends;
- if (StringStream.EqualsRaw(TypeRefTable.GetNamespace(extendsRefHandle), "System"))
+ if (StringHeap.EqualsRaw(TypeRefTable.GetNamespace(extendsRefHandle), "System"))
{
StringHandle nameHandle = TypeRefTable.GetName(extendsRefHandle);
- if (StringStream.EqualsRaw(nameHandle, "MulticastDelegate")
- || StringStream.EqualsRaw(nameHandle, "ValueType")
- || StringStream.EqualsRaw(nameHandle, "Attribute"))
+ if (StringHeap.EqualsRaw(nameHandle, "MulticastDelegate")
+ || StringHeap.EqualsRaw(nameHandle, "ValueType")
+ || StringHeap.EqualsRaw(nameHandle, "Attribute"))
{
return false;
}
@@ -528,14 +528,14 @@ namespace System.Reflection.Metadata
Debug.Assert(!namespaceHandle.IsVirtual && !nameHandle.IsVirtual);
- if (StringStream.EqualsRaw(namespaceHandle, "Windows.UI.Xaml"))
+ if (StringHeap.EqualsRaw(namespaceHandle, "Windows.UI.Xaml"))
{
- if (StringStream.EqualsRaw(nameHandle, "TreatAsPublicMethodAttribute"))
+ if (StringHeap.EqualsRaw(nameHandle, "TreatAsPublicMethodAttribute"))
{
treatment |= MethodDefTreatment.MarkPublicFlag;
}
- if (StringStream.EqualsRaw(nameHandle, "TreatAsAbstractMethodAttribute"))
+ if (StringHeap.EqualsRaw(nameHandle, "TreatAsAbstractMethodAttribute"))
{
treatment |= MethodDefTreatment.MarkAbstractFlag;
}
@@ -559,7 +559,7 @@ namespace System.Reflection.Metadata
var flags = FieldTable.GetFlags(handle);
FieldDefTreatment treatment = FieldDefTreatment.None;
- if ((flags & FieldAttributes.RTSpecialName) != 0 && StringStream.EqualsRaw(FieldTable.GetName(handle), "value__"))
+ if ((flags & FieldAttributes.RTSpecialName) != 0 && StringHeap.EqualsRaw(FieldTable.GetName(handle), "value__"))
{
TypeDefinitionHandle typeDef = GetDeclaringType(handle);
@@ -568,8 +568,8 @@ namespace System.Reflection.Metadata
{
var typeRef = (TypeReferenceHandle)baseTypeHandle;
- if (StringStream.EqualsRaw(TypeRefTable.GetName(typeRef), "Enum") &&
- StringStream.EqualsRaw(TypeRefTable.GetNamespace(typeRef), "System"))
+ if (StringHeap.EqualsRaw(TypeRefTable.GetName(typeRef), "Enum") &&
+ StringHeap.EqualsRaw(TypeRefTable.GetNamespace(typeRef), "System"))
{
treatment = FieldDefTreatment.EnumValue;
}
@@ -632,7 +632,7 @@ namespace System.Reflection.Metadata
else if (parent.Kind == HandleKind.TypeSpecification)
{
BlobHandle blob = TypeSpecTable.GetSignature((TypeSpecificationHandle)parent);
- BlobReader sig = new BlobReader(BlobStream.GetMemoryBlock(blob));
+ BlobReader sig = new BlobReader(BlobHeap.GetMemoryBlock(blob));
if (sig.Length < 2 ||
sig.ReadByte() != (byte)CorElementType.ELEMENT_TYPE_GENERICINST ||
@@ -665,7 +665,7 @@ namespace System.Reflection.Metadata
{
for (int i = 1; i <= AssemblyRefTable.NumberOfNonVirtualRows; i++)
{
- if (StringStream.EqualsRaw(AssemblyRefTable.GetName(i), "mscorlib"))
+ if (StringHeap.EqualsRaw(AssemblyRefTable.GetName(i), "mscorlib"))
{
return i;
}
@@ -694,14 +694,14 @@ namespace System.Reflection.Metadata
}
var targetTypeDef = (TypeDefinitionHandle)parent;
- if (StringStream.EqualsRaw(TypeDefTable.GetNamespace(targetTypeDef), "Windows.Foundation.Metadata"))
+ if (StringHeap.EqualsRaw(TypeDefTable.GetNamespace(targetTypeDef), "Windows.Foundation.Metadata"))
{
- if (StringStream.EqualsRaw(TypeDefTable.GetName(targetTypeDef), "VersionAttribute"))
+ if (StringHeap.EqualsRaw(TypeDefTable.GetName(targetTypeDef), "VersionAttribute"))
{
return CustomAttributeValueTreatment.AttributeUsageVersionAttribute;
}
- if (StringStream.EqualsRaw(TypeDefTable.GetName(targetTypeDef), "DeprecatedAttribute"))
+ if (StringHeap.EqualsRaw(TypeDefTable.GetName(targetTypeDef), "DeprecatedAttribute"))
{
return CustomAttributeValueTreatment.AttributeUsageDeprecatedAttribute;
}
@@ -736,8 +736,8 @@ namespace System.Reflection.Metadata
}
var attributeTypeRef = (TypeReferenceHandle)attributeType;
- return StringStream.EqualsRaw(TypeRefTable.GetName(attributeTypeRef), "AttributeUsageAttribute") &&
- StringStream.EqualsRaw(TypeRefTable.GetNamespace(attributeTypeRef), "Windows.Foundation.Metadata");
+ return StringHeap.EqualsRaw(TypeRefTable.GetName(attributeTypeRef), "AttributeUsageAttribute") &&
+ StringHeap.EqualsRaw(TypeRefTable.GetNamespace(attributeTypeRef), "Windows.Foundation.Metadata");
}
private bool HasAttribute(EntityHandle token, string asciiNamespaceName, string asciiTypeName)
@@ -746,8 +746,8 @@ namespace System.Reflection.Metadata
{
StringHandle namespaceName, typeName;
if (GetAttributeTypeNameRaw(caHandle, out namespaceName, out typeName) &&
- StringStream.EqualsRaw(typeName, asciiTypeName) &&
- StringStream.EqualsRaw(namespaceName, asciiNamespaceName))
+ StringHeap.EqualsRaw(typeName, asciiTypeName) &&
+ StringHeap.EqualsRaw(namespaceName, asciiNamespaceName))
{
return true;
}
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReader.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReader.cs
index 1c0d7a5cf9..170bfdc357 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReader.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReader.cs
@@ -7,8 +7,6 @@ using System.Collections.Immutable;
using System.Diagnostics;
using System.Reflection.Internal;
using System.Reflection.Metadata.Ecma335;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
using System.Text;
namespace System.Reflection.Metadata
@@ -18,15 +16,16 @@ namespace System.Reflection.Metadata
/// </summary>
public sealed partial class MetadataReader
{
- private readonly MetadataReaderOptions _options;
- internal readonly MetadataStringDecoder utf8Decoder;
- internal readonly NamespaceCache namespaceCache;
- private Dictionary<TypeDefinitionHandle, ImmutableArray<TypeDefinitionHandle>> _lazyNestedTypesMap;
+ internal readonly MetadataStringDecoder Utf8Decoder;
+ internal readonly NamespaceCache NamespaceCache;
internal readonly MemoryBlock Block;
// A row id of "mscorlib" AssemblyRef in a WinMD file (each WinMD file must have such a reference).
internal readonly int WinMDMscorlibRef;
+ private readonly MetadataReaderOptions _options;
+ private Dictionary<TypeDefinitionHandle, ImmutableArray<TypeDefinitionHandle>> _lazyNestedTypesMap;
+
#region Constructors
/// <summary>
@@ -97,7 +96,7 @@ namespace System.Reflection.Metadata
this.Block = new MemoryBlock(metadata, length);
_options = options;
- this.utf8Decoder = utf8Decoder;
+ this.Utf8Decoder = utf8Decoder;
var headerReader = new BlobReader(this.Block);
this.ReadMetadataHeader(ref headerReader, out _versionString);
@@ -140,7 +139,7 @@ namespace System.Reflection.Metadata
}
// read
- this.namespaceCache = new NamespaceCache(this);
+ this.NamespaceCache = new NamespaceCache(this);
if (_metadataKind != MetadataKind.Ecma335)
{
@@ -157,10 +156,10 @@ namespace System.Reflection.Metadata
private readonly MetadataStreamKind _metadataStreamKind;
private readonly DebugMetadataHeader _debugMetadataHeader;
- internal StringStreamReader StringStream;
- internal BlobStreamReader BlobStream;
- internal GuidStreamReader GuidStream;
- internal UserStringStreamReader UserStringStream;
+ internal StringHeap StringHeap;
+ internal BlobHeap BlobHeap;
+ internal GuidHeap GuidHeap;
+ internal UserStringHeap UserStringHeap;
/// <summary>
/// True if the metadata stream has minimal delta format. Used for EnC.
@@ -207,7 +206,7 @@ namespace System.Reflection.Metadata
}
int numberOfBytesRead;
- versionString = memReader.GetMemoryBlockAt(0, versionStringSize).PeekUtf8NullTerminated(0, null, utf8Decoder, out numberOfBytesRead, '\0');
+ versionString = memReader.GetMemoryBlockAt(0, versionStringSize).PeekUtf8NullTerminated(0, null, Utf8Decoder, out numberOfBytesRead, '\0');
memReader.SkipBytes(versionStringSize);
}
@@ -285,7 +284,7 @@ namespace System.Reflection.Metadata
throw new BadImageFormatException(SR.NotEnoughSpaceForStringStream);
}
- this.StringStream = new StringStreamReader(metadataRoot.GetMemoryBlockAt((int)streamHeader.Offset, streamHeader.Size), _metadataKind);
+ this.StringHeap = new StringHeap(metadataRoot.GetMemoryBlockAt((int)streamHeader.Offset, streamHeader.Size), _metadataKind);
break;
case COR20Constants.BlobStreamName:
@@ -294,7 +293,7 @@ namespace System.Reflection.Metadata
throw new BadImageFormatException(SR.NotEnoughSpaceForBlobStream);
}
- this.BlobStream = new BlobStreamReader(metadataRoot.GetMemoryBlockAt((int)streamHeader.Offset, streamHeader.Size), _metadataKind);
+ this.BlobHeap = new BlobHeap(metadataRoot.GetMemoryBlockAt((int)streamHeader.Offset, streamHeader.Size), _metadataKind);
break;
case COR20Constants.GUIDStreamName:
@@ -303,7 +302,7 @@ namespace System.Reflection.Metadata
throw new BadImageFormatException(SR.NotEnoughSpaceForGUIDStream);
}
- this.GuidStream = new GuidStreamReader(metadataRoot.GetMemoryBlockAt((int)streamHeader.Offset, streamHeader.Size));
+ this.GuidHeap = new GuidHeap(metadataRoot.GetMemoryBlockAt((int)streamHeader.Offset, streamHeader.Size));
break;
case COR20Constants.UserStringStreamName:
@@ -312,7 +311,7 @@ namespace System.Reflection.Metadata
throw new BadImageFormatException(SR.NotEnoughSpaceForBlobStream);
}
- this.UserStringStream = new UserStringStreamReader(metadataRoot.GetMemoryBlockAt((int)streamHeader.Offset, streamHeader.Size));
+ this.UserStringHeap = new UserStringHeap(metadataRoot.GetMemoryBlockAt((int)streamHeader.Offset, streamHeader.Size));
break;
case COR20Constants.CompressedMetadataTableStreamName:
@@ -834,36 +833,11 @@ namespace System.Reflection.Metadata
#region Helpers
- // internal for testing
- internal NamespaceCache NamespaceCache
- {
- get { return namespaceCache; }
- }
-
- internal bool UseFieldPtrTable
- {
- get { return this.FieldPtrTable.NumberOfRows > 0; }
- }
-
- internal bool UseMethodPtrTable
- {
- get { return this.MethodPtrTable.NumberOfRows > 0; }
- }
-
- internal bool UseParamPtrTable
- {
- get { return this.ParamPtrTable.NumberOfRows > 0; }
- }
-
- internal bool UseEventPtrTable
- {
- get { return this.EventPtrTable.NumberOfRows > 0; }
- }
-
- internal bool UsePropertyPtrTable
- {
- get { return this.PropertyPtrTable.NumberOfRows > 0; }
- }
+ internal bool UseFieldPtrTable => FieldPtrTable.NumberOfRows > 0;
+ internal bool UseMethodPtrTable => MethodPtrTable.NumberOfRows > 0;
+ internal bool UseParamPtrTable => ParamPtrTable.NumberOfRows > 0;
+ internal bool UseEventPtrTable => EventPtrTable.NumberOfRows > 0;
+ internal bool UsePropertyPtrTable => PropertyPtrTable.NumberOfRows > 0;
internal void GetFieldRange(TypeDefinitionHandle typeDef, out int firstFieldRowId, out int lastFieldRowId)
{
@@ -1083,22 +1057,22 @@ namespace System.Reflection.Metadata
public string GetString(StringHandle handle)
{
- return StringStream.GetString(handle, utf8Decoder);
+ return StringHeap.GetString(handle, Utf8Decoder);
}
public string GetString(NamespaceDefinitionHandle handle)
{
if (handle.HasFullName)
{
- return StringStream.GetString(handle.GetFullName(), utf8Decoder);
+ return StringHeap.GetString(handle.GetFullName(), Utf8Decoder);
}
- return namespaceCache.GetFullName(handle);
+ return NamespaceCache.GetFullName(handle);
}
public byte[] GetBlobBytes(BlobHandle handle)
{
- return BlobStream.GetBytes(handle);
+ return BlobHeap.GetBytes(handle);
}
public ImmutableArray<byte> GetBlobContent(BlobHandle handle)
@@ -1110,17 +1084,22 @@ namespace System.Reflection.Metadata
public BlobReader GetBlobReader(BlobHandle handle)
{
- return BlobStream.GetBlobReader(handle);
+ return BlobHeap.GetBlobReader(handle);
+ }
+
+ public BlobReader GetBlobReader(StringHandle handle)
+ {
+ return StringHeap.GetBlobReader(handle);
}
public string GetUserString(UserStringHandle handle)
{
- return UserStringStream.GetString(handle);
+ return UserStringHeap.GetString(handle);
}
public Guid GetGuid(GuidHandle handle)
{
- return GuidStream.GetGuid(handle);
+ return GuidHeap.GetGuid(handle);
}
public ModuleDefinition GetModuleDefinition()
@@ -1146,13 +1125,13 @@ namespace System.Reflection.Metadata
public NamespaceDefinition GetNamespaceDefinitionRoot()
{
- NamespaceData data = namespaceCache.GetRootNamespace();
+ NamespaceData data = NamespaceCache.GetRootNamespace();
return new NamespaceDefinition(data);
}
public NamespaceDefinition GetNamespaceDefinition(NamespaceDefinitionHandle handle)
{
- NamespaceData data = namespaceCache.GetNamespaceData(handle);
+ NamespaceData data = NamespaceCache.GetNamespaceData(handle);
return new NamespaceDefinition(data);
}
@@ -1372,7 +1351,7 @@ namespace System.Reflection.Metadata
public string GetString(DocumentNameBlobHandle handle)
{
- return BlobStream.GetDocumentName(handle);
+ return BlobHeap.GetDocumentName(handle);
}
public Document GetDocument(DocumentHandle handle)
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReaderProvider.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReaderProvider.cs
index 5c732dccc8..acd43da9c2 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReaderProvider.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReaderProvider.cs
@@ -27,6 +27,10 @@ namespace System.Reflection.Metadata
private MemoryBlockProvider _blockProviderOpt;
private AbstractMemoryBlock _lazyMetadataBlock;
+ // cached reader
+ private MetadataReader _lazyMetadataReader;
+ private readonly object _metadataReaderGuard = new object();
+
private MetadataReaderProvider(AbstractMemoryBlock metadataBlock)
{
Debug.Assert(metadataBlock != null);
@@ -222,6 +226,8 @@ namespace System.Reflection.Metadata
_lazyMetadataBlock?.Dispose();
_lazyMetadataBlock = null;
+
+ _lazyMetadataReader = null;
}
/// <summary>
@@ -229,22 +235,58 @@ namespace System.Reflection.Metadata
/// </summary>
/// <remarks>
/// The caller must keep the <see cref="MetadataReaderProvider"/> alive and undisposed throughout the lifetime of the metadata reader.
+ ///
+ /// If this method is called multiple times each call with arguments equal to the arguments passed to the previous successful call
+ /// returns the same instance of <see cref="MetadataReader"/> as the previous call.
/// </remarks>
/// <exception cref="ArgumentException">The encoding of <paramref name="utf8Decoder"/> is not <see cref="UTF8Encoding"/>.</exception>
/// <exception cref="PlatformNotSupportedException">The current platform is big-endian.</exception>
/// <exception cref="IOException">IO error while reading from the underlying stream.</exception>
+ /// <exception cref="ObjectDisposedException">Provider has been disposed.</exception>
public unsafe MetadataReader GetMetadataReader(MetadataReaderOptions options = MetadataReaderOptions.Default, MetadataStringDecoder utf8Decoder = null)
{
- AbstractMemoryBlock metadata = GetMetadataBlock();
- return new MetadataReader(metadata.Pointer, metadata.Size, options, utf8Decoder);
+ var cachedReader = _lazyMetadataReader;
+
+ if (CanReuseReader(cachedReader, options, utf8Decoder))
+ {
+ return cachedReader;
+ }
+
+ // If multiple threads attempt to open a metadata reader with the same options and decoder
+ // it's cheaper to wait for the other thread to finish initializing the reader than to open
+ // two readers and discard one.
+ // Note that it's rare to reader the same metadata using different options.
+ lock (_metadataReaderGuard)
+ {
+ cachedReader = _lazyMetadataReader;
+
+ if (CanReuseReader(cachedReader, options, utf8Decoder))
+ {
+ return cachedReader;
+ }
+
+ AbstractMemoryBlock metadata = GetMetadataBlock();
+ var newReader = new MetadataReader(metadata.Pointer, metadata.Size, options, utf8Decoder);
+ _lazyMetadataReader = newReader;
+ return newReader;
+ }
+ }
+
+ private static bool CanReuseReader(MetadataReader reader, MetadataReaderOptions options, MetadataStringDecoder utf8DecoderOpt)
+ {
+ return reader != null && reader.Options == options && ReferenceEquals(reader.Utf8Decoder, utf8DecoderOpt ?? MetadataStringDecoder.DefaultUTF8);
}
/// <exception cref="IOException">IO error while reading from the underlying stream.</exception>
+ /// <exception cref="ObjectDisposedException">Provider has been disposed.</exception>
internal AbstractMemoryBlock GetMetadataBlock()
{
if (_lazyMetadataBlock == null)
{
- Debug.Assert(_blockProviderOpt != null);
+ if (_blockProviderOpt == null)
+ {
+ throw new ObjectDisposedException(nameof(MetadataReaderProvider));
+ }
var newBlock = _blockProviderOpt.GetMemoryBlock(0, _blockProviderOpt.Size);
if (Interlocked.CompareExchange(ref _lazyMetadataBlock, newBlock, null) != null)
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataStringComparer.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataStringComparer.cs
index d6d1db56a5..01caf7cfd0 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataStringComparer.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataStringComparer.cs
@@ -68,7 +68,7 @@ namespace System.Reflection.Metadata
Throw.ValueArgumentNull();
}
- return _reader.StringStream.Equals(handle, value, _reader.utf8Decoder, ignoreCase);
+ return _reader.StringHeap.Equals(handle, value, _reader.Utf8Decoder, ignoreCase);
}
public bool Equals(NamespaceDefinitionHandle handle, string value)
@@ -85,10 +85,10 @@ namespace System.Reflection.Metadata
if (handle.HasFullName)
{
- return _reader.StringStream.Equals(handle.GetFullName(), value, _reader.utf8Decoder, ignoreCase);
+ return _reader.StringHeap.Equals(handle.GetFullName(), value, _reader.Utf8Decoder, ignoreCase);
}
- return value == _reader.namespaceCache.GetFullName(handle);
+ return value == _reader.NamespaceCache.GetFullName(handle);
}
public bool Equals(DocumentNameBlobHandle handle, string value)
@@ -103,7 +103,7 @@ namespace System.Reflection.Metadata
Throw.ValueArgumentNull();
}
- return _reader.BlobStream.DocumentNameEquals(handle, value, ignoreCase);
+ return _reader.BlobHeap.DocumentNameEquals(handle, value, ignoreCase);
}
public bool StartsWith(StringHandle handle, string value)
@@ -118,7 +118,7 @@ namespace System.Reflection.Metadata
Throw.ValueArgumentNull();
}
- return _reader.StringStream.StartsWith(handle, value, _reader.utf8Decoder, ignoreCase);
+ return _reader.StringHeap.StartsWith(handle, value, _reader.Utf8Decoder, ignoreCase);
}
}
}
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/PEReaderExtensions.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/PEReaderExtensions.cs
index 9c551e3731..a08441030f 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/PEReaderExtensions.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/PEReaderExtensions.cs
@@ -22,7 +22,7 @@ namespace System.Reflection.Metadata
/// <exception cref="BadImageFormatException">The body is not found in the metadata or is invalid.</exception>
/// <exception cref="InvalidOperationException">Section where the method is stored is not available.</exception>
/// <exception cref="IOException">IO error while reading from the underlying stream.</exception>
- public static unsafe MethodBodyBlock GetMethodBody(this PEReader peReader, int relativeVirtualAddress)
+ public static MethodBodyBlock GetMethodBody(this PEReader peReader, int relativeVirtualAddress)
{
if (peReader == null)
{
@@ -36,8 +36,7 @@ namespace System.Reflection.Metadata
}
// Call to validating public BlobReader constructor is by design -- we need to throw PlatformNotSupported on big-endian architecture.
- var blobReader = new BlobReader(block.Pointer, block.Length);
- return MethodBodyBlock.Create(blobReader);
+ return MethodBodyBlock.Create(block.GetReader());
}
/// <summary>
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/ImportScope.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/ImportScope.cs
index 631f5312f8..eee67d94eb 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/ImportScope.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/ImportScope.cs
@@ -35,7 +35,7 @@ namespace System.Reflection.Metadata
public ImportDefinitionCollection GetImports()
{
- return new ImportDefinitionCollection(_reader.BlobStream.GetMemoryBlock(ImportsBlob));
+ return new ImportDefinitionCollection(_reader.BlobHeap.GetMemoryBlock(ImportsBlob));
}
}
}
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/MethodDebugInformation.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/MethodDebugInformation.cs
index becbfa2c8a..cf9a511b3d 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/MethodDebugInformation.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/MethodDebugInformation.cs
@@ -60,7 +60,7 @@ namespace System.Reflection.Metadata
public SequencePointCollection GetSequencePoints()
{
- return new SequencePointCollection(_reader.BlobStream.GetMemoryBlock(SequencePointsBlob), Document);
+ return new SequencePointCollection(_reader.BlobHeap.GetMemoryBlock(SequencePointsBlob), Document);
}
/// <summary>
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/PortablePdbVersions.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/PortablePdbVersions.cs
index 55139c5e36..40a9779ae8 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/PortablePdbVersions.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/PortablePdbVersions.cs
@@ -38,7 +38,8 @@ namespace System.Reflection.Metadata
internal const uint DebugDirectoryEmbeddedSignature = 0x4244504d;
- internal static uint DebugDirectoryEntryVersion(ushort portablePdbVersion) => 'P' << 24 | 'M' << 16 | (uint)portablePdbVersion;
+ internal const ushort PortableCodeViewVersionMagic = 0x504d;
+ internal static uint DebugDirectoryEntryVersion(ushort portablePdbVersion) => PortableCodeViewVersionMagic << 16 | (uint)portablePdbVersion;
internal static uint DebugDirectoryEmbeddedVersion(ushort portablePdbVersion) => (uint)DefaultEmbeddedVersion << 16 | portablePdbVersion;
internal static string Format(ushort version) => (version >> 8) + "." + (version & 0xff);
}
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/Handles.TypeSystem.cs b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/Handles.TypeSystem.cs
index 7d405c0493..8f8a5259c0 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/Handles.TypeSystem.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/Handles.TypeSystem.cs
@@ -2341,9 +2341,9 @@ namespace System.Reflection.Metadata
public static implicit operator Handle(StringHandle handle)
{
- // VTT... -> V111 10TT
+ // VTTx xxxx xxxx xxxx xxxx xxxx xxxx xxxx -> V111 10TT
return new Handle(
- (byte)((handle._value & HeapHandleType.VirtualBit) >> 24 | HandleType.String | (handle._value & StringHandleType.NonVirtualTypeMask) >> 26),
+ (byte)((handle._value & HeapHandleType.VirtualBit) >> 24 | HandleType.String | (handle._value & StringHandleType.NonVirtualTypeMask) >> HeapHandleType.OffsetBitCount),
(int)(handle._value & HeapHandleType.OffsetMask));
}
@@ -2354,13 +2354,15 @@ namespace System.Reflection.Metadata
Throw.InvalidCast();
}
- // V111 10TT -> VTT...
+ // V111 10TT -> VTTx xxxx xxxx xxxx xxxx xxxx xxxx xxxx
return new StringHandle(
(handle.VType & HandleType.VirtualBit) << 24 |
(handle.VType & HandleType.NonVirtualStringTypeMask) << HeapHandleType.OffsetBitCount |
(uint)handle.Offset);
}
+ internal uint RawValue => _value;
+
internal bool IsVirtual
{
get { return (_value & HeapHandleType.VirtualBit) != 0; }
@@ -2619,6 +2621,8 @@ namespace System.Reflection.Metadata
(uint)handle.Offset);
}
+ internal uint RawValue => _value;
+
public bool IsNil
{
get { return _value == 0; }
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/DebugDirectory/DebugDirectoryBuilder.cs b/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/DebugDirectory/DebugDirectoryBuilder.cs
index 64f284a288..cf1ce3c3c8 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/DebugDirectory/DebugDirectoryBuilder.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/DebugDirectory/DebugDirectoryBuilder.cs
@@ -39,6 +39,15 @@ namespace System.Reflection.PortableExecutable
});
}
+ /// <summary>
+ /// Adds a CodeView entry.
+ /// </summary>
+ /// <param name="pdbPath">Path to the PDB. Shall not be empty.</param>
+ /// <param name="pdbContentId">Unique id of the PDB content.</param>
+ /// <param name="portablePdbVersion">Version of Portable PDB format (e.g. 0x0100 for 1.0), or 0 if the PDB is not portable.</param>
+ /// <exception cref="ArgumentNullException"><paramref name="pdbPath"/> is null.</exception>
+ /// <exception cref="ArgumentException"><paramref name="pdbPath"/> contains NUL character.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="portablePdbVersion"/> is smaller than 0x0100.</exception>
public void AddCodeViewEntry(
string pdbPath,
BlobContentId pdbContentId,
@@ -49,6 +58,17 @@ namespace System.Reflection.PortableExecutable
Throw.ArgumentNull(nameof(pdbPath));
}
+ // We allow NUL characters to allow for padding for backward compat purposes.
+ if (pdbPath.Length == 0 || pdbPath.IndexOf('\0') == 0)
+ {
+ Throw.InvalidArgument(SR.ExpectedNonEmptyString, nameof(pdbPath));
+ }
+
+ if (portablePdbVersion > 0 && portablePdbVersion < PortablePdbVersions.MinFormatVersion)
+ {
+ Throw.ArgumentOutOfRange(nameof(portablePdbVersion));
+ }
+
int dataSize = WriteCodeViewData(_dataBuilder, pdbPath, pdbContentId.Guid);
AddEntry(
@@ -58,11 +78,21 @@ namespace System.Reflection.PortableExecutable
dataSize: dataSize);
}
+ /// <summary>
+ /// Adds Reproducible entry.
+ /// </summary>
public void AddReproducibleEntry()
{
AddEntry(type: DebugDirectoryEntryType.Reproducible, version: 0, stamp: 0);
}
+ /// <summary>
+ /// Adds Embedded Portable PDB entry.
+ /// </summary>
+ /// <param name="debugMetadata">Portable PDB metadata builder.</param>
+ /// <param name="portablePdbVersion">Version of Portable PDB format (e.g. 0x0100 for 1.0).</param>
+ /// <exception cref="ArgumentNullException"><paramref name="debugMetadata"/> is null.</exception>
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="portablePdbVersion"/> is smaller than 0x0100.</exception>
public void AddEmbeddedPortablePdbEntry(BlobBuilder debugMetadata, ushort portablePdbVersion)
{
if (debugMetadata == null)
@@ -70,6 +100,11 @@ namespace System.Reflection.PortableExecutable
Throw.ArgumentNull(nameof(debugMetadata));
}
+ if (portablePdbVersion < PortablePdbVersions.MinFormatVersion)
+ {
+ Throw.ArgumentOutOfRange(nameof(portablePdbVersion));
+ }
+
int dataSize = WriteEmbeddedPortablePdbData(_dataBuilder, debugMetadata);
AddEntry(
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/DebugDirectory/DebugDirectoryEntry.cs b/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/DebugDirectory/DebugDirectoryEntry.cs
index 2686a3620f..db6377f49c 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/DebugDirectory/DebugDirectoryEntry.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/DebugDirectory/DebugDirectoryEntry.cs
@@ -2,6 +2,8 @@
// 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.Reflection.Metadata;
+
namespace System.Reflection.PortableExecutable
{
/// <summary>
@@ -58,6 +60,11 @@ namespace System.Reflection.PortableExecutable
/// </summary>
public int DataPointer { get; }
+ /// <summary>
+ /// True if the the entry is a <see cref="DebugDirectoryEntryType.CodeView"/> entry pointing to a Portable PDB.
+ /// </summary>
+ public bool IsPortableCodeView => MinorVersion == PortablePdbVersions.PortableCodeViewVersionMagic;
+
public DebugDirectoryEntry(
uint stamp,
ushort majorVersion,
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEMemoryBlock.cs b/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEMemoryBlock.cs
index ae2ee4a250..5a456b048f 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEMemoryBlock.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEMemoryBlock.cs
@@ -64,7 +64,7 @@ namespace System.Reflection.PortableExecutable
/// Reads the content of a part of the block into an array.
/// </summary>
/// <exception cref="ArgumentOutOfRangeException">Specified range is not contained within the block.</exception>
- public unsafe ImmutableArray<byte> GetContent(int start, int length)
+ public ImmutableArray<byte> GetContent(int start, int length)
{
BlobUtilities.ValidateRange(Length, start, length, nameof(length));
return _block?.GetContentUnchecked(_offset + start, length) ?? ImmutableArray<byte>.Empty;
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs b/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs
index 58ebf96f72..fdbd44a647 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs
@@ -6,8 +6,10 @@ using System.Collections.Immutable;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
+using System.Linq;
using System.Reflection.Internal;
using System.Reflection.Metadata;
+using System.Runtime.ExceptionServices;
using System.Threading;
namespace System.Reflection.PortableExecutable
@@ -29,6 +31,8 @@ namespace System.Reflection.PortableExecutable
// May be null in the event that the entire image is not
// deemed necessary and we have been instructed to read
// the image contents without being lazy.
+ //
+ // _lazyPEHeaders are not null in that case.
private MemoryBlockProvider _peImage;
// If we read the data from the image lazily (peImage != null) we defer reading the PE headers.
@@ -166,6 +170,8 @@ namespace System.Reflection.PortableExecutable
throw new ArgumentOutOfRangeException(nameof(options));
}
+ IsLoadedImage = (options & PEStreamOptions.IsLoadedImage) != 0;
+
long start = peStream.Position;
int actualSize = StreamExtensions.GetAndValidateSize(peStream, size, nameof(peStream));
@@ -240,6 +246,8 @@ namespace System.Reflection.PortableExecutable
/// </remarks>
public void Dispose()
{
+ _lazyPEHeaders = null;
+
_peImage?.Dispose();
_peImage = null;
@@ -261,6 +269,22 @@ namespace System.Reflection.PortableExecutable
}
}
+ private MemoryBlockProvider GetPEImage()
+ {
+ var peImage = _peImage;
+ if (peImage == null)
+ {
+ if (_lazyPEHeaders == null)
+ {
+ Throw.PEReaderDisposed();
+ }
+
+ Throw.InvalidOperation_PEImageNotAvailable();
+ }
+
+ return peImage;
+ }
+
/// <summary>
/// Gets the PE headers.
/// </summary>
@@ -282,10 +306,8 @@ namespace System.Reflection.PortableExecutable
/// <exception cref="IOException">Error reading from the stream.</exception>
private void InitializePEHeaders()
{
- Debug.Assert(_peImage != null);
-
StreamConstraints constraints;
- Stream stream = _peImage.GetStream(out constraints);
+ Stream stream = GetPEImage().GetStream(out constraints);
PEHeaders headers;
if (constraints.GuardOpt != null)
@@ -319,12 +341,7 @@ namespace System.Reflection.PortableExecutable
{
if (_lazyImageBlock == null)
{
- if (_peImage == null)
- {
- throw new InvalidOperationException(SR.PEImageNotAvailable);
- }
-
- var newBlock = _peImage.GetMemoryBlock();
+ var newBlock = GetPEImage().GetMemoryBlock();
if (Interlocked.CompareExchange(ref _lazyImageBlock, newBlock, null) != null)
{
// another thread created the block already, we need to dispose ours:
@@ -336,6 +353,7 @@ namespace System.Reflection.PortableExecutable
}
/// <exception cref="IOException">IO error while reading from the underlying stream.</exception>
+ /// <exception cref="InvalidOperationException">PE image doesn't have metadata.</exception>
private AbstractMemoryBlock GetMetadataBlock()
{
if (!HasMetadata)
@@ -345,9 +363,7 @@ namespace System.Reflection.PortableExecutable
if (_lazyMetadataBlock == null)
{
- Debug.Assert(_peImage != null, "We always have metadata if peImage is not available.");
-
- var newBlock = _peImage.GetMemoryBlock(PEHeaders.MetadataStartOffset, PEHeaders.MetadataSize);
+ var newBlock = GetPEImage().GetMemoryBlock(PEHeaders.MetadataStartOffset, PEHeaders.MetadataSize);
if (Interlocked.CompareExchange(ref _lazyMetadataBlock, newBlock, null) != null)
{
// another thread created the block already, we need to dispose ours:
@@ -362,13 +378,9 @@ namespace System.Reflection.PortableExecutable
/// <exception cref="InvalidOperationException">PE image not available.</exception>
private AbstractMemoryBlock GetPESectionBlock(int index)
{
- if (_peImage == null)
- {
- throw new InvalidOperationException(SR.PEImageNotAvailable);
- }
-
Debug.Assert(index >= 0 && index < PEHeaders.SectionHeaders.Length);
- Debug.Assert(_peImage != null);
+
+ var peImage = GetPEImage();
if (_lazyPESectionBlocks == null)
{
@@ -378,7 +390,7 @@ namespace System.Reflection.PortableExecutable
AbstractMemoryBlock newBlock;
if (IsLoadedImage)
{
- newBlock = _peImage.GetMemoryBlock(
+ newBlock = peImage.GetMemoryBlock(
PEHeaders.SectionHeaders[index].VirtualAddress,
PEHeaders.SectionHeaders[index].VirtualSize);
}
@@ -397,7 +409,7 @@ namespace System.Reflection.PortableExecutable
PEHeaders.SectionHeaders[index].VirtualSize,
PEHeaders.SectionHeaders[index].SizeOfRawData);
- newBlock = _peImage.GetMemoryBlock(PEHeaders.SectionHeaders[index].PointerToRawData, size);
+ newBlock = peImage.GetMemoryBlock(PEHeaders.SectionHeaders[index].PointerToRawData, size);
}
if (Interlocked.CompareExchange(ref _lazyPESectionBlocks[index], newBlock, null) != null)
@@ -415,10 +427,7 @@ namespace System.Reflection.PortableExecutable
/// <remarks>
/// Returns false if the <see cref="PEReader"/> is constructed from a stream and only part of it is prefetched into memory.
/// </remarks>
- public bool IsEntireImageAvailable
- {
- get { return _lazyImageBlock != null || _peImage != null; }
- }
+ public bool IsEntireImageAvailable => _lazyImageBlock != null || _peImage != null;
/// <summary>
/// Gets a pointer to and size of the PE image if available (<see cref="IsEntireImageAvailable"/>).
@@ -516,7 +525,8 @@ namespace System.Reflection.PortableExecutable
/// </summary>
/// <exception cref="BadImageFormatException">Bad format of the entry.</exception>
/// <exception cref="IOException">IO error while reading from the underlying stream.</exception>
- public unsafe ImmutableArray<DebugDirectoryEntry> ReadDebugDirectory()
+ /// <exception cref="InvalidOperationException">PE image not available.</exception>
+ public ImmutableArray<DebugDirectoryEntry> ReadDebugDirectory()
{
var debugDirectory = PEHeaders.PEHeader.DebugTableDirectory;
if (debugDirectory.Size == 0)
@@ -535,10 +545,9 @@ namespace System.Reflection.PortableExecutable
throw new BadImageFormatException(SR.InvalidDirectorySize);
}
- using (AbstractMemoryBlock block = _peImage.GetMemoryBlock(position, debugDirectory.Size))
+ using (AbstractMemoryBlock block = GetPEImage().GetMemoryBlock(position, debugDirectory.Size))
{
- var reader = new BlobReader(block.Pointer, block.Size);
- return ReadDebugDirectoryEntries(reader);
+ return ReadDebugDirectoryEntries(block.GetReader());
}
}
@@ -574,7 +583,7 @@ namespace System.Reflection.PortableExecutable
private AbstractMemoryBlock GetDebugDirectoryEntryDataBlock(DebugDirectoryEntry entry)
{
int dataOffset = IsLoadedImage ? entry.DataRelativeVirtualAddress : entry.DataPointer;
- return _peImage.GetMemoryBlock(dataOffset, entry.DataSize);
+ return GetPEImage().GetMemoryBlock(dataOffset, entry.DataSize);
}
/// <summary>
@@ -583,40 +592,38 @@ namespace System.Reflection.PortableExecutable
/// <exception cref="ArgumentException"><paramref name="entry"/> is not a CodeView entry.</exception>
/// <exception cref="BadImageFormatException">Bad format of the data.</exception>
/// <exception cref="IOException">IO error while reading from the underlying stream.</exception>
- public unsafe CodeViewDebugDirectoryData ReadCodeViewDebugDirectoryData(DebugDirectoryEntry entry)
+ /// <exception cref="InvalidOperationException">PE image not available.</exception>
+ public CodeViewDebugDirectoryData ReadCodeViewDebugDirectoryData(DebugDirectoryEntry entry)
{
if (entry.Type != DebugDirectoryEntryType.CodeView)
{
- throw new ArgumentException(SR.NotCodeViewEntry, nameof(entry));
+ Throw.InvalidArgument(SR.Format(SR.UnexpectedDebugDirectoryType, nameof(DebugDirectoryEntryType.CodeView)), nameof(entry));
}
using (var block = GetDebugDirectoryEntryDataBlock(entry))
{
- var reader = new BlobReader(block.Pointer, block.Size);
+ return DecodeCodeViewDebugDirectoryData(block);
+ }
+ }
- if (reader.ReadByte() != (byte)'R' ||
- reader.ReadByte() != (byte)'S' ||
- reader.ReadByte() != (byte)'D' ||
- reader.ReadByte() != (byte)'S')
- {
- throw new BadImageFormatException(SR.UnexpectedCodeViewDataSignature);
- }
+ // internal for testing
+ internal static CodeViewDebugDirectoryData DecodeCodeViewDebugDirectoryData(AbstractMemoryBlock block)
+ {
+ var reader = block.GetReader();
- Guid guid = reader.ReadGuid();
- int age = reader.ReadInt32();
- string path = reader.ReadUtf8NullTerminated();
+ if (reader.ReadByte() != (byte)'R' ||
+ reader.ReadByte() != (byte)'S' ||
+ reader.ReadByte() != (byte)'D' ||
+ reader.ReadByte() != (byte)'S')
+ {
+ throw new BadImageFormatException(SR.UnexpectedCodeViewDataSignature);
+ }
- // path may be padded with NULs
- while (reader.RemainingBytes > 0)
- {
- if (reader.ReadByte() != 0)
- {
- throw new BadImageFormatException(SR.InvalidPathPadding);
- }
- }
+ Guid guid = reader.ReadGuid();
+ int age = reader.ReadInt32();
+ string path = reader.ReadUtf8NullTerminated();
- return new CodeViewDebugDirectoryData(guid, age, path);
- }
+ return new CodeViewDebugDirectoryData(guid, age, path);
}
/// <summary>
@@ -627,11 +634,12 @@ namespace System.Reflection.PortableExecutable
/// </returns>
/// <exception cref="ArgumentException"><paramref name="entry"/> is not a <see cref="DebugDirectoryEntryType.EmbeddedPortablePdb"/> entry.</exception>
/// <exception cref="BadImageFormatException">Bad format of the data.</exception>
- public unsafe MetadataReaderProvider ReadEmbeddedPortablePdbDebugDirectoryData(DebugDirectoryEntry entry)
+ /// <exception cref="InvalidOperationException">PE image not available.</exception>
+ public MetadataReaderProvider ReadEmbeddedPortablePdbDebugDirectoryData(DebugDirectoryEntry entry)
{
if (entry.Type != DebugDirectoryEntryType.EmbeddedPortablePdb)
{
- throw new ArgumentException(SR.NotCodeViewEntry, nameof(entry));
+ Throw.InvalidArgument(SR.Format(SR.UnexpectedDebugDirectoryType, nameof(DebugDirectoryEntryType.EmbeddedPortablePdb)), nameof(entry));
}
ValidateEmbeddedPortablePdbVersion(entry);
@@ -669,10 +677,7 @@ namespace System.Reflection.PortableExecutable
{
byte[] decompressed;
- const int headerSize = 2 * sizeof(int);
-
- var headerReader = new BlobReader(block.Pointer, headerSize);
-
+ var headerReader = block.GetReader();
if (headerReader.ReadUInt32() != PortablePdbVersions.DebugDirectoryEmbeddedSignature)
{
throw new BadImageFormatException(SR.UnexpectedEmbeddedPortablePdbDataSignature);
@@ -689,7 +694,7 @@ namespace System.Reflection.PortableExecutable
throw new BadImageFormatException(SR.DataTooBig);
}
- var compressed = new ReadOnlyUnmanagedMemoryStream(block.Pointer + headerSize, block.Size - headerSize);
+ var compressed = new ReadOnlyUnmanagedMemoryStream(headerReader.CurrentPointer, headerReader.RemainingBytes);
var deflate = new DeflateStream(compressed, CompressionMode.Decompress, leaveOpen: true);
if (decompressedSize > 0)
@@ -721,5 +726,222 @@ namespace System.Reflection.PortableExecutable
return ImmutableByteArrayInterop.DangerousCreateFromUnderlyingArray(ref decompressed);
}
+
+ /// <summary>
+ /// Opens a Portable PDB associated with this PE image.
+ /// </summary>
+ /// <param name="peImagePath">
+ /// The path to the PE image. The path is used to locate the PDB file located in the directory containing the PE file.
+ /// </param>
+ /// <param name="pdbFileStreamProvider">
+ /// If specified, called to open a <see cref="Stream"/> for a given file path.
+ /// The provider is expected to either return a readable and seekable <see cref="Stream"/>,
+ /// or <c>null</c> if the target file doesn't exist or should be ignored for some reason.
+ ///
+ /// The provider shall throw <see cref="IOException"/> if it fails to open the file due to an unexpected IO error.
+ /// </param>
+ /// <param name="pdbReaderProvider">
+ /// If successful, a new instance of <see cref="MetadataReaderProvider"/> to be used to read the Portable PDB,.
+ /// </param>
+ /// <param name="pdbPath">
+ /// If successful and the PDB is found in a file, the path to the file. Returns <c>null</c> if the PDB is embedded in the PE image itself.
+ /// </param>
+ /// <returns>
+ /// True if the PE image has a PDB associated with it and the PDB has been successfully opened.
+ /// </returns>
+ /// <remarks>
+ /// Implements a simple PDB file lookup based on the content of the PE image Debug Directory.
+ /// A sophisticated tool might need to follow up with additional lookup on search paths or symbol server.
+ ///
+ /// The method looks the PDB up in the following steps in the listed order:
+ /// 1) Check for a matching PDB file of the name found in the CodeView entry in the directory containing the PE file (the directory of <paramref name="peImagePath"/>).
+ /// 2) Check for a PDB embedded in the PE image itself.
+ ///
+ /// The first PDB that matches the information specified in the Debug Directory is returned.
+ /// </remarks>
+ /// <exception cref="ArgumentNullException"><paramref name="peImagePath"/> or <paramref name="pdbFileStreamProvider"/> is null.</exception>
+ /// <exception cref="InvalidOperationException">The stream returned from <paramref name="pdbFileStreamProvider"/> doesn't support read and seek operations.</exception>
+ /// <exception cref="BadImageFormatException">No matching PDB file is found due to an error: The PE image or the PDB is invalid.</exception>
+ /// <exception cref="IOException">No matching PDB file is found due to an error: An IO error occurred while reading the PE image or the PDB.</exception>
+ public bool TryOpenAssociatedPortablePdb(string peImagePath, Func<string, Stream> pdbFileStreamProvider, out MetadataReaderProvider pdbReaderProvider, out string pdbPath)
+ {
+ if (peImagePath == null)
+ {
+ Throw.ArgumentNull(nameof(peImagePath));
+ }
+
+ if (pdbFileStreamProvider == null)
+ {
+ Throw.ArgumentNull(nameof(pdbFileStreamProvider));
+ }
+
+ pdbReaderProvider = null;
+ pdbPath = null;
+
+ string peImageDirectory;
+ try
+ {
+ peImageDirectory = Path.GetDirectoryName(peImagePath);
+ }
+ catch (Exception e)
+ {
+ throw new ArgumentException(e.Message, nameof(peImagePath));
+ }
+
+ Exception errorToReport = null;
+ var entries = ReadDebugDirectory();
+
+ // First try .pdb file specified in CodeView data (we prefer .pdb file on disk over embedded PDB
+ // since embedded PDB needs decompression which is less efficient than memory-mapping the file).
+ var codeViewEntry = entries.FirstOrDefault(e => e.IsPortableCodeView);
+ if (codeViewEntry.DataSize != 0 &&
+ TryOpenCodeViewPortablePdb(codeViewEntry, peImageDirectory, pdbFileStreamProvider, out pdbReaderProvider, out pdbPath, ref errorToReport))
+ {
+ return true;
+ }
+
+ // if it failed try Embedded Portable PDB (if available):
+ var embeddedPdbEntry = entries.FirstOrDefault(e => e.Type == DebugDirectoryEntryType.EmbeddedPortablePdb);
+ if (embeddedPdbEntry.DataSize != 0 &&
+ TryOpenEmbeddedPortablePdb(embeddedPdbEntry, out pdbReaderProvider, ref errorToReport))
+ {
+ return true;
+ }
+
+ // Report any metadata and IO errors. PDB might exist but we couldn't read some metadata.
+ // The caller might chose to ignore the failure or report it to the user.
+ if (errorToReport != null)
+ {
+ Debug.Assert(errorToReport is BadImageFormatException || errorToReport is IOException);
+ ExceptionDispatchInfo.Capture(errorToReport).Throw();
+ }
+
+ return false;
+ }
+
+ private bool TryOpenCodeViewPortablePdb(DebugDirectoryEntry codeViewEntry, string peImageDirectory, Func<string, Stream> pdbFileStreamProvider, out MetadataReaderProvider provider, out string pdbPath, ref Exception errorToReport)
+ {
+ pdbPath = null;
+ provider = null;
+
+ CodeViewDebugDirectoryData data;
+
+ try
+ {
+ data = ReadCodeViewDebugDirectoryData(codeViewEntry);
+ }
+ catch (Exception e) when (e is BadImageFormatException || e is IOException)
+ {
+ errorToReport = errorToReport ?? e;
+ return false;
+ }
+
+ if (data.Age != 1)
+ {
+ // not a portable code view:
+ return false;
+ }
+
+ var id = new BlobContentId(data.Guid, codeViewEntry.Stamp);
+
+ // The interpretation os the path in the CodeView needs to be platform agnostic,
+ // so that PDBs built on Windows work on Unix-like systems and vice versa.
+ // System.IO.Path.GetFileName() on Unix-like systems doesn't treat '\' as a file name separator,
+ // so we need a custom implementation. Also avoid throwing an exception if the path contains invalid characters,
+ // they might not be invalid on the other platform. It's up to the FS APIs to deal with that when opening the stream.
+ string collocatedPdbPath = PathUtilities.CombinePathWithRelativePath(peImageDirectory, PathUtilities.GetFileName(data.Path));
+
+ if (TryOpenPortablePdbFile(collocatedPdbPath, id, pdbFileStreamProvider, out provider, ref errorToReport))
+ {
+ pdbPath = collocatedPdbPath;
+ return true;
+ }
+
+ return false;
+ }
+
+ private bool TryOpenPortablePdbFile(string path, BlobContentId id, Func<string, Stream> pdbFileStreamProvider, out MetadataReaderProvider provider, ref Exception errorToReport)
+ {
+ provider = null;
+ MetadataReaderProvider candidate = null;
+
+ try
+ {
+ Stream pdbStream;
+
+ try
+ {
+ pdbStream = pdbFileStreamProvider(path);
+ }
+ catch (FileNotFoundException)
+ {
+ // Not an unexpected IO exception, continue witout reporting the error.
+ pdbStream = null;
+ }
+
+ if (pdbStream == null)
+ {
+ return false;
+ }
+
+ if (!pdbStream.CanRead || !pdbStream.CanSeek)
+ {
+ throw new InvalidOperationException(SR.StreamMustSupportReadAndSeek);
+ }
+
+ candidate = MetadataReaderProvider.FromPortablePdbStream(pdbStream);
+
+ // Validate that the PDB matches the assembly version
+ if (new BlobContentId(candidate.GetMetadataReader().DebugMetadataHeader.Id) != id)
+ {
+ return false;
+ }
+
+ provider = candidate;
+ return true;
+ }
+ catch (Exception e) when (e is BadImageFormatException || e is IOException)
+ {
+ errorToReport = errorToReport ?? e;
+ return false;
+ }
+ finally
+ {
+ if (provider == null)
+ {
+ candidate?.Dispose();
+ }
+ }
+ }
+
+ private bool TryOpenEmbeddedPortablePdb(DebugDirectoryEntry embeddedPdbEntry, out MetadataReaderProvider provider, ref Exception errorToReport)
+ {
+ provider = null;
+ MetadataReaderProvider candidate = null;
+
+ try
+ {
+ candidate = ReadEmbeddedPortablePdbDebugDirectoryData(embeddedPdbEntry);
+
+ // throws if headers are invalid:
+ candidate.GetMetadataReader();
+
+ provider = candidate;
+ return true;
+ }
+ catch (Exception e) when (e is BadImageFormatException || e is IOException)
+ {
+ errorToReport = errorToReport ?? e;
+ return false;
+ }
+ finally
+ {
+ if (candidate == null)
+ {
+ candidate?.Dispose();
+ }
+ }
+ }
+
}
}
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEStreamOptions.cs b/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEStreamOptions.cs
index b4d151c312..f9810ece72 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEStreamOptions.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEStreamOptions.cs
@@ -35,13 +35,18 @@ namespace System.Reflection.PortableExecutable
/// <see cref="PEReader"/> closes the stream automatically by the time the constructor returns unless <see cref="LeaveOpen"/> is specified.
/// </remarks>
PrefetchEntireImage = 1 << 2,
+
+ /// <summary>
+ /// Indicates that the underlying PE image has been loaded into memory by the OS loader.
+ /// </summary>
+ IsLoadedImage = 1 << 3,
}
internal static class PEStreamOptionsExtensions
{
public static bool IsValid(this PEStreamOptions options)
{
- return (options & ~(PEStreamOptions.LeaveOpen | PEStreamOptions.PrefetchEntireImage | PEStreamOptions.PrefetchMetadata)) == 0;
+ return (options & ~(PEStreamOptions.LeaveOpen | PEStreamOptions.PrefetchEntireImage | PEStreamOptions.PrefetchMetadata | PEStreamOptions.IsLoadedImage)) == 0;
}
}
}
diff --git a/src/System.Reflection.Metadata/src/System/Reflection/Throw.cs b/src/System.Reflection.Metadata/src/System/Reflection/Throw.cs
index e55d9c8314..41bc5fd604 100644
--- a/src/System.Reflection.Metadata/src/System/Reflection/Throw.cs
+++ b/src/System.Reflection.Metadata/src/System/Reflection/Throw.cs
@@ -229,6 +229,12 @@ namespace System.Reflection
}
[MethodImpl(MethodImplOptions.NoInlining)]
+ internal static void InvalidOperation_PEImageNotAvailable()
+ {
+ throw new InvalidOperationException(SR.PEImageNotAvailable);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
internal static void TooManySubnamespaces()
{
throw new BadImageFormatException(SR.TooManySubnamespaces);
@@ -251,5 +257,11 @@ namespace System.Reflection
{
throw new ImageFormatLimitationException(SR.Format(SR.HeapSizeLimitExceeded, heap));
}
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ internal static void PEReaderDisposed()
+ {
+ throw new ObjectDisposedException(nameof(PortableExecutable.PEReader));
+ }
}
}
diff --git a/src/System.Reflection.Metadata/tests/Metadata/HandleTests.cs b/src/System.Reflection.Metadata/tests/Metadata/HandleTests.cs
index f957dcbcda..bc50ec7723 100644
--- a/src/System.Reflection.Metadata/tests/Metadata/HandleTests.cs
+++ b/src/System.Reflection.Metadata/tests/Metadata/HandleTests.cs
@@ -566,21 +566,37 @@ namespace System.Reflection.Metadata.Tests
Assert.Equal(StringKind.Plain, str.StringKind);
Assert.False(str.IsVirtual);
Assert.Equal(123, str.GetHeapOffset());
+ Assert.Equal(str, (Handle)str);
+ Assert.Equal(str, (StringHandle)(Handle)str);
+ Assert.Equal(0x78, ((Handle)str).VType);
+ Assert.Equal(123, ((Handle)str).Offset);
var vstr = StringHandle.FromVirtualIndex(StringHandle.VirtualIndex.AttributeTargets);
Assert.Equal(StringKind.Virtual, vstr.StringKind);
Assert.True(vstr.IsVirtual);
Assert.Equal(StringHandle.VirtualIndex.AttributeTargets, vstr.GetVirtualIndex());
+ Assert.Equal(vstr, (Handle)vstr);
+ Assert.Equal(vstr, (StringHandle)(Handle)vstr);
+ Assert.Equal(0xF8, ((Handle)vstr).VType);
+ Assert.Equal((int)StringHandle.VirtualIndex.AttributeTargets, ((Handle)vstr).Offset);
var dot = StringHandle.FromOffset(123).WithDotTermination();
Assert.Equal(StringKind.DotTerminated, dot.StringKind);
Assert.False(dot.IsVirtual);
Assert.Equal(123, dot.GetHeapOffset());
+ Assert.Equal(dot, (Handle)dot);
+ Assert.Equal(dot, (StringHandle)(Handle)dot);
+ Assert.Equal(0x79, ((Handle)dot).VType);
+ Assert.Equal(123, ((Handle)dot).Offset);
var winrtPrefix = StringHandle.FromOffset(123).WithWinRTPrefix();
Assert.Equal(StringKind.WinRTPrefixed, winrtPrefix.StringKind);
Assert.True(winrtPrefix.IsVirtual);
Assert.Equal(123, winrtPrefix.GetHeapOffset());
+ Assert.Equal(winrtPrefix, (Handle)winrtPrefix);
+ Assert.Equal(winrtPrefix, (StringHandle)(Handle)winrtPrefix);
+ Assert.Equal(0xF9, ((Handle)winrtPrefix).VType);
+ Assert.Equal(123, ((Handle)winrtPrefix).Offset);
}
[Fact]
@@ -589,14 +605,26 @@ namespace System.Reflection.Metadata.Tests
var full = NamespaceDefinitionHandle.FromFullNameOffset(123);
Assert.False(full.IsVirtual);
Assert.Equal(123, full.GetHeapOffset());
+ Assert.Equal(full, (Handle)full);
+ Assert.Equal(full, (NamespaceDefinitionHandle)(Handle)full);
+ Assert.Equal(0x7C, ((Handle)full).VType);
+ Assert.Equal(123, ((Handle)full).Offset);
var virtual1 = NamespaceDefinitionHandle.FromVirtualIndex(123);
Assert.True(virtual1.IsVirtual);
+ Assert.Equal(virtual1, (Handle)virtual1);
+ Assert.Equal(virtual1, (NamespaceDefinitionHandle)(Handle)virtual1);
+ Assert.Equal(0xFC, ((Handle)virtual1).VType);
+ Assert.Equal(123, ((Handle)virtual1).Offset);
- var virtual2 = NamespaceDefinitionHandle.FromVirtualIndex((UInt32.MaxValue >> 3));
+ var virtual2 = NamespaceDefinitionHandle.FromVirtualIndex(uint.MaxValue >> 3);
Assert.True(virtual2.IsVirtual);
+ Assert.Equal(virtual2, (Handle)virtual2);
+ Assert.Equal(virtual2, (NamespaceDefinitionHandle)(Handle)virtual2);
+ Assert.Equal(0xFC, ((Handle)virtual2).VType);
+ Assert.Equal((int)(uint.MaxValue >> 3), ((Handle)virtual2).Offset);
- Assert.Throws<BadImageFormatException>(() => NamespaceDefinitionHandle.FromVirtualIndex((UInt32.MaxValue >> 3) + 1));
+ Assert.Throws<BadImageFormatException>(() => NamespaceDefinitionHandle.FromVirtualIndex((uint.MaxValue >> 3) + 1));
}
[Fact]
diff --git a/src/System.Reflection.Metadata/tests/Metadata/MetadataReaderProviderTests.cs b/src/System.Reflection.Metadata/tests/Metadata/MetadataReaderProviderTests.cs
index 140b2bf90c..4d40b1a2f6 100644
--- a/src/System.Reflection.Metadata/tests/Metadata/MetadataReaderProviderTests.cs
+++ b/src/System.Reflection.Metadata/tests/Metadata/MetadataReaderProviderTests.cs
@@ -4,16 +4,29 @@
using System.Collections.Immutable;
using System.IO;
-using System.Reflection.Metadata;
-using System.Reflection.Metadata.Tests;
+using System.Reflection.Metadata.Ecma335;
+using System.Text;
using Xunit;
namespace System.Reflection.Metadata.Tests
{
public class MetadataReaderProviderTests
{
+ private static BlobBuilder BuildMetadataImage()
+ {
+ var mdBuilder = new MetadataBuilder();
+ mdBuilder.AddModule(0, default(StringHandle), default(GuidHandle), default(GuidHandle), default(GuidHandle));
+
+ var rootBuilder = new MetadataRootBuilder(mdBuilder, "v9.9.9.9");
+
+ var builder = new BlobBuilder();
+ rootBuilder.Serialize(builder, 0, 0);
+
+ return builder;
+ }
+
[Fact]
- public unsafe void FromMetadataImage1()
+ public unsafe void FromMetadataImage_BadArgs()
{
Assert.Throws<ArgumentNullException>(() => MetadataReaderProvider.FromMetadataImage(null, 10));
@@ -66,6 +79,50 @@ namespace System.Reflection.Metadata.Tests
}
[Fact]
+ public void GetMetadataReader_FromMetadataImage()
+ {
+ TestGetMetadataReader(MetadataReaderProvider.FromMetadataImage(BuildMetadataImage().ToImmutableArray()));
+ }
+
+ [Fact]
+ public void GetMetadataReader_FromMetadataStream()
+ {
+ TestGetMetadataReader(MetadataReaderProvider.FromMetadataStream(new MemoryStream(BuildMetadataImage().ToArray())));
+ }
+
+ private unsafe void TestGetMetadataReader(MetadataReaderProvider provider)
+ {
+ var decoder = new TestMetadataStringDecoder(Encoding.UTF8, (a, b) => "str");
+
+ var reader1 = provider.GetMetadataReader(MetadataReaderOptions.None, decoder);
+ Assert.Equal("str", reader1.MetadataVersion);
+ Assert.Same(reader1.Utf8Decoder, decoder);
+ Assert.Equal(reader1.Options, MetadataReaderOptions.None);
+
+ var reader2 = provider.GetMetadataReader(MetadataReaderOptions.None, decoder);
+ Assert.Same(reader1, reader2);
+
+ var reader3 = provider.GetMetadataReader(MetadataReaderOptions.None);
+ Assert.NotSame(reader2, reader3);
+ Assert.Equal("v9.9.9.9", reader3.MetadataVersion);
+ Assert.Same(reader3.Utf8Decoder, MetadataStringDecoder.DefaultUTF8);
+ Assert.Equal(reader3.Options, MetadataReaderOptions.None);
+
+ var reader4 = provider.GetMetadataReader(MetadataReaderOptions.None);
+ Assert.Same(reader3, reader4);
+
+ var reader5 = provider.GetMetadataReader(MetadataReaderOptions.ApplyWindowsRuntimeProjections);
+ Assert.NotSame(reader4, reader5);
+ Assert.Equal("v9.9.9.9", reader5.MetadataVersion);
+ Assert.Same(reader5.Utf8Decoder, MetadataStringDecoder.DefaultUTF8);
+ Assert.Equal(reader5.Options, MetadataReaderOptions.ApplyWindowsRuntimeProjections);
+
+ provider.Dispose();
+ Assert.Throws<ObjectDisposedException>(() => provider.GetMetadataReader(MetadataReaderOptions.ApplyWindowsRuntimeProjections));
+ Assert.Throws<ObjectDisposedException>(() => provider.GetMetadataReader());
+ }
+
+ [Fact]
[ActiveIssue(7996)]
public void FromMetadataStream_NonZeroStart()
{
diff --git a/src/System.Reflection.Metadata/tests/Metadata/MetadataReaderTests.cs b/src/System.Reflection.Metadata/tests/Metadata/MetadataReaderTests.cs
index 2eddf138d3..8689738a58 100644
--- a/src/System.Reflection.Metadata/tests/Metadata/MetadataReaderTests.cs
+++ b/src/System.Reflection.Metadata/tests/Metadata/MetadataReaderTests.cs
@@ -221,6 +221,114 @@ namespace System.Reflection.Metadata.Tests
Assert.Equal(3, reader.AssemblyReferences.Count);
}
+ [Fact]
+ public void GetBlobReader_VirtualBlob()
+ {
+ var reader = GetMetadataReader(WinRT.Lib, options: MetadataReaderOptions.ApplyWindowsRuntimeProjections);
+ var handle = reader.AssemblyReferences.Skip(3).First();
+ Assert.True(handle.IsVirtual);
+
+ var assemblyRef = reader.GetAssemblyReference(handle);
+ Assert.Equal("System.Runtime", reader.GetString(assemblyRef.Name));
+
+ AssertEx.Equal(
+ new byte[] { 0xB0, 0x3F, 0x5F, 0x7F, 0x11, 0xD5, 0x0A, 0x3A },
+ reader.GetBlobBytes(assemblyRef.PublicKeyOrToken));
+
+ var blobReader = reader.GetBlobReader(assemblyRef.PublicKeyOrToken);
+ Assert.Equal(new byte[] { 0xB0, 0x3F, 0x5F, 0x7F, 0x11, 0xD5, 0x0A, 0x3A }, blobReader.ReadBytes(8));
+ Assert.Equal(0, blobReader.RemainingBytes);
+ }
+
+ [Fact]
+ public void GetString_WinRTPrefixed_Projected()
+ {
+ var reader = GetMetadataReader(WinRT.Lib, options: MetadataReaderOptions.ApplyWindowsRuntimeProjections);
+
+ // .class /*02000002*/ public auto ansi sealed beforefieldinit Lib.Class1
+ var winrtDefHandle = MetadataTokens.TypeDefinitionHandle(2);
+ var winrtDef = reader.GetTypeDefinition(winrtDefHandle);
+ Assert.Equal(StringKind.Plain, winrtDef.Name.StringKind);
+ Assert.Equal("Class1", reader.GetString(winrtDef.Name));
+ Assert.Equal(
+ TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.AutoLayout | TypeAttributes.AnsiClass |
+ TypeAttributes.Sealed | TypeAttributes.BeforeFieldInit,
+ winrtDef.Attributes);
+
+ var strReader = reader.GetBlobReader(winrtDef.Name);
+ Assert.Equal(Encoding.UTF8.GetBytes("Class1"), strReader.ReadBytes("Class1".Length));
+ Assert.Equal(0, strReader.RemainingBytes);
+
+ // .class /*02000003*/ private auto ansi import windowsruntime sealed beforefieldinit Lib.'<WinRT>Class1'
+ var clrDefHandle = MetadataTokens.TypeDefinitionHandle(3);
+ var clrDef = reader.GetTypeDefinition(clrDefHandle);
+ Assert.Equal(StringKind.WinRTPrefixed, clrDef.Name.StringKind);
+ Assert.Equal("<WinRT>Class1", reader.GetString(clrDef.Name));
+ Assert.Equal(
+ TypeAttributes.Class | TypeAttributes.NotPublic | TypeAttributes.AutoLayout | TypeAttributes.AnsiClass |
+ TypeAttributes.Import | TypeAttributes.WindowsRuntime | TypeAttributes.Sealed | TypeAttributes.BeforeFieldInit,
+ clrDef.Attributes);
+
+ strReader = reader.GetBlobReader(clrDef.Name);
+ Assert.Equal(Encoding.UTF8.GetBytes("<WinRT>Class1"), strReader.ReadBytes("<WinRT>Class1".Length));
+ Assert.Equal(0, strReader.RemainingBytes);
+ }
+
+ [Fact]
+ public void GetString_WinRTPrefixed_NotProjected()
+ {
+ var reader = GetMetadataReader(WinRT.Lib, options: MetadataReaderOptions.None);
+
+ // .class /*02000002*/ private auto ansi sealed beforefieldinit specialname Lib.'<CLR>Class1'
+ var winrtDefHandle = MetadataTokens.TypeDefinitionHandle(2);
+ var winrtDef = reader.GetTypeDefinition(winrtDefHandle);
+ Assert.Equal(StringKind.Plain, winrtDef.Name.StringKind);
+ Assert.Equal("<CLR>Class1", reader.GetString(winrtDef.Name));
+ Assert.Equal(
+ TypeAttributes.Class | TypeAttributes.NotPublic | TypeAttributes.AutoLayout | TypeAttributes.AnsiClass |
+ TypeAttributes.Sealed | TypeAttributes.BeforeFieldInit | TypeAttributes.SpecialName,
+ winrtDef.Attributes);
+
+ var strReader = reader.GetBlobReader(winrtDef.Name);
+ Assert.Equal(Encoding.UTF8.GetBytes("<CLR>Class1"), strReader.ReadBytes("<CLR>Class1".Length));
+ Assert.Equal(0, strReader.RemainingBytes);
+
+ // .class /*02000003*/ public auto ansi windowsruntime sealed beforefieldinit Lib.Class1
+ var clrDefHandle = MetadataTokens.TypeDefinitionHandle(3);
+ var clrDef = reader.GetTypeDefinition(clrDefHandle);
+ Assert.Equal(StringKind.Plain, clrDef.Name.StringKind);
+ Assert.Equal("Class1", reader.GetString(clrDef.Name));
+ Assert.Equal(
+ TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.AutoLayout | TypeAttributes.AnsiClass |
+ TypeAttributes.WindowsRuntime | TypeAttributes.Sealed | TypeAttributes.BeforeFieldInit,
+ clrDef.Attributes);
+
+ strReader = reader.GetBlobReader(clrDef.Name);
+ Assert.Equal(Encoding.UTF8.GetBytes("Class1"), strReader.ReadBytes("Class1".Length));
+ Assert.Equal(0, strReader.RemainingBytes);
+ }
+
+ [Fact]
+ public void GetString_DotTerminated()
+ {
+ var reader = GetMetadataReader(WinRT.Lib, options: MetadataReaderOptions.None);
+
+ // 4: 0x23000001 (AssemblyRef) 'CompilationRelaxationsAttribute' (#1c3) 'System.Runtime.CompilerServices' (#31a)
+ var typeRef = reader.GetTypeReference(MetadataTokens.TypeReferenceHandle(4));
+ Assert.Equal("System.Runtime.CompilerServices", reader.GetString(typeRef.Namespace));
+
+ var strReader = reader.GetBlobReader(typeRef.Namespace);
+ Assert.Equal(Encoding.UTF8.GetBytes("System.Runtime.CompilerServices"), strReader.ReadBytes("System.Runtime.CompilerServices".Length));
+ Assert.Equal(0, strReader.RemainingBytes);
+
+ var dotTerminated = typeRef.Namespace.WithDotTermination();
+ Assert.Equal("System", reader.GetString(dotTerminated));
+
+ strReader = reader.GetBlobReader(dotTerminated);
+ Assert.Equal(Encoding.UTF8.GetBytes("System"), strReader.ReadBytes("System".Length));
+ Assert.Equal(0, strReader.RemainingBytes);
+ }
+
/// <summary>
/// Assembly Table Columns:
/// Name (offset to #String)
@@ -2642,7 +2750,7 @@ namespace System.Reflection.Metadata.Tests
offsetToModuleTable = offsetToMetadata + peReader.GetMetadataReader().GetTableMetadataOffset(TableIndex.Module);
// skip root header
- BlobReader blobReader = new BlobReader(metadata.Pointer, metadata.Length);
+ BlobReader blobReader = metadata.GetReader();
blobReader.ReadUInt32(); // signature
blobReader.ReadUInt16(); // major version
blobReader.ReadUInt16(); // minor version
diff --git a/src/System.Reflection.Metadata/tests/Metadata/PortablePdb/DocumentNameTests.cs b/src/System.Reflection.Metadata/tests/Metadata/PortablePdb/DocumentNameTests.cs
index 4a4a489d6a..884a5178d1 100644
--- a/src/System.Reflection.Metadata/tests/Metadata/PortablePdb/DocumentNameTests.cs
+++ b/src/System.Reflection.Metadata/tests/Metadata/PortablePdb/DocumentNameTests.cs
@@ -34,7 +34,7 @@ namespace System.Reflection.Metadata.Tests
fixed (byte* ptr = blobHeapData)
{
- var blobHeap = new BlobStreamReader(new MemoryBlock(ptr, blobHeapData.Length), MetadataKind.Ecma335);
+ var blobHeap = new BlobHeap(new MemoryBlock(ptr, blobHeapData.Length), MetadataKind.Ecma335);
var handle = DocumentNameBlobHandle.FromOffset(8);
@@ -77,7 +77,7 @@ namespace System.Reflection.Metadata.Tests
fixed (byte* ptr = blobHeapData)
{
- var blobHeap = new BlobStreamReader(new MemoryBlock(ptr, blobHeapData.Length), MetadataKind.Ecma335);
+ var blobHeap = new BlobHeap(new MemoryBlock(ptr, blobHeapData.Length), MetadataKind.Ecma335);
var handle = DocumentNameBlobHandle.FromOffset(3);
@@ -119,7 +119,7 @@ namespace System.Reflection.Metadata.Tests
fixed (byte* ptr = blobHeapData)
{
- var blobHeap = new BlobStreamReader(new MemoryBlock(ptr, blobHeapData.Length), MetadataKind.Ecma335);
+ var blobHeap = new BlobHeap(new MemoryBlock(ptr, blobHeapData.Length), MetadataKind.Ecma335);
var handle = DocumentNameBlobHandle.FromOffset(3);
@@ -155,7 +155,7 @@ namespace System.Reflection.Metadata.Tests
fixed (byte* ptr = blobHeapData)
{
- var blobHeap = new BlobStreamReader(new MemoryBlock(ptr, blobHeapData.Length), MetadataKind.Ecma335);
+ var blobHeap = new BlobHeap(new MemoryBlock(ptr, blobHeapData.Length), MetadataKind.Ecma335);
var handle = DocumentNameBlobHandle.FromOffset(3);
@@ -185,7 +185,7 @@ namespace System.Reflection.Metadata.Tests
fixed (byte* ptr = blobHeapData)
{
- var blobHeap = new BlobStreamReader(new MemoryBlock(ptr, blobHeapData.Length), MetadataKind.Ecma335);
+ var blobHeap = new BlobHeap(new MemoryBlock(ptr, blobHeapData.Length), MetadataKind.Ecma335);
var handle = DocumentNameBlobHandle.FromOffset(3);
@@ -228,7 +228,7 @@ namespace System.Reflection.Metadata.Tests
fixed (byte* ptr = blobHeapData)
{
- var blobHeap = new BlobStreamReader(new MemoryBlock(ptr, blobHeapData.Length), MetadataKind.Ecma335);
+ var blobHeap = new BlobHeap(new MemoryBlock(ptr, blobHeapData.Length), MetadataKind.Ecma335);
var handle = DocumentNameBlobHandle.FromOffset(7);
@@ -258,7 +258,7 @@ namespace System.Reflection.Metadata.Tests
fixed (byte* ptr = blobHeapData)
{
- var blobHeap = new BlobStreamReader(new MemoryBlock(ptr, blobHeapData.Length), MetadataKind.Ecma335);
+ var blobHeap = new BlobHeap(new MemoryBlock(ptr, blobHeapData.Length), MetadataKind.Ecma335);
var handle = DocumentNameBlobHandle.FromOffset(1);
diff --git a/src/System.Reflection.Metadata/tests/PortableExecutable/DebugDirectoryBuilderTests.cs b/src/System.Reflection.Metadata/tests/PortableExecutable/DebugDirectoryBuilderTests.cs
index 88bda6e015..71191ac41b 100644
--- a/src/System.Reflection.Metadata/tests/PortableExecutable/DebugDirectoryBuilderTests.cs
+++ b/src/System.Reflection.Metadata/tests/PortableExecutable/DebugDirectoryBuilderTests.cs
@@ -13,10 +13,32 @@ namespace System.Reflection.PortableExecutable.Tests
public class DebugDirectoryBuilderTests
{
[Fact]
- public void Errors()
+ public void AddEmbeddedPortablePdbEntry_Args()
{
- var b = new DebugDirectoryBuilder();
- Assert.Throws<ArgumentNullException>(() => b.AddCodeViewEntry(null, default(BlobContentId), 0));
+ var bb = new BlobBuilder();
+
+ var builder = new DebugDirectoryBuilder();
+ Assert.Throws<ArgumentNullException>(() => builder.AddEmbeddedPortablePdbEntry(null, 0x0100));
+ Assert.Throws<ArgumentOutOfRangeException>(() => builder.AddEmbeddedPortablePdbEntry(bb, 0x0000));
+ Assert.Throws<ArgumentOutOfRangeException>(() => builder.AddEmbeddedPortablePdbEntry(bb, 0x00ff));
+ builder.AddEmbeddedPortablePdbEntry(bb, 0x0100);
+ builder.AddEmbeddedPortablePdbEntry(bb, 0xffff);
+ }
+
+ [Fact]
+ public void AddCodeViewEntry_Args()
+ {
+ var builder = new DebugDirectoryBuilder();
+ Assert.Throws<ArgumentException>(() => builder.AddCodeViewEntry("", default(BlobContentId), 0x0100));
+ Assert.Throws<ArgumentException>(() => builder.AddCodeViewEntry("\0", default(BlobContentId), 0x0100));
+ Assert.Throws<ArgumentException>(() => builder.AddCodeViewEntry("\0xx", default(BlobContentId), 0x0100));
+ builder.AddCodeViewEntry("foo\0", default(BlobContentId), 0x0100);
+ Assert.Throws<ArgumentNullException>(() => builder.AddCodeViewEntry(null, default(BlobContentId), 0x0100));
+ builder.AddCodeViewEntry("foo", default(BlobContentId), 0);
+ Assert.Throws<ArgumentOutOfRangeException>(() => builder.AddCodeViewEntry("foo", default(BlobContentId), 0x0001));
+ Assert.Throws<ArgumentOutOfRangeException>(() => builder.AddCodeViewEntry("foo", default(BlobContentId), 0x00ff));
+ builder.AddCodeViewEntry("foo", default(BlobContentId), 0x0100);
+ builder.AddCodeViewEntry("foo", default(BlobContentId), 0xffff);
}
[Fact]
@@ -65,6 +87,7 @@ namespace System.Reflection.PortableExecutable.Tests
Assert.Equal(0, actual[0].MajorVersion);
Assert.Equal(0, actual[0].MinorVersion);
Assert.Equal(DebugDirectoryEntryType.CodeView, actual[0].Type);
+ Assert.False(actual[0].IsPortableCodeView);
Assert.Equal(0x00000020, actual[0].DataSize);
Assert.Equal(0x0000106c, actual[0].DataRelativeVirtualAddress);
Assert.Equal(0x0000206c, actual[0].DataPointer);
@@ -123,6 +146,7 @@ namespace System.Reflection.PortableExecutable.Tests
Assert.Equal(0xABCD, actual[0].MajorVersion);
Assert.Equal(0x504d, actual[0].MinorVersion);
Assert.Equal(DebugDirectoryEntryType.CodeView, actual[0].Type);
+ Assert.True(actual[0].IsPortableCodeView);
Assert.Equal(0x0000011c, actual[0].DataSize);
Assert.Equal(0x0000106c, actual[0].DataRelativeVirtualAddress);
Assert.Equal(0x0000206c, actual[0].DataPointer);
@@ -158,6 +182,7 @@ namespace System.Reflection.PortableExecutable.Tests
Assert.Equal(0, actual[0].MajorVersion);
Assert.Equal(0, actual[0].MinorVersion);
Assert.Equal(DebugDirectoryEntryType.Reproducible, actual[0].Type);
+ Assert.False(actual[0].IsPortableCodeView);
Assert.Equal(0, actual[0].DataSize);
Assert.Equal(0, actual[0].DataRelativeVirtualAddress);
Assert.Equal(0, actual[0].DataPointer);
@@ -262,6 +287,7 @@ namespace System.Reflection.PortableExecutable.Tests
Assert.Equal(0x0100, actual[0].MajorVersion);
Assert.Equal(0x0100, actual[0].MinorVersion);
Assert.Equal(DebugDirectoryEntryType.EmbeddedPortablePdb, actual[0].Type);
+ Assert.False(actual[0].IsPortableCodeView);
Assert.Equal(0x00000012, actual[0].DataSize);
Assert.Equal(0x0000001c, actual[0].DataRelativeVirtualAddress);
Assert.Equal(0x0000001c, actual[0].DataPointer);
@@ -274,121 +300,5 @@ namespace System.Reflection.PortableExecutable.Tests
}
}
}
-
- [Fact]
- public void EmbeddedPortablePdb_Errors()
- {
- var bytes1 = ImmutableArray.Create(new byte[]
- {
- 0x4D, 0x50, 0x44, 0x42, // signature
- 0xFF, 0xFF, 0xFF, 0xFF, // uncompressed size
- 0xEB, 0x28, 0x4F, 0x0B, 0x75, 0x31, 0x56, 0x12, 0x04, 0x00 // compressed data
- });
-
- using (var block = new ByteArrayMemoryProvider(bytes1).GetMemoryBlock(0, bytes1.Length))
- {
- Assert.Throws<BadImageFormatException>(() => PEReader.DecodeEmbeddedPortablePdbDebugDirectoryData(block));
- }
-
- var bytes2 = ImmutableArray.Create(new byte[]
- {
- 0x4D, 0x50, 0x44, 0x42, // signature
- 0x09, 0x00, 0x00, 0x00, // uncompressed size
- 0xEB, 0x28, 0x4F, 0x0B, 0x75, 0x31, 0x56, 0x12, 0x04, 0x00 // compressed data
- });
-
- using (var block = new ByteArrayMemoryProvider(bytes2).GetMemoryBlock(0, bytes2.Length))
- {
- Assert.Throws<BadImageFormatException>(() => PEReader.DecodeEmbeddedPortablePdbDebugDirectoryData(block));
- }
-
- var bytes3 = ImmutableArray.Create(new byte[]
- {
- 0x4D, 0x50, 0x44, 0x42, // signature
- 0x00, 0x00, 0x00, 0x00, // uncompressed size
- 0xEB, 0x28, 0x4F, 0x0B, 0x75, 0x31, 0x56, 0x12, 0x04, 0x00 // compressed data
- });
-
- using (var block = new ByteArrayMemoryProvider(bytes3).GetMemoryBlock(0, bytes3.Length))
- {
- Assert.Throws<BadImageFormatException>(() => PEReader.DecodeEmbeddedPortablePdbDebugDirectoryData(block));
- }
-
- var bytes4 = ImmutableArray.Create(new byte[]
- {
- 0x4D, 0x50, 0x44, 0x42, // signature
- 0xff, 0xff, 0xff, 0x7f, // uncompressed size
- 0xEB, 0x28, 0x4F, 0x0B, 0x75, 0x31, 0x56, 0x12, 0x04, 0x00 // compressed data
- });
-
- using (var block = new ByteArrayMemoryProvider(bytes4).GetMemoryBlock(0, bytes4.Length))
- {
- Assert.Throws<BadImageFormatException>(() => PEReader.DecodeEmbeddedPortablePdbDebugDirectoryData(block));
- }
-
- var bytes5 = ImmutableArray.Create(new byte[]
- {
- 0x4D, 0x50, 0x44, 0x42, // signature
- 0x08, 0x00, 0x00, 0x00, // uncompressed size
- 0xEF, 0xFF, 0x4F, 0xFF, 0x75, 0x31, 0x56, 0x12, 0x04, 0x00 // compressed data
- });
-
- using (var block = new ByteArrayMemoryProvider(bytes4).GetMemoryBlock(0, bytes4.Length))
- {
- Assert.Throws<BadImageFormatException>(() => PEReader.DecodeEmbeddedPortablePdbDebugDirectoryData(block));
- }
-
- var bytes6 = ImmutableArray.Create(new byte[]
- {
- 0x4D, 0x50, 0x44, 0x43, // signature
- 0x08, 0x00, 0x00, 0x00, // uncompressed size
- 0xEB, 0x28, 0x4F, 0x0B, 0x75, 0x31, 0x56, 0x12, 0x04, 0x00 // compressed data
- });
-
- using (var block = new ByteArrayMemoryProvider(bytes6).GetMemoryBlock(0, bytes6.Length))
- {
- Assert.Throws<BadImageFormatException>(() => PEReader.DecodeEmbeddedPortablePdbDebugDirectoryData(block));
- }
-
- var bytes7 = ImmutableArray.Create(new byte[]
- {
- 0x4D, 0x50, 0x44, 0x43, // signature
- 0x08, 0x00, 0x00,
- });
-
- using (var block = new ByteArrayMemoryProvider(bytes7).GetMemoryBlock(0, bytes7.Length))
- {
- Assert.Throws<BadImageFormatException>(() => PEReader.DecodeEmbeddedPortablePdbDebugDirectoryData(block));
- }
-
- var bytes8 = ImmutableArray.Create(new byte[]
- {
- 0x4D, 0x50, 0x44, 0x43, // signature
- 0x08, 0x00, 0x00,
- });
-
- using (var block = new ByteArrayMemoryProvider(bytes8).GetMemoryBlock(0, bytes8.Length))
- {
- Assert.Throws<BadImageFormatException>(() => PEReader.DecodeEmbeddedPortablePdbDebugDirectoryData(block));
- }
- }
-
- [Fact]
- public void ValidateEmbeddedPortablePdbVersion()
- {
- // major version (Portable PDB format):
- PEReader.ValidateEmbeddedPortablePdbVersion(new DebugDirectoryEntry(0, 0x0100, 0x0100, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0));
- PEReader.ValidateEmbeddedPortablePdbVersion(new DebugDirectoryEntry(0, 0x0101, 0x0100, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0));
- PEReader.ValidateEmbeddedPortablePdbVersion(new DebugDirectoryEntry(0, 0xffff, 0x0100, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0));
-
- Assert.Throws<BadImageFormatException>(() => PEReader.ValidateEmbeddedPortablePdbVersion(new DebugDirectoryEntry(0, 0x0000, 0x0100, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0)));
- Assert.Throws<BadImageFormatException>(() => PEReader.ValidateEmbeddedPortablePdbVersion(new DebugDirectoryEntry(0, 0x00ff, 0x0100, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0)));
-
- // minor version (Embedded blob format):
- Assert.Throws<BadImageFormatException>(() => PEReader.ValidateEmbeddedPortablePdbVersion(new DebugDirectoryEntry(0, 0x0100, 0x0101, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0)));
- Assert.Throws<BadImageFormatException>(() => PEReader.ValidateEmbeddedPortablePdbVersion(new DebugDirectoryEntry(0, 0x0100, 0x0000, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0)));
- Assert.Throws<BadImageFormatException>(() => PEReader.ValidateEmbeddedPortablePdbVersion(new DebugDirectoryEntry(0, 0x0100, 0x00ff, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0)));
- Assert.Throws<BadImageFormatException>(() => PEReader.ValidateEmbeddedPortablePdbVersion(new DebugDirectoryEntry(0, 0x0100, 0x0200, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0)));
- }
}
}
diff --git a/src/System.Reflection.Metadata/tests/PortableExecutable/DebugDirectoryTests.cs b/src/System.Reflection.Metadata/tests/PortableExecutable/DebugDirectoryTests.cs
index 4797de8f0a..bf27278272 100644
--- a/src/System.Reflection.Metadata/tests/PortableExecutable/DebugDirectoryTests.cs
+++ b/src/System.Reflection.Metadata/tests/PortableExecutable/DebugDirectoryTests.cs
@@ -2,8 +2,10 @@
// 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.Collections.Immutable;
using System.IO;
using System.Linq;
+using System.Reflection.Internal;
using System.Reflection.Metadata.Tests;
using Xunit;
@@ -39,6 +41,13 @@ namespace System.Reflection.PortableExecutable.Tests
LoaderUtilities.LoadPEAndValidate(Misc.Debug, ValidateCodeView);
}
+ [Fact]
+ [PlatformSpecific(PlatformID.Windows)]
+ public void CodeView_Loaded_FromStream()
+ {
+ LoaderUtilities.LoadPEAndValidate(Misc.Debug, ValidateCodeView, useStream: true);
+ }
+
private void ValidateCodeView(PEReader reader)
{
// dumpbin:
@@ -51,6 +60,7 @@ namespace System.Reflection.PortableExecutable.Tests
var cvEntry = reader.ReadDebugDirectory().Single();
Assert.Equal(DebugDirectoryEntryType.CodeView, cvEntry.Type);
+ Assert.False(cvEntry.IsPortableCodeView);
Assert.Equal(0x050c, cvEntry.DataPointer);
Assert.Equal(0x230c, cvEntry.DataRelativeVirtualAddress);
Assert.Equal(0x011c, cvEntry.DataSize); // includes NUL padding
@@ -96,6 +106,7 @@ namespace System.Reflection.PortableExecutable.Tests
var cvEntry = entries[0];
Assert.Equal(DebugDirectoryEntryType.CodeView, cvEntry.Type);
+ Assert.False(cvEntry.IsPortableCodeView);
Assert.Equal(0x0538, cvEntry.DataPointer);
Assert.Equal(0x2338, cvEntry.DataRelativeVirtualAddress);
Assert.Equal(0x0032, cvEntry.DataSize); // no NUL padding
@@ -110,6 +121,7 @@ namespace System.Reflection.PortableExecutable.Tests
var detEntry = entries[1];
Assert.Equal(DebugDirectoryEntryType.Reproducible, detEntry.Type);
+ Assert.False(detEntry.IsPortableCodeView);
Assert.Equal(0, detEntry.DataPointer);
Assert.Equal(0, detEntry.DataRelativeVirtualAddress);
Assert.Equal(0, detEntry.DataSize);
@@ -118,8 +130,236 @@ namespace System.Reflection.PortableExecutable.Tests
Assert.Equal(0u, detEntry.Stamp);
Assert.Equal(2, entries.Length);
+ }
+
+ [Fact]
+ [PlatformSpecific(PlatformID.Windows)]
+ public void EmbeddedPortablePdb_Loaded()
+ {
+ LoaderUtilities.LoadPEAndValidate(PortablePdbs.DocumentsEmbeddedDll, ValidateEmbeddedPortablePdb);
+ }
+
+ [Fact]
+ [PlatformSpecific(PlatformID.Windows)]
+ public void EmbeddedPortablePdb_Loaded_FromStream()
+ {
+ LoaderUtilities.LoadPEAndValidate(PortablePdbs.DocumentsEmbeddedDll, ValidateEmbeddedPortablePdb, useStream: true);
+ }
+
+ private void ValidateEmbeddedPortablePdb(PEReader reader)
+ {
+ var entries = reader.ReadDebugDirectory();
+ Assert.Equal(DebugDirectoryEntryType.CodeView, entries[0].Type);
+ Assert.Equal(DebugDirectoryEntryType.Reproducible, entries[1].Type);
+ Assert.Equal(DebugDirectoryEntryType.EmbeddedPortablePdb, entries[2].Type);
+
+ var provider = reader.ReadEmbeddedPortablePdbDebugDirectoryData(entries[2]);
+ var pdbReader = provider.GetMetadataReader();
+ var document = pdbReader.GetDocument(pdbReader.Documents.First());
+ Assert.Equal(@"C:\Documents.cs", pdbReader.GetString(document.Name));
+ }
+
+ [Fact]
+ public void DebugDirectoryData_Errors()
+ {
+ var reader = new PEReader(new MemoryStream(Misc.Members));
+
+ Assert.Throws<ArgumentException>("entry", () => reader.ReadCodeViewDebugDirectoryData(new DebugDirectoryEntry(0, 0, 0, DebugDirectoryEntryType.Coff, 0, 0, 0)));
+ Assert.Throws<BadImageFormatException>(() => reader.ReadCodeViewDebugDirectoryData(new DebugDirectoryEntry(0, 0, 0, DebugDirectoryEntryType.CodeView, 0, 0, 0)));
+
+ Assert.Throws<ArgumentException>("entry", () => reader.ReadEmbeddedPortablePdbDebugDirectoryData(new DebugDirectoryEntry(0, 0, 0, DebugDirectoryEntryType.Coff, 0, 0, 0)));
+ Assert.Throws<BadImageFormatException>(() => reader.ReadEmbeddedPortablePdbDebugDirectoryData(new DebugDirectoryEntry(0, 0, 0, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0)));
+ }
+
+ [Fact]
+ public void ValidateEmbeddedPortablePdbVersion()
+ {
+ // major version (Portable PDB format):
+ PEReader.ValidateEmbeddedPortablePdbVersion(new DebugDirectoryEntry(0, 0x0100, 0x0100, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0));
+ PEReader.ValidateEmbeddedPortablePdbVersion(new DebugDirectoryEntry(0, 0x0101, 0x0100, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0));
+ PEReader.ValidateEmbeddedPortablePdbVersion(new DebugDirectoryEntry(0, 0xffff, 0x0100, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0));
+
+ Assert.Throws<BadImageFormatException>(() => PEReader.ValidateEmbeddedPortablePdbVersion(new DebugDirectoryEntry(0, 0x0000, 0x0100, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0)));
+ Assert.Throws<BadImageFormatException>(() => PEReader.ValidateEmbeddedPortablePdbVersion(new DebugDirectoryEntry(0, 0x00ff, 0x0100, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0)));
+
+ // minor version (Embedded blob format):
+ Assert.Throws<BadImageFormatException>(() => PEReader.ValidateEmbeddedPortablePdbVersion(new DebugDirectoryEntry(0, 0x0100, 0x0101, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0)));
+ Assert.Throws<BadImageFormatException>(() => PEReader.ValidateEmbeddedPortablePdbVersion(new DebugDirectoryEntry(0, 0x0100, 0x0000, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0)));
+ Assert.Throws<BadImageFormatException>(() => PEReader.ValidateEmbeddedPortablePdbVersion(new DebugDirectoryEntry(0, 0x0100, 0x00ff, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0)));
+ Assert.Throws<BadImageFormatException>(() => PEReader.ValidateEmbeddedPortablePdbVersion(new DebugDirectoryEntry(0, 0x0100, 0x0200, DebugDirectoryEntryType.EmbeddedPortablePdb, 0, 0, 0)));
+ }
+
+ [Fact]
+ public void CodeView_PathPadding()
+ {
+ var bytes = ImmutableArray.Create(new byte[]
+ {
+ (byte)'R', (byte)'S', (byte)'D', (byte)'S', // signature
+ 0x6E, 0xE6, 0x88, 0x3C, 0xB9, 0xE0, 0x08, 0x45, 0x92, 0x90, 0x11, 0xE0, 0xDB, 0x51, 0xA1, 0xC5, // GUID
+ 0x01, 0x00, 0x00, 0x00, // age
+ (byte)'x', 0x00, 0x20, 0xff, // path
+ });
+
+ using (var block = new ByteArrayMemoryProvider(bytes).GetMemoryBlock(0, bytes.Length))
+ {
+ Assert.Equal("x", PEReader.DecodeCodeViewDebugDirectoryData(block).Path);
+ }
+
+ using (var block = new ByteArrayMemoryProvider(bytes).GetMemoryBlock(0, bytes.Length - 1))
+ {
+ Assert.Equal("x", PEReader.DecodeCodeViewDebugDirectoryData(block).Path);
+ }
+
+ using (var block = new ByteArrayMemoryProvider(bytes).GetMemoryBlock(0, bytes.Length - 2))
+ {
+ Assert.Equal("x", PEReader.DecodeCodeViewDebugDirectoryData(block).Path);
+ }
+
+ using (var block = new ByteArrayMemoryProvider(bytes).GetMemoryBlock(0, bytes.Length - 3))
+ {
+ Assert.Equal("x", PEReader.DecodeCodeViewDebugDirectoryData(block).Path);
+ }
+
+ using (var block = new ByteArrayMemoryProvider(bytes).GetMemoryBlock(0, bytes.Length - 4))
+ {
+ Assert.Equal("", PEReader.DecodeCodeViewDebugDirectoryData(block).Path);
+ }
+ }
+
+ [Fact]
+ public void CodeView_Errors()
+ {
+ var bytes = ImmutableArray.Create(new byte[]
+ {
+ (byte)'R', (byte)'S', (byte)'D', (byte)'S', // signature
+ 0x6E, 0xE6, 0x88, 0x3C, 0xB9, 0xE0, 0x08, 0x45, 0x92, 0x90, 0x11, 0xE0, 0xDB, 0x51, 0xA1, 0xC5, // GUID
+ 0x01, 0x00, 0x00, 0x00, // age
+ (byte)'x', 0x00, // path
+ });
- Assert.Throws<ArgumentException>("entry", () => reader.ReadCodeViewDebugDirectoryData(detEntry));
+ using (var block = new ByteArrayMemoryProvider(bytes).GetMemoryBlock(0, 1))
+ {
+ Assert.Throws<BadImageFormatException>(() => PEReader.DecodeCodeViewDebugDirectoryData(block));
+ }
+
+ using (var block = new ByteArrayMemoryProvider(bytes).GetMemoryBlock(0, 4))
+ {
+ Assert.Throws<BadImageFormatException>(() => PEReader.DecodeCodeViewDebugDirectoryData(block));
+ }
+
+ using (var block = new ByteArrayMemoryProvider(bytes).GetMemoryBlock(0, bytes.Length - 3))
+ {
+ Assert.Throws<BadImageFormatException>(() => PEReader.DecodeCodeViewDebugDirectoryData(block));
+ }
+ }
+
+ [Fact]
+ public void EmbeddedPortablePdb_Errors()
+ {
+ var bytes1 = ImmutableArray.Create(new byte[]
+ {
+ 0x4D, 0x50, 0x44, 0x42, // signature
+ 0xFF, 0xFF, 0xFF, 0xFF, // uncompressed size
+ 0xEB, 0x28, 0x4F, 0x0B, 0x75, 0x31, 0x56, 0x12, 0x04, 0x00 // compressed data
+ });
+
+ using (var block = new ByteArrayMemoryProvider(bytes1).GetMemoryBlock(0, bytes1.Length))
+ {
+ Assert.Throws<BadImageFormatException>(() => PEReader.DecodeEmbeddedPortablePdbDebugDirectoryData(block));
+ }
+
+ var bytes2 = ImmutableArray.Create(new byte[]
+ {
+ 0x4D, 0x50, 0x44, 0x42, // signature
+ 0x09, 0x00, 0x00, 0x00, // uncompressed size
+ 0xEB, 0x28, 0x4F, 0x0B, 0x75, 0x31, 0x56, 0x12, 0x04, 0x00 // compressed data
+ });
+
+ using (var block = new ByteArrayMemoryProvider(bytes2).GetMemoryBlock(0, bytes2.Length))
+ {
+ Assert.Throws<BadImageFormatException>(() => PEReader.DecodeEmbeddedPortablePdbDebugDirectoryData(block));
+ }
+
+ var bytes3 = ImmutableArray.Create(new byte[]
+ {
+ 0x4D, 0x50, 0x44, 0x42, // signature
+ 0x00, 0x00, 0x00, 0x00, // uncompressed size
+ 0xEB, 0x28, 0x4F, 0x0B, 0x75, 0x31, 0x56, 0x12, 0x04, 0x00 // compressed data
+ });
+
+ using (var block = new ByteArrayMemoryProvider(bytes3).GetMemoryBlock(0, bytes3.Length))
+ {
+ Assert.Throws<BadImageFormatException>(() => PEReader.DecodeEmbeddedPortablePdbDebugDirectoryData(block));
+ }
+
+ var bytes4 = ImmutableArray.Create(new byte[]
+ {
+ 0x4D, 0x50, 0x44, 0x42, // signature
+ 0xff, 0xff, 0xff, 0x7f, // uncompressed size
+ 0xEB, 0x28, 0x4F, 0x0B, 0x75, 0x31, 0x56, 0x12, 0x04, 0x00 // compressed data
+ });
+
+ using (var block = new ByteArrayMemoryProvider(bytes4).GetMemoryBlock(0, bytes4.Length))
+ {
+ Assert.Throws<BadImageFormatException>(() => PEReader.DecodeEmbeddedPortablePdbDebugDirectoryData(block));
+ }
+
+ var bytes5 = ImmutableArray.Create(new byte[]
+ {
+ 0x4D, 0x50, 0x44, 0x42, // signature
+ 0x08, 0x00, 0x00, 0x00, // uncompressed size
+ 0xEF, 0xFF, 0x4F, 0xFF, 0x75, 0x31, 0x56, 0x12, 0x04, 0x00 // compressed data
+ });
+
+ using (var block = new ByteArrayMemoryProvider(bytes4).GetMemoryBlock(0, bytes4.Length))
+ {
+ Assert.Throws<BadImageFormatException>(() => PEReader.DecodeEmbeddedPortablePdbDebugDirectoryData(block));
+ }
+
+ var bytes6 = ImmutableArray.Create(new byte[]
+ {
+ 0x4D, 0x50, 0x44, 0x43, // signature
+ 0x08, 0x00, 0x00, 0x00, // uncompressed size
+ 0xEB, 0x28, 0x4F, 0x0B, 0x75, 0x31, 0x56, 0x12, 0x04, 0x00 // compressed data
+ });
+
+ using (var block = new ByteArrayMemoryProvider(bytes6).GetMemoryBlock(0, bytes6.Length))
+ {
+ Assert.Throws<BadImageFormatException>(() => PEReader.DecodeEmbeddedPortablePdbDebugDirectoryData(block));
+ }
+
+ var bytes7 = ImmutableArray.Create(new byte[]
+ {
+ 0x4D, 0x50, 0x44, 0x43, // signature
+ 0x08, 0x00, 0x00,
+ });
+
+ using (var block = new ByteArrayMemoryProvider(bytes7).GetMemoryBlock(0, bytes7.Length))
+ {
+ Assert.Throws<BadImageFormatException>(() => PEReader.DecodeEmbeddedPortablePdbDebugDirectoryData(block));
+ }
+
+ var bytes8 = ImmutableArray.Create(new byte[]
+ {
+ 0x4D, 0x50, 0x44, 0x43, // signature
+ 0x08, 0x00, 0x00,
+ });
+
+ using (var block = new ByteArrayMemoryProvider(bytes8).GetMemoryBlock(0, bytes8.Length))
+ {
+ Assert.Throws<BadImageFormatException>(() => PEReader.DecodeEmbeddedPortablePdbDebugDirectoryData(block));
+ }
+
+ var bytes9 = ImmutableArray.Create(new byte[]
+ {
+ 0x4D, 0x50, 0x44, 0x43, // signature
+ 0x08, 0x00, 0x00, 0x00
+ });
+
+ using (var block = new ByteArrayMemoryProvider(bytes9).GetMemoryBlock(0, 1))
+ {
+ Assert.Throws<BadImageFormatException>(() => PEReader.DecodeEmbeddedPortablePdbDebugDirectoryData(block));
+ }
}
}
}
diff --git a/src/System.Reflection.Metadata/tests/PortableExecutable/PEReaderTests.cs b/src/System.Reflection.Metadata/tests/PortableExecutable/PEReaderTests.cs
index 9c35a087d6..20b7842ce5 100644
--- a/src/System.Reflection.Metadata/tests/PortableExecutable/PEReaderTests.cs
+++ b/src/System.Reflection.Metadata/tests/PortableExecutable/PEReaderTests.cs
@@ -2,15 +2,10 @@
// 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.Collections.Immutable;
using System.IO;
-using System.Reflection;
-using System.Reflection.Internal;
-using System.Reflection.Internal.Tests;
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
using System.Reflection.Metadata.Tests;
-using System.Runtime.InteropServices;
using Xunit;
namespace System.Reflection.PortableExecutable.Tests
@@ -76,6 +71,8 @@ namespace System.Reflection.PortableExecutable.Tests
byte b = 1;
Assert.True(new PEReader(&b, 1, isLoadedImage: true).IsLoadedImage);
Assert.False(new PEReader(&b, 1, isLoadedImage: false).IsLoadedImage);
+
+ Assert.True(new PEReader(new MemoryStream(), PEStreamOptions.IsLoadedImage).IsLoadedImage);
Assert.False(new PEReader(new MemoryStream()).IsLoadedImage);
}
@@ -298,5 +295,519 @@ namespace System.Reflection.PortableExecutable.Tests
Assert.Throws<ArgumentOutOfRangeException>(() => reader.GetSectionData(int.MinValue));
}
}
+
+ [Fact]
+ public void TryOpenAssociatedPortablePdb_Args()
+ {
+ var peStream = new MemoryStream(PortablePdbs.DocumentsDll);
+ using (var reader = new PEReader(peStream))
+ {
+ MetadataReaderProvider pdbProvider;
+ string pdbPath;
+
+ Assert.False(reader.TryOpenAssociatedPortablePdb(@"b.dll", _ => null, out pdbProvider, out pdbPath));
+ Assert.Throws<ArgumentNullException>(() => reader.TryOpenAssociatedPortablePdb(@"b.dll", null, out pdbProvider, out pdbPath));
+ Assert.Throws<ArgumentNullException>(() => reader.TryOpenAssociatedPortablePdb(null, _ => null, out pdbProvider, out pdbPath));
+ Assert.Throws<ArgumentException>("peImagePath", () => reader.TryOpenAssociatedPortablePdb("C:\\a\\\0\\b", _ => null, out pdbProvider, out pdbPath));
+ }
+ }
+
+ [Fact]
+ public void TryOpenAssociatedPortablePdb_CollocatedFile()
+ {
+ var peStream = new MemoryStream(PortablePdbs.DocumentsDll);
+ using (var reader = new PEReader(peStream))
+ {
+ string pathQueried = null;
+
+ Func<string, Stream> streamProvider = p =>
+ {
+ Assert.Null(pathQueried);
+ pathQueried = p;
+ return new MemoryStream(PortablePdbs.DocumentsPdb);
+ };
+
+ MetadataReaderProvider pdbProvider;
+ string pdbPath;
+
+ Assert.True(reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), streamProvider, out pdbProvider, out pdbPath));
+ Assert.Equal(Path.Combine("pedir", "Documents.pdb"), pathQueried);
+
+ Assert.Equal(Path.Combine("pedir", "Documents.pdb"), pdbPath);
+ var pdbReader = pdbProvider.GetMetadataReader();
+ Assert.Equal(13, pdbReader.Documents.Count);
+ }
+ }
+
+ [Fact]
+ public void TryOpenAssociatedPortablePdb_Embedded()
+ {
+ var peStream = new MemoryStream(PortablePdbs.DocumentsEmbeddedDll);
+ using (var reader = new PEReader(peStream))
+ {
+ string pathQueried = null;
+
+ Func<string, Stream> streamProvider = p =>
+ {
+ Assert.Null(pathQueried);
+ pathQueried = p;
+ return null;
+ };
+
+ MetadataReaderProvider pdbProvider;
+ string pdbPath;
+
+ Assert.True(reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), streamProvider, out pdbProvider, out pdbPath));
+ Assert.Equal(Path.Combine("pedir", "Documents.Embedded.pdb"), pathQueried);
+
+ Assert.Null(pdbPath);
+ var pdbReader = pdbProvider.GetMetadataReader();
+ Assert.Equal(13, pdbReader.Documents.Count);
+ }
+ }
+
+ [Fact]
+ public void TryOpenAssociatedPortablePdb_EmbeddedOnly()
+ {
+ var peStream = new MemoryStream(PortablePdbs.DocumentsEmbeddedDll);
+ using (var reader = new PEReader(peStream))
+ {
+ MetadataReaderProvider pdbProvider;
+ string pdbPath;
+
+ Assert.True(reader.TryOpenAssociatedPortablePdb(@"x", _ => null, out pdbProvider, out pdbPath));
+
+ Assert.Null(pdbPath);
+ var pdbReader = pdbProvider.GetMetadataReader();
+ Assert.Equal(13, pdbReader.Documents.Count);
+ }
+ }
+
+ [Fact]
+ public unsafe void TryOpenAssociatedPortablePdb_EmbeddedUnused()
+ {
+ var peStream = new MemoryStream(PortablePdbs.DocumentsEmbeddedDll);
+ using (var reader = new PEReader(peStream))
+ {
+ var embeddedReader = reader.ReadEmbeddedPortablePdbDebugDirectoryData(reader.ReadDebugDirectory()[2]).GetMetadataReader();
+ var embeddedBytes = new BlobReader(embeddedReader.MetadataPointer, embeddedReader.MetadataLength).ReadBytes(embeddedReader.MetadataLength);
+
+ string pathQueried = null;
+
+ Func<string, Stream> streamProvider = p =>
+ {
+ Assert.Null(pathQueried);
+ pathQueried = p;
+ return new MemoryStream(embeddedBytes);
+ };
+
+ MetadataReaderProvider pdbProvider;
+ string pdbPath;
+
+ Assert.True(reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), streamProvider, out pdbProvider, out pdbPath));
+ Assert.Equal(Path.Combine("pedir", "Documents.Embedded.pdb"), pathQueried);
+
+ Assert.Equal(Path.Combine("pedir", "Documents.Embedded.pdb"), pdbPath);
+ var pdbReader = pdbProvider.GetMetadataReader();
+ Assert.Equal(13, pdbReader.Documents.Count);
+ }
+ }
+
+ [Fact]
+ public void TryOpenAssociatedPortablePdb_UnixStylePath()
+ {
+ var id = new BlobContentId(Guid.Parse("18091B06-32BB-46C2-9C3B-7C9389A2F6C6"), 0x12345678);
+ var ddBuilder = new DebugDirectoryBuilder();
+ ddBuilder.AddCodeViewEntry(@"/abc/def.xyz", id, portablePdbVersion: 0x0100);
+
+ var peStream = new MemoryStream(TestBuilders.BuildPEWithDebugDirectory(ddBuilder));
+
+ using (var reader = new PEReader(peStream))
+ {
+ string pathQueried = null;
+
+ Func<string, Stream> streamProvider = p =>
+ {
+ Assert.Null(pathQueried);
+ pathQueried = p;
+ return null;
+ };
+
+ MetadataReaderProvider pdbProvider;
+ string pdbPath;
+ Assert.False(reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), streamProvider, out pdbProvider, out pdbPath));
+ Assert.Equal(Path.Combine("pedir", "def.xyz"), pathQueried);
+ }
+ }
+
+ [Fact]
+ public void TryOpenAssociatedPortablePdb_WindowsSpecificPath()
+ {
+ var id = new BlobContentId(Guid.Parse("18091B06-32BB-46C2-9C3B-7C9389A2F6C6"), 0x12345678);
+ var ddBuilder = new DebugDirectoryBuilder();
+ ddBuilder.AddCodeViewEntry(@"C:def.xyz", id, portablePdbVersion: 0x0100);
+
+ var peStream = new MemoryStream(TestBuilders.BuildPEWithDebugDirectory(ddBuilder));
+
+ using (var reader = new PEReader(peStream))
+ {
+ string pathQueried = null;
+
+ Func<string, Stream> streamProvider = p =>
+ {
+ Assert.Null(pathQueried);
+ pathQueried = p;
+ return null;
+ };
+
+ MetadataReaderProvider pdbProvider;
+ string pdbPath;
+ Assert.False(reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), streamProvider, out pdbProvider, out pdbPath));
+ Assert.Equal(Path.Combine("pedir", "def.xyz"), pathQueried);
+ }
+ }
+
+ [Fact]
+ public void TryOpenAssociatedPortablePdb_WindowsInvalidCharacters()
+ {
+ var id = new BlobContentId(Guid.Parse("18091B06-32BB-46C2-9C3B-7C9389A2F6C6"), 0x12345678);
+ var ddBuilder = new DebugDirectoryBuilder();
+ ddBuilder.AddCodeViewEntry(@"/a/*/c*.pdb", id, portablePdbVersion: 0x0100);
+
+ var peStream = new MemoryStream(TestBuilders.BuildPEWithDebugDirectory(ddBuilder));
+
+ using (var reader = new PEReader(peStream))
+ {
+ string pathQueried = null;
+
+ Func<string, Stream> streamProvider = p =>
+ {
+ Assert.Null(pathQueried);
+ pathQueried = p;
+ return null;
+ };
+
+ MetadataReaderProvider pdbProvider;
+ string pdbPath;
+ Assert.False(reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), streamProvider, out pdbProvider, out pdbPath));
+ Assert.Equal(PathUtilities.CombinePathWithRelativePath("pedir", "c*.pdb"), pathQueried);
+ }
+ }
+
+ [Fact]
+ public void TryOpenAssociatedPortablePdb_DuplicateEntries_CodeView()
+ {
+ var id = new BlobContentId(Guid.Parse("18091B06-32BB-46C2-9C3B-7C9389A2F6C6"), 0x12345678);
+ var ddBuilder = new DebugDirectoryBuilder();
+ ddBuilder.AddCodeViewEntry(@"/a/b/a.pdb", id, portablePdbVersion: 0);
+ ddBuilder.AddReproducibleEntry();
+ ddBuilder.AddCodeViewEntry(@"/a/b/c.pdb", id, portablePdbVersion: 0x0100);
+ ddBuilder.AddCodeViewEntry(@"/a/b/d.pdb", id, portablePdbVersion: 0x0100);
+
+ var peStream = new MemoryStream(TestBuilders.BuildPEWithDebugDirectory(ddBuilder));
+
+ using (var reader = new PEReader(peStream))
+ {
+ string pathQueried = null;
+
+ Func<string, Stream> streamProvider = p =>
+ {
+ Assert.Null(pathQueried);
+ pathQueried = p;
+ return null;
+ };
+
+ MetadataReaderProvider pdbProvider;
+ string pdbPath;
+ Assert.False(reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), streamProvider, out pdbProvider, out pdbPath));
+ Assert.Equal(PathUtilities.CombinePathWithRelativePath("pedir", "c.pdb"), pathQueried);
+ }
+ }
+
+ [Fact]
+ public void TryOpenAssociatedPortablePdb_DuplicateEntries_Embedded()
+ {
+ var pdbBuilder1 = new BlobBuilder();
+ pdbBuilder1.WriteBytes(PortablePdbs.DocumentsPdb);
+
+ var pdbBuilder2 = new BlobBuilder();
+ pdbBuilder2.WriteByte(1);
+
+ var id = new BlobContentId(Guid.Parse("18091B06-32BB-46C2-9C3B-7C9389A2F6C6"), 0x12345678);
+ var ddBuilder = new DebugDirectoryBuilder();
+ ddBuilder.AddCodeViewEntry(@"/a/b/a.pdb", id, portablePdbVersion: 0x0100);
+ ddBuilder.AddReproducibleEntry();
+ ddBuilder.AddEmbeddedPortablePdbEntry(pdbBuilder1, portablePdbVersion: 0x0100);
+ ddBuilder.AddEmbeddedPortablePdbEntry(pdbBuilder2, portablePdbVersion: 0x0100);
+
+ var peStream = new MemoryStream(TestBuilders.BuildPEWithDebugDirectory(ddBuilder));
+
+ using (var reader = new PEReader(peStream))
+ {
+ string pathQueried = null;
+
+ Func<string, Stream> streamProvider = p =>
+ {
+ Assert.Null(pathQueried);
+ pathQueried = p;
+ return null;
+ };
+
+ MetadataReaderProvider pdbProvider;
+ string pdbPath;
+ Assert.True(reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), streamProvider, out pdbProvider, out pdbPath));
+ Assert.Equal(PathUtilities.CombinePathWithRelativePath("pedir", "a.pdb"), pathQueried);
+ Assert.Null(pdbPath);
+
+ Assert.Equal(13, pdbProvider.GetMetadataReader().Documents.Count);
+ }
+ }
+
+ [Fact]
+ public void TryOpenAssociatedPortablePdb_CodeViewVsEmbedded_NonMatchingPdbId()
+ {
+ var pdbBuilder = new BlobBuilder();
+ pdbBuilder.WriteBytes(PortablePdbs.DocumentsPdb);
+
+ var id = new BlobContentId(Guid.Parse("18091B06-32BB-46C2-9C3B-7C9389A2F6C6"), 0x12345678);
+ var ddBuilder = new DebugDirectoryBuilder();
+ ddBuilder.AddCodeViewEntry(@"/a/b/a.pdb", id, portablePdbVersion: 0x0100);
+ ddBuilder.AddEmbeddedPortablePdbEntry(pdbBuilder, portablePdbVersion: 0x0100);
+
+ var peStream = new MemoryStream(TestBuilders.BuildPEWithDebugDirectory(ddBuilder));
+
+ using (var reader = new PEReader(peStream))
+ {
+ string pathQueried = null;
+
+ Func<string, Stream> streamProvider = p =>
+ {
+ Assert.Null(pathQueried);
+ pathQueried = p;
+
+ // Doesn't match the id
+ return new MemoryStream(PortablePdbs.DocumentsPdb);
+ };
+
+ MetadataReaderProvider pdbProvider;
+ string pdbPath;
+ Assert.True(reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), streamProvider, out pdbProvider, out pdbPath));
+
+ Assert.Null(pdbPath);
+ Assert.Equal(PathUtilities.CombinePathWithRelativePath("pedir", "a.pdb"), pathQueried);
+
+ Assert.Equal(13, pdbProvider.GetMetadataReader().Documents.Count);
+ }
+ }
+
+ [Fact]
+ public void TryOpenAssociatedPortablePdb_BadPdbFile_FallbackToEmbedded()
+ {
+ var pdbBuilder = new BlobBuilder();
+ pdbBuilder.WriteBytes(PortablePdbs.DocumentsPdb);
+
+ var id = new BlobContentId(Guid.Parse("18091B06-32BB-46C2-9C3B-7C9389A2F6C6"), 0x12345678);
+ var ddBuilder = new DebugDirectoryBuilder();
+ ddBuilder.AddCodeViewEntry(@"/a/b/a.pdb", id, portablePdbVersion: 0x0100);
+ ddBuilder.AddEmbeddedPortablePdbEntry(pdbBuilder, portablePdbVersion: 0x0100);
+
+ var peStream = new MemoryStream(TestBuilders.BuildPEWithDebugDirectory(ddBuilder));
+
+ using (var reader = new PEReader(peStream))
+ {
+ string pathQueried = null;
+
+ Func<string, Stream> streamProvider = p =>
+ {
+ Assert.Null(pathQueried);
+ pathQueried = p;
+
+ // Bad PDB
+ return new MemoryStream(new byte[] { 0x01 });
+ };
+
+ MetadataReaderProvider pdbProvider;
+ string pdbPath;
+ Assert.True(reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), streamProvider, out pdbProvider, out pdbPath));
+
+ Assert.Null(pdbPath);
+ Assert.Equal(PathUtilities.CombinePathWithRelativePath("pedir", "a.pdb"), pathQueried);
+
+ Assert.Equal(13, pdbProvider.GetMetadataReader().Documents.Count);
+ }
+ }
+
+ [Fact]
+ public void TryOpenAssociatedPortablePdb_ExpectedExceptionFromStreamProvider_FallbackOnEmbedded_Valid()
+ {
+ var pdbBuilder = new BlobBuilder();
+ pdbBuilder.WriteBytes(PortablePdbs.DocumentsPdb);
+
+ var id = new BlobContentId(Guid.Parse("18091B06-32BB-46C2-9C3B-7C9389A2F6C6"), 0x12345678);
+ var ddBuilder = new DebugDirectoryBuilder();
+ ddBuilder.AddCodeViewEntry(@"/a/b/a.pdb", id, portablePdbVersion: 0x0100);
+ ddBuilder.AddEmbeddedPortablePdbEntry(pdbBuilder, portablePdbVersion: 0x0100);
+
+ var peStream = new MemoryStream(TestBuilders.BuildPEWithDebugDirectory(ddBuilder));
+
+ using (var reader = new PEReader(peStream))
+ {
+ MetadataReaderProvider pdbProvider;
+ string pdbPath;
+
+ Assert.True(reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), _ => { throw new IOException(); }, out pdbProvider, out pdbPath));
+ Assert.Null(pdbPath);
+ Assert.Equal(13, pdbProvider.GetMetadataReader().Documents.Count);
+
+ Assert.True(reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), _ => { throw new BadImageFormatException(); }, out pdbProvider, out pdbPath));
+ Assert.Null(pdbPath);
+ Assert.Equal(13, pdbProvider.GetMetadataReader().Documents.Count);
+
+ Assert.True(reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), _ => { throw new FileNotFoundException(); }, out pdbProvider, out pdbPath));
+ Assert.Null(pdbPath);
+ Assert.Equal(13, pdbProvider.GetMetadataReader().Documents.Count);
+ }
+ }
+
+ [Fact]
+ public void TryOpenAssociatedPortablePdb_ExpectedExceptionFromStreamProvider_FallbackOnEmbedded_Invalid()
+ {
+ var pdbBuilder = new BlobBuilder();
+ pdbBuilder.WriteBytes(new byte[] { 0x01 });
+
+ var id = new BlobContentId(Guid.Parse("18091B06-32BB-46C2-9C3B-7C9389A2F6C6"), 0x12345678);
+ var ddBuilder = new DebugDirectoryBuilder();
+ ddBuilder.AddCodeViewEntry(@"/a/b/a.pdb", id, portablePdbVersion: 0x0100);
+ ddBuilder.AddEmbeddedPortablePdbEntry(pdbBuilder, portablePdbVersion: 0x0100);
+
+ var peStream = new MemoryStream(TestBuilders.BuildPEWithDebugDirectory(ddBuilder));
+
+ using (var reader = new PEReader(peStream))
+ {
+ MetadataReaderProvider pdbProvider;
+ string pdbPath;
+
+ // reports the first error:
+ Assert.Throws<IOException>(() =>
+ reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), _ => { throw new IOException(); }, out pdbProvider, out pdbPath));
+
+ // reports the first error:
+ AssertEx.Throws<BadImageFormatException>(() =>
+ reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), _ => { throw new BadImageFormatException("Bang!"); }, out pdbProvider, out pdbPath),
+ e => Assert.Equal("Bang!", e.Message));
+
+ // file doesn't exist, fall back to embedded without reporting FileNotFoundExeception
+ Assert.Throws<BadImageFormatException>(() =>
+ reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), _ => { throw new FileNotFoundException(); }, out pdbProvider, out pdbPath));
+
+ Assert.Throws<BadImageFormatException>(() =>
+ reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), _ => null, out pdbProvider, out pdbPath));
+ }
+ }
+
+ [Fact]
+ public void TryOpenAssociatedPortablePdb_ExpectedExceptionFromStreamProvider_NoFallback()
+ {
+ var pdbBuilder = new BlobBuilder();
+ pdbBuilder.WriteBytes(PortablePdbs.DocumentsPdb);
+
+ var id = new BlobContentId(Guid.Parse("18091B06-32BB-46C2-9C3B-7C9389A2F6C6"), 0x12345678);
+ var ddBuilder = new DebugDirectoryBuilder();
+ ddBuilder.AddCodeViewEntry(@"/a/b/a.pdb", id, portablePdbVersion: 0x0100);
+
+ var peStream = new MemoryStream(TestBuilders.BuildPEWithDebugDirectory(ddBuilder));
+
+ using (var reader = new PEReader(peStream))
+ {
+ MetadataReaderProvider pdbProvider;
+ string pdbPath;
+
+ Assert.Throws<IOException>(() =>
+ reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), _ => { throw new IOException(); }, out pdbProvider, out pdbPath));
+
+ AssertEx.Throws<BadImageFormatException>(() =>
+ reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), _ => { throw new BadImageFormatException("Bang!"); }, out pdbProvider, out pdbPath),
+ e => Assert.Equal("Bang!", e.Message));
+
+ // file doesn't exist and no embedded => return false
+ Assert.False(reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), _ => { throw new FileNotFoundException(); }, out pdbProvider, out pdbPath));
+ }
+ }
+
+ [Fact]
+ public void TryOpenAssociatedPortablePdb_BadStreamProvider()
+ {
+ var pdbBuilder = new BlobBuilder();
+ pdbBuilder.WriteBytes(PortablePdbs.DocumentsPdb);
+
+ var id = new BlobContentId(Guid.Parse("18091B06-32BB-46C2-9C3B-7C9389A2F6C6"), 0x12345678);
+ var ddBuilder = new DebugDirectoryBuilder();
+ ddBuilder.AddCodeViewEntry(@"/a/b/a.pdb", id, portablePdbVersion: 0x0100);
+
+ var peStream = new MemoryStream(TestBuilders.BuildPEWithDebugDirectory(ddBuilder));
+
+ using (var reader = new PEReader(peStream))
+ {
+ MetadataReaderProvider pdbProvider;
+ string pdbPath;
+
+ // pass-thru:
+ Assert.Throws<ArgumentException>(() =>
+ reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), _ => { throw new ArgumentException(); }, out pdbProvider, out pdbPath));
+
+ Assert.Throws<InvalidOperationException>(() =>
+ reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), _ => { return new TestStream(canRead: false, canWrite: true, canSeek: true); }, out pdbProvider, out pdbPath));
+
+ Assert.Throws<InvalidOperationException>(() =>
+ reader.TryOpenAssociatedPortablePdb(Path.Combine("pedir", "file.exe"), _ => { return new TestStream(canRead: true, canWrite: true, canSeek: false); }, out pdbProvider, out pdbPath));
+ }
+ }
+
+ [Fact]
+ public void Dispose()
+ {
+ var peStream = new MemoryStream(PortablePdbs.DocumentsEmbeddedDll);
+ var reader = new PEReader(peStream);
+
+ MetadataReaderProvider pdbProvider;
+ string pdbPath;
+
+ Assert.True(reader.TryOpenAssociatedPortablePdb(@"x", _ => null, out pdbProvider, out pdbPath));
+ Assert.NotNull(pdbProvider);
+ Assert.Null(pdbPath);
+
+ var ddEntries = reader.ReadDebugDirectory();
+ var ddCodeView = ddEntries[0];
+ var ddEmbedded = ddEntries[2];
+
+ var embeddedPdbProvider = reader.ReadEmbeddedPortablePdbDebugDirectoryData(ddEmbedded);
+
+ // dispose the PEReader:
+ reader.Dispose();
+
+ Assert.False(reader.IsEntireImageAvailable);
+
+ Assert.Throws<ObjectDisposedException>(() => reader.PEHeaders);
+ Assert.Throws<ObjectDisposedException>(() => reader.HasMetadata);
+ Assert.Throws<ObjectDisposedException>(() => reader.GetMetadata());
+ Assert.Throws<ObjectDisposedException>(() => reader.GetSectionData(1000));
+ Assert.Throws<ObjectDisposedException>(() => reader.GetMetadataReader());
+ Assert.Throws<ObjectDisposedException>(() => reader.GetMethodBody(0));
+ Assert.Throws<ObjectDisposedException>(() => reader.GetEntireImage());
+ Assert.Throws<ObjectDisposedException>(() => reader.ReadDebugDirectory());
+ Assert.Throws<ObjectDisposedException>(() => reader.ReadCodeViewDebugDirectoryData(ddCodeView));
+ Assert.Throws<ObjectDisposedException>(() => reader.ReadEmbeddedPortablePdbDebugDirectoryData(ddEmbedded));
+
+ MetadataReaderProvider __;
+ string ___;
+ Assert.Throws<ObjectDisposedException>(() => reader.TryOpenAssociatedPortablePdb(@"x", _ => null, out __, out ___));
+
+ // ok to use providers after PEReader disposed:
+ var pdbReader = pdbProvider.GetMetadataReader();
+ Assert.Equal(13, pdbReader.Documents.Count);
+
+ pdbReader = embeddedPdbProvider.GetMetadataReader();
+ Assert.Equal(13, pdbReader.Documents.Count);
+ }
}
}
diff --git a/src/System.Reflection.Metadata/tests/PortableExecutable/TestStream.cs b/src/System.Reflection.Metadata/tests/PortableExecutable/TestStream.cs
new file mode 100644
index 0000000000..eba77f457b
--- /dev/null
+++ b/src/System.Reflection.Metadata/tests/PortableExecutable/TestStream.cs
@@ -0,0 +1,24 @@
+// 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.IO;
+
+namespace System.Reflection.Metadata.Tests
+{
+ public class TestStream : TestStreamBase
+ {
+ private readonly bool _canRead, _canWrite, _canSeek;
+
+ public TestStream(bool canRead = false, bool canWrite = false, bool canSeek = false)
+ {
+ _canRead = canRead;
+ _canWrite = canWrite;
+ _canSeek = canSeek;
+ }
+
+ public override bool CanRead => _canRead;
+ public override bool CanWrite => _canWrite;
+ public override bool CanSeek => _canSeek;
+ }
+}
diff --git a/src/System.Reflection.Metadata/tests/Resources/Misc/Debug.cs b/src/System.Reflection.Metadata/tests/Resources/Misc/Debug.cs
index dc258300e2..45aa0a86e9 100644
--- a/src/System.Reflection.Metadata/tests/Resources/Misc/Debug.cs
+++ b/src/System.Reflection.Metadata/tests/Resources/Misc/Debug.cs
@@ -1,3 +1,7 @@
+// 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.
+
// csc /target:library /debug:full Debug.cs
public class C
diff --git a/src/System.Reflection.Metadata/tests/Resources/Misc/Deterministic.cs b/src/System.Reflection.Metadata/tests/Resources/Misc/Deterministic.cs
index 317cf8a68f..1fe5d85444 100644
--- a/src/System.Reflection.Metadata/tests/Resources/Misc/Deterministic.cs
+++ b/src/System.Reflection.Metadata/tests/Resources/Misc/Deterministic.cs
@@ -1,3 +1,7 @@
+// 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.
+
// csc /target:library /debug:full /deterministic Deterministic.cs
public class C
diff --git a/src/System.Reflection.Metadata/tests/Resources/PortablePdbs/Documents.Embedded.dll b/src/System.Reflection.Metadata/tests/Resources/PortablePdbs/Documents.Embedded.dll
new file mode 100644
index 0000000000..d668ed804c
--- /dev/null
+++ b/src/System.Reflection.Metadata/tests/Resources/PortablePdbs/Documents.Embedded.dll
Binary files differ
diff --git a/src/System.Reflection.Metadata/tests/Resources/PortablePdbs/Documents.cmd b/src/System.Reflection.Metadata/tests/Resources/PortablePdbs/Documents.cmd
index 1bc2aeb231..d352db17cc 100644
--- a/src/System.Reflection.Metadata/tests/Resources/PortablePdbs/Documents.cmd
+++ b/src/System.Reflection.Metadata/tests/Resources/PortablePdbs/Documents.cmd
@@ -1,2 +1,3 @@
csc /target:library /debug:portable /optimize- /deterministic Documents.cs
+csc /target:library /debug:embedded /optimize- /deterministic Documents.cs /out:Documents.Embedded.dll
diff --git a/src/System.Reflection.Metadata/tests/Resources/PortablePdbs/Documents.cs b/src/System.Reflection.Metadata/tests/Resources/PortablePdbs/Documents.cs
index 65217012c1..0d701c8176 100644
--- a/src/System.Reflection.Metadata/tests/Resources/PortablePdbs/Documents.cs
+++ b/src/System.Reflection.Metadata/tests/Resources/PortablePdbs/Documents.cs
@@ -1,4 +1,8 @@
-#line 1 "C:\Documents.cs"
+// 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.
+
+#line 1 "C:\Documents.cs"
#pragma checksum "C:\Documents.cs" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "DBEB2A067B2F0E0D678A002C587A2806056C3DCE"
using System;
diff --git a/src/System.Reflection.Metadata/tests/Resources/TestResources.cs b/src/System.Reflection.Metadata/tests/Resources/TestResources.cs
index 1e4c9cad3b..4648fadb39 100644
--- a/src/System.Reflection.Metadata/tests/Resources/TestResources.cs
+++ b/src/System.Reflection.Metadata/tests/Resources/TestResources.cs
@@ -61,6 +61,7 @@ namespace System.Reflection.Metadata.Tests
{
public static readonly byte[] DocumentsDll = ResourceHelper.GetResource("PortablePdbs.Documents.dll");
public static readonly byte[] DocumentsPdb = ResourceHelper.GetResource("PortablePdbs.Documents.pdb");
+ public static readonly byte[] DocumentsEmbeddedDll = ResourceHelper.GetResource("PortablePdbs.Documents.Embedded.dll");
}
internal static class SynthesizedPeImages
diff --git a/src/System.Reflection.Metadata/tests/System.Reflection.Metadata.Tests.csproj b/src/System.Reflection.Metadata/tests/System.Reflection.Metadata.Tests.csproj
index ac28f31035..b65477d988 100644
--- a/src/System.Reflection.Metadata/tests/System.Reflection.Metadata.Tests.csproj
+++ b/src/System.Reflection.Metadata/tests/System.Reflection.Metadata.Tests.csproj
@@ -51,6 +51,9 @@
<Compile Include="..\..\Common\src\Microsoft\Win32\SafeHandles\SafeLibraryHandle.cs">
<Link>Common\Microsoft\Win32\Handles\SafeLibraryHandle.cs</Link>
</Compile>
+ <Compile Include="..\..\Common\tests\System\IO\TempFile.cs">
+ <Link>Common\System\IO\TempFile.cs</Link>
+ </Compile>
<Compile Include="Metadata\BlobContentIdTests.cs" />
<Compile Include="Metadata\BlobTests.cs" />
<Compile Include="Metadata\BlobUtilitiesTests.cs" />
@@ -84,10 +87,13 @@
<Compile Include="PortableExecutable\DebugDirectoryBuilderTests.cs" />
<Compile Include="PortableExecutable\PEHeaderBuilderTests.cs" />
<Compile Include="PortableExecutable\PEMemoryBlockTests.cs" />
+ <Compile Include="PortableExecutable\TestStream.cs" />
<Compile Include="TestUtilities\ByteArrayUtilities.cs" />
<Compile Include="TestUtilities\LoaderUtilities.cs" />
<Compile Include="TestUtilities\PinnedBlob.cs" />
<Compile Include="TestUtilities\SigningUtilities.cs" />
+ <Compile Include="TestUtilities\TestBuilders.cs" />
+ <Compile Include="TestUtilities\TestMetadataStringDecoder.cs" />
<Compile Include="Utilities\AbstractMemoryBlockTests.cs" />
<Compile Include="PortableExecutable\BadImageFormat.cs" />
<Compile Include="PortableExecutable\DebugDirectoryTests.cs" />
@@ -98,8 +104,6 @@
<Compile Include="PortableExecutable\SectionHeaderTests.cs" />
<Compile Include="Utilities\StreamExtensionsTests.cs" />
<Compile Include="Metadata\MetadataReaderProviderTests.cs" />
- <EmbeddedResource Include="Resources\Misc\KeyPair.snk" />
- <None Include="Resources\PortablePdbs\Documents.cs" />
<Compile Include="Resources\TestResources.cs" />
<Compile Include="TestUtilities\AssertEx.cs" />
<Compile Include="TestUtilities\DiffUtil.cs" />
@@ -116,6 +120,8 @@
<None Include="project.json" />
<None Include="Resources\Namespace\NamespaceForwardedCS.cs" />
<None Include="Resources\Namespace\NamespaceTests.cs" />
+ <EmbeddedResource Include="Resources\Namespace\NamespaceForwardedCS.dll" />
+ <EmbeddedResource Include="Resources\Namespace\NamespaceTests.dll" />
<None Include="Resources\Interop\Interop.Mock01.cs" />
<None Include="Resources\Interop\Interop.Mock01.Impl.cs" />
<None Include="Resources\Interop\IndexerWithByRefParam.il" />
@@ -123,6 +129,7 @@
<EmbeddedResource Include="Resources\Interop\Interop.Mock01.dll" />
<EmbeddedResource Include="Resources\Interop\Interop.Mock01.Impl.dll" />
<None Include="Resources\Misc\CPPClassLibrary2.h" />
+ <EmbeddedResource Include="Resources\Misc\KeyPair.snk" />
<EmbeddedResource Include="Resources\Misc\CPPClassLibrary2.obj" />
<None Include="Resources\Misc\EmptyType.il" />
<EmbeddedResource Include="Resources\Misc\EmptyType.dll" />
@@ -132,8 +139,6 @@
<EmbeddedResource Include="Resources\Misc\Deterministic.dll" />
<None Include="Resources\Misc\Debug.cs" />
<EmbeddedResource Include="Resources\Misc\Debug.dll" />
- <EmbeddedResource Include="Resources\Namespace\NamespaceForwardedCS.dll" />
- <EmbeddedResource Include="Resources\Namespace\NamespaceTests.dll" />
<None Include="Resources\NetModule\AppCS.cs" />
<EmbeddedResource Include="Resources\NetModule\AppCS.exe" />
<None Include="Resources\NetModule\ModuleCS00.cs" />
@@ -146,7 +151,9 @@
<None Include="Resources\WinRT\Lib.cs" />
<EmbeddedResource Include="Resources\PortablePdbs\Documents.dll" />
<EmbeddedResource Include="Resources\PortablePdbs\Documents.pdb" />
+ <EmbeddedResource Include="Resources\PortablePdbs\Documents.Embedded.dll" />
<None Include="Resources\PortablePdbs\Documents.cmd" />
+ <None Include="Resources\PortablePdbs\Documents.cs" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
diff --git a/src/System.Reflection.Metadata/tests/TestUtilities/AssertEx.cs b/src/System.Reflection.Metadata/tests/TestUtilities/AssertEx.cs
index dbda99ebd2..7cde9772ca 100644
--- a/src/System.Reflection.Metadata/tests/TestUtilities/AssertEx.cs
+++ b/src/System.Reflection.Metadata/tests/TestUtilities/AssertEx.cs
@@ -450,5 +450,22 @@ namespace System.Reflection.Metadata.Tests
Fail($"Expected 0 items but found {list.Count}: {message}\r\nItems:\r\n {string.Join("\r\n ", list)}");
}
}
+
+ public static void Throws<T>(Func<object> testCode, Action<T> exceptionValidation) where T : Exception
+ {
+ try
+ {
+ testCode();
+ Assert.False(true, $"Exception of type '{typeof(T)}' was expected but none was thrown.");
+ }
+ catch (T e)
+ {
+ exceptionValidation(e);
+ }
+ catch (Exception e)
+ {
+ Assert.False(true, $"Exception of type '{typeof(T)}' was expected but '{e.GetType()}' was thrown instead.");
+ }
+ }
}
}
diff --git a/src/System.Reflection.Metadata/tests/TestUtilities/LoaderUtilities.cs b/src/System.Reflection.Metadata/tests/TestUtilities/LoaderUtilities.cs
index 52743d8652..d5c681bfe9 100644
--- a/src/System.Reflection.Metadata/tests/TestUtilities/LoaderUtilities.cs
+++ b/src/System.Reflection.Metadata/tests/TestUtilities/LoaderUtilities.cs
@@ -6,31 +6,34 @@ using Microsoft.Win32.SafeHandles;
using System.IO;
using System.Reflection.PortableExecutable;
using Xunit;
+using System.Reflection.Internal;
namespace System.Reflection.Metadata.Tests
{
internal unsafe static class LoaderUtilities
{
- public static void LoadPEAndValidate(byte[] peImage, Action<PEReader> validator)
+ public static void LoadPEAndValidate(byte[] peImage, Action<PEReader> validator, bool useStream = false)
{
- string tempFile = Path.GetTempFileName();
- File.WriteAllBytes(tempFile, peImage);
-
- using (SafeLibraryHandle libHandle = global::Interop.mincore.LoadLibraryExW(tempFile, IntPtr.Zero, 0))
+ using (var tempFile = new TempFile(Path.GetTempFileName()))
{
- byte* peImagePtr = (byte*)global::Interop.mincore.GetModuleHandle(Path.GetFileName(tempFile));
-
- Assert.True(peImagePtr != null);
- Assert.Equal('M', (char)peImagePtr[0]);
- Assert.Equal('Z', (char)peImagePtr[1]);
+ File.WriteAllBytes(tempFile.Path, peImage);
- using (var peReader = new PEReader(peImagePtr, int.MaxValue, isLoadedImage: true))
+ using (SafeLibraryHandle libHandle = global::Interop.mincore.LoadLibraryExW(tempFile.Path, IntPtr.Zero, 0))
{
- validator(peReader);
+ byte* peImagePtr = (byte*)global::Interop.mincore.GetModuleHandle(Path.GetFileName(tempFile.Path));
+
+ Assert.True(peImagePtr != null);
+ Assert.Equal('M', (char)peImagePtr[0]);
+ Assert.Equal('Z', (char)peImagePtr[1]);
+
+ using (var peReader = useStream ?
+ new PEReader(new ReadOnlyUnmanagedMemoryStream(peImagePtr, int.MaxValue), PEStreamOptions.IsLoadedImage) :
+ new PEReader(peImagePtr, int.MaxValue, isLoadedImage: true))
+ {
+ validator(peReader);
+ }
}
}
-
- File.Delete(tempFile);
}
}
}
diff --git a/src/System.Reflection.Metadata/tests/TestUtilities/TestBuilders.cs b/src/System.Reflection.Metadata/tests/TestUtilities/TestBuilders.cs
new file mode 100644
index 0000000000..8f8b10641b
--- /dev/null
+++ b/src/System.Reflection.Metadata/tests/TestUtilities/TestBuilders.cs
@@ -0,0 +1,30 @@
+// 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.IO;
+using System.Reflection.Metadata;
+using System.Reflection.Metadata.Ecma335;
+
+namespace System.Reflection.PortableExecutable.Tests
+{
+ public static class TestBuilders
+ {
+ public static byte[] BuildPEWithDebugDirectory(DebugDirectoryBuilder debugDirectoryBuilder)
+ {
+ var peStream = new MemoryStream();
+ var ilBuilder = new BlobBuilder();
+ var metadataBuilder = new MetadataBuilder();
+
+ var peBuilder = new ManagedPEBuilder(
+ PEHeaderBuilder.CreateLibraryHeader(),
+ new MetadataRootBuilder(metadataBuilder),
+ ilBuilder,
+ debugDirectoryBuilder: debugDirectoryBuilder);
+
+ var peImageBuilder = new BlobBuilder();
+ peBuilder.Serialize(peImageBuilder);
+ return peImageBuilder.ToArray();
+ }
+ }
+}
diff --git a/src/System.Reflection.Metadata/tests/TestUtilities/TestMetadataStringDecoder.cs b/src/System.Reflection.Metadata/tests/TestUtilities/TestMetadataStringDecoder.cs
new file mode 100644
index 0000000000..3331ffa0ce
--- /dev/null
+++ b/src/System.Reflection.Metadata/tests/TestUtilities/TestMetadataStringDecoder.cs
@@ -0,0 +1,26 @@
+// 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.Text;
+
+namespace System.Reflection.Metadata.Tests
+{
+ public unsafe delegate string GetString(byte* bytes, int count);
+
+ public sealed class TestMetadataStringDecoder : MetadataStringDecoder
+ {
+ private readonly GetString _getString;
+
+ public TestMetadataStringDecoder(Encoding encoding, GetString getString)
+ : base(encoding)
+ {
+ _getString = getString;
+ }
+
+ public override unsafe string GetString(byte* bytes, int byteCount)
+ {
+ return _getString(bytes, byteCount);
+ }
+ }
+}
diff --git a/src/System.Reflection.Metadata/tests/Utilities/MemoryBlockTests.cs b/src/System.Reflection.Metadata/tests/Utilities/MemoryBlockTests.cs
index 715f0289f2..ee2f2d1727 100644
--- a/src/System.Reflection.Metadata/tests/Utilities/MemoryBlockTests.cs
+++ b/src/System.Reflection.Metadata/tests/Utilities/MemoryBlockTests.cs
@@ -118,7 +118,7 @@ namespace System.Reflection.Metadata.Tests
}
// To cover to big to pool case.
- str = String.Concat(Enumerable.Repeat(str, 10000));
+ str = string.Concat(Enumerable.Repeat(str, 10000));
fixed (byte* ptr = (buffer = utf8.GetBytes(str)))
{
Assert.Equal(str, new MemoryBlock(ptr, buffer.Length).PeekUtf8NullTerminated(0, null, decoder, out bytesRead));
@@ -148,23 +148,6 @@ namespace System.Reflection.Metadata.Tests
}
}
- unsafe delegate string GetString(byte* bytes, int count);
-
- sealed class CustomDecoder : MetadataStringDecoder
- {
- private GetString _getString;
- public CustomDecoder(Encoding encoding, GetString getString)
- : base(encoding)
- {
- _getString = getString;
- }
-
- public override unsafe string GetString(byte* bytes, int byteCount)
- {
- return _getString(bytes, byteCount);
- }
- }
-
[Fact]
public unsafe void DecoderIsUsedCorrectly()
{
@@ -173,7 +156,7 @@ namespace System.Reflection.Metadata.Tests
int bytesRead;
bool prefixed = false;
- var decoder = new CustomDecoder(
+ var decoder = new TestMetadataStringDecoder(
Encoding.UTF8,
(bytes, byteCount) =>
{
@@ -198,10 +181,10 @@ namespace System.Reflection.Metadata.Tests
}
// decoder will fail to intercept because we don't bother calling it for empty strings.
- Assert.Same(String.Empty, new MemoryBlock(null, 0).PeekUtf8NullTerminated(0, null, decoder, out bytesRead));
+ Assert.Same(string.Empty, new MemoryBlock(null, 0).PeekUtf8NullTerminated(0, null, decoder, out bytesRead));
Assert.Equal(0, bytesRead);
- Assert.Same(String.Empty, new MemoryBlock(null, 0).PeekUtf8NullTerminated(0, new byte[0], decoder, out bytesRead));
+ Assert.Same(string.Empty, new MemoryBlock(null, 0).PeekUtf8NullTerminated(0, new byte[0], decoder, out bytesRead));
Assert.Equal(0, bytesRead);
}
diff --git a/src/System.Reflection.Primitives/dir.props b/src/System.Reflection.Primitives/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Reflection.Primitives/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Reflection.Primitives/pkg/System.Reflection.Primitives.pkgproj b/src/System.Reflection.Primitives/pkg/System.Reflection.Primitives.pkgproj
index b0e374d90f..e282fb766e 100644
--- a/src/System.Reflection.Primitives/pkg/System.Reflection.Primitives.pkgproj
+++ b/src/System.Reflection.Primitives/pkg/System.Reflection.Primitives.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Reflection.Primitives.csproj">
diff --git a/src/System.Reflection.Primitives/pkg/ValidationSuppression.txt b/src/System.Reflection.Primitives/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Reflection.Primitives/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Reflection.Primitives/pkg/aot/System.Reflection.Primitives.pkgproj b/src/System.Reflection.Primitives/pkg/aot/System.Reflection.Primitives.pkgproj
index 38b50b8697..a27e529204 100644
--- a/src/System.Reflection.Primitives/pkg/aot/System.Reflection.Primitives.pkgproj
+++ b/src/System.Reflection.Primitives/pkg/aot/System.Reflection.Primitives.pkgproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2.0</Version>
<PackageTargetRuntime>aot</PackageTargetRuntime>
<PreventImplementationReference>true</PreventImplementationReference>
</PropertyGroup>
diff --git a/src/System.Reflection.Primitives/src/System.Reflection.Primitives.csproj b/src/System.Reflection.Primitives/src/System.Reflection.Primitives.csproj
index 93ac85208d..dfca2b7dfd 100644
--- a/src/System.Reflection.Primitives/src/System.Reflection.Primitives.csproj
+++ b/src/System.Reflection.Primitives/src/System.Reflection.Primitives.csproj
@@ -3,18 +3,9 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Reflection.Primitives</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'!='netcore50'">true</IsPartialFacadeAssembly>
- <NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
+ <NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
- <ItemGroup Condition="'$(PackageTargetFramework)' == ''">
- <PackageDestination Include="lib/netstandard1.3">
- <TargetFramework>netstandard1.3</TargetFramework>
- </PackageDestination>
- <PackageDestination Include="lib/uap10.1">
- <TargetFramework>uap10.1</TargetFramework>
- </PackageDestination>
- </ItemGroup>
<!-- Help VS understand available configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
diff --git a/src/System.Reflection.Primitives/src/project.json b/src/System.Reflection.Primitives/src/project.json
index 4acd4f6c2c..39e65df0db 100644
--- a/src/System.Reflection.Primitives/src/project.json
+++ b/src/System.Reflection.Primitives/src/project.json
@@ -1,6 +1,6 @@
{
"frameworks": {
- "netstandard1.0": {
+ "netstandard1.3": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.TargetingPack.Private.CoreCLR": "1.1.0-beta-24431-03"
diff --git a/src/System.Reflection.TypeExtensions/dir.props b/src/System.Reflection.TypeExtensions/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.Reflection.TypeExtensions/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Reflection.TypeExtensions/ref/4.0.0/System.Reflection.TypeExtensions.depproj b/src/System.Reflection.TypeExtensions/ref/4.0.0/System.Reflection.TypeExtensions.depproj
index 936df44f24..1681b96d7d 100644
--- a/src/System.Reflection.TypeExtensions/ref/4.0.0/System.Reflection.TypeExtensions.depproj
+++ b/src/System.Reflection.TypeExtensions/ref/4.0.0/System.Reflection.TypeExtensions.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Reflection.TypeExtensions/ref/System.Reflection.TypeExtensions.csproj b/src/System.Reflection.TypeExtensions/ref/System.Reflection.TypeExtensions.csproj
index 7b62250546..dfabf65b5c 100644
--- a/src/System.Reflection.TypeExtensions/ref/System.Reflection.TypeExtensions.csproj
+++ b/src/System.Reflection.TypeExtensions/ref/System.Reflection.TypeExtensions.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.5</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.5</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Reflection.TypeExtensions/src/System.Reflection.TypeExtensions.csproj b/src/System.Reflection.TypeExtensions/src/System.Reflection.TypeExtensions.csproj
index 4a39aa4153..9662d28201 100644
--- a/src/System.Reflection.TypeExtensions/src/System.Reflection.TypeExtensions.csproj
+++ b/src/System.Reflection.TypeExtensions/src/System.Reflection.TypeExtensions.csproj
@@ -3,10 +3,8 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Reflection.TypeExtensions</AssemblyName>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' != 'netcore50aot'">true</IsPartialFacadeAssembly>
<ProjectGuid>{1E689C1B-690C-4799-BDE9-6E7990585894}</ProjectGuid>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.5</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.5</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Reflection.TypeExtensions/tests/Assembly/AssemblyExtensionTests.cs b/src/System.Reflection.TypeExtensions/tests/AssemblyExtensionTests.cs
index fc0b96dbb4..0de1e2986b 100644
--- a/src/System.Reflection.TypeExtensions/tests/Assembly/AssemblyExtensionTests.cs
+++ b/src/System.Reflection.TypeExtensions/tests/AssemblyExtensionTests.cs
@@ -11,22 +11,22 @@ namespace System.Reflection.Tests
[Fact]
public void GetExportedTypesTest()
{
- Assembly executingAssembly = this.GetType().GetTypeInfo().Assembly;
- Assert.True(executingAssembly.GetExportedTypes().Length >= 183);
+ Assembly executingAssembly = GetType().GetTypeInfo().Assembly;
+ Assert.True(executingAssembly.GetExportedTypes().Length >= 120);
}
[Fact]
public void GetModulesTest()
{
- Assembly executingAssembly = this.GetType().GetTypeInfo().Assembly;
+ Assembly executingAssembly = GetType().GetTypeInfo().Assembly;
Assert.Equal(1, executingAssembly.GetModules().Length);
}
[Fact]
public void GetTypes()
{
- Assembly executingAssembly = this.GetType().GetTypeInfo().Assembly;
- Assert.True(executingAssembly.GetTypes().Length >= 236);
+ Assembly executingAssembly = GetType().GetTypeInfo().Assembly;
+ Assert.True(executingAssembly.GetTypes().Length >= 200);
}
}
}
diff --git a/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoConstructorName.cs b/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoConstructorName.cs
deleted file mode 100644
index d9a658c747..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoConstructorName.cs
+++ /dev/null
@@ -1,18 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- public class ConstructorInfoConstructorName
- {
- //Positive Test 1: Ensure ConstructorInfo.ContructorName is correct
- [Fact]
- public void PosTest1()
- {
- Assert.Equal(".ctor", ConstructorInfo.ConstructorName);
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoInvoke1.cs b/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoInvoke1.cs
deleted file mode 100644
index 9c838896f3..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoInvoke1.cs
+++ /dev/null
@@ -1,166 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- // Invoke(System.Object[])
- public class ConstructorInfoInvokeTests
- {
- public class TestClass
- {
- public TestClass(int i, string s) { throw new System.Exception(); }
- }
-
- public class ConstructorInfoInvoke1
- {
- public ConstructorInfoInvoke1() { }
- public ConstructorInfoInvoke1(int i) { }
- public ConstructorInfoInvoke1(int i, String s) { }
- public ConstructorInfoInvoke1(String s, int i) { }
- }
-
- // Positive Test 1: Ensure ConstructorInfo.Invoke(System.Object[]) can be called with default array
- [Fact]
- public void PosTest1()
- {
- ConstructorInfo ci = typeof(ConstructorInfoInvoke1).GetConstructor(new Type[] { });
- Object[] testarray = { };
- Object myobject;
- myobject = ci.Invoke(testarray);
- Assert.NotNull(myobject);
- }
-
- // Positive Test 2: Ensure ConstructorInfo.Invoke(System.Object[]) can be called with array having one element
- [Fact]
- public void PosTest2()
- {
- Type[] types = new Type[1];
- types[0] = typeof(int);
- ConstructorInfo ci = typeof(ConstructorInfoInvoke1).GetConstructor(types);
- Object[] testarray = new Object[1];
- testarray[0] = 1;
- Object myobject;
- myobject = ci.Invoke(testarray);
- Assert.NotNull(myobject);
- }
-
- // Positive Test 3: Ensure ConstructorInfo.Invoke(System.Object[]) can be called with array having two elements (int, string)
- [Fact]
- public void PosTest3()
- {
- Type[] types = new Type[2];
- types[0] = typeof(int);
- types[1] = typeof(String);
- ConstructorInfo ci = typeof(ConstructorInfoInvoke1).GetConstructor(types);
- Object[] testarray = new Object[2];
- testarray[0] = 1;
- testarray[1] = "Hello, Test!";
- Object myobject;
- myobject = ci.Invoke(testarray);
- Assert.NotNull(myobject);
- }
-
- // Positive Test 4: Ensure ConstructorInfo.Invoke(System.Object[]) can be called with array having two elements (string, int)
- [Fact]
- public void PosTest4()
- {
- Type[] types = new Type[2];
- types[0] = typeof(String);
- types[1] = typeof(int);
- ConstructorInfo ci = typeof(ConstructorInfoInvoke1).GetConstructor(types);
- Object[] testarray = new Object[2];
- testarray[0] = "Hello, Test!";
- testarray[1] = 1;
- Object myobject;
- myobject = ci.Invoke(testarray);
- Assert.NotNull(myobject);
- }
-
- // Positive Test 5: Ensure ConstructorInfo.Invoke(System.Object[]) can be called with array in which there is a null
- [Fact]
- public void PosTest5()
- {
- Type[] types = new Type[2];
- types[0] = typeof(String);
- types[1] = typeof(int);
- ConstructorInfo ci = typeof(ConstructorInfoInvoke1).GetConstructor(types);
- Object[] testarray = new Object[2];
- testarray[0] = null;
- testarray[1] = 1;
- Object myobject;
- myobject = ci.Invoke(testarray);
- Assert.NotNull(myobject);
- }
-
- // Negative Test 1: MemberAccessException should be thrown when the class is abstract.
- [Fact]
- public void NegTest1()
- {
- Object[] testarray = new Object[] { };
- Type type = typeof(TestAbstractClass);
- ConstructorInfo myci = type.GetConstructor(new Type[] { });
- Assert.Throws<MemberAccessException>(() =>
- {
- myci.Invoke(testarray);
- });
- }
-
- // Negative Test 2: ArgumentException should be thrown when the parameters array does not contain values that match the types accepted by this constructor.
- [Fact]
- public void NegTest2()
- {
- Type[] types = new Type[2];
- types[0] = typeof(int);
- types[1] = typeof(String);
- ConstructorInfo ci = typeof(ConstructorInfoInvoke1).GetConstructor(types);
- Object[] testarray = new Object[2];
- testarray[0] = 1;
- testarray[1] = 2;
- Object myobject;
- Assert.Throws<ArgumentException>(() =>
- {
- myobject = ci.Invoke(testarray);
- });
- }
-
- // Negative Test 3: TargetInvocationException should be thrown when the invoked constructor throws an exception.
- [Fact]
- public void NegTest3()
- {
- Type[] types = new Type[2];
- types[0] = typeof(int);
- types[1] = typeof(String);
- ConstructorInfo ci = typeof(TestClass).GetConstructor(types);
- Object[] testarray = new Object[2];
- testarray[0] = 1;
- testarray[1] = "test";
- Object myobject;
- Assert.Throws<TargetInvocationException>(() =>
- {
- myobject = ci.Invoke(testarray);
- });
- }
-
- // Negative Test 4: TargetParameterCountException should be thrown when an incorrect number of parameters was passed.
- [Fact]
- public void NegTest4()
- {
- Type[] types = new Type[2];
- types[0] = typeof(int);
- types[1] = typeof(String);
- ConstructorInfo ci = typeof(TestClass).GetConstructor(types);
- Object[] testarray = new Object[3];
- testarray[0] = 1;
- testarray[1] = "test";
- testarray[2] = "test1";
- Object myobject;
- Assert.Throws<TargetParameterCountException>(() =>
- {
- myobject = ci.Invoke(testarray);
- });
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoInvoke2.cs b/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoInvoke2.cs
deleted file mode 100644
index 5e0d53dd23..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoInvoke2.cs
+++ /dev/null
@@ -1,172 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- // Invoke(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
- public class ConstructorInfoInvoke2
- {
- public class TestClass
- {
- public TestClass() { }
- public TestClass(int i) { }
- public TestClass(int i, String s) { }
- public TestClass(String s, int i) { }
- public TestClass(int i, int j, int k) { throw new System.Exception(); }
- }
-
- // Positive Test 1: Ensure it can be called with default array
- [Fact]
- public void PosTest1()
- {
- ConstructorInfo ci = typeof(TestClass).GetConstructor(new Type[] { });
- Object[] testarray = { };
- Object myobject;
- myobject = ci.Invoke(testarray);
- Assert.NotNull(myobject);
- }
-
- // Positive Test 2: Ensure it can be called with array having one element
- [Fact]
- public void PosTest2()
- {
- Type[] types = new Type[1];
- types[0] = typeof(int);
- ConstructorInfo ci = typeof(TestClass).GetConstructor(types);
- Object[] testarray = new Object[1];
- testarray[0] = 1;
- Object myobject;
- myobject = ci.Invoke(testarray);
- Assert.NotNull(myobject);
- }
-
- // Positive Test 3: Ensure it can be called with array having two elements (int, string)
- [Fact]
- public void PosTest3()
- {
- Type[] types = new Type[2];
- types[0] = typeof(int);
- types[1] = typeof(String);
- ConstructorInfo ci = typeof(TestClass).GetConstructor(types);
- Object[] testarray = new Object[2];
- testarray[0] = 1;
- testarray[1] = "Hello, Test!";
- Object myobject;
- myobject = ci.Invoke(testarray);
- Assert.NotNull(myobject);
- }
-
- // Positive Test 4: Ensure it can be called with array having two elements (string, int)
- [Fact]
- public void PosTest4()
- {
- Type[] types = new Type[2];
- types[0] = typeof(String);
- types[1] = typeof(int);
- ConstructorInfo ci = typeof(TestClass).GetConstructor(types);
- Object[] testarray = new Object[2];
- testarray[0] = "Hello, Test!";
- testarray[1] = 1;
- Object myobject;
- myobject = ci.Invoke(testarray);
- Assert.NotNull(myobject);
- }
-
- // Positive Test 5: Ensure it can be called with array in which there is a null
- [Fact]
- public void PosTest5()
- {
- Type[] types = new Type[2];
- types[0] = typeof(String);
- types[1] = typeof(int);
- ConstructorInfo ci = typeof(TestClass).GetConstructor(types);
- Object[] testarray = new Object[2];
- testarray[0] = null;
- testarray[1] = 1;
- Object myobject;
- myobject = ci.Invoke(testarray);
- Assert.NotNull(myobject);
- }
-
- // Negative Test 1: MemberAccessException should be thrown when the class is abstract.
- [Fact]
- public void NegTest1()
- {
- Object[] testarray = new Object[] { };
- Type type = typeof(TestAbstractClass);
- ConstructorInfo myci = type.GetConstructor(new Type[] { });
- Assert.Throws<MemberAccessException>(() =>
- {
- myci.Invoke(testarray);
- });
- }
-
- // Negative Test 2: ArgumentException should be thrown when the parameters array does not contain values that match the types accepted by this constructor.
- [Fact]
- public void NegTest2()
- {
- Type[] types = new Type[2];
- types[0] = typeof(int);
- types[1] = typeof(String);
- ConstructorInfo ci = typeof(TestClass).GetConstructor(types);
- Object[] testarray = new Object[2];
- testarray[0] = 1;
- testarray[1] = 2;
- Object myobject;
- Assert.Throws<ArgumentException>(() =>
- {
- myobject = ci.Invoke(testarray);
- });
- }
-
- // Negative Test 3: TargetInvocationException should be thrown when the invoked constructor throws an exception.
- [Fact]
- public void NegTest3()
- {
- Type[] types = new Type[3];
- types[0] = typeof(int);
- types[1] = typeof(int);
- types[2] = typeof(int);
- ConstructorInfo ci = typeof(TestClass).GetConstructor(types);
- Object[] testarray = new Object[3];
- testarray[0] = 1;
- testarray[1] = 2;
- testarray[2] = 3;
- Object myobject;
- Assert.Throws<TargetInvocationException>(() =>
- {
- myobject = ci.Invoke(testarray);
- });
- }
-
- // Negative Test 4: TargetParameterCountException should be thrown when an incorrect number of parameters was passed.
- [Fact]
- public void NegTest4()
- {
- Type[] types = new Type[2];
- types[0] = typeof(int);
- types[1] = typeof(String);
- ConstructorInfo ci = typeof(TestClass).GetConstructor(types);
- Object[] testarray = new Object[3];
- testarray[0] = 1;
- testarray[1] = "test";
- testarray[2] = "test1";
- Object myobject;
- Assert.Throws<TargetParameterCountException>(() =>
- {
- myobject = ci.Invoke(testarray);
- });
- }
- }
-
- // Used by several tests
- public abstract class TestAbstractClass
- {
- public TestAbstractClass() { }
-
- public abstract void TestAbstractMethod();
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoInvokeArrayTests.cs b/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoInvokeArrayTests.cs
new file mode 100644
index 0000000000..881c5502d5
--- /dev/null
+++ b/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoInvokeArrayTests.cs
@@ -0,0 +1,269 @@
+// 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 Xunit;
+
+namespace System.Reflection.Tests
+{
+ public class ConstructorInfoInvokeArrayTests
+ {
+ [Fact]
+ public void Invoke_SZArrayConstructor()
+ {
+ Type type = Type.GetType("System.Object[]");
+ ConstructorInfo[] constructors = type.GetConstructors();
+ Assert.Equal(1, constructors.Length);
+
+ ConstructorInfo constructor = constructors[0];
+ int[] blength = new int[] { -100, -9, -1 };
+ for (int j = 0; j < blength.Length; j++)
+ {
+ Assert.Throws<OverflowException>(() => constructor.Invoke(new object[] { blength[j] }));
+ }
+
+ int[] glength = new int[] { 0, 1, 2, 3, 5, 10, 99, 65535 };
+ for (int j = 0; j < glength.Length; j++)
+ {
+ object[] arr = (object[])constructor.Invoke(new object[] { glength[j] });
+ Assert.Equal(0, arr.GetLowerBound(0));
+ Assert.Equal(glength[j] - 1, arr.GetUpperBound(0));
+ Assert.Equal(glength[j], arr.Length);
+ }
+ }
+
+ [Fact]
+ public void Invoke_1DArrayConstructor()
+ {
+ Type type = Type.GetType("System.Char[*]");
+ MethodInfo getLowerBound = type.GetMethod("GetLowerBound");
+ MethodInfo getUpperBound = type.GetMethod("GetUpperBound");
+ PropertyInfo getLength = type.GetProperty("Length");
+
+ ConstructorInfo[] constructors = type.GetConstructors();
+ Assert.Equal(2, constructors.Length);
+
+ for (int i = 0; i < constructors.Length; i++)
+ {
+ switch (constructors[i].GetParameters().Length)
+ {
+ case 1:
+ {
+ int[] invalidLengths = new int[] { -100, -9, -1 };
+ for (int j = 0; j < invalidLengths.Length; j++)
+ {
+ Assert.Throws<OverflowException>(() => constructors[i].Invoke(new object[] { invalidLengths[j] }));
+ }
+
+ int[] validLengths = new int[] { 0, 1, 2, 3, 5, 10, 99 };
+ for (int j = 0; j < validLengths.Length; j++)
+ {
+ char[] arr = (char[])constructors[i].Invoke(new object[] { validLengths[j] });
+ Assert.Equal(0, arr.GetLowerBound(0));
+ Assert.Equal(validLengths[j] - 1, arr.GetUpperBound(0));
+ Assert.Equal(validLengths[j], arr.Length);
+ }
+ }
+ break;
+ case 2:
+ {
+ int[] invalidLowerBounds = new int[] { -20, 0, 20 };
+ int[] invalidLengths = new int[] { -100, -9, -1 };
+ for (int j = 0; j < invalidLengths.Length; j++)
+ {
+ Assert.Throws<OverflowException>(() => constructors[i].Invoke(new object[] { invalidLowerBounds[j], invalidLengths[j] }));
+ }
+
+ int[] validLowerBounds = new int[] { 0, 1, -1, 2, -3, 5, -10, 99, 100 };
+ int[] validLengths = new int[] { 0, 1, 3, 2, 3, 5, 10, 99, 0 };
+ for (int j = 0; j < validLengths.Length; j++)
+ {
+ object o = constructors[i].Invoke(new object[] { validLowerBounds[j], validLengths[j] });
+
+ Assert.Equal(validLowerBounds[j], (int)getLowerBound.Invoke(o, new object[] { 0 }));
+ Assert.Equal(validLowerBounds[j] + validLengths[j] - 1, (int)getUpperBound.Invoke(o, new object[] { 0 }));
+ Assert.Equal(validLengths[j], (int)getLength.GetValue(o, null));
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ [Fact]
+ public void Invoke_2DArrayConstructor()
+ {
+ Type type = Type.GetType("System.Int32[,]", false);
+
+ ConstructorInfo[] constructors = type.GetConstructors();
+ Assert.Equal(2, constructors.Length);
+
+ for (int i = 0; i < constructors.Length; i++)
+ {
+ switch (constructors[i].GetParameters().Length)
+ {
+ case 2:
+ {
+ int[] invalidLengths1 = new int[] { -11, -10, 0, 10 };
+ int[] invalidLengths2 = new int[] { -33, 0, -20, -33 };
+
+ for (int j = 0; j < invalidLengths1.Length; j++)
+ {
+ Assert.Throws<OverflowException>(() => constructors[i].Invoke(new object[] { invalidLengths1[j], invalidLengths2[j] }));
+ }
+
+ int[] validLengths1 = new int[] { 0, 0, 1, 1, 2, 1, 2, 10, 17, 99 };
+ int[] validLengths2 = new int[] { 0, 1, 0, 1, 1, 2, 2, 110, 5, 900 };
+
+ for (int j = 0; j < validLengths1.Length; j++)
+ {
+ int[,] arr = (int[,])constructors[i].Invoke(new object[] { validLengths1[j], validLengths2[j] });
+ Assert.Equal(0, arr.GetLowerBound(0));
+ Assert.Equal(validLengths1[j] - 1, arr.GetUpperBound(0));
+ Assert.Equal(0, arr.GetLowerBound(1));
+ Assert.Equal(validLengths2[j] - 1, arr.GetUpperBound(1));
+ Assert.Equal(validLengths1[j] * validLengths2[j], arr.Length);
+ }
+ }
+
+ break;
+ case 4:
+ {
+ int[] invalidLowerBounds1 = new int[] { 10, -10, 20 };
+ int[] invalidLowerBounds2 = new int[] { -10, 10, 0 };
+ int[] invalidLengths3 = new int[] { -11, -10, 0 };
+ int[] invalidLengths4 = new int[] { -33, 0, -20 };
+
+ for (int j = 0; j < invalidLengths3.Length; j++)
+ {
+ Assert.Throws<OverflowException>(() => constructors[i].Invoke(new object[] { invalidLowerBounds1[j], invalidLengths3[j], invalidLowerBounds2[j], invalidLengths4[j] }));
+ }
+
+ int baseNum = 3;
+ int baseNum4 = baseNum * baseNum * baseNum * baseNum;
+ int[] validLengths1 = new int[baseNum4];
+ int[] validLowerBounds1 = new int[baseNum4];
+ int[] validLengths2 = new int[baseNum4];
+ int[] validLowerBounds2 = new int[baseNum4];
+
+ int cnt = 0;
+ for (int pos1 = 0; pos1 < baseNum; pos1++)
+ for (int pos2 = 0; pos2 < baseNum; pos2++)
+ for (int pos3 = 0; pos3 < baseNum; pos3++)
+ for (int pos4 = 0; pos4 < baseNum; pos4++)
+ {
+ int saved = cnt;
+ validLengths1[cnt] = saved % baseNum;
+ saved = saved / baseNum;
+ validLengths2[cnt] = saved % baseNum;
+ saved = saved / baseNum;
+ validLowerBounds1[cnt] = saved % baseNum;
+ saved = saved / baseNum;
+ validLowerBounds2[cnt] = saved % baseNum;
+ cnt++;
+ }
+
+ for (int j = 0; j < validLengths2.Length; j++)
+ {
+ int[,] arr = (int[,])constructors[i].Invoke(new object[] { validLengths1[j], validLengths2[j], validLowerBounds1[j], validLowerBounds2[j] });
+ Assert.Equal(validLengths1[j], arr.GetLowerBound(0));
+ Assert.Equal(validLengths1[j] + validLengths2[j] - 1, arr.GetUpperBound(0));
+ Assert.Equal(validLowerBounds1[j], arr.GetLowerBound(1));
+ Assert.Equal(validLowerBounds1[j] + validLowerBounds2[j] - 1, arr.GetUpperBound(1));
+ Assert.Equal(validLengths2[j] * validLowerBounds2[j], arr.Length);
+ }
+
+ // Lower can be < 0
+ validLengths1 = new int[] { 10, 10, 65535, 40, 0, -10, -10, -20, -40, 0 };
+ validLowerBounds1 = new int[] { 5, 99, -100, 30, 4, -5, 99, 100, -30, 0 };
+ validLengths2 = new int[] { 1, 200, 2, 40, 0, 1, 200, 2, 40, 65535 };
+ validLowerBounds2 = new int[] { 5, 10, 1, 0, 4, 5, 65535, 1, 0, 4 };
+
+ for (int j = 0; j < validLengths2.Length; j++)
+ {
+ int[,] arr = (int[,])constructors[i].Invoke(new object[] { validLengths1[j], validLengths2[j], validLowerBounds1[j], validLowerBounds2[j] });
+ Assert.Equal(validLengths1[j], arr.GetLowerBound(0));
+ Assert.Equal(validLengths1[j] + validLengths2[j] - 1, arr.GetUpperBound(0));
+ Assert.Equal(validLowerBounds1[j], arr.GetLowerBound(1));
+ Assert.Equal(validLowerBounds1[j] + validLowerBounds2[j] - 1, arr.GetUpperBound(1));
+ Assert.Equal(validLengths2[j] * validLowerBounds2[j], arr.Length);
+ }
+ }
+ break;
+ }
+ }
+ }
+ [Fact]
+ public void Invoke_LargeDimensionalArrayConstructor()
+ {
+ Type type = Type.GetType("System.Type[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,]");
+ ConstructorInfo[] cia = type.GetConstructors();
+ Assert.Equal(2, cia.Length);
+ Assert.Throws<TypeLoadException>(() => Type.GetType("System.Type[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,]"));
+ }
+
+ [Fact]
+ public void Invoke_JaggedArrayConstructor()
+ {
+ Type type = Type.GetType("System.String[][]");
+ ConstructorInfo[] constructors = type.GetConstructors();
+ Assert.Equal(2, constructors.Length);
+
+ for (int i = 0; i < constructors.Length; i++)
+ {
+ switch (constructors[i].GetParameters().Length)
+ {
+ case 1:
+ {
+ int[] invalidLengths = new int[] { -11, -10, -99 };
+ for (int j = 0; j < invalidLengths.Length; j++)
+ {
+ Assert.Throws<OverflowException>(() => constructors[i].Invoke(new object[] { invalidLengths[j] }));
+ }
+
+ int[] validLengths = new int[] { 0, 1, 2, 10, 17, 99 };
+ for (int j = 0; j < validLengths.Length; j++)
+ {
+ string[][] arr = (string[][])constructors[i].Invoke(new object[] { validLengths[j] });
+ Assert.Equal(0, arr.GetLowerBound(0));
+ Assert.Equal(validLengths[j] - 1, arr.GetUpperBound(0));
+ Assert.Equal(validLengths[j], arr.Length);
+ }
+ }
+ break;
+ case 2:
+ {
+ int[] invalidLengths1 = new int[] { -11, -10, 10, 1 };
+ int[] invalidLengths2 = new int[] { -33, 0, -33, -1 };
+ for (int j = 0; j < invalidLengths1.Length; j++)
+ {
+ Assert.Throws<OverflowException>(() => constructors[i].Invoke(new object[] { invalidLengths1[j], invalidLengths2[j] }));
+ }
+
+ int[] validLengths1 = new int[] { 0, 0, 0, 1, 1, 2, 1, 2, 10, 17, 500 };
+ int[] validLengths2 = new int[] { -33, 0, 1, 0, 1, 1, 2, 2, 110, 5, 100 };
+ for (int j = 0; j < validLengths1.Length; j++)
+ {
+ string[][] arr = (string[][])constructors[i].Invoke(new object[] { validLengths1[j], validLengths2[j] });
+ Assert.Equal(0, arr.GetLowerBound(0));
+ Assert.Equal(validLengths1[j] - 1, arr.GetUpperBound(0));
+ Assert.Equal(validLengths1[j], arr.Length);
+
+ if (validLengths1[j] == 0)
+ {
+ Assert.Equal(arr.Length, 0);
+ }
+ else
+ {
+ Assert.Equal(0, arr[0].GetLowerBound(0));
+ Assert.Equal(validLengths2[j] - 1, arr[0].GetUpperBound(0));
+ Assert.Equal(validLengths2[j], arr[0].Length);
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+}
diff --git a/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoMemberType.cs b/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoMemberType.cs
deleted file mode 100644
index 38ed109950..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoMemberType.cs
+++ /dev/null
@@ -1,31 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- // MemberType
- public class ConstructorInfoMemberType
- {
- public class TestClass
- {
- public TestClass()
- {
- }
-
- public void GetMyMemberType()
- {
- }
- }
-
- // Positive Test 1: Ensure a constructor's MemberType is Constructor.
- [Fact]
- public void PosTest1()
- {
- ConstructorInfo ci = typeof(TestClass).GetConstructor(new Type[] { });
- Assert.True(ci.IsConstructor);
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoTests.cs b/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoTests.cs
new file mode 100644
index 0000000000..ecd9f10b63
--- /dev/null
+++ b/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoTests.cs
@@ -0,0 +1,87 @@
+// 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.Collections.Generic;
+using Xunit;
+
+namespace System.Reflection.Tests
+{
+ public class ConstructorInfoTests
+ {
+ public class ConstructorInfoInvoke
+ {
+ public ConstructorInfoInvoke() { }
+ public ConstructorInfoInvoke(int i) { }
+ public ConstructorInfoInvoke(int i, string s) { }
+ public ConstructorInfoInvoke(string s, int i) { }
+ public ConstructorInfoInvoke(int i, int j, int k) { throw new Exception(); }
+ }
+
+ public abstract class TestAbstractClass
+ {
+ public TestAbstractClass() { }
+ public abstract void TestAbstractMethod();
+ }
+
+ [Fact]
+ public void ConstructorName_ReturnsExpected()
+ {
+ Assert.Equal(".ctor", ConstructorInfo.ConstructorName);
+ }
+
+ public static IEnumerable<object[]> Invoke_TestData()
+ {
+ yield return new object[] { new Type[0], new object[0] };
+ yield return new object[] { new Type[] { typeof(int) }, new object[] { 1 } };
+ yield return new object[] { new Type[] { typeof(int), typeof(string) }, new object[] { 1, "Hello, Test!" } };
+ yield return new object[] { new Type[] { typeof(string), typeof(int) }, new object[] { "Hello, Test!", 1 } };
+ yield return new object[] { new Type[] { typeof(string), typeof(int) }, new object[] { null, 1 } };
+ }
+
+ [Theory]
+ [MemberData(nameof(Invoke_TestData))]
+ public void Invoke(Type[] constructorTypeParameters, object[] parameters)
+ {
+ ConstructorInfo constructor = typeof(ConstructorInfoInvoke).GetConstructor(constructorTypeParameters);
+ object constructedObject = constructor.Invoke(parameters);
+ Assert.NotNull(constructedObject);
+ }
+
+ public static IEnumerable<object[]> Invoke_Invalid_TestData()
+ {
+ // Constructor is in an abstract class
+ yield return new object[] { typeof(TestAbstractClass), new Type[0], new object[0], typeof(MemberAccessException) };
+
+ // Mismatched values
+ yield return new object[] { typeof(ConstructorInfoInvoke), new Type[] { typeof(int), typeof(string) }, new object[] { 1, 2 }, typeof(ArgumentException) };
+
+ // Constructor throws an exception
+ yield return new object[] { typeof(ConstructorInfoInvoke), new Type[] { typeof(int), typeof(int), typeof(int) }, new object[] { 1, 2, 3 }, typeof(TargetInvocationException) };
+
+ // Incorrect number of parameters
+ yield return new object[] { typeof(ConstructorInfoInvoke), new Type[] { typeof(int), typeof(string) }, new object[] { 1, "test", "test1" }, typeof(TargetParameterCountException) };
+ }
+
+ [Theory]
+ [MemberData(nameof(Invoke_Invalid_TestData))]
+ public void Invoke_Invalid(Type constructorParent, Type[] constructorTypeParameters, object[] parameters, Type exceptionType)
+ {
+ ConstructorInfo constructor = constructorParent.GetConstructor(constructorTypeParameters);
+ Assert.Throws(exceptionType, () => constructor.Invoke(parameters));
+ }
+
+ [Fact]
+ public void IsConstructor_ReturnsTrue()
+ {
+ ConstructorInfo ci = typeof(ConstructorInfoInvoke).GetConstructor(new Type[0]);
+ Assert.True(ci.IsConstructor);
+ }
+
+ [Fact]
+ public void TypeConstructorName_ReturnsExpected()
+ {
+ Assert.Equal(".cctor", ConstructorInfo.TypeConstructorName);
+ }
+ }
+}
diff --git a/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoTypeConstructorName.cs b/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoTypeConstructorName.cs
deleted file mode 100644
index b008889da6..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/ConstructorInfoTypeConstructorName.cs
+++ /dev/null
@@ -1,17 +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.Reflection;
-using Xunit;
-
-// TypeConstructorName
-public class ConstructorInfoTypeConstructorName
-{
- // Positive Test 1: Ensure ConstructorInfo.TypeContructorName is correct
- [Fact]
- public void PosTest1()
- {
- Assert.Equal(ConstructorInfo.TypeConstructorName, ".cctor");
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/InvokeArrayCtors.cs b/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/InvokeArrayCtors.cs
deleted file mode 100644
index e4fe9257e9..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/ConstructorInfo/InvokeArrayCtors.cs
+++ /dev/null
@@ -1,299 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- public class TestMultiDimensionalArray
- {
- [Fact]
- public void TestSZArrayConstructorInvoke()
- {
- Type type = Type.GetType("System.Object[]");
- ConstructorInfo[] cia = type.GetConstructors();
- Assert.Equal(1, cia.Length);
-
- ConstructorInfo ci = cia[0];
- object[] arr = null;
- int[] blength = new int[] { -100, -9, -1 };
- for (int j = 0; j < blength.Length; j++)
- {
- Assert.Throws<OverflowException>(() =>
- {
- arr = (object[])ci.Invoke(new Object[] { blength[j] });
- });
- }
-
- int[] glength = new int[] { 0, 1, 2, 3, 5, 10, 99, 65535 };
- for (int j = 0; j < glength.Length; j++)
- {
- arr = (object[])ci.Invoke(new Object[] { glength[j] });
- Assert.Equal(0, arr.GetLowerBound(0));
- Assert.Equal(glength[j] - 1, arr.GetUpperBound(0));
- Assert.Equal(glength[j], arr.Length);
- }
- }
- [Fact]
- public void Test1DArrayConstructorInvoke()
- {
- Type type = Type.GetType("System.Char[*]");
- MethodInfo milb = type.GetMethod("GetLowerBound");
- MethodInfo miub = type.GetMethod("GetUpperBound");
- PropertyInfo pil = type.GetProperty("Length");
-
- ConstructorInfo[] cia = type.GetConstructors();
- Assert.Equal(2, cia.Length);
-
- for (int i = 0; i < cia.Length; i++)
- {
- char[] arr = null;
- switch (cia[i].GetParameters().Length)
- {
- case 1:
- {
- int[] blength = new int[] { -100, -9, -1 };
- for (int j = 0; j < blength.Length; j++)
- {
- Assert.Throws<OverflowException>(() =>
- {
- arr = (char[])cia[i].Invoke(new Object[] { blength[j] });
- });
- }
-
- int[] glength = new int[] { 0, 1, 2, 3, 5, 10, 99 };
- for (int j = 0; j < glength.Length; j++)
- {
- arr = (char[])cia[i].Invoke(new Object[] { glength[j] });
- Assert.Equal(0, arr.GetLowerBound(0));
- Assert.Equal(glength[j] - 1, arr.GetUpperBound(0));
- Assert.Equal(glength[j], arr.Length);
- }
- }
- break;
- case 2:
- {
- int[] b_lower = new int[] { -20, 0, 20 };
- int[] blength = new int[] { -100, -9, -1 };
- for (int j = 0; j < blength.Length; j++)
- {
- Assert.Throws<OverflowException>(() =>
- {
- arr = (char[])cia[i].Invoke(new Object[] { b_lower[j], blength[j] });
- });
- }
-
- int[] glower = new int[] { 0, 1, -1, 2, -3, 5, -10, 99, 100 };
- int[] glength = new int[] { 0, 1, 3, 2, 3, 5, 10, 99, 0 };
- for (int j = 0; j < glength.Length; j++)
- {
- object o = cia[i].Invoke(new Object[] { glower[j], glength[j] });
-
- Assert.Equal(glower[j], (int)milb.Invoke(o, new object[] { 0 }));
- Assert.Equal(glower[j] + glength[j] - 1, (int)miub.Invoke(o, new object[] { 0 }));
- Assert.Equal(glength[j], (int)pil.GetValue(o, null));
- }
- }
- break;
- }
- }
- }
-
- [Fact]
- public void Test2DArrayConstructorInvoke()
- {
- Type type = Type.GetType("System.Int32[,]", false);
-
- ConstructorInfo[] cia = type.GetConstructors();
- Assert.Equal(2, cia.Length);
-
- for (int i = 0; i < cia.Length; i++)
- {
- int[,] arr = null;
- switch (cia[i].GetParameters().Length)
- {
- case 2:
- {
- int[] blength1 = new int[] { -11, -10, 0, 10 };
- int[] blength2 = new int[] { -33, 0, -20, -33 };
-
- for (int j = 0; j < blength1.Length; j++)
- {
- Assert.Throws<OverflowException>(() =>
- {
- arr = (int[,])cia[i].Invoke(new Object[] { blength1[j], blength2[j] });
- });
- }
-
-
- int[] glength1 = new int[] { 0, 0, 1, 1, 2, 1, 2, 10, 17, 99 };
- int[] glength2 = new int[] { 0, 1, 0, 1, 1, 2, 2, 110, 5, 900 };
-
- for (int j = 0; j < glength1.Length; j++)
- {
- arr = (int[,])cia[i].Invoke(new Object[] { glength1[j], glength2[j] });
- Assert.Equal(0, arr.GetLowerBound(0));
- Assert.Equal(glength1[j] - 1, arr.GetUpperBound(0));
- Assert.Equal(0, arr.GetLowerBound(1));
- Assert.Equal(glength2[j] - 1, arr.GetUpperBound(1));
- Assert.Equal(glength1[j] * glength2[j], arr.Length);
- }
- }
-
- break;
-
- case 4:
- {
- int[] b_lower1 = new int[] { 10, -10, 20 };
- int[] b_lower2 = new int[] { -10, 10, 0 };
- int[] blength1 = new int[] { -11, -10, 0 };
- int[] blength2 = new int[] { -33, 0, -20 };
-
- for (int j = 0; j < blength1.Length; j++)
- {
- Assert.Throws<OverflowException>(() =>
- {
- arr = (int[,])cia[i].Invoke(new Object[] { b_lower1[j], blength1[j], b_lower2[j], blength2[j] });
- });
- }
-
- int baseNum = 3;
- int baseNum4 = baseNum * baseNum * baseNum * baseNum;
- int[] glower1 = new int[baseNum4];
- int[] glower2 = new int[baseNum4];
- int[] glength1 = new int[baseNum4];
- int[] glength2 = new int[baseNum4];
-
- int cnt = 0;
- for (int pos1 = 0; pos1 < baseNum; pos1++)
- for (int pos2 = 0; pos2 < baseNum; pos2++)
- for (int pos3 = 0; pos3 < baseNum; pos3++)
- for (int pos4 = 0; pos4 < baseNum; pos4++)
- {
- int saved = cnt;
- glower1[cnt] = saved % baseNum;
- saved = saved / baseNum;
- glength1[cnt] = saved % baseNum;
- saved = saved / baseNum;
- glower2[cnt] = saved % baseNum;
- saved = saved / baseNum;
- glength2[cnt] = saved % baseNum;
- cnt++;
- }
-
- for (int j = 0; j < glength1.Length; j++)
- {
- arr = (int[,])cia[i].Invoke(new Object[] { glower1[j], glength1[j], glower2[j], glength2[j] });
- Assert.Equal(glower1[j], arr.GetLowerBound(0));
- Assert.Equal(glower1[j] + glength1[j] - 1, arr.GetUpperBound(0));
- Assert.Equal(glower2[j], arr.GetLowerBound(1));
- Assert.Equal(glower2[j] + glength2[j] - 1, arr.GetUpperBound(1));
- Assert.Equal(glength1[j] * glength2[j], arr.Length);
- }
-
- // lower can be < 0
- glower1 = new int[] { 10, 10, 65535, 40, 0, -10, -10, -20, -40, 0 };
- glower2 = new int[] { 5, 99, -100, 30, 4, -5, 99, 100, -30, 0 };
- glength1 = new int[] { 1, 200, 2, 40, 0, 1, 200, 2, 40, 65535 };
- glength2 = new int[] { 5, 10, 1, 0, 4, 5, 65535, 1, 0, 4 };
-
- for (int j = 0; j < glength1.Length; j++)
- {
- arr = (int[,])cia[i].Invoke(new Object[] { glower1[j], glength1[j], glower2[j], glength2[j] });
- Assert.Equal(glower1[j], arr.GetLowerBound(0));
- Assert.Equal(glower1[j] + glength1[j] - 1, arr.GetUpperBound(0));
- Assert.Equal(glower2[j], arr.GetLowerBound(1));
- Assert.Equal(glower2[j] + glength2[j] - 1, arr.GetUpperBound(1));
- Assert.Equal(glength1[j] * glength2[j], arr.Length);
- }
- }
- break;
- }
- }
- }
- [Fact]
- public void Test4DArrayConstructorInvoke()
- {
- Type type = Type.GetType("System.Type[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,]");
- ConstructorInfo[] cia = type.GetConstructors();
- Assert.Equal(2, cia.Length);
- Assert.Throws<TypeLoadException>(() =>
- {
- type = Type.GetType("System.Type[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,]");
- });
- }
-
- [Fact]
- public void TestJaggedArrayConstructorInvoke()
- {
- Type type = Type.GetType("System.String[][]");
- ConstructorInfo[] cia = type.GetConstructors();
- Assert.Equal(2, cia.Length);
-
- for (int i = 0; i < cia.Length; i++)
- {
- string[][] arr = null;
- ParameterInfo[] pia = cia[i].GetParameters();
- switch (pia.Length)
- {
- case 1:
- {
- int[] blength1 = new int[] { -11, -10, -99 };
- for (int j = 0; j < blength1.Length; j++)
- {
- Assert.Throws<OverflowException>(() =>
- {
- arr = (string[][])cia[i].Invoke(new Object[] { blength1[j] });
- });
- }
-
- int[] glength1 = new int[] { 0, 1, 2, 10, 17, 99 }; //
- for (int j = 0; j < glength1.Length; j++)
- {
- arr = (string[][])cia[i].Invoke(new Object[] { glength1[j] });
- Assert.Equal(0, arr.GetLowerBound(0));
- Assert.Equal(glength1[j] - 1, arr.GetUpperBound(0));
- Assert.Equal(glength1[j], arr.Length);
- }
- }
- break;
- case 2:
- {
- int[] blength1 = new int[] { -11, -10, 10, 1 };
- int[] blength2 = new int[] { -33, 0, -33, -1 };
- for (int j = 0; j < blength1.Length; j++)
- {
- Assert.Throws<OverflowException>(() =>
- {
- arr = (string[][])cia[i].Invoke(new Object[] { blength1[j], blength2[j] });
- });
- }
-
- int[] glength1 = new int[] { 0, 0, 0, 1, 1, 2, 1, 2, 10, 17, 500 };
- int[] glength2 = new int[] { -33, 0, 1, 0, 1, 1, 2, 2, 110, 5, 100 };
- for (int j = 0; j < glength1.Length; j++)
- {
- arr = (string[][])cia[i].Invoke(new Object[] { glength1[j], glength2[j] });
- Assert.Equal(0, arr.GetLowerBound(0));
- Assert.Equal(glength1[j] - 1, arr.GetUpperBound(0));
- Assert.Equal(glength1[j], arr.Length);
-
- if (glength1[j] == 0)
- {
- Assert.Equal(arr.Length, 0);
- }
- else
- {
- Assert.Equal(0, arr[0].GetLowerBound(0));
- Assert.Equal(glength2[j] - 1, arr[0].GetUpperBound(0));
- Assert.Equal(glength2[j], arr[0].Length);
- }
- }
- }
- break;
- }
- }
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoAddEventHandler.cs b/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoAddEventHandler.cs
deleted file mode 100644
index 573ee3ad3c..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoAddEventHandler.cs
+++ /dev/null
@@ -1,131 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- public delegate void TestForEvent1();
-
- // System.Reflection.EventInfo.AddEventHandler
- public class EventInfoAddEventHandler
- {
- // Positive Test 1: add Event handler to the not static event
- [Fact]
- public void PosTest1()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event1");
- eventinfo.AddEventHandler(tc1, new TestForEvent1(tc1.method1));
- tc1.method();
- Assert.Equal(1, TestClass1.StaticVariable1);
- }
-
- // Positive Test 2:add to Event handler to the static event and the target is null
- [Fact]
- public void PosTest2()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event2");
- eventinfo.AddEventHandler(null, new TestForEvent1(tc1.method2));
- tc1.method();
- Assert.Equal(-1, TestClass1.StaticVariable2);
- }
-
- // Positive Test 3:add to Event handler to the static event and the target is not null
- [Fact]
- public void PosTest3()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event2");
- eventinfo.AddEventHandler(tc1, new TestForEvent1(tc1.method3));
- tc1.method();
- Assert.Equal(1, TestClass1.StaticVariable3);
- }
-
- // Negative Test 1:add to Event handler to the not static event and the target is null
- [Fact]
- public void NegTest1()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event1");
- // System.Reflection.TargetException not visible at the moment.
- Exception e = Assert.ThrowsAny<Exception>(() => eventinfo.AddEventHandler(null, new TestForEvent1(tc1.method2)));
- Assert.Equal("System.Reflection.TargetException", e.GetType().FullName);
- }
-
- // Negative Test 2:The EventInfo is not declared on the target
- [Fact]
- public void NegTest2()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event1");
- TestClass2 tc2 = new TestClass2();
- Exception e = Assert.ThrowsAny<Exception>(() => eventinfo.AddEventHandler(tc2, new TestForEvent1(tc1.method2)));
- Assert.Equal("System.Reflection.TargetException", e.GetType().FullName);
- }
-
- // Negative Test 3:The event does not have a public add accessor
- [Fact]
- public void NegTest3()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event3", BindingFlags.NonPublic | BindingFlags.Instance);
- TestClass2 tc2 = new TestClass2();
- Assert.Throws<InvalidOperationException>(() =>
- {
- eventinfo.AddEventHandler(tc2, new TestForEvent1(tc1.method2));
- });
- }
- }
-
- public class TestClass1
- {
- public static int StaticVariable1 = 0; // Incremented by method1
- public static int StaticVariable2 = 0; // Decremented by method2
- public static int StaticVariable3 = 0; // Incremented by method3
-
- public readonly int m_ConstVariable = 0;
- public event TestForEvent1 Event1;
- public static event TestForEvent1 Event2;
- private event TestForEvent1 Event3;
-
- public void method()
- {
- if (Event1 != null)
- {
- Event1();
- }
- if (Event2 != null)
- {
- Event2();
- }
- if (Event3 != null)
- {
- Event3();
- }
- }
- public void method1()
- {
- StaticVariable1++;
- }
- protected internal void method2()
- {
- StaticVariable2--;
- }
- public void method3()
- {
- StaticVariable3++;
- }
- }
- public class TestClass2
- {
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoAttributesProperty.cs b/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoAttributesProperty.cs
deleted file mode 100644
index 01f4622c74..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoAttributesProperty.cs
+++ /dev/null
@@ -1,80 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- // System.Reflection.EventInfo.Attributes
- public class EventInfoAttributesProperty
- {
- public delegate void Delegate1();
- public delegate void Delegate2();
-
- // Positive Test 1: The eventinfo corresponding public event
- [Fact]
- public void PosTest1()
- {
- Type tpA = typeof(TestClass);
- EventInfo eventinfo = tpA.GetEvent("Event1");
- EventAttributes eventattribute = eventinfo.Attributes;
- Assert.Equal(EventAttributes.None, eventattribute);
- }
-
- // Positive Test 2: The eventinfo corresponding private event
- [Fact]
- public void PosTest2()
- {
- Type tpA = typeof(TestClass);
- EventInfo eventinfo = tpA.GetEvent("Event2", BindingFlags.NonPublic | BindingFlags.Instance);
- EventAttributes eventattribute = eventinfo.Attributes;
- Assert.Equal(EventAttributes.None, eventattribute);
- }
-
- // Positive Test 3: The eventinfo corresponding protected event
- [Fact]
- public void PosTest3()
- {
- Type tpA = typeof(TestClass);
- EventInfo eventinfo = tpA.GetEvent("Event3", BindingFlags.NonPublic | BindingFlags.Instance);
- EventAttributes eventattribute = eventinfo.Attributes;
- Assert.Equal(EventAttributes.None, eventattribute);
- }
-
- // Positive Test 4: The eventinfo corresponding internal event
- [Fact]
- public void PosTest4()
- {
- Type tpA = typeof(TestClass);
- EventInfo eventinfo = tpA.GetEvent("Event4", BindingFlags.NonPublic | BindingFlags.Instance);
- EventAttributes eventattribute = eventinfo.Attributes;
- Assert.Equal(EventAttributes.None, eventattribute);
- }
-
- public class TestClass
- {
- public event Delegate1 Event1
- {
- add { Event1 += new Delegate1(new TestClass().method1); }
- remove { Event1 -= new Delegate1(new TestClass().method1); }
- }
- private event Delegate1 Event2
- {
- add { Event2 += new Delegate1(new TestClass().method1); }
- remove { Event2 -= new Delegate1(new TestClass().method1); }
- }
- protected event Delegate1 Event3
- {
- add { Event3 += new Delegate1(new TestClass().method1); }
- remove { Event3 -= new Delegate1(new TestClass().method1); }
- }
- internal event Delegate1 Event4
- {
- add { Event4 += new Delegate1(new TestClass().method1); }
- remove { Event4 -= new Delegate1(new TestClass().method1); }
- }
- public void method1() { }
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoEventHandlerType.cs b/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoEventHandlerType.cs
deleted file mode 100644
index f674c50185..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoEventHandlerType.cs
+++ /dev/null
@@ -1,81 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- // System.Reflection.EventInfo.EventHandlerType
- public class EventInfoEventHandlerType
- {
- public delegate void Delegate();
-
- // Positive Test 1: The event is public
- [Fact]
- public void PosTest1()
- {
- Type tpA = typeof(TestClass);
- EventInfo eventinfo = tpA.GetEvent("Event1");
- Type eventinfoType = eventinfo.EventHandlerType;
- Assert.Equal(typeof(Delegate), eventinfoType);
- }
-
- // Positive Test 2: The event is private
- [Fact]
- public void PosTest2()
- {
- Type tpA = typeof(TestClass);
- EventInfo eventinfo = tpA.GetEvent("Event2", BindingFlags.NonPublic | BindingFlags.Instance);
- Type eventinfoType = eventinfo.EventHandlerType;
- Assert.Equal(typeof(Delegate), eventinfoType);
- }
-
- // Positive Test 3: The event is protected
- [Fact]
- public void PosTest3()
- {
- Type tpA = typeof(TestClass);
- EventInfo eventinfo = tpA.GetEvent("Event3", BindingFlags.NonPublic | BindingFlags.Instance);
- Type eventinfoType = eventinfo.EventHandlerType;
- Assert.Equal(typeof(Delegate), eventinfoType);
- }
-
- // Positive Test 4: The event is internal
- [Fact]
- public void PosTest4()
- {
- Type tpA = typeof(TestClass);
- EventInfo eventinfo = tpA.GetEvent("Event4", BindingFlags.NonPublic | BindingFlags.Instance);
- Type eventinfoType = eventinfo.EventHandlerType;
- Assert.Equal(typeof(Delegate), eventinfoType);
- }
-
-#pragma warning disable 0067
- public class TestClass
- {
- public event Delegate Event1;
- private event Delegate Event2;
- protected event Delegate Event3;
- internal event Delegate Event4;
- public void method01()
- {
- Event1 += new Delegate(method1);
- }
- public void method02()
- {
- Event2 += new Delegate(method1);
- }
- public void method03()
- {
- Event3 += new Delegate(method1);
- }
- public void method04()
- {
- Event4 += new Delegate(method1);
- }
- public void method1() { }
- }
-#pragma warning restore 0067
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetAddMethod1.cs b/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetAddMethod1.cs
deleted file mode 100644
index fb845c3d2c..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetAddMethod1.cs
+++ /dev/null
@@ -1,97 +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.Diagnostics;
-using Xunit;
-
-namespace System.Reflection.Tests
-{
- // System.Reflection.EventInfo.GetAddMethod()
- public class EventInfoGetAddMethod1
- {
- public delegate void Delegate1(int i);
-
- public delegate void Delegate2();
-
- // Positive Test 1:The Event is public
- [Fact]
- public void PosTest1()
- {
- TestClass1 tc1 = new TestClass1();
- tc1.Event1 += new Delegate1(tc1.method1);
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event1");
- MethodInfo methodinfo = eventinfo.GetAddMethod();
- Assert.Equal("Void add_Event1(Delegate1)", methodinfo.ToString());
- }
-
- // Positive Test 2:The Event is private
- [Fact]
- public void PosTest2()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event3", BindingFlags.NonPublic | BindingFlags.Instance);
- MethodInfo methodinfo = eventinfo.GetAddMethod();
- Assert.Null(methodinfo);
- }
-
- // Positive Test 3:The Event is protected
- [Fact]
- public void PosTest3()
- {
- TestClass1 tc1 = new TestClass1();
- tc1.Event2 += new Delegate2(tc1.method2);
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event2", BindingFlags.Instance | BindingFlags.NonPublic);
- MethodInfo methodinfo = eventinfo.GetAddMethod();
- Assert.Null(methodinfo);
- }
-
- // Positive Test 4:The Event is protected internal
- [Fact]
- public void PosTest4()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event4", BindingFlags.Instance | BindingFlags.NonPublic);
- MethodInfo methodinfo = eventinfo.GetAddMethod();
- Assert.Null(methodinfo);
- }
-
- public class TestClass1
- {
- public event Delegate1 Event1;
- protected internal event Delegate2 Event2;
- private event Delegate1 Event3;
- protected event Delegate2 Event4;
- public void method()
- {
- if (Event1 != null)
- {
- Event1(0);
- }
- if (Event2 != null)
- {
- Event2();
- }
- if (Event3 != null)
- {
- Event3(0);
- }
- if (Event4 != null)
- {
- Event4();
- }
- }
- public void method1(int i)
- {
- Debug.WriteLine(i);
- }
- public void method2()
- {
- }
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetAddMethod2.cs b/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetAddMethod2.cs
deleted file mode 100644
index 5f1f89cf73..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetAddMethod2.cs
+++ /dev/null
@@ -1,130 +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.Diagnostics;
-using Xunit;
-
-namespace System.Reflection.Tests
-{
- // System.Reflection.EventInfo.GetAddMethod(System.Boolean)
- public class EventInfoGetAddMethod2
- {
- public delegate void Delegate1(int i);
- public delegate void Delegate2();
-
- // Positive Test 1:The Event is public
- [Fact]
- public void PosTest1()
- {
- TestClass1 tc1 = new TestClass1();
- tc1.Event1 += new Delegate1(tc1.method1);
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event1");
- MethodInfo methodinfo = eventinfo.GetAddMethod(true);
- Assert.Equal("Void add_Event1(Delegate1)", methodinfo.ToString());
- }
-
- // Positive Test 2:The Event is private and the param of Nonpublic is true
- [Fact]
- public void PosTest2()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event3", BindingFlags.NonPublic | BindingFlags.Instance);
- MethodInfo methodinfo = eventinfo.GetAddMethod(true);
- Assert.Equal("Void add_Event3(Delegate1)", methodinfo.ToString());
- }
-
- // Positive Test 3:The Event is private and the param of Nonpublic is false
- [Fact]
- public void PosTest3()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event3", BindingFlags.NonPublic | BindingFlags.Instance);
- MethodInfo methodinfo = eventinfo.GetAddMethod(false);
- Assert.Null(methodinfo);
- }
-
- // Positive Test 4:The Event is protected and the param of Nonpublic is true
- [Fact]
- public void PosTest4()
- {
- TestClass1 tc1 = new TestClass1();
- tc1.Event2 += new Delegate2(tc1.method2);
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event2", BindingFlags.Instance | BindingFlags.NonPublic);
- MethodInfo methodinfo = eventinfo.GetAddMethod(true);
- Assert.Equal("Void add_Event2(Delegate2)", methodinfo.ToString());
- }
-
- // Positive Test 5:The Event is protected and the param of Nonpublic is false
- [Fact]
- public void PosTest5()
- {
- TestClass1 tc1 = new TestClass1();
- tc1.Event2 += new Delegate2(tc1.method2);
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event2", BindingFlags.Instance | BindingFlags.NonPublic);
- MethodInfo methodinfo = eventinfo.GetAddMethod(false);
- Assert.Null(methodinfo);
- }
-
- // Positive Test 6:The Event is protected internal and the param of Nonpublic is true
- [Fact]
- public void PosTest6()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event4", BindingFlags.Instance | BindingFlags.NonPublic);
- MethodInfo methodinfo = eventinfo.GetAddMethod(true);
- Assert.Equal("Void add_Event4(Delegate2)", methodinfo.ToString());
- }
-
- // Positive Test 7:The Event is protected internal and the param of Nonpublic is false
- [Fact]
- public void PosTest7()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event4", BindingFlags.Instance | BindingFlags.NonPublic);
- MethodInfo methodinfo = eventinfo.GetAddMethod(false);
- Assert.Null(methodinfo);
- }
-
- public class TestClass1
- {
- public event Delegate1 Event1;
- protected internal event Delegate2 Event2;
- private event Delegate1 Event3;
- protected event Delegate2 Event4;
- public void method()
- {
- if (Event1 != null)
- {
- Event1(0);
- }
- if (Event2 != null)
- {
- Event2();
- }
- if (Event3 != null)
- {
- Event3(0);
- }
- if (Event4 != null)
- {
- Event4();
- }
- }
- public void method1(int i)
- {
- Debug.WriteLine(i);
- }
- public void method2()
- {
- }
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetRaiseMethod1.cs b/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetRaiseMethod1.cs
deleted file mode 100644
index b43cdc964f..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetRaiseMethod1.cs
+++ /dev/null
@@ -1,73 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- // System.Reflection.EventInfo.GetRaiseMethod()
- public class EventInfoGetRaiseMethod1
- {
- public delegate void Delegate1();
-
- // Positive Test 1:The Event is public
- [Fact]
- public void PosTest1()
- {
- TestClass tc = new TestClass();
- Type tpA = tc.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event1");
- MethodInfo methodinfo = eventinfo.GetRaiseMethod();
- Assert.Null(methodinfo);
- }
-
- // Positive Test 2:The Event is private
- [Fact]
- public void PosTest2()
- {
- TestClass tc = new TestClass();
- Type tpA = tc.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event2", BindingFlags.NonPublic | BindingFlags.Instance);
- MethodInfo methodinfo = eventinfo.GetRaiseMethod();
- Assert.Null(methodinfo);
- }
-
- // Positive Test 3:The Event is protected
- [Fact]
- public void PosTest3()
- {
- TestClass tc = new TestClass();
- Type tpA = tc.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event3", BindingFlags.NonPublic | BindingFlags.Instance);
- MethodInfo methodinfo = eventinfo.GetRaiseMethod();
- Assert.Null(methodinfo);
- }
-
- public class TestClass
- {
- public event Delegate1 Event1;
- private event Delegate1 Event2;
- protected event Delegate1 Event3;
- public void method()
- {
- if (Event1 != null)
- {
- Event1 += new Delegate1(method1);
- Event1();
- }
- if (Event2 != null)
- {
- Event2 += new Delegate1(method1);
- Event2();
- }
- if (Event3 != null)
- {
- Event3 += new Delegate1(method1);
- Event3();
- }
- }
- public void method1() { }
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetRaiseMethod2.cs b/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetRaiseMethod2.cs
deleted file mode 100644
index f8365ab6eb..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetRaiseMethod2.cs
+++ /dev/null
@@ -1,106 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- // System.Reflection.EventInfo.GetRaiseMethod(System Boolean)
- public class EventInfoGetRaiseMethod2
- {
- public delegate void Delegate1();
-
- // Positive Test 1:The Event is public and the param Nonpublic is true
- [Fact]
- public void PosTest1()
- {
- TestClass tc = new TestClass();
- Type tpA = tc.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event1");
- MethodInfo methodinfo = eventinfo.GetRaiseMethod(true);
- Assert.Null(methodinfo);
- }
-
- // Positive Test 2:The Event is public and the param Nonpublic is false
- [Fact]
- public void PosTest2()
- {
- TestClass tc = new TestClass();
- Type tpA = tc.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event1");
- MethodInfo methodinfo = eventinfo.GetRaiseMethod(false);
- Assert.Null(methodinfo);
- }
-
- // Positive Test 3:The Event is private and the param Nonpublic is true
- [Fact]
- public void PosTest3()
- {
- TestClass tc = new TestClass();
- Type tpA = tc.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event2", BindingFlags.NonPublic | BindingFlags.Instance);
- MethodInfo methodinfo = eventinfo.GetRaiseMethod(true);
- Assert.Null(methodinfo);
- }
-
- // Positive Test 4:The Event is private and the param Nonpublic is false
- [Fact]
- public void PosTest4()
- {
- TestClass tc = new TestClass();
- Type tpA = tc.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event2", BindingFlags.NonPublic | BindingFlags.Instance);
- MethodInfo methodinfo = eventinfo.GetRaiseMethod(false);
- Assert.Null(methodinfo);
- }
-
- // Positive Test 5:The Event is protected and the param Nonpublic is true
- [Fact]
- public void PosTest5()
- {
- TestClass tc = new TestClass();
- Type tpA = tc.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event3", BindingFlags.NonPublic | BindingFlags.Instance);
- MethodInfo methodinfo = eventinfo.GetRaiseMethod(true);
- Assert.Null(methodinfo);
- }
-
- // Positive Test 6:The Event is protected and the param Nonpublic is false
- [Fact]
- public void PosTest6()
- {
- TestClass tc = new TestClass();
- Type tpA = tc.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event3", BindingFlags.NonPublic | BindingFlags.Instance);
- MethodInfo methodinfo = eventinfo.GetRaiseMethod(false);
- Assert.Null(methodinfo);
- }
-
- public class TestClass
- {
- public event Delegate1 Event1;
- private event Delegate1 Event2;
- protected event Delegate1 Event3;
- public void method()
- {
- if (Event1 != null)
- {
- Event1 += new Delegate1(method1);
- Event1();
- }
- if (Event2 != null)
- {
- Event2 += new Delegate1(method1);
- Event2();
- }
- if (Event3 != null)
- {
- Event3 += new Delegate1(method1);
- Event3();
- }
- }
- public void method1() { }
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetRemoveMethod1.cs b/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetRemoveMethod1.cs
deleted file mode 100644
index b6d38760aa..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetRemoveMethod1.cs
+++ /dev/null
@@ -1,122 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- // System.Reflection.EventInfo.GetRemoveMethod()
- public class EventInfoGetRemoveMethod1
- {
- public delegate void Delegate1();
-
- // Positive Test 1:The Event is public
- [Fact]
- public void PosTest1()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event1");
- MethodInfo methodinfo = eventinfo.GetRemoveMethod();
- Assert.Equal("Void remove_Event1(Delegate1)", methodinfo.ToString());
- }
-
- // Positive Test 2:The Event is private
- [Fact]
- public void PosTest2()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event2", BindingFlags.NonPublic | BindingFlags.Instance);
- MethodInfo methodinfo = eventinfo.GetRemoveMethod();
- Assert.Null(methodinfo);
- }
-
- // Positive Test 3:The Event is protected
- [Fact]
- public void PosTest3()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event3", BindingFlags.Instance | BindingFlags.NonPublic);
- MethodInfo methodinfo = eventinfo.GetRemoveMethod();
- Assert.Null(methodinfo);
- }
-
- // Positive Test 4:The Event defined in private class is public
- [Fact]
- public void PosTest4()
- {
- MyClass tc1 = new MyClass();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event", BindingFlags.Instance | BindingFlags.Public);
- MethodInfo methodinfo = eventinfo.GetRemoveMethod();
- Assert.Equal("Void remove_Event(Delegate1)", methodinfo.ToString());
- }
-
- // Positive Test 5:The Event is internal
- [Fact]
- public void PosTest5()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event4", BindingFlags.Instance | BindingFlags.NonPublic);
- MethodInfo methodinfo = eventinfo.GetRemoveMethod();
- Assert.Null(methodinfo);
- }
-
- private class MyClass
- {
- public event Delegate1 Event;
- public void method()
- {
- if (Event != null)
- {
- Event += new Delegate1(method1);
- Event -= new Delegate1(method1);
- Event();
- }
- }
- public void method1() { }
- }
-
- public class TestClass1
- {
- public event Delegate1 Event1;
- private event Delegate1 Event2;
- protected event Delegate1 Event3;
- internal event Delegate1 Event4;
- public void method()
- {
- if (Event1 != null)
- {
- Event1 += new Delegate1(method1);
- Event1 -= new Delegate1(method1);
- Event1();
- }
- if (Event2 != null)
- {
- Event2 += new Delegate1(method1);
- Event2 -= new Delegate1(method1);
- Event2();
- }
- if (Event3 != null)
- {
- Event3 += new Delegate1(method1);
- Event3 -= new Delegate1(method1);
- Event3();
- }
- if (Event4 != null)
- {
- Event4 += new Delegate1(method1);
- Event4 -= new Delegate1(method1);
- Event4();
- }
- }
- public void method1()
- {
- }
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetRemoveMethod2.cs b/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetRemoveMethod2.cs
deleted file mode 100644
index 89ddf352ef..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoGetRemoveMethod2.cs
+++ /dev/null
@@ -1,111 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- // System.Reflection.EventInfo.GetRemoveMethod(System Boolean)
- public class EventInfoGetRemoveMethod2
- {
- public delegate void Delegate1();
-
- // Positive Test 1:The Event is public and the param Nonpublic is true
- [Fact]
- public void PosTest1()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event1");
- MethodInfo methodinfo = eventinfo.GetRemoveMethod(true);
- Assert.Equal("Void remove_Event1(Delegate1)", methodinfo.ToString());
- }
-
- // Positive Test 2:The Event is public and the param Nonpublic is false
- [Fact]
- public void PosTest2()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event1");
- MethodInfo methodinfo = eventinfo.GetRemoveMethod(false);
- Assert.Equal("Void remove_Event1(Delegate1)", methodinfo.ToString());
- }
-
- // Positive Test 3:The Event is private and the param Nonpublic is true
- [Fact]
- public void PosTest3()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event2", BindingFlags.NonPublic | BindingFlags.Instance);
- MethodInfo methodinfo = eventinfo.GetRemoveMethod(true);
- Assert.Equal("Void remove_Event2(Delegate1)", methodinfo.ToString());
- }
-
- // Positive Test 4:The Event is private and the param Nonpublic is false
- [Fact]
- public void PosTest4()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event2", BindingFlags.Instance | BindingFlags.NonPublic);
- MethodInfo methodinfo = eventinfo.GetRemoveMethod(false);
- Assert.Null(methodinfo);
- }
-
- // Positive Test 5:The Event is protected and the param Nonpublic is true
- [Fact]
- public void PosTest5()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event3", BindingFlags.NonPublic | BindingFlags.Instance);
- MethodInfo methodinfo = eventinfo.GetRemoveMethod(true);
- Assert.Equal("Void remove_Event3(Delegate1)", methodinfo.ToString());
- }
-
- // Positive Test 6:The Event is protected and the param Nonpublic is false
- [Fact]
- public void PosTest6()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event3", BindingFlags.Instance | BindingFlags.NonPublic);
- MethodInfo methodinfo = eventinfo.GetRemoveMethod(false);
- Assert.Null(methodinfo);
- }
-
- public class TestClass1
- {
- public event Delegate1 Event1;
- private event Delegate1 Event2;
- protected event Delegate1 Event3;
- public void method()
- {
- if (Event1 != null)
- {
- Event1 += new Delegate1(method1);
- Event1 -= new Delegate1(method1);
- Event1();
- }
- if (Event2 != null)
- {
- Event2 += new Delegate1(method1);
- Event2 -= new Delegate1(method1);
- Event2();
- }
- if (Event3 != null)
- {
- Event3 += new Delegate1(method1);
- Event3 -= new Delegate1(method1);
- Event3();
- }
- }
- public void method1()
- {
- }
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoIsSpecialName.cs b/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoIsSpecialName.cs
deleted file mode 100644
index 168793c33d..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoIsSpecialName.cs
+++ /dev/null
@@ -1,77 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- // System.Reflection.EventInfo.IsSpecialNameProperty
- public class EventInfoIsSpecialName
- {
- public delegate void Delegate1();
-
- // Positive Test 1:the event is public and not contain_
- [Fact]
- public void PosTest1()
- {
- Type tpA = typeof(TestClass);
- EventInfo eventinfo = tpA.GetEvent("Event1");
- Assert.False(eventinfo.IsSpecialName);
- }
-
- // Positive Test 2:the event is public but contain_
- [Fact]
- public void PosTest2()
- {
- Type tpA = typeof(TestClass);
- EventInfo eventinfo = tpA.GetEvent("_Event2");
- Assert.False(eventinfo.IsSpecialName);
- }
-
- // Positive Test 3:the event is private and not contain_
- [Fact]
- public void PosTest3()
- {
- Type tpA = typeof(TestClass);
- EventInfo eventinfo = tpA.GetEvent("Event3", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(eventinfo.IsSpecialName);
- }
-
- // Positive Test 4:the event is private but contain_
- [Fact]
- public void PosTest4()
- {
- Type tpA = typeof(TestClass);
- EventInfo eventinfo = tpA.GetEvent("Event_4", BindingFlags.Instance | BindingFlags.NonPublic);
- Assert.False(eventinfo.IsSpecialName);
- }
-
- public class TestClass
- {
- public event Delegate1 Event1;
- public event Delegate1 _Event2;
- private event Delegate1 Event3;
- private event Delegate1 Event_4;
- public void method()
- {
- if (Event1 != null)
- {
- Event1();
- }
- if (_Event2 != null)
- {
- _Event2();
- }
- if (Event3 != null)
- {
- Event3();
- }
- if (Event_4 != null)
- {
- Event_4();
- }
- }
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoMemberType.cs b/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoMemberType.cs
deleted file mode 100644
index d92808bc41..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoMemberType.cs
+++ /dev/null
@@ -1,77 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- // System.Reflection.EventInfo.MemberTypeProperty
- public class EventInfoMemberType
- {
- public delegate void Delegate1();
-
- // Positive Test 1:the event is public
- [Fact]
- public void PosTest1()
- {
- Type tpA = typeof(TestClass);
- EventInfo eventinfo = tpA.GetEvent("Event1");
- Assert.Equal("System.Reflection.RuntimeEventInfo", eventinfo.GetType().FullName);
- }
-
- // Positive Test 2:the event is protected
- [Fact]
- public void PosTest2()
- {
- Type tpA = typeof(TestClass);
- EventInfo eventinfo = tpA.GetEvent("Event2", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.Equal("System.Reflection.RuntimeEventInfo", eventinfo.GetType().FullName);
- }
-
- // Positive Test 3:the event is private
- [Fact]
- public void PosTest3()
- {
- Type tpA = typeof(TestClass);
- EventInfo eventinfo = tpA.GetEvent("Event3", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.Equal("System.Reflection.RuntimeEventInfo", eventinfo.GetType().FullName);
- }
-
- // Positive Test 4:the event is internal
- [Fact]
- public void PosTest4()
- {
- Type tpA = typeof(TestClass);
- EventInfo eventinfo = tpA.GetEvent("Event4", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.Equal("System.Reflection.RuntimeEventInfo", eventinfo.GetType().FullName);
- }
-
- public class TestClass
- {
- public event Delegate1 Event1;
- protected event Delegate1 Event2;
- private event Delegate1 Event3;
- internal event Delegate1 Event4;
- public void method()
- {
- if (Event1 != null)
- {
- Event1();
- }
- if (Event2 != null)
- {
- Event2();
- }
- if (Event3 != null)
- {
- Event3();
- }
- if (Event4 != null)
- {
- Event4();
- }
- }
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoRemoveEventHandler.cs b/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoRemoveEventHandler.cs
deleted file mode 100644
index c0b933d1d9..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoRemoveEventHandler.cs
+++ /dev/null
@@ -1,138 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- // System.Reflection.EventInfo.RemoveEvenHandler(System object,System delegate)
- public class EventInfoRemoveEventHandler
- {
- public delegate void TestForEvent1();
-
- // Positive Test 1:First Add Event handler to the not static event then Remove
- [Fact]
- public void PosTest1()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event1");
- eventinfo.AddEventHandler(tc1, new TestForEvent1(tc1.method1));
- tc1.method01();
- eventinfo.RemoveEventHandler(tc1, new TestForEvent1(tc1.method1));
- tc1.method01();
- Assert.Equal(1, TestClass1.m_StaticVariable1);
- }
-
- // Positive Test 2:First Add Event handler to the static event and the target is null then Remove
- [Fact]
- public void PosTest2()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event2");
- eventinfo.AddEventHandler(null, new TestForEvent1(tc1.method2));
- tc1.method02();
- eventinfo.RemoveEventHandler(null, new TestForEvent1(tc1.method2));
- tc1.method02();
- Assert.Equal(1, TestClass1.m_StaticVariable2);
- }
-
- // Positive Test 3:First Add Event handler to the static event and the target is not null then Remove
- [Fact]
- public void PosTest3()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event2");
- eventinfo.AddEventHandler(tc1, new TestForEvent1(tc1.method3));
- tc1.method02();
- eventinfo.RemoveEventHandler(tc1, new TestForEvent1(tc1.method3));
- tc1.method02();
- Assert.Equal(1, TestClass1.m_StaticVariable3);
- }
-
- // Negative Test 1:The event does not have a public add accessor
- [Fact]
- public void NegTest1()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event3", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.Throws<InvalidOperationException>(() =>
- {
- eventinfo.RemoveEventHandler(tc1, new TestForEvent1(tc1.method3));
- });
- }
-
- // Negative Test 2:The EventInfo is not declared on the target
- [Fact]
- public void NegTest2()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event1");
- TestClass2 tc2 = new TestClass2();
- Exception e = Assert.ThrowsAny<Exception>(() => eventinfo.RemoveEventHandler(tc2, new TestForEvent1(tc1.method1)));
- Assert.Contains("TargetException", e.GetType().FullName);
- }
-
- // Negative Test 3:add to Event handler to the not static event and the target is null
- [Fact]
- public void NegTest3()
- {
- TestClass1 tc1 = new TestClass1();
- Type tpA = tc1.GetType();
- EventInfo eventinfo = tpA.GetEvent("Event1");
- Exception e = Assert.ThrowsAny<Exception>(() => eventinfo.RemoveEventHandler(null, new TestForEvent1(tc1.method1)));
- Assert.Contains("TargetException", e.GetType().FullName);
- }
-
- public class TestClass1
- {
- public static int m_StaticVariable1 = 0;
- public static int m_StaticVariable2 = 0;
- public static int m_StaticVariable3 = 0;
- public event TestForEvent1 Event1;
- public static event TestForEvent1 Event2;
- private event TestForEvent1 Event3;
- public void method01()
- {
- if (Event1 != null)
- {
- Event1();
- }
- }
- public void method02()
- {
- if (Event2 != null)
- {
- Event2();
- }
- }
- public void method03()
- {
- if (Event3 != null)
- {
- Event3();
- }
- }
- public void method1()
- {
- m_StaticVariable1++;
- }
- public void method2()
- {
- m_StaticVariable2++;
- }
- public void method3()
- {
- m_StaticVariable3++;
- }
- }
- public class TestClass2
- {
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/EventInfoTests.cs b/src/System.Reflection.TypeExtensions/tests/EventInfoTests.cs
new file mode 100644
index 0000000000..fe55992257
--- /dev/null
+++ b/src/System.Reflection.TypeExtensions/tests/EventInfoTests.cs
@@ -0,0 +1,200 @@
+// 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.Collections.Generic;
+using Xunit;
+
+#pragma warning disable 0067
+
+namespace System.Reflection.Tests
+{
+ public delegate void VoidDelegate();
+ public delegate void IntDelegate(int i);
+
+ public class EventInfoTests
+ {
+ public static IEnumerable<object[]> AddEventHandler_TestData()
+ {
+ EI_Class tc1 = new EI_Class();
+ yield return new object[] { typeof(EI_Class).GetEvent("PublicEvent"), tc1, new VoidDelegate(tc1.PublicVoidMethod1), 1 };
+ yield return new object[] { typeof(EI_Class).GetEvent("PublicStaticEvent"), null, new VoidDelegate(tc1.ProtectedInternalVoidMethod), 2 };
+ yield return new object[] { typeof(EI_Class).GetEvent("PublicStaticEvent"), tc1, new VoidDelegate(tc1.PublicVoidMethod2), 3 };
+ }
+
+ [Theory]
+ [MemberData(nameof(AddEventHandler_TestData))]
+ public void AddEventHandler_RemoveEventHandler(EventInfo eventInfo, EI_Class target, Delegate handler, int expectedStaticVariable)
+ {
+ // Add and make sure we bound the event.
+ eventInfo.AddEventHandler(target, handler);
+ target?.InvokeAllEvents();
+ EI_Class.InvokeStaticEvent();
+ Assert.Equal(expectedStaticVariable, EI_Class.AddEventHandler_RemoveEventHandler_Test_TrackingVariable);
+ EI_Class.AddEventHandler_RemoveEventHandler_Test_TrackingVariable = 0; // Reset
+
+ // Remove and make sure we unbound the event.
+ eventInfo.RemoveEventHandler(target, handler);
+ target?.InvokeAllEvents();
+ EI_Class.InvokeStaticEvent();
+ Assert.Equal(0, EI_Class.AddEventHandler_RemoveEventHandler_Test_TrackingVariable);
+ }
+
+ public static IEnumerable<object[]> AddEventHandler_Invalid_TestData()
+ {
+ // Null target for instance method
+ EI_Class tc1 = new EI_Class();
+ yield return new object[] { typeof(EI_Class).GetEvent("PublicEvent"), null, new VoidDelegate(tc1.ProtectedInternalVoidMethod), typeof(TargetException) };
+
+ // Event not declared on target
+ yield return new object[] { typeof(EI_Class).GetEvent("PublicEvent"), new DummyClass(), new VoidDelegate(tc1.ProtectedInternalVoidMethod), typeof(TargetException) };
+
+ // Event does not have a public add accessor
+ yield return new object[] { typeof(EI_Class).GetEvent("PrivateEvent", BindingFlags.NonPublic | BindingFlags.Instance), new DummyClass(), new VoidDelegate(tc1.ProtectedInternalVoidMethod), typeof(InvalidOperationException) };
+ }
+
+ [Theory]
+ [MemberData(nameof(AddEventHandler_Invalid_TestData))]
+ public void AddEventHandler_Invalid(EventInfo eventInfo, object target, Delegate handler, Type exceptionType)
+ {
+ Assert.Throws(exceptionType, () => eventInfo.AddEventHandler(target, handler));
+ Assert.Throws(exceptionType, () => eventInfo.RemoveEventHandler(target, handler));
+ }
+
+ [Theory]
+ [InlineData(nameof(EI_Class.PublicEvent))]
+ [InlineData(nameof(EI_Class.Public_Event))]
+ [InlineData("PrivateEvent")]
+ [InlineData("ProtectedEvent")]
+ [InlineData(nameof(EI_Class.ProtectedInternalEvent))]
+ public void Attributes_IsSpecialName(string name)
+ {
+ EventInfo eventInfo = Helpers.GetEvent(typeof(EI_Class), name);
+ Assert.Equal(EventAttributes.None, eventInfo.Attributes);
+ Assert.False(eventInfo.IsSpecialName);
+ }
+
+ [Theory]
+ [InlineData(nameof(EI_Class.PublicEvent), typeof(VoidDelegate))]
+ [InlineData("PrivateEvent", typeof(VoidDelegate))]
+ [InlineData("ProtectedEvent", typeof(VoidDelegate))]
+ [InlineData(nameof(EI_Class.ProtectedInternalEvent), typeof(VoidDelegate))]
+ public void EventHandlerType(string name, Type expected)
+ {
+ EventInfo eventInfo = Helpers.GetEvent(typeof(EI_Class), name);
+ Assert.Equal(expected, eventInfo.EventHandlerType);
+ }
+
+ [Theory]
+ [InlineData(nameof(EI_Class.PublicEvent), "Void add_PublicEvent(System.Reflection.Tests.VoidDelegate)", false)]
+ [InlineData("PrivateEvent", "Void add_PrivateEvent(System.Reflection.Tests.VoidDelegate)", true)]
+ [InlineData("ProtectedEvent", "Void add_ProtectedEvent(System.Reflection.Tests.VoidDelegate)", true)]
+ [InlineData(nameof(EI_Class.ProtectedInternalEvent), "Void add_ProtectedInternalEvent(System.Reflection.Tests.VoidDelegate)", true)]
+ public void GetAddMethod(string name, string expectedToString, bool nonPublic)
+ {
+ EventInfo eventInfo = Helpers.GetEvent(typeof(EI_Class), name);
+ MethodInfo method = eventInfo.GetAddMethod();
+ Assert.Equal(nonPublic, method == null);
+ if (method != null)
+ {
+ Assert.Equal(expectedToString, method.ToString());
+ }
+
+ method = eventInfo.GetAddMethod(false);
+ Assert.Equal(nonPublic, method == null);
+ if (method != null)
+ {
+ Assert.Equal(expectedToString, method.ToString());
+ }
+
+ method = eventInfo.GetAddMethod(true);
+ Assert.NotNull(method);
+ Assert.Equal(expectedToString, method.ToString());
+ }
+
+ [Theory]
+ [InlineData(nameof(EI_Class.PublicEvent))]
+ [InlineData("PrivateEvent")]
+ [InlineData("ProtectedEvent")]
+ [InlineData(nameof(EI_Class.ProtectedInternalEvent))]
+ public void GetRaiseMethod(string name)
+ {
+ EventInfo eventInfo = Helpers.GetEvent(typeof(EI_Class), name);
+ Assert.Null(eventInfo.GetRaiseMethod());
+ Assert.Null(eventInfo.GetRaiseMethod(false));
+ Assert.Null(eventInfo.GetRaiseMethod(true));
+ }
+
+ [Theory]
+ [InlineData(nameof(EI_Class.PublicEvent), "Void remove_PublicEvent(System.Reflection.Tests.VoidDelegate)", false)]
+ [InlineData("PrivateEvent", "Void remove_PrivateEvent(System.Reflection.Tests.VoidDelegate)", true)]
+ [InlineData("ProtectedEvent", "Void remove_ProtectedEvent(System.Reflection.Tests.VoidDelegate)", true)]
+ [InlineData(nameof(EI_Class.ProtectedInternalEvent), "Void remove_ProtectedInternalEvent(System.Reflection.Tests.VoidDelegate)", true)]
+ public void GetRemoveMethod(string name, string expectedToString, bool nonPublic)
+ {
+ EventInfo eventInfo = Helpers.GetEvent(typeof(EI_Class), name);
+ MethodInfo method = eventInfo.GetRemoveMethod();
+ Assert.Equal(nonPublic, method == null);
+ if (method != null)
+ {
+ Assert.Equal(expectedToString, method.ToString());
+ }
+
+ method = eventInfo.GetRemoveMethod(false);
+ Assert.Equal(nonPublic, method == null);
+ if (method != null)
+ {
+ Assert.Equal(expectedToString, method.ToString());
+ }
+
+ method = eventInfo.GetRemoveMethod(true);
+ Assert.NotNull(method);
+ Assert.Equal(expectedToString, method.ToString());
+ }
+
+ [Theory]
+ [InlineData(nameof(EI_Class.PublicEvent))]
+ [InlineData("ProtectedEvent")]
+ [InlineData("PrivateEvent")]
+ [InlineData(nameof(EI_Class.InternalEvent))]
+ public void GetType_FullName(string name)
+ {
+ EventInfo eventInfo = Helpers.GetEvent(typeof(EI_Class), name);
+ Assert.Equal("System.Reflection.RuntimeEventInfo", eventInfo.GetType().FullName);
+ }
+ }
+
+ public class EI_Class
+ {
+ public static int AddEventHandler_RemoveEventHandler_Test_TrackingVariable = 0;
+
+ public event VoidDelegate PublicEvent;
+ public event VoidDelegate Public_Event;
+ public static event VoidDelegate PublicStaticEvent;
+ private event VoidDelegate PrivateEvent;
+ private event VoidDelegate Private_Event;
+ internal event VoidDelegate InternalEvent;
+ protected event VoidDelegate ProtectedEvent;
+ protected internal event VoidDelegate ProtectedInternalEvent;
+
+ public void InvokeAllEvents()
+ {
+ PublicEvent?.Invoke();
+ PrivateEvent?.Invoke();
+ InternalEvent?.Invoke();
+ ProtectedEvent?.Invoke();
+ ProtectedInternalEvent?.Invoke();
+ }
+
+ public static void InvokeStaticEvent()
+ {
+ PublicStaticEvent?.Invoke();
+ }
+
+ public void PublicVoidMethod1() => AddEventHandler_RemoveEventHandler_Test_TrackingVariable += 1;
+ protected internal void ProtectedInternalVoidMethod() => AddEventHandler_RemoveEventHandler_Test_TrackingVariable += 2;
+ public void PublicVoidMethod2() => AddEventHandler_RemoveEventHandler_Test_TrackingVariable += 3;
+ }
+
+ public class DummyClass { }
+}
diff --git a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoAttributes.cs b/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoAttributes.cs
deleted file mode 100644
index a5c4d4b853..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoAttributes.cs
+++ /dev/null
@@ -1,101 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- public class FieldInfoAttributes
- {
- private BindingFlags _allFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
-
-#pragma warning disable 169
-#pragma warning disable 649
- static private int s_field1;
- static public string Field2;
- static protected int Field3;
- static internal string Field4;
- static protected internal int Field5;
- private int _field6;
- public string Field7;
- protected int Field8;
- internal string Field9;
- protected internal int Field10;
- public const string Field11 = "";
-#pragma warning restore 169
-#pragma warning restore 649
-
- [Fact]
- public void PosTest1()
- {
- PosTest(typeof(FieldInfoAttributes).GetField("s_field1", _allFlags), FieldAttributes.Private | FieldAttributes.Static, "00A");
- }
-
- [Fact]
- public void PosTest2()
- {
- PosTest(typeof(FieldInfoAttributes).GetField("Field2", _allFlags), FieldAttributes.Public | FieldAttributes.Static, "00B");
- }
-
- [Fact]
- public void PosTest3()
- {
- PosTest(typeof(FieldInfoAttributes).GetField("Field3", _allFlags), FieldAttributes.Family | FieldAttributes.Static, "00C");
- }
-
- [Fact]
- public void PosTest4()
- {
- PosTest(typeof(FieldInfoAttributes).GetField("Field4", _allFlags), FieldAttributes.Assembly | FieldAttributes.Static, "00D");
- }
-
- [Fact]
- public void PosTest5()
- {
- PosTest(typeof(FieldInfoAttributes).GetField("Field5", _allFlags), FieldAttributes.FamORAssem | FieldAttributes.Static, "00E");
- }
-
- [Fact]
- public void PosTest6()
- {
- PosTest(typeof(FieldInfoAttributes).GetField("_field6", _allFlags), FieldAttributes.Private, "00F");
- }
-
- [Fact]
- public void PosTest7()
- {
- PosTest(typeof(FieldInfoAttributes).GetField("Field7", _allFlags), FieldAttributes.Public, "00G");
- }
-
- [Fact]
- public void PosTest8()
- {
- PosTest(typeof(FieldInfoAttributes).GetField("Field8", _allFlags), FieldAttributes.Family, "00H");
- }
-
- [Fact]
- public void PosTest9()
- {
- PosTest(typeof(FieldInfoAttributes).GetField("Field9", _allFlags), FieldAttributes.Assembly, "00I");
- }
-
- [Fact]
- public void PosTest10()
- {
- PosTest(typeof(FieldInfoAttributes).GetField("Field10", _allFlags), FieldAttributes.FamORAssem, "00J");
- }
-
- [Fact]
- public void PosTest11()
- {
- PosTest(typeof(FieldInfoAttributes).GetField("Field11", _allFlags), FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.Literal | FieldAttributes.HasDefault, "00K");
- }
-
- private void PosTest(FieldInfo fi, FieldAttributes expected, string id)
- {
- FieldAttributes actual = fi.Attributes;
- Assert.Equal(expected, actual);
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoFieldType.cs b/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoFieldType.cs
deleted file mode 100644
index 61f8000e27..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoFieldType.cs
+++ /dev/null
@@ -1,128 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- public class FieldInfoFieldType
- {
- private BindingFlags _allFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
-
-#pragma warning disable 169
-#pragma warning disable 649
- static private int s_field1;
- static public string Field2;
- static protected BindingFlags Field3;
- static internal int? Field4;
- static protected internal int[] Field5;
- private UserMadeStruct _field6;
- public UserMadeClass Field7;
- protected UserMadeGenericClass<int> Field8;
- internal UserMadeGenericClass<string>.UserNestedClass Field9;
- protected internal UserMadeInterface Field10;
- public UserMadeEnum Field11;
-#pragma warning restore 169
-#pragma warning restore 649
-
- [Fact]
- public void PosTest1()
- {
- PosTest(typeof(FieldInfoFieldType).GetField("s_field1", _allFlags), typeof(int), "00A");
- }
-
- [Fact]
- public void PosTest2()
- {
- PosTest(typeof(FieldInfoFieldType).GetField("Field2", _allFlags), typeof(string), "00B");
- }
-
- [Fact]
- public void PosTest3()
- {
- PosTest(typeof(FieldInfoFieldType).GetField("Field3", _allFlags), typeof(BindingFlags), "00C");
- }
-
- [Fact]
- public void PosTest4()
- {
- PosTest(typeof(FieldInfoFieldType).GetField("Field4", _allFlags), typeof(int?), "00D");
- }
-
- [Fact]
- public void PosTest5()
- {
- PosTest(typeof(FieldInfoFieldType).GetField("Field5", _allFlags), typeof(int[]), "00E");
- }
-
- [Fact]
- public void PosTest6()
- {
- PosTest(typeof(FieldInfoFieldType).GetField("_field6", _allFlags), typeof(UserMadeStruct), "00F");
- }
-
- [Fact]
- public void PosTest7()
- {
- PosTest(typeof(FieldInfoFieldType).GetField("Field7", _allFlags), typeof(UserMadeClass), "00G");
- }
-
- [Fact]
- public void PosTest8()
- {
- PosTest(typeof(FieldInfoFieldType).GetField("Field8", _allFlags), typeof(UserMadeGenericClass<int>), "00H");
- }
-
- [Fact]
- public void PosTest9()
- {
- PosTest(typeof(FieldInfoFieldType).GetField("Field9", _allFlags), typeof(UserMadeGenericClass<string>.UserNestedClass), "00I");
- }
-
- [Fact]
- public void PosTest10()
- {
- PosTest(typeof(FieldInfoFieldType).GetField("Field10", _allFlags), typeof(UserMadeInterface), "00J");
- }
-
- [Fact]
- public void PosTest11()
- {
- PosTest(typeof(FieldInfoFieldType).GetField("Field11", _allFlags), typeof(UserMadeEnum), "00K");
- }
-
- private void PosTest(FieldInfo fi, Type expected, string id)
- {
- Type actual = fi.FieldType;
- Assert.Equal(expected, actual);
- }
- }
-
- #region Helper Objects
-
- internal struct UserMadeStruct
- {
- }
-
- public class UserMadeClass
- {
- }
-
- public class UserMadeGenericClass<T>
- {
- internal class UserNestedClass { }
- }
-
- public interface UserMadeInterface
- {
- }
-
- public enum UserMadeEnum
- {
- val1,
- val2
- }
-
- #endregion
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoGetValue1.cs b/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoGetValue1.cs
deleted file mode 100644
index 003fd0356f..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoGetValue1.cs
+++ /dev/null
@@ -1,159 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- // System.Reflection.FieldInfo.GetValue(System.Object)
- public class FieldInfoGetValue1
- {
- // Positive Test 1: Test a general field in a system defined class
- [Fact]
- public void PosTest1()
- {
- string str = "Test String Value";
- Type type = typeof(System.String);
- FieldInfo fieldinfo = type.GetField("Empty");
- object obj = fieldinfo.GetValue(str);
- Assert.Equal("", obj.ToString());
- }
-
- // Positive Test 2: Test a string field in a customized class
- [Fact]
- public void PosTest2()
- {
- string argu_str1 = "ArgumentString1";
- string argu_str2 = "ArgumentString2";
- TestClassA str = new TestClassA(argu_str1, argu_str2);
- Type type = typeof(TestClassA);
- FieldInfo fieldinfo = type.GetField("str1");
- object obj = fieldinfo.GetValue(str);
- Assert.Equal(argu_str1, obj.ToString());
- }
-
- // Positive Test 3: Test a field of a sub class derived from its base class
- [Fact]
- public void PosTest3()
- {
- int int1 = new Random().Next(int.MinValue, int.MaxValue);
- subclass sub = new subclass(int1);
- Type type = typeof(subclass);
- FieldInfo fieldinfo = type.GetField("v_int", BindingFlags.NonPublic | BindingFlags.Instance);
- object obj = fieldinfo.GetValue(sub);
- Assert.Equal(int1, (int)obj);
- }
-
- // Positive Test 4: Test a nullable type field in a customized class
- [Fact]
- public void PosTest4()
- {
- TestClassA str = new TestClassA();
- Type type = typeof(TestClassA);
- FieldInfo fieldinfo = type.GetField("v_null_int");
- object obj = fieldinfo.GetValue(str);
- Assert.Null(obj);
- }
-
- // Positive Test 5: Get the object of a customized class type
- [Fact]
- public void PosTest5()
- {
- TestClassA str = new TestClassA();
- Type type = typeof(TestClassA);
- FieldInfo fieldinfo = type.GetField("tc");
- object obj = fieldinfo.GetValue(str);
- int int1 = (obj as TypeClass).value;
- Assert.Equal(1000, int1);
- }
-
- // Positive Test 6: Test a generic type field
- [Fact]
- public void PosTest6()
- {
- genClass<int> str = new genClass<int>(12345);
- Type type = typeof(genClass<int>);
- FieldInfo fieldinfo = type.GetField("t");
- object obj = fieldinfo.GetValue(str);
- Assert.Equal(12345, (int)obj);
- }
-
- // Positive Test 7: Test a static field
- [Fact]
- public void PosTest7()
- {
- Type type = typeof(TestClassA);
- TestClassA.sta_int = -99;
- FieldInfo fieldinfo = type.GetField("sta_int");
- object obj = fieldinfo.GetValue(null);
- Assert.Equal(-99, (int)obj);
- }
-
- // Negative Test 1: The argument object is null reference
- [Fact]
- public void NegTest1()
- {
- genClass<int> str = new genClass<int>(12345);
- Type type = typeof(genClass<int>);
- FieldInfo fieldinfo = type.GetField("t");
- // System.Reflection.TargetException not visible at the moment.
- Exception e = Assert.ThrowsAny<Exception>(() => fieldinfo.GetValue(null));
- Assert.Equal("System.Reflection.TargetException", e.GetType().FullName);
- }
-
-
- #region Test helper classes
- public class TestClassA
- {
- public string str1;
- public string str2;
- public TestClassA(string a, string b)
- {
- str1 = a;
- str2 = b;
- }
- public TestClassA()
- {
- v_null_int = null;
- tc = new TypeClass();
- _vpri = 100;
- }
- protected int v_int;
- public int? v_null_int;
- public TypeClass tc;
- public static int sta_int;
- private int _vpri;
- public void usingv()
- {
- int a = _vpri;
- }
- }
- public class subclass : TestClassA
- {
- public subclass(int c)
- : base(null, null)
- {
- v_int = c;
- }
- }
-
- public class genClass<T>
- {
- public T t;
- public genClass(T value)
- {
- t = value;
- }
- }
- public class TypeClass
- {
- public TypeClass()
- {
- value = 1000;
- }
- public int value;
- }
- #endregion
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsAssembly.cs b/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsAssembly.cs
deleted file mode 100644
index 3f420f77a7..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsAssembly.cs
+++ /dev/null
@@ -1,101 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- public class FieldInfoIsAssembly
- {
- private BindingFlags _allFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
-
-#pragma warning disable 169
-#pragma warning disable 649
- static private int s_field1;
- static public string Field2;
- static protected int Field3;
- static internal string Field4;
- static protected internal int Field5;
- private int _field6;
- public string Field7;
- protected int Field8;
- internal string Field9;
- protected internal int Field10;
- public string Field11;
-#pragma warning restore 169
-#pragma warning restore 649
-
- [Fact]
- public void PosTest1()
- {
- PosTest(typeof(FieldInfoIsAssembly).GetField("s_field1", _allFlags), false, "00A");
- }
-
- [Fact]
- public void PosTest2()
- {
- PosTest(typeof(FieldInfoIsAssembly).GetField("Field2", _allFlags), false, "00B");
- }
-
- [Fact]
- public void PosTest3()
- {
- PosTest(typeof(FieldInfoIsAssembly).GetField("Field3", _allFlags), false, "00C");
- }
-
- [Fact]
- public void PosTest4()
- {
- PosTest(typeof(FieldInfoIsAssembly).GetField("Field4", _allFlags), true, "00D");
- }
-
- [Fact]
- public void PosTest5()
- {
- PosTest(typeof(FieldInfoIsAssembly).GetField("Field5", _allFlags), false, "00E");
- }
-
- [Fact]
- public void PosTest6()
- {
- PosTest(typeof(FieldInfoIsAssembly).GetField("_field6", _allFlags), false, "00F");
- }
-
- [Fact]
- public void PosTest7()
- {
- PosTest(typeof(FieldInfoIsAssembly).GetField("Field7", _allFlags), false, "00G");
- }
-
- [Fact]
- public void PosTest8()
- {
- PosTest(typeof(FieldInfoIsAssembly).GetField("Field8", _allFlags), false, "00H");
- }
-
- [Fact]
- public void PosTest9()
- {
- PosTest(typeof(FieldInfoIsAssembly).GetField("Field9", _allFlags), true, "00I");
- }
-
- [Fact]
- public void PosTest10()
- {
- PosTest(typeof(FieldInfoIsAssembly).GetField("Field10", _allFlags), false, "00J");
- }
-
- [Fact]
- public void PosTest11()
- {
- PosTest(typeof(FieldInfoIsAssembly).GetField("Field11", _allFlags), false, "00K");
- }
-
- private void PosTest(FieldInfo fi, bool expected, string id)
- {
- bool actual = fi.IsAssembly;
- Assert.Equal(expected, actual);
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsFamily.cs b/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsFamily.cs
deleted file mode 100644
index 5d6a41797d..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsFamily.cs
+++ /dev/null
@@ -1,101 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- public class FieldInfoIsFamily
- {
- private BindingFlags _allFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
-
-#pragma warning disable 169
-#pragma warning disable 649
- static private int s_field1;
- static public string Field2;
- static protected int Field3;
- static internal string Field4;
- static protected internal int Field5;
- private int _field6;
- public string Field7;
- protected int Field8;
- internal string Field9;
- protected internal int Field10;
- public string Field11;
-#pragma warning restore 169
-#pragma warning restore 649
-
- [Fact]
- public void PosTest1()
- {
- PosTest(typeof(FieldInfoIsFamily).GetField("s_field1", _allFlags), false, "00A");
- }
-
- [Fact]
- public void PosTest2()
- {
- PosTest(typeof(FieldInfoIsFamily).GetField("Field2", _allFlags), false, "00B");
- }
-
- [Fact]
- public void PosTest3()
- {
- PosTest(typeof(FieldInfoIsFamily).GetField("Field3", _allFlags), true, "00C");
- }
-
- [Fact]
- public void PosTest4()
- {
- PosTest(typeof(FieldInfoIsFamily).GetField("Field4", _allFlags), false, "00D");
- }
-
- [Fact]
- public void PosTest5()
- {
- PosTest(typeof(FieldInfoIsFamily).GetField("Field5", _allFlags), false, "00E");
- }
-
- [Fact]
- public void PosTest6()
- {
- PosTest(typeof(FieldInfoIsFamily).GetField("_field6", _allFlags), false, "00F");
- }
-
- [Fact]
- public void PosTest7()
- {
- PosTest(typeof(FieldInfoIsFamily).GetField("Field7", _allFlags), false, "00G");
- }
-
- [Fact]
- public void PosTest8()
- {
- PosTest(typeof(FieldInfoIsFamily).GetField("Field8", _allFlags), true, "00H");
- }
-
- [Fact]
- public void PosTest9()
- {
- PosTest(typeof(FieldInfoIsFamily).GetField("Field9", _allFlags), false, "00I");
- }
-
- [Fact]
- public void PosTest10()
- {
- PosTest(typeof(FieldInfoIsFamily).GetField("Field10", _allFlags), false, "00J");
- }
-
- [Fact]
- public void PosTest11()
- {
- PosTest(typeof(FieldInfoIsFamily).GetField("Field11", _allFlags), false, "00K");
- }
-
- private void PosTest(FieldInfo fi, bool expected, string id)
- {
- bool actual = fi.IsFamily;
- Assert.Equal(expected, actual);
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsFamilyAndAssembly.cs b/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsFamilyAndAssembly.cs
deleted file mode 100644
index 5d743d14df..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsFamilyAndAssembly.cs
+++ /dev/null
@@ -1,119 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- // System.Reflection.FieldInfo.IsFamilyAndAssembly
- public class FieldInfoIsFamilyAndAssembly
- {
- // Positive Test 1:the class is public and the field is public
- [Fact]
- public void PosTest1()
- {
- Type tpA = typeof(TestPublicClass);
- FieldInfo fieldinfo = tpA.GetField("field1", BindingFlags.Public | BindingFlags.Instance);
- Assert.False(fieldinfo.IsFamilyAndAssembly, "IsFamilyAndAssembly was true for FieldInfo " + fieldinfo);
- }
-
- // Positive Test 2:the class is public and the field is protected
- [Fact]
- public void PosTest2()
- {
- Type tpA = typeof(TestPublicClass);
- FieldInfo fieldinfo = tpA.GetField("field2", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsFamilyAndAssembly, "IsFamilyAndAssembly was true for FieldInfo " + fieldinfo);
- }
-
- // Positive Test 3:the class is public and the field is protected internal
- [Fact]
- public void PosTest3()
- {
- Type tpA = typeof(TestPublicClass);
- FieldInfo fieldinfo = tpA.GetField("field3", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsFamilyAndAssembly, "IsFamilyAndAssembly was true for FieldInfo " + fieldinfo);
- }
-
- // Positive Test 4:the class is public and the field is private
- [Fact]
- public void PosTest4()
- {
- Type tpA = typeof(TestPublicClass);
- FieldInfo fieldinfo = tpA.GetField("_field4", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsFamilyAndAssembly, "IsFamilyAndAssembly was true for FieldInfo " + fieldinfo);
- }
-
- // Positive Test 5:the class is public and the field is internal
- [Fact]
- public void PosTest5()
- {
- Type tpA = typeof(TestPublicClass);
- FieldInfo fieldinfo = tpA.GetField("field5", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsFamilyAndAssembly, "IsFamilyAndAssembly was true for FieldInfo " + fieldinfo);
- }
-
- // Positive Test 6:the class is internal and the field is public
- [Fact]
- public void PosTest6()
- {
- Type tpA = typeof(TestinternalClass);
- FieldInfo fieldinfo = tpA.GetField("field1", BindingFlags.Public | BindingFlags.Instance);
- Assert.False(fieldinfo.IsFamilyAndAssembly, "IsFamilyAndAssembly was true for FieldInfo " + fieldinfo);
- }
-
- // Positive Test 7:the class is internal and the field is protected
- [Fact]
- public void PosTest7()
- {
- Type tpA = typeof(TestinternalClass);
- FieldInfo fieldinfo = tpA.GetField("field2", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsFamilyAndAssembly, "IsFamilyAndAssembly was true for FieldInfo " + fieldinfo);
- }
-
- // Positive Test 8:the class is internal and the field is protected internal
- [Fact]
- public void PosTest8()
- {
- Type tpA = typeof(TestinternalClass);
- FieldInfo fieldinfo = tpA.GetField("field3", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsFamilyAndAssembly, "IsFamilyAndAssembly was true for FieldInfo " + fieldinfo);
- }
-
- // Positive Test 9:the class is internal and the field is private
- [Fact]
- public void PosTest9()
- {
- Type tpA = typeof(TestinternalClass);
- FieldInfo fieldinfo = tpA.GetField("_field4", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsFamilyAndAssembly, "IsFamilyAndAssembly was true for FieldInfo " + fieldinfo);
- }
-
- // Positive Test 10:the class is internal and the field is internal
- [Fact]
- public void PosTest10()
- {
- Type tpA = typeof(TestinternalClass);
- FieldInfo fieldinfo = tpA.GetField("field5", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsFamilyAndAssembly, "IsFamilyAndAssembly was true for FieldInfo " + fieldinfo);
- }
-
- public class TestPublicClass
- {
- public string field1 = System.IO.Path.GetRandomFileName() + "TestString";
- protected string field2 = System.IO.Path.GetRandomFileName() + "TestString";
- protected internal string field3 = System.IO.Path.GetRandomFileName() + "TestString";
- private string _field4 = System.IO.Path.GetRandomFileName() + "TestString";
- internal int field5 = new Random().Next(int.MinValue, int.MaxValue);
- }
- internal class TestinternalClass
- {
- public string field1 = System.IO.Path.GetRandomFileName() + "TestString";
- protected string field2 = System.IO.Path.GetRandomFileName() + "TestString";
- protected internal string field3 = System.IO.Path.GetRandomFileName() + "TestString";
- private string _field4 = System.IO.Path.GetRandomFileName() + "TestString";
- internal int field5 = new Random().Next(int.MinValue, int.MaxValue);
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsFamilyOrAssembly.cs b/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsFamilyOrAssembly.cs
deleted file mode 100644
index e5e334ab1b..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsFamilyOrAssembly.cs
+++ /dev/null
@@ -1,121 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- // System.Reflection.FieldInfo.IsFamilyOrAssembly
- public class FieldInfoIsFamilyOrAssembly
- {
- // Positive Test 1:the class is public and the field is public
- [Fact]
- public void PosTest1()
- {
- Type tpA = typeof(TestPublicClass);
- FieldInfo fieldinfo = tpA.GetField("field1", BindingFlags.Public | BindingFlags.Instance);
- Assert.False(fieldinfo.IsFamilyOrAssembly, "IsFamilyOrAssembly was true for FieldInfo " + fieldinfo);
- }
-
- // Positive Test 2:the class is public and the field is protected
- [Fact]
- public void PosTest2()
- {
- Type tpA = typeof(TestPublicClass);
- FieldInfo fieldinfo = tpA.GetField("field2", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsFamilyOrAssembly, "IsFamilyOrAssembly was true for FieldInfo " + fieldinfo);
- }
-
- // Positive Test 3:the class is public and the field is protected internal
- [Fact]
- public void PosTest3()
- {
- Type tpA = typeof(TestPublicClass);
- FieldInfo fieldinfo = tpA.GetField("field3", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.True(fieldinfo.IsFamilyOrAssembly, "IsFamilyOrAssembly was true for FieldInfo " + fieldinfo);
- }
-
- // Positive Test 4:the class is public and the field is private
- [Fact]
- public void PosTest4()
- {
- Type tpA = typeof(TestPublicClass);
- FieldInfo fieldinfo = tpA.GetField("_field4", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsFamilyOrAssembly, "IsFamilyOrAssembly was true for FieldInfo " + fieldinfo);
- }
-
- // Positive Test 5:the class is public and the field is internal
- [Fact]
- public void PosTest5()
- {
- Type tpA = typeof(TestPublicClass);
- FieldInfo fieldinfo = tpA.GetField("field5", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsFamilyOrAssembly, "IsFamilyOrAssembly was true for FieldInfo " + fieldinfo);
- }
-
- // Positive Test 6:the class is internal and the field is public
- [Fact]
- public void PosTest6()
- {
- Type tpA = typeof(TestinternalClass);
- FieldInfo fieldinfo = tpA.GetField("field1", BindingFlags.Public | BindingFlags.Instance);
- Assert.False(fieldinfo.IsFamilyOrAssembly, "IsFamilyOrAssembly was true for FieldInfo " + fieldinfo);
- }
-
- // Positive Test 7:the class is internal and the field is protected
- [Fact]
- public void PosTest7()
- {
- Type tpA = typeof(TestinternalClass);
- FieldInfo fieldinfo = tpA.GetField("field2", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsFamilyOrAssembly, "IsFamilyOrAssembly was true for FieldInfo " + fieldinfo);
- }
-
- // Positive Test 8:the class is internal and the field is protected internal
- [Fact]
- public void PosTest8()
- {
- Type tpA = typeof(TestinternalClass);
- FieldInfo fieldinfo = tpA.GetField("field3", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.True(fieldinfo.IsFamilyOrAssembly, "IsFamilyOrAssembly was true for FieldInfo " + fieldinfo);
- }
-
- // Positive Test 9:the class is internal and the field is private
- [Fact]
- public void PosTest9()
- {
- Type tpA = typeof(TestinternalClass);
- FieldInfo fieldinfo = tpA.GetField("_field4", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsFamilyOrAssembly, "IsFamilyOrAssembly was true for FieldInfo " + fieldinfo);
- }
-
- // Positive Test 10:the class is internal and the field is internal
- [Fact]
- public void PosTest10()
- {
- Type tpA = typeof(TestinternalClass);
- FieldInfo fieldinfo = tpA.GetField("field5", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsFamilyOrAssembly, "IsFamilyOrAssembly was true for FieldInfo " + fieldinfo);
- }
-
- #region ForTestObject
- public class TestPublicClass
- {
- public string field1 = System.IO.Path.GetRandomFileName() + "TestString";
- protected string field2 = System.IO.Path.GetRandomFileName() + "TestString";
- protected internal string field3 = System.IO.Path.GetRandomFileName() + "TestString";
- private string _field4 = System.IO.Path.GetRandomFileName() + "TestString";
- internal int field5 = new Random().Next(int.MinValue, int.MaxValue);
- }
- internal class TestinternalClass
- {
- public string field1 = System.IO.Path.GetRandomFileName() + "TestString";
- protected string field2 = System.IO.Path.GetRandomFileName() + "TestString";
- protected internal string field3 = System.IO.Path.GetRandomFileName() + "TestString";
- private string _field4 = System.IO.Path.GetRandomFileName() + "TestString";
- internal int field5 = new Random().Next(int.MinValue, int.MaxValue);
- }
- #endregion
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsInitOnly.cs b/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsInitOnly.cs
deleted file mode 100644
index 9a9349519f..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsInitOnly.cs
+++ /dev/null
@@ -1,131 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- // System.Reflection.FieldInfo.IsInitOnly
- public class FieldInfoIsInitOnly
- {
- // Positive Test 1:the class is public and the field is public
- [Fact]
- public void PosTest1()
- {
- Type tpA = typeof(TestClassPublic);
- FieldInfo fieldinfo = tpA.GetField("field1", BindingFlags.Public | BindingFlags.Instance);
- Assert.False(fieldinfo.IsInitOnly);
- }
-
- // Positive Test 2:the class is public and the field is public readonly
- [Fact]
- public void PosTest2()
- {
- Type tpA = typeof(TestClassPublic);
- FieldInfo fieldinfo = tpA.GetField("field2", BindingFlags.Public | BindingFlags.Instance);
- Assert.True(fieldinfo.IsInitOnly);
- }
-
- // Positive Test 3:the class is public and the field is protected readonly
- [Fact]
- public void PosTest3()
- {
- Type tpA = typeof(TestClassPublic);
- FieldInfo fieldinfo = tpA.GetField("field3", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.True(fieldinfo.IsInitOnly);
- }
-
- // Positive Test 4:the class is public and the field is protected
- [Fact]
- public void PosTest4()
- {
- Type tpA = typeof(TestClassPublic);
- FieldInfo fieldinfo = tpA.GetField("field4", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsInitOnly);
- }
-
- // Positive Test 5:the class is public and the field is private
- [Fact]
- public void PosTest5()
- {
- Type tpA = typeof(TestClassPublic);
- FieldInfo fieldinfo = tpA.GetField("_field5", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsInitOnly);
- }
-
- // Positive Test 6:the class is public and the field is private readonly
- [Fact]
- public void PosTest6()
- {
- Type tpA = typeof(TestClassPublic);
- FieldInfo fieldinfo = tpA.GetField("_field6", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.True(fieldinfo.IsInitOnly);
- }
-
- // Positive Test 7:the class is internal and the field is public
- [Fact]
- public void PosTest7()
- {
- Type tpA = typeof(TestClassInternal);
- FieldInfo fieldinfo = tpA.GetField("field1", BindingFlags.Public | BindingFlags.Instance);
- Assert.False(fieldinfo.IsInitOnly);
- }
-
- // Positive Test 8:the class is internal and the field is protected internal readonly
- [Fact]
- public void PosTest8()
- {
- Type tpA = typeof(TestClassInternal);
- FieldInfo fieldinfo = tpA.GetField("field0", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.True(fieldinfo.IsInitOnly);
- }
-
- // Positive Test 9:the class is internal and the field is public readonly
- [Fact]
- public void PosTest9()
- {
- Type tpA = typeof(TestClassInternal);
- FieldInfo fieldinfo = tpA.GetField("field2", BindingFlags.Public | BindingFlags.Instance);
- Assert.True(fieldinfo.IsInitOnly);
- }
-
- // Positive Test 10:the class is internal and the field is private
- [Fact]
- public void PosTest10()
- {
- Type tpA = typeof(TestClassInternal);
- FieldInfo fieldinfo = tpA.GetField("_field3", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsInitOnly);
- }
-
- // Positive Test 11:the class is internal and the field is private readonly
- [Fact]
- public void PosTest11()
- {
- Type tpA = typeof(TestClassInternal);
- FieldInfo fieldinfo = tpA.GetField("_field4", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.True(fieldinfo.IsInitOnly);
- }
-
- #region ForTestObject
- public class TestClassPublic
- {
- public string field1 = System.IO.Path.GetRandomFileName() + "TestString";
- public readonly int field2 = new Random().Next(int.MinValue, int.MaxValue);
- protected readonly int field3 = new Random().Next(int.MinValue, int.MaxValue);
- protected string field4 = System.IO.Path.GetRandomFileName() + "TestString";
- private int _field5 = new Random().Next(int.MinValue, int.MaxValue);
- private readonly string _field6 = System.IO.Path.GetRandomFileName() + "TestString";
- }
- internal class TestClassInternal
- {
- protected internal readonly int field0 = new Random().Next(int.MinValue, int.MaxValue);
- public string field1 = System.IO.Path.GetRandomFileName() + "TestString";
- public readonly int field2 = new Random().Next(int.MinValue, int.MaxValue);
- private string _field3 = System.IO.Path.GetRandomFileName() + "TestString";
- private readonly int _field4 = new Random().Next(int.MinValue, int.MaxValue);
- }
- #endregion
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsLiteral.cs b/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsLiteral.cs
deleted file mode 100644
index 8500c9dfb3..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsLiteral.cs
+++ /dev/null
@@ -1,72 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- // System.Reflection.FieldInfo.IsLiteral
- public class FieldInfoIsLiteral
- {
- // Positive Test 1:the class is public and the field is public const
- [Fact]
- public void PosTest1()
- {
- Type tpA = typeof(TestClassPublic);
- FieldInfo fieldinfo = tpA.GetField("field1", BindingFlags.Public | BindingFlags.Static);
- Assert.True(fieldinfo.IsLiteral);
- }
-
- // Positive Test 2:the class is public and the field is public static
- [Fact]
- public void PosTest2()
- {
- Type tpA = typeof(TestClassPublic);
- FieldInfo fieldinfo = tpA.GetField("field2", BindingFlags.Public | BindingFlags.Static);
- Assert.False(fieldinfo.IsLiteral);
- }
-
- // Positive Test 3:the class is public and the field is protected internal const
- [Fact]
- public void PosTest3()
- {
- Type tpA = typeof(TestClassPublic);
- FieldInfo fieldinfo = tpA.GetField("field4", BindingFlags.NonPublic | BindingFlags.Static);
- Assert.True(fieldinfo.IsLiteral);
- }
-
- // Positive Test 4:the class is public and the field is protected internal
- [Fact]
- public void PosTest4()
- {
- Type tpA = typeof(TestClassPublic);
- FieldInfo fieldinfo = tpA.GetField("field3", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsLiteral);
- }
-
- // Positive Test 5:the class is public and the field is private
- [Fact]
- public void PosTest5()
- {
- Type tpA = typeof(TestClassPublic);
- FieldInfo fieldinfo = tpA.GetField("_field5", BindingFlags.NonPublic | BindingFlags.Instance);
- Assert.False(fieldinfo.IsLiteral);
- }
-
- // this class will only ever be used for reflection so
- // build warnings about unused fields do not apply.
-#pragma warning disable 0414
- public class TestClassPublic
- {
- public const string field1 = "Test";
- public static string field2 = "TestClassPublicField2";
- protected internal int field3 = new Random().Next(int.MinValue, int.MaxValue);
- protected internal const int field4 = 123;
- private string _field5 = "TestClassPublicPrivateField5";
- }
-#pragma warning restore 0414
- }
-}
-
-
diff --git a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsPrivate.cs b/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsPrivate.cs
deleted file mode 100644
index eabcda9620..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsPrivate.cs
+++ /dev/null
@@ -1,101 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- public class FieldInfoIsPrivate
- {
- private BindingFlags _allFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
-
-#pragma warning disable 169
-#pragma warning disable 649
- static private int s_field1;
- static public string Field2;
- static protected int Field3;
- static internal string Field4;
- static protected internal int Field5;
- private int _field6;
- public string Field7;
- protected int Field8;
- internal string Field9;
- protected internal int Field10;
- public string Field11;
-#pragma warning restore 169
-#pragma warning restore 649
-
- [Fact]
- public void PosTest1()
- {
- PosTest(typeof(FieldInfoIsPrivate).GetField("s_field1", _allFlags), true, "00A");
- }
-
- [Fact]
- public void PosTest2()
- {
- PosTest(typeof(FieldInfoIsPrivate).GetField("Field2", _allFlags), false, "00B");
- }
-
- [Fact]
- public void PosTest3()
- {
- PosTest(typeof(FieldInfoIsPrivate).GetField("Field3", _allFlags), false, "00C");
- }
-
- [Fact]
- public void PosTest4()
- {
- PosTest(typeof(FieldInfoIsPrivate).GetField("Field4", _allFlags), false, "00D");
- }
-
- [Fact]
- public void PosTest5()
- {
- PosTest(typeof(FieldInfoIsPrivate).GetField("Field5", _allFlags), false, "00E");
- }
-
- [Fact]
- public void PosTest6()
- {
- PosTest(typeof(FieldInfoIsPrivate).GetField("_field6", _allFlags), true, "00F");
- }
-
- [Fact]
- public void PosTest7()
- {
- PosTest(typeof(FieldInfoIsPrivate).GetField("Field7", _allFlags), false, "00G");
- }
-
- [Fact]
- public void PosTest8()
- {
- PosTest(typeof(FieldInfoIsPrivate).GetField("Field8", _allFlags), false, "00H");
- }
-
- [Fact]
- public void PosTest9()
- {
- PosTest(typeof(FieldInfoIsPrivate).GetField("Field9", _allFlags), false, "00I");
- }
-
- [Fact]
- public void PosTest10()
- {
- PosTest(typeof(FieldInfoIsPrivate).GetField("Field10", _allFlags), false, "00J");
- }
-
- [Fact]
- public void PosTest11()
- {
- PosTest(typeof(FieldInfoIsPrivate).GetField("Field11", _allFlags), false, "00K");
- }
-
- private void PosTest(FieldInfo fi, bool expected, string id)
- {
- bool actual = fi.IsPrivate;
- Assert.Equal(expected, actual);
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsPublic.cs b/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsPublic.cs
deleted file mode 100644
index 841d26bc3b..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsPublic.cs
+++ /dev/null
@@ -1,101 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- public class FieldInfoIsPublic
- {
- private BindingFlags _allFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
-
-#pragma warning disable 169
-#pragma warning disable 649
- static private int s_field1;
- static public string Field2;
- static protected int Field3;
- static internal string Field4;
- static protected internal int Field5;
- private int _field6;
- public string Field7;
- protected int Field8;
- internal string Field9;
- protected internal int Field10;
- public string Field11;
-#pragma warning restore 169
-#pragma warning restore 649
-
- [Fact]
- public void PosTest1()
- {
- PosTest(typeof(FieldInfoIsPublic).GetField("s_field1", _allFlags), false, "00A");
- }
-
- [Fact]
- public void PosTest2()
- {
- PosTest(typeof(FieldInfoIsPublic).GetField("Field2", _allFlags), true, "00B");
- }
-
- [Fact]
- public void PosTest3()
- {
- PosTest(typeof(FieldInfoIsPublic).GetField("Field3", _allFlags), false, "00C");
- }
-
- [Fact]
- public void PosTest4()
- {
- PosTest(typeof(FieldInfoIsPublic).GetField("Field4", _allFlags), false, "00D");
- }
-
- [Fact]
- public void PosTest5()
- {
- PosTest(typeof(FieldInfoIsPublic).GetField("Field5", _allFlags), false, "00E");
- }
-
- [Fact]
- public void PosTest6()
- {
- PosTest(typeof(FieldInfoIsPublic).GetField("_field6", _allFlags), false, "00F");
- }
-
- [Fact]
- public void PosTest7()
- {
- PosTest(typeof(FieldInfoIsPublic).GetField("Field7", _allFlags), true, "00G");
- }
-
- [Fact]
- public void PosTest8()
- {
- PosTest(typeof(FieldInfoIsPublic).GetField("Field8", _allFlags), false, "00H");
- }
-
- [Fact]
- public void PosTest9()
- {
- PosTest(typeof(FieldInfoIsPublic).GetField("Field9", _allFlags), false, "00I");
- }
-
- [Fact]
- public void PosTest10()
- {
- PosTest(typeof(FieldInfoIsPublic).GetField("Field10", _allFlags), false, "00J");
- }
-
- [Fact]
- public void PosTest11()
- {
- PosTest(typeof(FieldInfoIsPublic).GetField("Field11", _allFlags), true, "00K");
- }
-
- private void PosTest(FieldInfo fi, bool expected, string id)
- {
- bool actual = fi.IsPublic;
- Assert.Equal(expected, actual);
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsSpecialName.il b/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsSpecialName.il
deleted file mode 100644
index 0eb4058eec..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsSpecialName.il
+++ /dev/null
@@ -1,629 +0,0 @@
-.assembly extern mscorlib
-{
-}
-.assembly extern TestLibrary
-{
-}
-.assembly FieldInfoIsSpecialName
-{
-}
-
-.module FieldInfoIsSpecialName.exe
-
-.class private auto ansi beforefieldinit FieldInfoIsSpecialName
- extends [mscorlib]System.Object
-{
- .field private valuetype [mscorlib]System.Reflection.BindingFlags AllFlags
-
- .field private static int32 Field1
- .field public specialname static string Field2
- .field static family int32 Field3
- .field static assembly string Field4
- .field static famorassem int32 Field5
- .field private int32 Field6
- .field public specialname string Field7
- .field family int32 Field8
- .field assembly string Field9
- .field famorassem int32 Field10
- .field public string Field11
-
- .method private hidebysig static int32
- Main() cil managed
- {
- .entrypoint
- .maxstack 2
- .locals init (class FieldInfoIsSpecialName V_0,
- int32 V_1,
- bool V_2)
- IL_0000: nop
- IL_0001: newobj instance void FieldInfoIsSpecialName::.ctor()
- IL_0006: stloc.0
- IL_0007: ldstr "FieldInfo.IsSpecialName"
- IL_000c: call void [TestLibrary]TestLibrary.TestFramework::BeginTestCase(string)
- IL_0011: nop
- IL_0012: ldloc.0
- IL_0013: callvirt instance bool FieldInfoIsSpecialName::RunTests()
- IL_0018: ldc.i4.0
- IL_0019: ceq
- IL_001b: stloc.2
- IL_001c: ldloc.2
- IL_001d: brtrue.s IL_0036
-
- IL_001f: nop
- IL_0020: call bool [TestLibrary]TestLibrary.TestFramework::EndTestCase()
- IL_0025: pop
- IL_0026: ldstr "PASS"
- IL_002b: call void [TestLibrary]TestLibrary.TestFramework::LogInformation(string)
- IL_0030: nop
- IL_0031: ldc.i4.s 100
- IL_0033: stloc.1
- IL_0034: br.s IL_004c
-
- IL_0036: nop
- IL_0037: call bool [TestLibrary]TestLibrary.TestFramework::EndTestCase()
- IL_003c: pop
- IL_003d: ldstr "FAIL"
- IL_0042: call void [TestLibrary]TestLibrary.TestFramework::LogInformation(string)
- IL_0047: nop
- IL_0048: ldc.i4.0
- IL_0049: stloc.1
- IL_004a: br.s IL_004c
-
- IL_004c: ldloc.1
- IL_004d: ret
- } // end of method FieldInfoIsSpecialName::Main
-
- .method public hidebysig instance bool
- RunTests() cil managed
- {
- .maxstack 1
- .locals init (bool V_0,
- bool V_1)
- IL_0000: nop
- IL_0001: ldc.i4.1
- IL_0002: stloc.0
- IL_0003: ldstr "[Positive]"
- IL_0008: call void [TestLibrary]TestLibrary.TestFramework::LogInformation(string)
- IL_000d: nop
- IL_000e: ldarg.0
- IL_000f: call instance bool FieldInfoIsSpecialName::PosTest1()
- IL_0014: brfalse.s IL_0019
-
- IL_0016: ldloc.0
- IL_0017: br.s IL_001a
-
- IL_0019: ldc.i4.0
- IL_001a: stloc.0
- IL_001b: ldarg.0
- IL_001c: call instance bool FieldInfoIsSpecialName::PosTest2()
- IL_0021: brfalse.s IL_0026
-
- IL_0023: ldloc.0
- IL_0024: br.s IL_0027
-
- IL_0026: ldc.i4.0
- IL_0027: stloc.0
- IL_0028: ldarg.0
- IL_0029: call instance bool FieldInfoIsSpecialName::PosTest3()
- IL_002e: brfalse.s IL_0033
-
- IL_0030: ldloc.0
- IL_0031: br.s IL_0034
-
- IL_0033: ldc.i4.0
- IL_0034: stloc.0
- IL_0035: ldarg.0
- IL_0036: call instance bool FieldInfoIsSpecialName::PosTest4()
- IL_003b: brfalse.s IL_0040
-
- IL_003d: ldloc.0
- IL_003e: br.s IL_0041
-
- IL_0040: ldc.i4.0
- IL_0041: stloc.0
- IL_0042: ldarg.0
- IL_0043: call instance bool FieldInfoIsSpecialName::PosTest5()
- IL_0048: brfalse.s IL_004d
-
- IL_004a: ldloc.0
- IL_004b: br.s IL_004e
-
- IL_004d: ldc.i4.0
- IL_004e: stloc.0
- IL_004f: ldarg.0
- IL_0050: call instance bool FieldInfoIsSpecialName::PosTest6()
- IL_0055: brfalse.s IL_005a
-
- IL_0057: ldloc.0
- IL_0058: br.s IL_005b
-
- IL_005a: ldc.i4.0
- IL_005b: stloc.0
- IL_005c: ldarg.0
- IL_005d: call instance bool FieldInfoIsSpecialName::PosTest7()
- IL_0062: brfalse.s IL_0067
-
- IL_0064: ldloc.0
- IL_0065: br.s IL_0068
-
- IL_0067: ldc.i4.0
- IL_0068: stloc.0
- IL_0069: ldarg.0
- IL_006a: call instance bool FieldInfoIsSpecialName::PosTest8()
- IL_006f: brfalse.s IL_0074
-
- IL_0071: ldloc.0
- IL_0072: br.s IL_0075
-
- IL_0074: ldc.i4.0
- IL_0075: stloc.0
- IL_0076: ldarg.0
- IL_0077: call instance bool FieldInfoIsSpecialName::PosTest9()
- IL_007c: brfalse.s IL_0081
-
- IL_007e: ldloc.0
- IL_007f: br.s IL_0082
-
- IL_0081: ldc.i4.0
- IL_0082: stloc.0
- IL_0083: ldarg.0
- IL_0084: call instance bool FieldInfoIsSpecialName::PosTest10()
- IL_0089: brfalse.s IL_008e
-
- IL_008b: ldloc.0
- IL_008c: br.s IL_008f
-
- IL_008e: ldc.i4.0
- IL_008f: stloc.0
- IL_0090: ldarg.0
- IL_0091: call instance bool FieldInfoIsSpecialName::PosTest11()
- IL_0096: brfalse.s IL_009b
-
- IL_0098: ldloc.0
- IL_0099: br.s IL_009c
-
- IL_009b: ldc.i4.0
- IL_009c: stloc.0
- IL_009d: ldloc.0
- IL_009e: stloc.1
- IL_009f: br.s IL_00a1
-
- IL_00a1: ldloc.1
- IL_00a2: ret
- } // end of method FieldInfoIsSpecialName::RunTests
-
- .method public hidebysig instance bool
- PosTest1() cil managed
- {
- // Code size 44 (0x2c)
- .maxstack 4
- .locals init (bool V_0)
- IL_0000: nop
- IL_0001: ldarg.0
- IL_0002: ldtoken FieldInfoIsSpecialName
- IL_0007: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
- IL_000c: ldstr "Field1"
- IL_0011: ldarg.0
- IL_0012: ldfld valuetype [mscorlib]System.Reflection.BindingFlags FieldInfoIsSpecialName::AllFlags
- IL_0017: callvirt instance class [mscorlib]System.Reflection.FieldInfo [mscorlib]System.Type::GetField(string,
- valuetype [mscorlib]System.Reflection.BindingFlags)
- IL_001c: ldc.i4.0
- IL_001d: ldstr "00A"
- IL_0022: call instance bool FieldInfoIsSpecialName::PosTest(class [mscorlib]System.Reflection.FieldInfo,
- bool,
- string)
- IL_0027: stloc.0
- IL_0028: br.s IL_002a
-
- IL_002a: ldloc.0
- IL_002b: ret
- } // end of method FieldInfoIsSpecialName::PosTest1
-
- .method public hidebysig instance bool
- PosTest2() cil managed
- {
- // Code size 44 (0x2c)
- .maxstack 4
- .locals init (bool V_0)
- IL_0000: nop
- IL_0001: ldarg.0
- IL_0002: ldtoken FieldInfoIsSpecialName
- IL_0007: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
- IL_000c: ldstr "Field2"
- IL_0011: ldarg.0
- IL_0012: ldfld valuetype [mscorlib]System.Reflection.BindingFlags FieldInfoIsSpecialName::AllFlags
- IL_0017: callvirt instance class [mscorlib]System.Reflection.FieldInfo [mscorlib]System.Type::GetField(string,
- valuetype [mscorlib]System.Reflection.BindingFlags)
- IL_001c: ldc.i4.1
- IL_001d: ldstr "00B"
- IL_0022: call instance bool FieldInfoIsSpecialName::PosTest(class [mscorlib]System.Reflection.FieldInfo,
- bool,
- string)
- IL_0027: stloc.0
- IL_0028: br.s IL_002a
-
- IL_002a: ldloc.0
- IL_002b: ret
- } // end of method FieldInfoIsSpecialName::PosTest2
-
- .method public hidebysig instance bool
- PosTest3() cil managed
- {
- // Code size 44 (0x2c)
- .maxstack 4
- .locals init (bool V_0)
- IL_0000: nop
- IL_0001: ldarg.0
- IL_0002: ldtoken FieldInfoIsSpecialName
- IL_0007: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
- IL_000c: ldstr "Field3"
- IL_0011: ldarg.0
- IL_0012: ldfld valuetype [mscorlib]System.Reflection.BindingFlags FieldInfoIsSpecialName::AllFlags
- IL_0017: callvirt instance class [mscorlib]System.Reflection.FieldInfo [mscorlib]System.Type::GetField(string,
- valuetype [mscorlib]System.Reflection.BindingFlags)
- IL_001c: ldc.i4.0
- IL_001d: ldstr "00C"
- IL_0022: call instance bool FieldInfoIsSpecialName::PosTest(class [mscorlib]System.Reflection.FieldInfo,
- bool,
- string)
- IL_0027: stloc.0
- IL_0028: br.s IL_002a
-
- IL_002a: ldloc.0
- IL_002b: ret
- } // end of method FieldInfoIsSpecialName::PosTest3
-
- .method public hidebysig instance bool
- PosTest4() cil managed
- {
- // Code size 44 (0x2c)
- .maxstack 4
- .locals init (bool V_0)
- IL_0000: nop
- IL_0001: ldarg.0
- IL_0002: ldtoken FieldInfoIsSpecialName
- IL_0007: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
- IL_000c: ldstr "Field4"
- IL_0011: ldarg.0
- IL_0012: ldfld valuetype [mscorlib]System.Reflection.BindingFlags FieldInfoIsSpecialName::AllFlags
- IL_0017: callvirt instance class [mscorlib]System.Reflection.FieldInfo [mscorlib]System.Type::GetField(string,
- valuetype [mscorlib]System.Reflection.BindingFlags)
- IL_001c: ldc.i4.0
- IL_001d: ldstr "00D"
- IL_0022: call instance bool FieldInfoIsSpecialName::PosTest(class [mscorlib]System.Reflection.FieldInfo,
- bool,
- string)
- IL_0027: stloc.0
- IL_0028: br.s IL_002a
-
- IL_002a: ldloc.0
- IL_002b: ret
- } // end of method FieldInfoIsSpecialName::PosTest4
-
- .method public hidebysig instance bool
- PosTest5() cil managed
- {
- // Code size 44 (0x2c)
- .maxstack 4
- .locals init (bool V_0)
- IL_0000: nop
- IL_0001: ldarg.0
- IL_0002: ldtoken FieldInfoIsSpecialName
- IL_0007: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
- IL_000c: ldstr "Field5"
- IL_0011: ldarg.0
- IL_0012: ldfld valuetype [mscorlib]System.Reflection.BindingFlags FieldInfoIsSpecialName::AllFlags
- IL_0017: callvirt instance class [mscorlib]System.Reflection.FieldInfo [mscorlib]System.Type::GetField(string,
- valuetype [mscorlib]System.Reflection.BindingFlags)
- IL_001c: ldc.i4.0
- IL_001d: ldstr "00E"
- IL_0022: call instance bool FieldInfoIsSpecialName::PosTest(class [mscorlib]System.Reflection.FieldInfo,
- bool,
- string)
- IL_0027: stloc.0
- IL_0028: br.s IL_002a
-
- IL_002a: ldloc.0
- IL_002b: ret
- } // end of method FieldInfoIsSpecialName::PosTest5
-
- .method public hidebysig instance bool
- PosTest6() cil managed
- {
- // Code size 44 (0x2c)
- .maxstack 4
- .locals init (bool V_0)
- IL_0000: nop
- IL_0001: ldarg.0
- IL_0002: ldtoken FieldInfoIsSpecialName
- IL_0007: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
- IL_000c: ldstr "Field6"
- IL_0011: ldarg.0
- IL_0012: ldfld valuetype [mscorlib]System.Reflection.BindingFlags FieldInfoIsSpecialName::AllFlags
- IL_0017: callvirt instance class [mscorlib]System.Reflection.FieldInfo [mscorlib]System.Type::GetField(string,
- valuetype [mscorlib]System.Reflection.BindingFlags)
- IL_001c: ldc.i4.0
- IL_001d: ldstr "00F"
- IL_0022: call instance bool FieldInfoIsSpecialName::PosTest(class [mscorlib]System.Reflection.FieldInfo,
- bool,
- string)
- IL_0027: stloc.0
- IL_0028: br.s IL_002a
-
- IL_002a: ldloc.0
- IL_002b: ret
- } // end of method FieldInfoIsSpecialName::PosTest6
-
- .method public hidebysig instance bool
- PosTest7() cil managed
- {
- // Code size 44 (0x2c)
- .maxstack 4
- .locals init (bool V_0)
- IL_0000: nop
- IL_0001: ldarg.0
- IL_0002: ldtoken FieldInfoIsSpecialName
- IL_0007: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
- IL_000c: ldstr "Field7"
- IL_0011: ldarg.0
- IL_0012: ldfld valuetype [mscorlib]System.Reflection.BindingFlags FieldInfoIsSpecialName::AllFlags
- IL_0017: callvirt instance class [mscorlib]System.Reflection.FieldInfo [mscorlib]System.Type::GetField(string,
- valuetype [mscorlib]System.Reflection.BindingFlags)
- IL_001c: ldc.i4.1
- IL_001d: ldstr "00G"
- IL_0022: call instance bool FieldInfoIsSpecialName::PosTest(class [mscorlib]System.Reflection.FieldInfo,
- bool,
- string)
- IL_0027: stloc.0
- IL_0028: br.s IL_002a
-
- IL_002a: ldloc.0
- IL_002b: ret
- } // end of method FieldInfoIsSpecialName::PosTest7
-
- .method public hidebysig instance bool
- PosTest8() cil managed
- {
- // Code size 44 (0x2c)
- .maxstack 4
- .locals init (bool V_0)
- IL_0000: nop
- IL_0001: ldarg.0
- IL_0002: ldtoken FieldInfoIsSpecialName
- IL_0007: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
- IL_000c: ldstr "Field8"
- IL_0011: ldarg.0
- IL_0012: ldfld valuetype [mscorlib]System.Reflection.BindingFlags FieldInfoIsSpecialName::AllFlags
- IL_0017: callvirt instance class [mscorlib]System.Reflection.FieldInfo [mscorlib]System.Type::GetField(string,
- valuetype [mscorlib]System.Reflection.BindingFlags)
- IL_001c: ldc.i4.0
- IL_001d: ldstr "00H"
- IL_0022: call instance bool FieldInfoIsSpecialName::PosTest(class [mscorlib]System.Reflection.FieldInfo,
- bool,
- string)
- IL_0027: stloc.0
- IL_0028: br.s IL_002a
-
- IL_002a: ldloc.0
- IL_002b: ret
- } // end of method FieldInfoIsSpecialName::PosTest8
-
- .method public hidebysig instance bool
- PosTest9() cil managed
- {
- // Code size 44 (0x2c)
- .maxstack 4
- .locals init (bool V_0)
- IL_0000: nop
- IL_0001: ldarg.0
- IL_0002: ldtoken FieldInfoIsSpecialName
- IL_0007: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
- IL_000c: ldstr "Field9"
- IL_0011: ldarg.0
- IL_0012: ldfld valuetype [mscorlib]System.Reflection.BindingFlags FieldInfoIsSpecialName::AllFlags
- IL_0017: callvirt instance class [mscorlib]System.Reflection.FieldInfo [mscorlib]System.Type::GetField(string,
- valuetype [mscorlib]System.Reflection.BindingFlags)
- IL_001c: ldc.i4.0
- IL_001d: ldstr "00I"
- IL_0022: call instance bool FieldInfoIsSpecialName::PosTest(class [mscorlib]System.Reflection.FieldInfo,
- bool,
- string)
- IL_0027: stloc.0
- IL_0028: br.s IL_002a
-
- IL_002a: ldloc.0
- IL_002b: ret
- } // end of method FieldInfoIsSpecialName::PosTest9
-
- .method public hidebysig instance bool
- PosTest10() cil managed
- {
- // Code size 44 (0x2c)
- .maxstack 4
- .locals init (bool V_0)
- IL_0000: nop
- IL_0001: ldarg.0
- IL_0002: ldtoken FieldInfoIsSpecialName
- IL_0007: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
- IL_000c: ldstr "Field10"
- IL_0011: ldarg.0
- IL_0012: ldfld valuetype [mscorlib]System.Reflection.BindingFlags FieldInfoIsSpecialName::AllFlags
- IL_0017: callvirt instance class [mscorlib]System.Reflection.FieldInfo [mscorlib]System.Type::GetField(string,
- valuetype [mscorlib]System.Reflection.BindingFlags)
- IL_001c: ldc.i4.0
- IL_001d: ldstr "00J"
- IL_0022: call instance bool FieldInfoIsSpecialName::PosTest(class [mscorlib]System.Reflection.FieldInfo,
- bool,
- string)
- IL_0027: stloc.0
- IL_0028: br.s IL_002a
-
- IL_002a: ldloc.0
- IL_002b: ret
- } // end of method FieldInfoIsSpecialName::PosTest10
-
- .method public hidebysig instance bool
- PosTest11() cil managed
- {
- // Code size 44 (0x2c)
- .maxstack 4
- .locals init (bool V_0)
- IL_0000: nop
- IL_0001: ldarg.0
- IL_0002: ldtoken FieldInfoIsSpecialName
- IL_0007: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
- IL_000c: ldstr "Field11"
- IL_0011: ldarg.0
- IL_0012: ldfld valuetype [mscorlib]System.Reflection.BindingFlags FieldInfoIsSpecialName::AllFlags
- IL_0017: callvirt instance class [mscorlib]System.Reflection.FieldInfo [mscorlib]System.Type::GetField(string,
- valuetype [mscorlib]System.Reflection.BindingFlags)
- IL_001c: ldc.i4.0
- IL_001d: ldstr "00K"
- IL_0022: call instance bool FieldInfoIsSpecialName::PosTest(class [mscorlib]System.Reflection.FieldInfo,
- bool,
- string)
- IL_0027: stloc.0
- IL_0028: br.s IL_002a
-
- IL_002a: ldloc.0
- IL_002b: ret
- } // end of method FieldInfoIsSpecialName::PosTest11
-
- .method private hidebysig instance bool
- PosTest(class [mscorlib]System.Reflection.FieldInfo fi,
- bool expected,
- string id) cil managed
- {
- // Code size 192 (0xc0)
- .maxstack 4
- .locals init (bool V_0,
- bool V_1,
- class [mscorlib]System.Exception V_2,
- bool V_3,
- bool V_4,
- object[] V_5)
- IL_0000: nop
- IL_0001: ldc.i4.1
- IL_0002: stloc.0
- IL_0003: ldstr "Test "
- IL_0008: ldarg.3
- IL_0009: call string [mscorlib]System.String::Concat(string,
- string)
- IL_000e: call void [TestLibrary]TestLibrary.TestFramework::BeginScenario(string)
- IL_0013: nop
- .try
- {
- IL_0014: nop
- IL_0015: ldarg.1
- IL_0016: callvirt instance bool [mscorlib]System.Reflection.FieldInfo::get_IsSpecialName()
- IL_001b: stloc.1
- IL_001c: ldloc.1
- IL_001d: ldarg.2
- IL_001e: ceq
- IL_0020: stloc.s V_4
- IL_0022: ldloc.s V_4
- IL_0024: brtrue.s IL_0079
-
- IL_0026: nop
- IL_0027: ldstr "001"
- IL_002c: ldc.i4.6
- IL_002d: newarr [mscorlib]System.Object
- IL_0032: stloc.s V_5
- IL_0034: ldloc.s V_5
- IL_0036: ldc.i4.0
- IL_0037: ldstr "Error in "
- IL_003c: stelem.ref
- IL_003d: ldloc.s V_5
- IL_003f: ldc.i4.1
- IL_0040: ldarg.3
- IL_0041: stelem.ref
- IL_0042: ldloc.s V_5
- IL_0044: ldc.i4.2
- IL_0045: ldstr ": Value not as expected. Expected: "
- IL_004a: stelem.ref
- IL_004b: ldloc.s V_5
- IL_004d: ldc.i4.3
- IL_004e: ldarga.s expected
- IL_0050: call instance string [mscorlib]System.Boolean::ToString()
- IL_0055: stelem.ref
- IL_0056: ldloc.s V_5
- IL_0058: ldc.i4.4
- IL_0059: ldstr ", Actual: "
- IL_005e: stelem.ref
- IL_005f: ldloc.s V_5
- IL_0061: ldc.i4.5
- IL_0062: ldloc.1
- IL_0063: box [mscorlib]System.Boolean
- IL_0068: stelem.ref
- IL_0069: ldloc.s V_5
- IL_006b: call string [mscorlib]System.String::Concat(object[])
- IL_0070: call void [TestLibrary]TestLibrary.TestFramework::LogError(string,
- string)
- IL_0075: nop
- IL_0076: ldc.i4.0
- IL_0077: stloc.0
- IL_0078: nop
- IL_0079: nop
- IL_007a: leave.s IL_00b9
-
- } // end .try
- catch [mscorlib]System.Exception
- {
- IL_007c: stloc.2
- IL_007d: nop
- IL_007e: ldstr "002"
- IL_0083: ldc.i4.4
- IL_0084: newarr [mscorlib]System.Object
- IL_0089: stloc.s V_5
- IL_008b: ldloc.s V_5
- IL_008d: ldc.i4.0
- IL_008e: ldstr "Unexpected exception in "
- IL_0093: stelem.ref
- IL_0094: ldloc.s V_5
- IL_0096: ldc.i4.1
- IL_0097: ldarg.3
- IL_0098: stelem.ref
- IL_0099: ldloc.s V_5
- IL_009b: ldc.i4.2
- IL_009c: ldstr ": "
- IL_00a1: stelem.ref
- IL_00a2: ldloc.s V_5
- IL_00a4: ldc.i4.3
- IL_00a5: ldloc.2
- IL_00a6: stelem.ref
- IL_00a7: ldloc.s V_5
- IL_00a9: call string [mscorlib]System.String::Concat(object[])
- IL_00ae: call void [TestLibrary]TestLibrary.TestFramework::LogError(string,
- string)
- IL_00b3: nop
- IL_00b4: ldc.i4.0
- IL_00b5: stloc.0
- IL_00b6: nop
- IL_00b7: leave.s IL_00b9
-
- } // end handler
- IL_00b9: nop
- IL_00ba: ldloc.0
- IL_00bb: stloc.3
- IL_00bc: br.s IL_00be
-
- IL_00be: ldloc.3
- IL_00bf: ret
- } // end of method FieldInfoIsSpecialName::PosTest
-
- .method public hidebysig specialname rtspecialname
- instance void .ctor() cil managed
- {
- // Code size 16 (0x10)
- .maxstack 8
- IL_0000: ldarg.0
- IL_0001: ldc.i4.s 60
- IL_0003: stfld valuetype [mscorlib]System.Reflection.BindingFlags FieldInfoIsSpecialName::AllFlags
- IL_0008: ldarg.0
- IL_0009: call instance void [mscorlib]System.Object::.ctor()
- IL_000e: nop
- IL_000f: ret
- } // end of method FieldInfoIsSpecialName::.ctor
-
-} // end of class FieldInfoIsSpecialName
-
diff --git a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsStatic.cs b/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsStatic.cs
deleted file mode 100644
index 679aefbec4..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoIsStatic.cs
+++ /dev/null
@@ -1,101 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- public class FieldInfoIsStatic
- {
- private BindingFlags _allFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
-
-#pragma warning disable 169
-#pragma warning disable 649
- static private int s_field1;
- static public string Field2;
- static protected int Field3;
- static internal string Field4;
- static protected internal int Field5;
- private int _field6;
- public string Field7;
- protected int Field8;
- internal string Field9;
- protected internal int Field10;
- public string Field11;
-#pragma warning restore 169
-#pragma warning restore 649
-
- [Fact]
- public void PosTest1()
- {
- PosTest(typeof(FieldInfoIsStatic).GetField("s_field1", _allFlags), true, "00A");
- }
-
- [Fact]
- public void PosTest2()
- {
- PosTest(typeof(FieldInfoIsStatic).GetField("Field2", _allFlags), true, "00B");
- }
-
- [Fact]
- public void PosTest3()
- {
- PosTest(typeof(FieldInfoIsStatic).GetField("Field3", _allFlags), true, "00C");
- }
-
- [Fact]
- public void PosTest4()
- {
- PosTest(typeof(FieldInfoIsStatic).GetField("Field4", _allFlags), true, "00D");
- }
-
- [Fact]
- public void PosTest5()
- {
- PosTest(typeof(FieldInfoIsStatic).GetField("Field5", _allFlags), true, "00E");
- }
-
- [Fact]
- public void PosTest6()
- {
- PosTest(typeof(FieldInfoIsStatic).GetField("_field6", _allFlags), false, "00F");
- }
-
- [Fact]
- public void PosTest7()
- {
- PosTest(typeof(FieldInfoIsStatic).GetField("Field7", _allFlags), false, "00G");
- }
-
- [Fact]
- public void PosTest8()
- {
- PosTest(typeof(FieldInfoIsStatic).GetField("Field8", _allFlags), false, "00H");
- }
-
- [Fact]
- public void PosTest9()
- {
- PosTest(typeof(FieldInfoIsStatic).GetField("Field9", _allFlags), false, "00I");
- }
-
- [Fact]
- public void PosTest10()
- {
- PosTest(typeof(FieldInfoIsStatic).GetField("Field10", _allFlags), false, "00J");
- }
-
- [Fact]
- public void PosTest11()
- {
- PosTest(typeof(FieldInfoIsStatic).GetField("Field11", _allFlags), false, "00K");
- }
-
- private void PosTest(FieldInfo fi, bool expected, string id)
- {
- bool actual = fi.IsStatic;
- Assert.Equal(expected, actual);
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoMemberType.cs b/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoMemberType.cs
deleted file mode 100644
index 1d28c4428d..0000000000
--- a/src/System.Reflection.TypeExtensions/tests/FieldInfo/FieldInfoMemberType.cs
+++ /dev/null
@@ -1,101 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- public class FieldInfoMemberType
- {
- private BindingFlags _allFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
-
-#pragma warning disable 169
-#pragma warning disable 649
- static private int s_field1;
- static public string Field2;
- static protected int Field3;
- static internal string Field4;
- static protected internal int Field5;
- private int _field6;
- public string Field7;
- protected int Field8;
- internal string Field9;
- protected internal int Field10;
- public string Field11;
-#pragma warning restore 169
-#pragma warning restore 649
-
- [Fact]
- public void PosTest1()
- {
- PosTest(typeof(FieldInfoMemberType).GetField("s_field1", _allFlags));
- }
-
- [Fact]
- public void PosTest2()
- {
- PosTest(typeof(FieldInfoMemberType).GetField("Field2", _allFlags));
- }
-
- [Fact]
- public void PosTest3()
- {
- PosTest(typeof(FieldInfoMemberType).GetField("Field3", _allFlags));
- }
-
- [Fact]
- public void PosTest4()
- {
- PosTest(typeof(FieldInfoMemberType).GetField("Field4", _allFlags));
- }
-
- [Fact]
- public void PosTest5()
- {
- PosTest(typeof(FieldInfoMemberType).GetField("Field5", _allFlags));
- }
-
- [Fact]
- public void PosTest6()
- {
- PosTest(typeof(FieldInfoMemberType).GetField("_field6", _allFlags));
- }
-
- [Fact]
- public void PosTest7()
- {
- PosTest(typeof(FieldInfoMemberType).GetField("Field7", _allFlags));
- }
-
- [Fact]
- public void PosTest8()
- {
- PosTest(typeof(FieldInfoMemberType).GetField("Field8", _allFlags));
- }
-
- [Fact]
- public void PosTest9()
- {
- PosTest(typeof(FieldInfoMemberType).GetField("Field9", _allFlags));
- }
-
- [Fact]
- public void PosTest10()
- {
- PosTest(typeof(FieldInfoMemberType).GetField("Field10", _allFlags));
- }
-
- [Fact]
- public void PosTest11()
- {
- PosTest(typeof(FieldInfoMemberType).GetField("Field11", _allFlags));
- }
-
-
- private void PosTest(FieldInfo fi)
- {
- Assert.NotNull(fi);
- }
- }
-}
diff --git a/src/System.Reflection.TypeExtensions/tests/FieldInfoTests.cs b/src/System.Reflection.TypeExtensions/tests/FieldInfoTests.cs
new file mode 100644
index 0000000000..d9083e49f3
--- /dev/null
+++ b/src/System.Reflection.TypeExtensions/tests/FieldInfoTests.cs
@@ -0,0 +1,115 @@
+// 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.Collections.Generic;
+using Xunit;
+
+#pragma warning disable 414, 169, 649
+
+namespace System.Reflection.Tests
+{
+ public class FieldInfoTests
+ {
+ [Theory]
+ [InlineData("s_privateField", FieldAttributes.Private | FieldAttributes.Static, typeof(int))]
+ [InlineData("s_publicField", FieldAttributes.Public | FieldAttributes.Static, typeof(string))]
+ [InlineData("s_protectedField", FieldAttributes.Family | FieldAttributes.Static, typeof(BindingFlags))]
+ [InlineData("s_internalField", FieldAttributes.Assembly | FieldAttributes.Static, typeof(int?))]
+ [InlineData("s_protectedInternalField", FieldAttributes.FamORAssem | FieldAttributes.Static, typeof(int[]))]
+ [InlineData("_privateField", FieldAttributes.Private, typeof(FI_EmptyStruct))]
+ [InlineData("_publicField", FieldAttributes.Public, typeof(FI_EquatableClass))]
+ [InlineData("_protectedField", FieldAttributes.Family, typeof(FI_GenericClass<int>))]
+ [InlineData("_internalField", FieldAttributes.Assembly, typeof(FI_GenericClass<string>.NestedClass))]
+ [InlineData("_protectedInternalField", FieldAttributes.FamORAssem, typeof(FI_EmptyInterface))]
+ [InlineData("ConstField", FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.Literal | FieldAttributes.HasDefault, typeof(FI_Enum))]
+ public void Properties(string name, FieldAttributes attributes, Type fieldType)
+ {
+ FieldInfo field = Helpers.GetField(typeof(FI_BaseClass), name);
+ Assert.Equal(attributes, field.Attributes);
+
+ Assert.Equal((attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Assembly, field.IsAssembly);
+ Assert.Equal((attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Family, field.IsFamily);
+ Assert.Equal((attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamANDAssem, field.IsFamilyAndAssembly);
+ Assert.Equal((attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamORAssem, field.IsFamilyOrAssembly);
+ Assert.Equal((attributes & FieldAttributes.InitOnly) != 0, field.IsInitOnly);
+ Assert.Equal((attributes & FieldAttributes.Literal) != 0, field.IsLiteral);
+ Assert.Equal((attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Public, field.IsPublic);
+ Assert.Equal((attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Private, field.IsPrivate);
+ Assert.Equal((attributes & FieldAttributes.Static) != 0, field.IsStatic);
+
+ Assert.Equal(fieldType, field.FieldType);
+ Assert.Equal(MemberTypes.Field, field.MemberType);
+ }
+
+ public static IEnumerable<object[]> GetValue_TestData()
+ {
+ yield return new object[] { typeof(string), "Empty", "abc", "" };
+
+ yield return new object[] { typeof(FI_BaseClass), "_privateStringField", new FI_BaseClass(), "2" };
+ yield return new object[] { typeof(FI_SubClass), "_protectedIntField", new FI_SubClass(), 3 };
+ yield return new object[] { typeof(FI_BaseClass), "_privateNullableIntField", new FI_BaseClass(), null };
+ yield return new object[] { typeof(FI_BaseClass), "_publicField", new FI_BaseClass(), new FI_EquatableClass() { ID = 42 } };
+
+ yield return new object[] { typeof(FI_BaseClass), "_protectedField", new FI_BaseClass(), new FI_GenericClass<int>() { ID = 24 } };
+ yield return new object[] { typeof(FI_BaseClass), "s_privateField", null, 1 };
+ }
+
+ [Theory]
+ [MemberData(nameof(GetValue_TestData))]
+ public void GetValue(Type type, string name, object obj, object value)
+ {
+ FieldInfo field = Helpers.GetField(type, name);
+ Assert.Equal(value, field.GetValue(obj));
+ }
+
+ [Fact]
+ public void GetValue_NullTarget_ThrowsTargetException()
+ {
+ FieldInfo field = Helpers.GetField(typeof(FI_BaseClass), "_privateStringField");
+ Assert.Throws<TargetException>(() => field.GetValue(null));
+ }
+ }
+
+ public class FI_BaseClass
+ {
+ private static int s_privateField = 1;
+ public static string s_publicField;
+ protected static BindingFlags s_protectedField;
+ internal static int? s_internalField;
+ protected internal static int[] s_protectedInternalField;
+
+ private string _privateStringField = "2";
+ protected int _protectedIntField = 3;
+ private int? _privateNullableIntField;
+ private FI_EmptyStruct _privateField;
+ public FI_EquatableClass _publicField = new FI_EquatableClass() { ID = 42 };
+ protected FI_GenericClass<int> _protectedField = new FI_GenericClass<int>() { ID = 24 };
+ internal FI_GenericClass<string>.NestedClass _internalField;
+ protected internal FI_EmptyInterface _protectedInternalField;
+
+ public const FI_Enum ConstField = FI_Enum.Case1;
+ }
+
+ public class FI_SubClass : FI_BaseClass { }
+
+ public struct FI_EmptyStruct { }
+ public class FI_EquatableClass
+ {
+ public int ID { get; set; }
+ public override bool Equals(object other) => ID.Equals(((FI_EquatableClass)other).ID);
+ public override int GetHashCode() => ID;
+ }
+
+ public class FI_GenericClass<T>
+ {
+ public T ID { get; set; }
+ public override bool Equals(object other) => ID.Equals(((FI_GenericClass<T>)other).ID);
+ public override int GetHashCode() => ID.GetHashCode();
+
+ public class NestedClass { }
+ }
+
+ public interface FI_EmptyInterface { }
+ public enum FI_Enum { Case1, Case2 }
+}
diff --git a/src/System.Reflection.TypeExtensions/tests/Helpers.cs b/src/System.Reflection.TypeExtensions/tests/Helpers.cs
new file mode 100644
index 0000000000..8eb59b1799
--- /dev/null
+++ b/src/System.Reflection.TypeExtensions/tests/Helpers.cs
@@ -0,0 +1,14 @@
+// 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.
+
+namespace System.Reflection.Tests
+{
+ public class Helpers
+ {
+ private const BindingFlags AllFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance;
+
+ public static EventInfo GetEvent(Type type, string name) => type.GetEvent(name, AllFlags);
+ public static FieldInfo GetField(Type type, string name) => type.GetField(name, AllFlags);
+ }
+}
diff --git a/src/System.Reflection.TypeExtensions/tests/System.Reflection.TypeExtensions.Tests.csproj b/src/System.Reflection.TypeExtensions/tests/System.Reflection.TypeExtensions.Tests.csproj
index e89d7ec2e4..0505ec8fcb 100644
--- a/src/System.Reflection.TypeExtensions/tests/System.Reflection.TypeExtensions.Tests.csproj
+++ b/src/System.Reflection.TypeExtensions/tests/System.Reflection.TypeExtensions.Tests.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
@@ -16,38 +16,12 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
</PropertyGroup>
<ItemGroup>
- <Compile Include="Assembly\AssemblyExtensionTests.cs" />
- <Compile Include="ConstructorInfo\InvokeArrayCtors.cs" />
- <Compile Include="ConstructorInfo\ConstructorInfoInvoke1.cs" />
- <Compile Include="ConstructorInfo\ConstructorInfoInvoke2.cs" />
- <Compile Include="ConstructorInfo\ConstructorInfoMemberType.cs" />
- <Compile Include="ConstructorInfo\ConstructorInfoTypeConstructorName.cs" />
- <Compile Include="EventInfo\EventInfoAddEventHandler.cs" />
- <Compile Include="EventInfo\EventInfoAttributesProperty.cs" />
- <Compile Include="EventInfo\EventInfoEventHandlerType.cs" />
- <Compile Include="EventInfo\EventInfoGetAddMethod1.cs" />
- <Compile Include="EventInfo\EventInfoGetAddMethod2.cs" />
- <Compile Include="EventInfo\EventInfoGetRaiseMethod1.cs" />
- <Compile Include="EventInfo\EventInfoGetRaiseMethod2.cs" />
- <Compile Include="EventInfo\EventInfoGetRemoveMethod1.cs" />
- <Compile Include="EventInfo\EventInfoGetRemoveMethod2.cs" />
- <Compile Include="EventInfo\EventInfoIsSpecialName.cs" />
- <Compile Include="EventInfo\EventInfoMemberType.cs" />
- <Compile Include="EventInfo\EventInfoRemoveEventHandler.cs" />
- <Compile Include="FieldInfo\FieldInfoAttributes.cs" />
- <Compile Include="FieldInfo\FieldInfoFieldType.cs" />
- <Compile Include="FieldInfo\FieldInfoGetValue1.cs" />
- <Compile Include="FieldInfo\FieldInfoIsAssembly.cs" />
- <Compile Include="FieldInfo\FieldInfoIsFamily.cs" />
- <Compile Include="FieldInfo\FieldInfoIsFamilyAndAssembly.cs" />
- <Compile Include="FieldInfo\FieldInfoIsFamilyOrAssembly.cs" />
- <Compile Include="FieldInfo\FieldInfoIsInitOnly.cs" />
- <Compile Include="FieldInfo\FieldInfoIsLiteral.cs" />
- <Compile Include="FieldInfo\FieldInfoIsPrivate.cs" />
- <Compile Include="FieldInfo\FieldInfoIsPublic.cs" />
- <Compile Include="FieldInfo\FieldInfoIsStatic.cs" />
- <Compile Include="FieldInfo\FieldInfoMemberType.cs" />
- <Compile Include="ConstructorInfo\ConstructorInfoConstructorName.cs" />
+ <Compile Include="AssemblyExtensionTests.cs" />
+ <Compile Include="ConstructorInfo\ConstructorInfoInvokeArrayTests.cs" />
+ <Compile Include="ConstructorInfo\ConstructorInfoTests.cs" />
+ <Compile Include="Helpers.cs" />
+ <Compile Include="EventInfoTests.cs" />
+ <Compile Include="FieldInfoTests.cs" />
<Compile Include="MemberInfo\MemberInfoMemberType.cs" />
<Compile Include="MemberInfo\MemberInfoModule.cs" />
<Compile Include="MemberInfo\MemberInfoName.cs" />
diff --git a/src/System.Reflection/dir.props b/src/System.Reflection/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.Reflection/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Reflection/pkg/aot/System.Reflection.pkgproj b/src/System.Reflection/pkg/aot/System.Reflection.pkgproj
index 4b48109893..34e7e46021 100644
--- a/src/System.Reflection/pkg/aot/System.Reflection.pkgproj
+++ b/src/System.Reflection/pkg/aot/System.Reflection.pkgproj
@@ -3,7 +3,6 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.1.1</Version>
<PackageTargetRuntime>aot</PackageTargetRuntime>
<PreventImplementationReference>true</PreventImplementationReference>
</PropertyGroup>
diff --git a/src/System.Reflection/ref/4.0.0/System.Reflection.depproj b/src/System.Reflection/ref/4.0.0/System.Reflection.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Reflection/ref/4.0.0/System.Reflection.depproj
+++ b/src/System.Reflection/ref/4.0.0/System.Reflection.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Reflection/ref/4.0.10/System.Reflection.depproj b/src/System.Reflection/ref/4.0.10/System.Reflection.depproj
index 61ed42e3a5..e67a3176b2 100644
--- a/src/System.Reflection/ref/4.0.10/System.Reflection.depproj
+++ b/src/System.Reflection/ref/4.0.10/System.Reflection.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Reflection/ref/System.Reflection.csproj b/src/System.Reflection/ref/System.Reflection.csproj
index 569ccf6ef1..8321f738b5 100644
--- a/src/System.Reflection/ref/System.Reflection.csproj
+++ b/src/System.Reflection/ref/System.Reflection.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.5</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.5</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Reflection/src/System.Reflection.csproj b/src/System.Reflection/src/System.Reflection.csproj
index cf5c5be6b2..b6c717b5fe 100644
--- a/src/System.Reflection/src/System.Reflection.csproj
+++ b/src/System.Reflection/src/System.Reflection.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Reflection</AssemblyName>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.5</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.5</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Reflection/tests/Assembly/Assembly_CustomAttributeTests.cs b/src/System.Reflection/tests/Assembly/Assembly_CustomAttributeTests.cs
deleted file mode 100644
index 1e6205f7bb..0000000000
--- a/src/System.Reflection/tests/Assembly/Assembly_CustomAttributeTests.cs
+++ /dev/null
@@ -1,198 +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 Xunit;
-using System;
-using System.Text;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-[assembly: System.Reflection.CustomAttributesTests.Data.Attr(77, name = "AttrSimple")]
-[assembly: System.Reflection.CustomAttributesTests.Data.Int32Attr(77, name = "Int32AttrSimple"),
-System.Reflection.CustomAttributesTests.Data.Int64Attr((Int64)77, name = "Int64AttrSimple"),
-System.Reflection.CustomAttributesTests.Data.StringAttr("hello", name = "StringAttrSimple"),
-System.Reflection.CustomAttributesTests.Data.EnumAttr(System.Reflection.CustomAttributesTests.Data.MyColorEnum.RED, name = "EnumAttrSimple"),
-System.Reflection.CustomAttributesTests.Data.TypeAttr(typeof(Object), name = "TypeAttrSimple")]
-
-[assembly: System.Runtime.CompilerServices.CompilationRelaxationsAttribute((Int32)8)]
-[assembly: System.Diagnostics.Debuggable((System.Diagnostics.DebuggableAttribute.DebuggingModes)263)]
-[assembly: System.CLSCompliant(false)]
-
-namespace System.Reflection.Tests
-{
- public class AssemblyCustomAttributeTest
- {
- //Test for custom Attribute of type Int32AttrSimple
- [Fact]
- public void Test_Int32AttrSimple()
- {
-
- Type attrType = typeof(System.Reflection.CustomAttributesTests.Data.Int32Attr);
- string attrstr = "[System.Reflection.CustomAttributesTests.Data.Int32Attr((Int32)77, name = \"Int32AttrSimple\")]";
- VerifyCustomAttribute(attrType, attrstr);
- }
-
- //Test for custom Attribute of Type Int64Attr
- [Fact]
- public void Test_Int64Attr()
- {
- Type attrType = typeof(System.Reflection.CustomAttributesTests.Data.Int64Attr);
- string attrstr = "[System.Reflection.CustomAttributesTests.Data.Int64Attr((Int64)77, name = \"Int64AttrSimple\")]";
- VerifyCustomAttribute(attrType, attrstr);
-
- }
-
- //Test for custom Attribute of TypeStringAttr
- [Fact]
- public void Test_StringAttr()
- {
-
- Type attrType = typeof(System.Reflection.CustomAttributesTests.Data.StringAttr);
- string attrstr = "[System.Reflection.CustomAttributesTests.Data.StringAttr(\"hello\", name = \"StringAttrSimple\")]";
- VerifyCustomAttribute(attrType, attrstr);
- }
-
- //Test for custom Attribute of type EnumAttr
- [Fact]
- public void Test_EnumAttr()
- {
-
- Type attrType = typeof(System.Reflection.CustomAttributesTests.Data.EnumAttr);
- string attrstr = "[System.Reflection.CustomAttributesTests.Data.EnumAttr((System.Reflection.CustomAttributesTests.Data.MyColorEnum)1, name = \"EnumAttrSimple\")]";
- VerifyCustomAttribute(attrType, attrstr);
- }
-
- //Test for custom Attribute of type TypeAttr
- [Fact]
- public void Test_TypeAttr()
- {
-
- Type attrType = typeof(System.Reflection.CustomAttributesTests.Data.TypeAttr);
- string attrstr = "[System.Reflection.CustomAttributesTests.Data.TypeAttr(typeof(System.Object), name = \"TypeAttrSimple\")]";
- VerifyCustomAttribute(attrType, attrstr);
- }
-
- //Test for custom Attribute of Type CompilationRelaxationsAttribute
- [Fact]
- public void Test_CompilationRelaxationsAttr()
- {
- Type attrType = typeof(System.Runtime.CompilerServices.CompilationRelaxationsAttribute);
- string attrstr = "[System.Runtime.CompilerServices.CompilationRelaxationsAttribute((Int32)8)]";
- VerifyCustomAttribute(attrType, attrstr);
- }
-
- //Test for custom Attribute of Type AssemblyTitleAttribute
- [Fact]
- public void Test_AssemblyIdentityAttr()
- {
-
- Type attrType = typeof(System.Reflection.AssemblyTitleAttribute);
- string attrstr = "[System.Reflection.AssemblyTitleAttribute(\"System.Reflection.Tests\")]";
- VerifyCustomAttribute(attrType, attrstr);
- }
-
- //Test for custom Attribute of Type AssemblyDescriptionAttribute
- [Fact]
- public void Test_AssemblyDescriptionAttribute()
- {
-
- Type attrType = typeof(System.Reflection.AssemblyDescriptionAttribute);
- string attrstr = "[System.Reflection.AssemblyDescriptionAttribute(\"System.Reflection.Tests\")]";
- VerifyCustomAttribute(attrType, attrstr);
- }
-
- //Test for custom Attribute of Type AssemblyCompanyAttribute
- [Fact]
- public void Test_AssemblyCompanyAttribute()
- {
-
- Type attrType = typeof(System.Reflection.AssemblyCompanyAttribute);
- string attrstr = "[System.Reflection.AssemblyCompanyAttribute(\"Microsoft Corporation\")]";
- VerifyCustomAttribute(attrType, attrstr);
- }
-
- //Test for custom Attribute of Type CLSCompliantAttribute
- [Fact]
- public void Test_CLSCompliantAttribute()
- {
-
- Type attrType = typeof(System.CLSCompliantAttribute);
- string attrstr = "[System.CLSCompliantAttribute((Boolean)True)]";
- VerifyCustomAttribute(attrType, attrstr);
- }
-
- //Test for custom Attribute of Type DebuggableAttribute
- [Fact]
- public void Test_DebuggableAttribute()
- {
-
- Type attrType = typeof(System.Diagnostics.DebuggableAttribute);
- string attrstr = "[System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute+DebuggingModes)263)]";
- VerifyCustomAttribute(attrType, attrstr);
- }
-
- //Test for custom Attribute of type Attribute
- [Fact]
- public void Test_SimpleAttribute()
- {
-
- Type attrType = typeof(System.Reflection.CustomAttributesTests.Data.Attr);
- string attrstr = "[System.Reflection.CustomAttributesTests.Data.Attr((Int32)77, name = \"AttrSimple\")]";
- VerifyCustomAttribute(attrType, attrstr);
- }
-
- private static void VerifyCustomAttribute(Type type, String attributeStr)
- {
- Assembly asm = GetExecutingAssembly();
- IEnumerator<CustomAttributeData> customAttrs = asm.CustomAttributes.GetEnumerator();
- CustomAttributeData current = null;
-
- bool result = false;
- while (customAttrs.MoveNext())
- {
- current = customAttrs.Current;
- if (current.AttributeType.Equals(type))
- {
- result = true;
- break;
- }
- }
-
- Assert.True(result, string.Format("Did not find custom attribute of type {0} ", type));
-
- result = false;
- // Also double check that we can get these values via ICustomAttributeProvider
- ICustomAttributeProvider prov = asm as ICustomAttributeProvider;
- Assert.NotNull(prov.GetCustomAttributes(type, false));
- Assert.Equal(1, prov.GetCustomAttributes(type, false).Length);
- Assert.True(prov.IsDefined(type, false));
-
- // Check that there exists a custom attribute with the same type.
- object[] atrs = prov.GetCustomAttributes(false);
- for (int i = 0; i < atrs.Length; i++)
- {
- if (atrs[i].GetType().Equals(type))
- {
- result = true;
- break;
- }
- }
-
- Assert.True(result, string.Format("Did not find custom attribute of type {0} ", type));
- }
-
- public static Assembly GetExecutingAssembly()
- {
- Assembly asm = null;
- Type t = typeof(AssemblyCustomAttributeTest);
- TypeInfo ti = t.GetTypeInfo();
- asm = ti.Assembly;
-
- return asm;
- }
- }
-}
-
diff --git a/src/System.Reflection/tests/Assembly/Assembly_DefinedTypeTests.cs b/src/System.Reflection/tests/Assembly/Assembly_DefinedTypeTests.cs
deleted file mode 100644
index 5b808e6ebc..0000000000
--- a/src/System.Reflection/tests/Assembly/Assembly_DefinedTypeTests.cs
+++ /dev/null
@@ -1,440 +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 Xunit;
-using System;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Reflection.DefinedTypeTests.Data;
-
-// Need to disable warning related to CLS Compliance as using Array as custom attribute is not CLS compliant
-#pragma warning disable 3016
-
-[assembly:
-Attr(77, name = "AttrSimple"),
-Int32Attr(77, name = "Int32AttrSimple"),
-Int64Attr((Int64)77, name = "Int64AttrSimple"),
-StringAttr("hello", name = "StringAttrSimple"),
-EnumAttr(MyColorEnum.RED, name = "EnumAttrSimple"),
-TypeAttr(typeof(Object), name = "TypeAttrSimple")
-]
-
-namespace System.Reflection.DefinedTypeTests.Data
-{
- public enum MyColorEnum
- {
- RED = 1,
- BLUE = 2,
- GREEN = 3
- }
-
- public class Util
- {
- public static string ObjectToString(Object o)
- {
- string s = string.Empty;
- if (o != null)
- {
- if (o is Array)
- {
- Array a = (Array)o;
- for (int i = 0; i < a.Length; i += 1)
- {
- if (i > 0)
- {
- s = s + ", ";
- }
-
- if (a.GetValue(i) is Array)
- s = s + Util.ObjectToString((Array)a.GetValue(i));
- else
- s = s + a.GetValue(i).ToString();
- }
- }
- else
- s = s + o.ToString();
- }
- return s;
- }
- }
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- public class Attr : Attribute
- {
- public Attr(int i)
- {
- value = i;
- sValue = null;
- }
-
- public Attr(int i, string s)
- {
- value = i;
- sValue = s;
- }
-
- public override string ToString()
- {
- return "Attr ToString : " + value.ToString() + " " + sValue;
- }
-
- public string name;
- public int value;
- public string sValue;
- }
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- public class Int32Attr : Attribute
- {
- public Int32Attr(int i)
- {
- value = i;
- arrayValue = null;
- }
-
- public Int32Attr(int i, int[] a)
- {
- value = i;
- arrayValue = a;
- }
-
- public string name;
- public readonly int value;
- public int field;
- public readonly int[] arrayValue;
- public int[] arrayField;
- private int _property = 0;
- public int property { get { return _property; } set { _property = value; } }
- private int[] _arrayProperty;
- public int[] arrayProperty { get { return _arrayProperty; } set { _arrayProperty = value; } }
-
- public override string ToString()
- {
- return GetType().ToString() + " - name : " + name
- + "; value : " + Util.ObjectToString(value)
- + "; field : " + Util.ObjectToString(field)
- + "; property : " + Util.ObjectToString(property)
- + "; array value : " + Util.ObjectToString(arrayValue)
- + "; array field : " + Util.ObjectToString(arrayField)
- + "; array property : " + Util.ObjectToString(arrayProperty);
- }
- }
-
-
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- public class Int64Attr : Attribute
- {
- public Int64Attr(long l)
- {
- value = l;
- arrayValue = null;
- }
-
- public Int64Attr(long l, long[] a)
- {
- value = l;
- arrayValue = a;
- }
-
- public string name;
- public readonly long value;
- public long field;
- public readonly long[] arrayValue;
- public long[] arrayField;
- private long _property = 0;
- public long property { get { return _property; } set { _property = value; } }
- private long[] _arrayProperty;
- public long[] arrayProperty { get { return _arrayProperty; } set { _arrayProperty = value; } }
-
- public override string ToString()
- {
- return GetType().ToString() + " - name : " + name
- + "; value : " + Util.ObjectToString(value)
- + "; field : " + Util.ObjectToString(field)
- + "; property : " + Util.ObjectToString(property)
- + "; array value : " + Util.ObjectToString(arrayValue)
- + "; array field : " + Util.ObjectToString(arrayField)
- + "; array property : " + Util.ObjectToString(arrayProperty);
- }
- }
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- public class EnumAttr : Attribute
- {
- public EnumAttr(MyColorEnum e)
- {
- value = e;
- arrayValue = null;
- }
-
- public EnumAttr(MyColorEnum e, MyColorEnum[] a)
- {
- value = e;
- arrayValue = a;
- }
-
- public string name;
- public readonly MyColorEnum value;
- public MyColorEnum field;
- public readonly MyColorEnum[] arrayValue;
- public MyColorEnum[] arrayField;
- private MyColorEnum _property = 0;
- public MyColorEnum property { get { return _property; } set { _property = value; } }
- private MyColorEnum[] _arrayProperty;
- public MyColorEnum[] arrayProperty { get { return _arrayProperty; } set { _arrayProperty = value; } }
-
- public override string ToString()
- {
- return GetType().ToString() + " - name : " + name
- + "; value : " + Util.ObjectToString(value)
- + "; field : " + Util.ObjectToString(field)
- + "; property : " + Util.ObjectToString(property)
- + "; array value : " + Util.ObjectToString(arrayValue)
- + "; array field : " + Util.ObjectToString(arrayField)
- + "; array property : " + Util.ObjectToString(arrayProperty);
- }
- }
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- public class StringAttr : Attribute
- {
- public StringAttr(string s)
- {
- value = s;
- arrayValue = null;
- }
-
- public StringAttr(string s, string[] a)
- {
- value = s;
- arrayValue = a;
- }
-
- public string name;
- public readonly string value;
- public string field;
- public readonly string[] arrayValue;
- public string[] arrayField;
- private string _property;
- public string property { get { return _property; } set { _property = value; } }
- private string[] _arrayProperty;
- public string[] arrayProperty { get { return _arrayProperty; } set { _arrayProperty = value; } }
-
- public override string ToString()
- {
- return GetType().ToString() + " - name : " + name
- + "; value : " + Util.ObjectToString(value)
- + "; field : " + Util.ObjectToString(field)
- + "; property : " + Util.ObjectToString(property)
- + "; array value : " + Util.ObjectToString(arrayValue)
- + "; array field : " + Util.ObjectToString(arrayField)
- + "; array property : " + Util.ObjectToString(arrayProperty);
- }
- }
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- public class TypeAttr : Attribute
- {
- public TypeAttr(Type t)
- {
- value = t;
- arrayValue = null;
- }
-
- public TypeAttr(Type t, Type[] a)
- {
- value = t;
- arrayValue = a;
- }
-
-
- public string name;
- public readonly Type value;
- public Type field;
- public readonly Type[] arrayValue;
- public Type[] arrayField;
- private Type _property;
- public Type property { get { return _property; } set { _property = value; } }
- private Type[] _arrayProperty;
- public Type[] arrayProperty { get { return _arrayProperty; } set { _arrayProperty = value; } }
-
- public override string ToString()
- {
- return GetType().ToString() + " - name : " + name
- + "; value : " + Util.ObjectToString(value)
- + "; field : " + Util.ObjectToString(field)
- + "; property : " + Util.ObjectToString(property)
- + "; array value : " + Util.ObjectToString(arrayValue)
- + "; array field : " + Util.ObjectToString(arrayField)
- + "; array property : " + Util.ObjectToString(arrayProperty);
- }
- }
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- public class ObjectAttr : Attribute
- {
- public ObjectAttr(Object v)
- {
- value = v;
- arrayValue = null;
- }
-
- public ObjectAttr(Object v, Object[] a)
- {
- value = v;
- arrayValue = a;
- }
-
- public string name;
- public readonly Object value;
- public Object field;
- public readonly Object[] arrayValue;
- public Object[] arrayField;
- private Object _property = 0;
- public Object property { get { return _property; } set { _property = value; } }
- private Object[] _arrayProperty;
- public Object[] arrayProperty { get { return _arrayProperty; } set { _arrayProperty = value; } }
-
- public override string ToString()
- {
- return GetType().ToString() + " - name : " + name
- + "; value : " + Util.ObjectToString(value)
- + "; field : " + Util.ObjectToString(field)
- + "; property : " + Util.ObjectToString(property)
- + "; array value : " + Util.ObjectToString(arrayValue)
- + "; array field : " + Util.ObjectToString(arrayField)
- + "; array property : " + Util.ObjectToString(arrayProperty);
- }
- }
-
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- public class NullAttr : Attribute
- {
- public NullAttr(string s, Type t, int[] a)
- {
- }
-
- public NullAttr(String s)
- {
- }
-
- public string name;
-
- public string stringField;
- public Type typeField;
- public int[] arrayField;
- public string stringProperty { get { return null; } set { } }
- public Type typeProperty { get { return null; } set { } }
- public int[] arrayProperty { get { return null; } set { } }
- }
-}
-
-namespace System.Reflection.Tests
-{
- public class DefinedTypeTests
- {
- //Negative Test for Attribute of type System.Int32
- [Fact]
- public void Test_DefinedTypeInt32()
- {
- Assert.False(IsTypeDefined(typeof(System.Int32)));
- }
-
- //Negative Test for Attribute of type ObsoleteAttribute
- [Fact]
- public void Test_DefinedTypeObsAttr()
- {
- Assert.False(IsTypeDefined(typeof(ObsoleteAttribute)));
- }
-
- //Test for Attribute of type System.Reflection.DefinedTypeTests.Data.Attr
- [Fact]
- public void Test_DefinedTypeAttr()
- {
- Assert.True(IsTypeDefined(typeof(System.Reflection.DefinedTypeTests.Data.Attr)));
- }
-
- //Test for Attribute of type System.Reflection.DefinedTypeTests.Data.Int32Attr
- [Fact]
- public void Test_DefinedTypeInt32Attr()
- {
- Assert.True(IsTypeDefined(typeof(System.Reflection.DefinedTypeTests.Data.Int32Attr)));
- }
-
- //Test for Attribute of type System.Reflection.DefinedTypeTests.Data.Int64Attr
- [Fact]
- public void Test_DefinedTypeInt64Attr()
- {
- Assert.True(IsTypeDefined(typeof(System.Reflection.DefinedTypeTests.Data.Int64Attr)));
- }
-
- //Test for Attribute of type System.Reflection.DefinedTypeTests.Data.StringAttr
- [Fact]
- public void Test_DefinedTypeStringAttr()
- {
- Assert.True(IsTypeDefined(typeof(System.Reflection.DefinedTypeTests.Data.StringAttr)));
- }
-
- //Test for Attribute of type System.Reflection.DefinedTypeTests.Data.EnumAttr
- [Fact]
- public void Test_DefinedTypeEnumAttr()
- {
- Assert.True(IsTypeDefined(typeof(System.Reflection.DefinedTypeTests.Data.EnumAttr)));
- }
-
- //Test for Attribute of type System.Reflection.DefinedTypeTests.Data.TypeAttr
- [Fact]
- public void Test_DefinedType_TypeAttr()
- {
- Assert.True(IsTypeDefined(typeof(System.Reflection.DefinedTypeTests.Data.TypeAttr)));
- }
-
- //Test for Attribute of type System.Reflection.DefinedTypeTests.Data.ObjectAttr
- [Fact]
- public void Test_DefinedTypeObjectAttr()
- {
- Assert.True(IsTypeDefined(typeof(System.Reflection.DefinedTypeTests.Data.ObjectAttr)));
- }
-
- //Test for Attribute of type System.Reflection.DefinedTypeTests.Data.NullAttr
- [Fact]
- public void Test_DefinedTypeNullAttr()
- {
- Assert.True(IsTypeDefined(typeof(System.Reflection.DefinedTypeTests.Data.NullAttr)));
- }
-
- private static bool IsTypeDefined(Type type)
- {
- bool typeDefined = false;
- Assembly asm = GetExecutingAssembly();
- IEnumerator<TypeInfo> alldefinedTypes = asm.DefinedTypes.GetEnumerator();
- TypeInfo ti = null;
- while (alldefinedTypes.MoveNext())
- {
- ti = alldefinedTypes.Current;
- if (ti.AsType().Equals(type))
- {
- //found type
- typeDefined = true;
- break;
- }
- }
-
- return typeDefined;
- }
-
- private static Assembly GetExecutingAssembly()
- {
- Assembly asm = null;
- Type t = typeof(DefinedTypeTests);
- TypeInfo ti = t.GetTypeInfo();
- asm = ti.Assembly;
- return asm;
- }
- }
-}
diff --git a/src/System.Reflection/tests/Assembly/Assembly_EmbeddedFiles.cs b/src/System.Reflection/tests/Assembly/Assembly_EmbeddedFiles.cs
deleted file mode 100644
index 09b8a88995..0000000000
--- a/src/System.Reflection/tests/Assembly/Assembly_EmbeddedFiles.cs
+++ /dev/null
@@ -1,31 +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.IO;
-using System.Reflection;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Globalization;
-using Xunit;
-
-namespace System.Reflection.Tests
-{
- public class EmbeddedFilesTest
- {
- [Fact]
- public void TestEmbeddedFiles()
- {
- var resources = typeof(EmbeddedFilesTest).GetTypeInfo().Assembly.GetManifestResourceNames();
-
- Assert.Contains("EmbeddedImage.png", resources);
-
- Stream s = typeof(EmbeddedFilesTest).GetTypeInfo().Assembly.GetManifestResourceStream("EmbeddedImage.png");
- Assert.NotNull(s);
-
- s = typeof(EmbeddedFilesTest).GetTypeInfo().Assembly.GetManifestResourceStream("NotExistFile");
- Assert.Null(s);
- }
- }
-}
diff --git a/src/System.Reflection/tests/Assembly/Assembly_EntryPointTests.cs b/src/System.Reflection/tests/Assembly/Assembly_EntryPointTests.cs
deleted file mode 100644
index b438cd6960..0000000000
--- a/src/System.Reflection/tests/Assembly/Assembly_EntryPointTests.cs
+++ /dev/null
@@ -1,23 +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.IO;
-using System.Reflection;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Globalization;
-using Xunit;
-
-namespace System.Reflection.Tests
-{
- public class EntryPointTests
- {
- [Fact]
- public void CurrentAssemblyDoesNotHaveAnEntryPoint()
- {
- Assert.Null(typeof(EntryPointTests).GetTypeInfo().Assembly.EntryPoint);
- }
- }
-}
diff --git a/src/System.Reflection/tests/Assembly/Assembly_EqualsTests.cs b/src/System.Reflection/tests/Assembly/Assembly_EqualsTests.cs
deleted file mode 100644
index 67ff47e675..0000000000
--- a/src/System.Reflection/tests/Assembly/Assembly_EqualsTests.cs
+++ /dev/null
@@ -1,44 +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 Xunit;
-using System;
-using System.Reflection;
-using System.Collections.Generic;
-
-namespace System.Reflection.Tests
-{
- public class EqualsTests
- {
- [Fact]
- //Try to Load System.Runtime and Verify Equals Method returns True
- public void EqualsTest1()
- {
- var assembly1 = Assembly.Load(new AssemblyName(typeof(int).GetTypeInfo().Assembly.FullName));
- var assembly2 = Assembly.Load(new AssemblyName(typeof(int).GetTypeInfo().Assembly.FullName));
-
- Assert.Equal(assembly1, assembly2);
- }
-
- [Fact]
- //Try to Load assembly other than System.Runtime and Verify Equals Method returns True
- public void EqualsTest2()
- {
- var assembly1 = Assembly.Load(new AssemblyName(typeof(List<int>).GetTypeInfo().Assembly.FullName));
- var assembly2 = Assembly.Load(new AssemblyName(typeof(List<int>).GetTypeInfo().Assembly.FullName));
-
- Assert.Equal(assembly1, assembly2);
- }
-
- [Fact]
- //Try to Load System.Runtime and currently Executing Assembly and Verify that Equals method returns False
- public void EqualsTest3()
- {
- var assembly1 = Assembly.Load(new AssemblyName(typeof(List<int>).GetTypeInfo().Assembly.FullName));
- var assembly2 = typeof(EqualsTests).GetTypeInfo().Assembly;
-
- Assert.NotEqual(assembly1, assembly2);
- }
- }
-}
diff --git a/src/System.Reflection/tests/Assembly/Assembly_ExportedTypesTests.cs b/src/System.Reflection/tests/Assembly/Assembly_ExportedTypesTests.cs
deleted file mode 100644
index e4f69be3ad..0000000000
--- a/src/System.Reflection/tests/Assembly/Assembly_ExportedTypesTests.cs
+++ /dev/null
@@ -1,183 +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 Xunit;
-using System;
-using System.Text;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using System.Reflection.ExportedTypesTests.Data;
-
-namespace System.Reflection.Tests
-{
- public class ExportedTypesTests
- {
- [Fact]
- //Verify public class is exported in Currently Executing Assembly
- public void ExportedTypesTest1()
- {
- Assembly asm = GetExecutingAssembly();
- Type etype = typeof(AssemblyExportedTypesPublicClass);
- Assert.True(IsTypeExported(asm, etype));
- }
-
- [Fact]
- //Verify public class containing main Method is exported in Currently Executing Assembly
- public void ExportedTypesTest2()
- {
- Assembly asm = GetExecutingAssembly();
- Type etype = typeof(ExportedTypesTests);
- Assert.True(IsTypeExported(asm, etype));
- }
-
- [Fact]
- //Verify public Nested class is exported
- public void ExportedTypesTest3()
- {
- Assembly asm = GetExecutingAssembly();
- Type etype = typeof(AssemblyExportedTypesPublicClass.PublicNestedClass);
- Assert.True(IsTypeExported(asm, etype));
- }
-
- [Fact]
- //Verify public Enum is exported
- public void ExportedTypesTest4()
- {
- Assembly asm = GetExecutingAssembly();
- Type etype = typeof(PublicEnum);
- Assert.True(IsTypeExported(asm, etype));
- }
-
- [Fact]
- //Verify Public Struct is exported
- public void ExportedTypesTest5()
- {
- Assembly asm = GetExecutingAssembly();
- Type etype = typeof(PublicStruct);
- Assert.True(IsTypeExported(asm, etype));
- }
-
- [Fact]
- //Verify Non public class is not exported
- public void ExportedTypesTest6()
- {
- Assembly asm = GetExecutingAssembly();
- Type etype = typeof(NonPublicClass);
- Assert.False(IsTypeExported(asm, etype));
- }
-
- [Fact]
- //Verify Internal class is not exported
- public void ExportedTypesTest7()
- {
- Assembly asm = GetExecutingAssembly();
- Type etype = typeof(FriendClass);
- Assert.False(IsTypeExported(asm, etype));
- }
-
- [Fact]
- //Verify Generic Public class is exported
- public void ExportedTypesTest8()
- {
- Assembly asm = GetExecutingAssembly();
- Type etype = typeof(GenericPublicClass<>);
- Assert.True(IsTypeExported(asm, etype));
- }
-
- private static Assembly GetExecutingAssembly()
- {
- Assembly asm = null;
-
- //currently Executing Assembly
- Type t = typeof(ExportedTypesTests);
- TypeInfo ti = t.GetTypeInfo();
- asm = ti.Assembly;
- return asm;
- }
-
- private static bool IsTypeExported(Assembly asm, Type type)
- {
- bool typeExported = false;
- IEnumerator<Type> allExportedTypes = asm.ExportedTypes.GetEnumerator();
- Type t = null;
- while (allExportedTypes.MoveNext())
- {
- t = allExportedTypes.Current;
- //
- if (t.Equals(type))
- {
- //found type
- typeExported = true;
- break;
- }
- }
-
- return typeExported;
- }
- }
-}
-
-namespace System.Reflection.ExportedTypesTests.Data
-{
- // Metadata for Reflection
- public class AssemblyExportedTypesPublicClass
- {
- public int[] intArray;
-
- public class PublicNestedClass { }
-
- protected class ProtectedNestedClass { }
-
- internal class FriendNestedClass { }
-
- private class PrivateNestedClass { }
- }
-
-
- public class GenericPublicClass<T>
- {
- public T[] array;
-
- public class PublicNestedClass { }
-
- protected class ProtectedNestedClass { }
-
- internal class FriendNestedClass { }
-
- private class PrivateNestedClass { }
- }
-
-
- internal class NonPublicClass
- {
- public class PublicNestedClass { }
-
- protected class ProtectedNestedClass { }
-
- internal class FriendNestedClass { }
-
- private class PrivateNestedClass { }
- }
-
- internal class FriendClass
- {
- public class PublicNestedClass { }
-
- protected class ProtectedNestedClass { }
-
- internal class FriendNestedClass { }
-
- private class PrivateNestedClass { }
- }
-
- public enum PublicEnum
- {
- RED = 1,
- BLUE = 2,
- GREEN = 3
- }
-
- public struct PublicStruct { }
-}
diff --git a/src/System.Reflection/tests/Assembly/Assembly_GetEntryAssembly.cs b/src/System.Reflection/tests/Assembly/Assembly_GetEntryAssembly.cs
deleted file mode 100644
index c1f25c8ed0..0000000000
--- a/src/System.Reflection/tests/Assembly/Assembly_GetEntryAssembly.cs
+++ /dev/null
@@ -1,21 +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 Xunit;
-using System;
-using System.Reflection;
-
-namespace System.Reflection.Tests
-{
- public class AssemblyGetEntryAssemblyTest
- {
- [Fact]
- public void Test_GetEntryAssembly()
- {
- Assert.NotNull(Assembly.GetEntryAssembly());
- Assert.True(Assembly.GetEntryAssembly().ToString().StartsWith("xunit.console.netcore", StringComparison.OrdinalIgnoreCase));
- }
- }
-}
-
diff --git a/src/System.Reflection/tests/Assembly/Assembly_GetHashcodeTests.cs b/src/System.Reflection/tests/Assembly/Assembly_GetHashcodeTests.cs
deleted file mode 100644
index eef81e72fe..0000000000
--- a/src/System.Reflection/tests/Assembly/Assembly_GetHashcodeTests.cs
+++ /dev/null
@@ -1,86 +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 Xunit;
-using System;
-using System.Text;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-namespace System.Reflection.Tests
-{
- public class HashCodeTests
- {
- [Fact]
- //Try to Load System.Runtime and Verify Assembly.GetHashCode method returns valid HashCode
- public void GetHashCodeTest1()
- {
- Assembly asm = LoadSystemRuntimeAssembly();
- int hashCode = asm.GetHashCode();
- Assert.False((hashCode == -1) || (hashCode == 0));
- }
-
- [Fact]
- //Try to Load FW assembly Verify HashCode
- public void GetHashCodeTest2()
- {
- Assembly asm = LoadSystemCollectionsAssembly();
- int hashCode = asm.GetHashCode();
-
- Assert.False((hashCode == -1) || (hashCode == 0));
- }
-
- [Fact]
- //Try to Load FW assembly and Verify HashCode
- public void GetHashCodeTest3()
- {
- Assembly asm = LoadSystemReflectionAssembly();
- int hashCode = asm.GetHashCode();
- Assert.False((hashCode == -1) || (hashCode == 0));
- }
-
- [Fact]
- //Verify currently executing Assembly has HashCode
- public void GetHashCodeTest4()
- {
- Type t = typeof(HashCodeTests);
- TypeInfo ti = t.GetTypeInfo();
- Assembly asm = ti.Assembly;
- int hashCode = asm.GetHashCode();
- Assert.False((hashCode == -1) || (hashCode == 0));
- }
-
- private static Assembly LoadSystemCollectionsAssembly()
- {
- //Force System.collections to be linked statically
- List<int> li = new List<int>();
- li.Add(1);
-
- //Load System.Collections
- Assembly a = Assembly.Load(new AssemblyName(typeof(List<int>).GetTypeInfo().Assembly.FullName));
- return a;
- }
-
- private static Assembly LoadSystemReflectionAssembly()
- {
- //Force System.Reflection to be linked statically
- AssemblyName name = new AssemblyName("Foo");
-
- //Load System.Reflection
- Assembly a = Assembly.Load(new AssemblyName(typeof(AssemblyName).GetTypeInfo().Assembly.FullName));
- return a;
- }
-
- private static Assembly LoadSystemRuntimeAssembly()
- {
- //Load System.Runtime
- Assembly a = Assembly.Load(new AssemblyName(typeof(int).GetTypeInfo().Assembly.FullName));
- return a;
- }
- }
-}
-
-
diff --git a/src/System.Reflection/tests/Assembly/Assembly_GetTypeTests.cs b/src/System.Reflection/tests/Assembly/Assembly_GetTypeTests.cs
deleted file mode 100644
index 4998b7f62f..0000000000
--- a/src/System.Reflection/tests/Assembly/Assembly_GetTypeTests.cs
+++ /dev/null
@@ -1,156 +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 Xunit;
-using System;
-using System.Reflection;
-using System.Text;
-
-namespace System.Reflection.Tests
-{
- public class GetTypeTests
- {
- //Try to Load a type from currently executing Assembly and return True or false depending on whether type is loaded or not
- private static bool LoadType(string ptype)
- {
- Assembly asm = GetExecutingAssembly();
- Type type = null;
-
- type = asm.GetType(ptype);
-
- if (type == null)
- {
- return false;
- }
- else if (!type.FullName.Equals(ptype))
- {
- return false;
- }
-
- return true;
- }
-
- //Load Type PublicClass from itself
- [Fact]
- public void GetTypeTest1()
- {
- string type = "System.Reflection.GetTypesTests.Data.PublicClass";
- //Try to Load Type
- Assert.True(LoadType(type));
- }
-
- //Load Type NonPublicClass from itself
- [Fact]
- public void GetTypeTest2()
- {
- string type = "System.Reflection.GetTypesTests.Data.NonPublicClass";
- //Try to Load Type
- Assert.True(LoadType(type));
- }
-
- //Load Type FriendClass from itself
- [Fact]
- public void GetTypeTest3()
- {
- string type = "System.Reflection.GetTypesTests.Data.FriendClass";
- //Try to Load Type
- Assert.True(LoadType(type));
- }
-
- //Load Type PublicEnum from itself
- [Fact]
- public void GetTypeTest4()
- {
- string type = "System.Reflection.GetTypesTests.Data.PublicEnum";
- //Try to Load Type
- Assert.True(LoadType(type));
- }
-
- //Load Type PublicStruct from itself
- [Fact]
- public void GetTypeTest5()
- {
- string type = "System.Reflection.GetTypesTests.Data.PublicStruct";
- //Try to Load Type
- Assert.True(LoadType(type));
- }
-
- private static Assembly GetExecutingAssembly()
- {
- Assembly currentasm = null;
-
- Type t = typeof(GetTypeTests);
- TypeInfo ti = t.GetTypeInfo();
- currentasm = ti.Assembly;
- return currentasm;
- }
- }
-}
-
-namespace System.Reflection.GetTypesTests.Data
-{
- // Metadata for Reflection
- public class PublicClass
- {
- public int[] intArray;
-
- public class PublicNestedClass { }
-
- protected class ProtectedNestedClass { }
-
- internal class FriendNestedClass { }
-
- private class PrivateNestedClass { }
- }
-
-
- public class GenericPublicClass<T>
- {
- public T[] array;
-
- public class PublicNestedClass { }
-
- protected class ProtectedNestedClass { }
-
- internal class FriendNestedClass { }
-
- private class PrivateNestedClass { }
- }
-
- //include metadata for non public class
- internal class NonPublicClass
- {
- public class PublicNestedClass { }
-
- protected class ProtectedNestedClass { }
-
- internal class FriendNestedClass { }
-
- private class PrivateNestedClass { }
- }
-
- //include metadata for non public class
- internal class FriendClass
- {
- public class PublicNestedClass { }
-
- protected class ProtectedNestedClass { }
-
- internal class FriendNestedClass { }
-
- private class PrivateNestedClass { }
- }
-
- public enum PublicEnum
- {
- RED = 1,
- BLUE = 2,
- GREEN = 3
- }
-
-
- public struct PublicStruct { }
-}
-
-
diff --git a/src/System.Reflection/tests/Assembly/Assembly_IsDynamicTests.cs b/src/System.Reflection/tests/Assembly/Assembly_IsDynamicTests.cs
deleted file mode 100644
index 614e981aac..0000000000
--- a/src/System.Reflection/tests/Assembly/Assembly_IsDynamicTests.cs
+++ /dev/null
@@ -1,57 +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 Xunit;
-using System;
-using System.Text;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-namespace System.Reflection.Tests
-{
- public class IsDynamicTests
- {
- [Fact]
- //Try to Load itself and Verify IsDynamic Property
- public void IsDynamicTest1()
- {
- Assembly asm = GetExecutingAssembly();
- Assert.False(asm.IsDynamic);
- }
-
- [Fact]
- //Try to Load assembly other than System.Runtime that is not already loaded and check IsDynamic property
- public void IsDynamicTest2()
- {
- Assembly asm = LoadSystemCollectionsAssembly();
- Assert.False(asm.IsDynamic);
- }
-
- private static Assembly LoadSystemCollectionsAssembly()
- {
- //Force System.collections to be linked statically
- List<int> li = new List<int>();
- li.Add(1);
-
- //Load System.Collections
- Assembly a = Assembly.Load(new AssemblyName("System.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"));
- return a;
- }
-
- private static Assembly GetExecutingAssembly()
- {
- Assembly currentasm = null;
-
- Type t = typeof(IsDynamicTests);
- TypeInfo ti = t.GetTypeInfo();
- currentasm = ti.Assembly;
- return currentasm;
- }
- }
-}
-
-
-
diff --git a/src/System.Reflection/tests/Assembly/Assembly_LoadTests.cs b/src/System.Reflection/tests/Assembly/Assembly_LoadTests.cs
deleted file mode 100644
index 6c80fc301e..0000000000
--- a/src/System.Reflection/tests/Assembly/Assembly_LoadTests.cs
+++ /dev/null
@@ -1,54 +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 Xunit;
-using System;
-using System.IO;
-using System.Reflection;
-using System.Collections.Generic;
-
-namespace System.Reflection.Tests
-{
- public class LoadTests
- {
- [Fact]
- //Null Assembly
- public void LoadTest1()
- {
- Assert.Throws<ArgumentNullException>("assemblyRef", () => Assembly.Load((AssemblyName)null));
- }
-
- [Fact]
- //Non existent Assembly
- public void LoadTest2()
- {
- Assert.Throws<FileNotFoundException>(() => Assembly.Load(new AssemblyName("no such assembly")));
- }
-
- [Fact]
- //Try to Load System.Runtime
- public void LoadTest3()
- {
- Assert.NotNull(Assembly.Load(new AssemblyName(typeof(int).GetTypeInfo().Assembly.FullName)));
- }
-
- [Fact]
- //Try to Load assembly that is not already loaded
- public void LoadTest4()
- {
- var assembly = Assembly.Load(new AssemblyName(typeof(List<int>).GetTypeInfo().Assembly.FullName));
- Assert.NotNull(assembly);
- }
-
- [Fact]
- //Try to Load assembly that is not already loaded
- public void LoadTest5()
- {
- var assembly = Assembly.Load(new AssemblyName(typeof(AssemblyName).GetTypeInfo().Assembly.FullName));
- Assert.NotNull(assembly);
- }
- }
-}
-
-
diff --git a/src/System.Reflection/tests/Assembly/Assembly_LocationTests.cs b/src/System.Reflection/tests/Assembly/Assembly_LocationTests.cs
deleted file mode 100644
index 35768d8f59..0000000000
--- a/src/System.Reflection/tests/Assembly/Assembly_LocationTests.cs
+++ /dev/null
@@ -1,19 +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 Xunit;
-
-namespace System.Reflection.Tests
-{
- public class LocationTests
- {
- // This test applies on all platforms including .NET Native. Location must at least be non-null (it can be empty).
- // System.Reflection.CoreCLR.Tests adds tests that expect more than that.
- [Fact]
- public void CurrentAssemblyHasNonNullLocation()
- {
- Assert.NotNull(typeof(LocationTests).GetTypeInfo().Assembly.Location);
- }
- }
-}
diff --git a/src/System.Reflection/tests/Assembly/Assembly_Members.cs b/src/System.Reflection/tests/Assembly/Assembly_Members.cs
deleted file mode 100644
index a39e450107..0000000000
--- a/src/System.Reflection/tests/Assembly/Assembly_Members.cs
+++ /dev/null
@@ -1,160 +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 Xunit;
-using System;
-using System.Text;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-namespace System.Reflection.Tests
-{
- public class Assembly_Members
- {
- [Fact]
- public void CodeBase()
- {
- string codeBase = GetExecutingAssembly().CodeBase;
- Assert.False(string.IsNullOrEmpty(codeBase));
- }
-
- [Fact]
- public void ImageRuntimeVersion()
- {
- string ver = GetExecutingAssembly().ImageRuntimeVersion;
- Assert.False(string.IsNullOrEmpty(ver));
- }
-
- [Fact]
- public void CreateInstance()
- {
- Assert.Throws<ArgumentException>(() => GetExecutingAssembly().CreateInstance(""));
- Assert.Throws<ArgumentNullException>(() => GetExecutingAssembly().CreateInstance(null));
- Assert.Throws<MissingMethodException>(() => GetExecutingAssembly().CreateInstance(typeof(MyClassWithPrivateCtor).FullName));
- Assert.Throws<MissingMethodException>(() => GetExecutingAssembly().CreateInstance(typeof(MyClassNoDefaultCtor).FullName));
-
- Object obj = GetExecutingAssembly().CreateInstance(typeof(MyClass).FullName);
- Assert.NotNull(obj);
- Assert.Equal(obj.GetType(), typeof(MyClass));
-
- obj = typeof(int).GetTypeInfo().Assembly.CreateInstance(typeof(int).FullName);
- Assert.NotNull(obj);
- Assert.Equal(obj.GetType(), typeof(int));
-
- obj = typeof(int).GetTypeInfo().Assembly.CreateInstance(typeof(Dictionary<int, string>).FullName);
- Assert.NotNull(obj);
- Assert.Equal(obj.GetType(), typeof(Dictionary<int, string>));
- }
-
- [Fact]
- public void CreateInstance_IgnoreCase()
- {
- Assert.Throws<ArgumentException>(() => GetExecutingAssembly().CreateInstance("", false));
- Assert.Throws<ArgumentNullException>(() => GetExecutingAssembly().CreateInstance(null, true));
- Assert.Throws<MissingMethodException>(() => GetExecutingAssembly().CreateInstance(typeof(MyClassWithPrivateCtor).FullName, false));
- Assert.Throws<MissingMethodException>(() => GetExecutingAssembly().CreateInstance(typeof(MyClassNoDefaultCtor).FullName, true));
-
- Object obj = GetExecutingAssembly().CreateInstance(typeof(MyClass).FullName, false);
- Assert.NotNull(obj);
- Assert.Equal(obj.GetType(), typeof(MyClass));
-
- obj = GetExecutingAssembly().CreateInstance(typeof(MyClass).FullName.ToLower(), true);
- Assert.NotNull(obj);
- Assert.Equal(obj.GetType(), typeof(MyClass));
-
- obj = typeof(int).GetTypeInfo().Assembly.CreateInstance(typeof(int).FullName.ToLower(), true);
- Assert.NotNull(obj);
- Assert.Equal(obj.GetType(), typeof(int));
-
- obj = typeof(Dictionary<,>).GetTypeInfo().Assembly.CreateInstance(typeof(Dictionary<int, string>).FullName.ToUpper(), true);
- Assert.NotNull(obj);
- Assert.Equal(typeof(Dictionary<int, string>), obj.GetType());
- }
-
- [Fact]
- public static void CreateQualifiedName()
- {
- Assert.Equal(typeof(Assembly_Members).FullName + ", " + GetExecutingAssembly().ToString(),
- Assembly.CreateQualifiedName(GetExecutingAssembly().ToString(), typeof(Assembly_Members).FullName));
- }
-
- [Fact]
- public static void GetExportedTypes()
- {
- Type[] types = GetExecutingAssembly().GetExportedTypes();
- Assert.NotNull(types);
- Assert.True(types.Length > 0);
- }
-
- [Fact]
- public static void GetReferencedAssemblies()
- {
- // It is too brittle to depend on the assembly references so we simply call the method and check that it does not throw.
- AssemblyName[] assemblies = GetExecutingAssembly().GetReferencedAssemblies();
- Assert.NotNull(assemblies);
- Assert.True(assemblies.Length > 0);
- }
-
- [Fact]
- public static void GetTypeMethod()
- {
- Type type = GetExecutingAssembly().GetType(typeof(MyClass).FullName);
- Assert.NotNull(type);
- Assert.Equal(type, typeof(MyClass));
-
- type = GetExecutingAssembly().GetType(typeof(MyPrivateNestedClass).FullName);
- Assert.NotNull(type);
- Assert.Equal(type, typeof(MyPrivateNestedClass));
-
- type = GetExecutingAssembly().GetType(typeof(MyPrivateClass).FullName);
- Assert.NotNull(type);
- Assert.Equal(type, typeof(MyPrivateClass));
-
- type = GetExecutingAssembly().GetType(typeof(MyClassWithPrivateCtor).FullName, false);
- Assert.NotNull(type);
- Assert.Equal(type, typeof(MyClassWithPrivateCtor));
-
- type = GetExecutingAssembly().GetType(typeof(MyClassNoDefaultCtor).FullName, true);
- Assert.NotNull(type);
- Assert.Equal(type, typeof(MyClassNoDefaultCtor));
-
- type = GetExecutingAssembly().GetType("notfound", false);
- Assert.Null(type);
-
- Assert.Throws<TypeLoadException>(() => GetExecutingAssembly().GetType("notfound", true));
- }
-
- public static Assembly GetExecutingAssembly()
- {
- Assembly asm = null;
- Type t = typeof(Assembly_Members);
- TypeInfo ti = t.GetTypeInfo();
- asm = ti.Assembly;
-
- return asm;
- }
-
- public class MyClass
- {
- public MyClass() { }
- }
-
- public class MyClassWithPrivateCtor
- {
- private MyClassWithPrivateCtor() { }
- }
-
- public class MyClassNoDefaultCtor
- {
- public MyClassNoDefaultCtor(int x) { }
- }
-
- private class MyPrivateNestedClass{ }
- }
-
- class MyPrivateClass { }
-}
-
diff --git a/src/System.Reflection/tests/Assembly/Assembly_ModulesTests.cs b/src/System.Reflection/tests/Assembly/Assembly_ModulesTests.cs
deleted file mode 100644
index 1a23e13cf2..0000000000
--- a/src/System.Reflection/tests/Assembly/Assembly_ModulesTests.cs
+++ /dev/null
@@ -1,64 +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 Xunit;
-using System;
-using System.IO;
-using System.Text;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-namespace System.Reflection.Tests
-{
- public class ModuleTests
- {
- //Load an Assembly that is not already loaded and try to find Modules in that
- [Fact]
- public void GetModulesTest1()
- {
- Assembly asm = LoadSystemCollectionsAssembly();
- IEnumerator<Module> mods = asm.Modules.GetEnumerator();
- mods.MoveNext();
- Module mod = mods.Current;
- Assert.NotNull(mod);
- }
-
- //Load an assembly that is already loaded and try to find Module
- [Fact]
- public void GetModulesTest2()
- {
- Assembly asm = LoadSystemReflectionAssembly();
- // reloading the assembly again to see whether it causes any load error
- IEnumerator<Module> mods = asm.Modules.GetEnumerator();
- mods.MoveNext();
- Module mod = mods.Current;
- Assert.NotNull(mod);
- }
-
- private static Assembly LoadSystemCollectionsAssembly()
- {
- //Force System.collections to be linked statically
- List<int> li = new List<int>();
- li.Add(1);
-
- //Load System.Collections
- Assembly a = Assembly.Load(new AssemblyName(typeof(List<int>).GetTypeInfo().Assembly.FullName));
- return a;
- }
-
- private static Assembly LoadSystemReflectionAssembly()
- {
- //Force System.Reflection to be linked statically
- AssemblyName name = new AssemblyName("Foo");
-
- //Load System.Reflection
- Assembly a = Assembly.Load(new AssemblyName(typeof(AssemblyName).GetTypeInfo().Assembly.FullName));
- return a;
- }
- }
-}
-
-
diff --git a/src/System.Reflection/tests/Assembly/Assembly_ToStringTests.cs b/src/System.Reflection/tests/Assembly/Assembly_ToStringTests.cs
deleted file mode 100644
index 0d469e2b4b..0000000000
--- a/src/System.Reflection/tests/Assembly/Assembly_ToStringTests.cs
+++ /dev/null
@@ -1,50 +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 Xunit;
-using System;
-using System.Reflection;
-using System.Collections.Generic;
-
-namespace System.Reflection.Tests
-{
- public class ToStringTests
- {
- [Fact]
- //Try to Load itself and Verify ToString method
- public void ToStringTest1()
- {
- var assembly = typeof(ToStringTests).GetTypeInfo().Assembly;
- var assemblyString = assembly.ToString();
-
- Assert.NotNull(assemblyString);
- Assert.True(assemblyString.Contains("System.Reflection.Tests"));
- }
-
- //Load Assembly and Verify PublicKeyToken is present in FullName
- [Fact]
- public void ToStringTest2()
- {
- var assembly = Assembly.Load(new AssemblyName(typeof(List<int>).GetTypeInfo().Assembly.FullName));
- var assemblyString = assembly.ToString();
-
- Assert.NotNull(assemblyString);
- Assert.True(assemblyString.Contains("PublicKeyToken="));
- }
-
-
- [Fact]
- //Try to Load assembly and Verify that ToString() method returns same string as FullName
- public void ToStringTest3()
- {
- var assembly = Assembly.Load(new AssemblyName(typeof(List<int>).GetTypeInfo().Assembly.FullName));
- var assemblyString = assembly.ToString();
-
- Assert.NotNull(assemblyString);
- Assert.Equal(assemblyString, assembly.FullName);
- }
- }
-}
-
-
diff --git a/src/System.Reflection/tests/AssemblyTests.cs b/src/System.Reflection/tests/AssemblyTests.cs
new file mode 100644
index 0000000000..fbe59e00f2
--- /dev/null
+++ b/src/System.Reflection/tests/AssemblyTests.cs
@@ -0,0 +1,343 @@
+// 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.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Reflection.Tests;
+using System.Runtime.CompilerServices;
+using Xunit;
+
+[assembly:
+Attr(77, name = "AttrSimple"),
+Int32Attr(77, name = "Int32AttrSimple"),
+Int64Attr(77, name = "Int64AttrSimple"),
+StringAttr("hello", name = "StringAttrSimple"),
+EnumAttr(PublicEnum.Case1, name = "EnumAttrSimple"),
+TypeAttr(typeof(object), name = "TypeAttrSimple")]
+
+[assembly: CompilationRelaxations(8)]
+[assembly: Debuggable((DebuggableAttribute.DebuggingModes)263)]
+[assembly: CLSCompliant(false)]
+
+namespace System.Reflection.Tests
+{
+ public class AssemblyTests
+ {
+ [Theory]
+ [InlineData(typeof(Int32Attr))]
+ [InlineData(typeof(Int64Attr))]
+ [InlineData(typeof(StringAttr))]
+ [InlineData(typeof(EnumAttr))]
+ [InlineData(typeof(TypeAttr))]
+ [InlineData(typeof(CompilationRelaxationsAttribute))]
+ [InlineData(typeof(AssemblyTitleAttribute))]
+ [InlineData(typeof(AssemblyDescriptionAttribute))]
+ [InlineData(typeof(AssemblyCompanyAttribute))]
+ [InlineData(typeof(CLSCompliantAttribute))]
+ [InlineData(typeof(DebuggableAttribute))]
+ [InlineData(typeof(Attr))]
+ public void CustomAttributes(Type type)
+ {
+ Assembly assembly = Helpers.ExecutingAssembly;
+ IEnumerable<CustomAttributeData> attributesData = assembly.CustomAttributes;
+ bool result = attributesData.Any(customAttribute => customAttribute.AttributeType.Equals(type));
+ Assert.True(result, $"Did not find custom attribute of type {type}.");
+
+ ICustomAttributeProvider attributeProvider = assembly;
+ Assert.Equal(1, attributeProvider.GetCustomAttributes(type, false).Length);
+ Assert.True(attributeProvider.IsDefined(type, false));
+
+ object[] customAttributes = attributeProvider.GetCustomAttributes(false);
+ result = customAttributes.Any(attribute => attribute.GetType().Equals(type));
+ Assert.True(result, $"Did not find custom attribute of type {type}.");
+ }
+
+ [Theory]
+ [InlineData(typeof(int), false)]
+ [InlineData(typeof(Attr), true)]
+ [InlineData(typeof(Int32Attr), true)]
+ [InlineData(typeof(Int64Attr), true)]
+ [InlineData(typeof(StringAttr), true)]
+ [InlineData(typeof(EnumAttr), true)]
+ [InlineData(typeof(TypeAttr), true)]
+ [InlineData(typeof(ObjectAttr), true)]
+ [InlineData(typeof(NullAttr), true)]
+ public void DefinedTypes(Type type, bool expected)
+ {
+ IEnumerable<TypeInfo> customAttrs = Helpers.ExecutingAssembly.DefinedTypes;
+ bool result = customAttrs.Any(typeInfo => typeInfo.AsType().Equals(type));
+ Assert.Equal(expected, result);
+ }
+
+ [Theory]
+ [InlineData("EmbeddedImage.png", true)]
+ [InlineData("NoSuchFile", false)]
+ public void EmbeddedFiles(string resource, bool exists)
+ {
+ string[] resources = Helpers.ExecutingAssembly.GetManifestResourceNames();
+ Assert.True(exists == resources.Contains(resource), $"{resource} resource expected existence: '{exists}', but got '{!exists}'");
+
+ Stream resourceStream = Helpers.ExecutingAssembly.GetManifestResourceStream(resource);
+ Assert.True(exists == (resourceStream != null), $"{resource} resource expected existence: '{exists}', but got '{!exists}'");
+ }
+
+ [Fact]
+ public void EntryPoint_ExecutingAssembly_IsNull()
+ {
+ Assert.Null(Helpers.ExecutingAssembly.EntryPoint);
+ }
+
+ public static IEnumerable<object[]> Equals_TestData()
+ {
+ yield return new object[] { Assembly.Load(new AssemblyName(typeof(int).GetTypeInfo().Assembly.FullName)), Assembly.Load(new AssemblyName(typeof(int).GetTypeInfo().Assembly.FullName)), true };
+ yield return new object[] { Assembly.Load(new AssemblyName(typeof(List<int>).GetTypeInfo().Assembly.FullName)), Assembly.Load(new AssemblyName(typeof(List<int>).GetTypeInfo().Assembly.FullName)), true };
+ yield return new object[] { Assembly.Load(new AssemblyName(typeof(List<int>).GetTypeInfo().Assembly.FullName)), Helpers.ExecutingAssembly, false };
+ }
+
+ [Theory]
+ [MemberData(nameof(Equals_TestData))]
+ public void Equals(Assembly assembly1, Assembly assembly2, bool expected)
+ {
+ Assert.Equal(expected, assembly1.Equals(assembly2));
+ }
+
+ [Theory]
+ [InlineData(typeof(AssemblyPublicClass), true)]
+ [InlineData(typeof(AssemblyTests), true)]
+ [InlineData(typeof(AssemblyPublicClass.PublicNestedClass), true)]
+ [InlineData(typeof(PublicEnum), true)]
+ [InlineData(typeof(BaseClass), true)]
+ [InlineData(typeof(AssemblyGenericPublicClass<>), true)]
+ [InlineData(typeof(AssemblyInternalClass), false)]
+ public void ExportedTypes(Type type, bool expected)
+ {
+ Assembly assembly = Helpers.ExecutingAssembly;
+ Assert.Equal(assembly.GetExportedTypes(), assembly.ExportedTypes);
+
+ Assert.Equal(expected, assembly.ExportedTypes.Contains(type));
+ }
+
+ [Fact]
+ public void GetEntryAssembly()
+ {
+ Assert.NotNull(Assembly.GetEntryAssembly());
+ Assert.True(Assembly.GetEntryAssembly().ToString().StartsWith("xunit.console.netcore", StringComparison.OrdinalIgnoreCase));
+ }
+
+ public static IEnumerable<object[]> GetHashCode_TestData()
+ {
+ yield return new object[] { LoadSystemRuntimeAssembly() };
+ yield return new object[] { LoadSystemCollectionsAssembly() };
+ yield return new object[] { LoadSystemReflectionAssembly() };
+ yield return new object[] { typeof(AssemblyTests).GetTypeInfo().Assembly };
+ }
+
+ [Theory]
+ [MemberData(nameof(GetHashCode_TestData))]
+ public void GetHashCode(Assembly assembly)
+ {
+ int hashCode = assembly.GetHashCode();
+ Assert.False((hashCode == -1) || (hashCode == 0));
+ }
+
+ [Theory]
+ [InlineData("System.Reflection.Tests.AssemblyPublicClass", true)]
+ [InlineData("System.Reflection.Tests.AssemblyInternalClass", true)]
+ [InlineData("System.Reflection.Tests.PublicEnum", true)]
+ [InlineData("System.Reflection.Tests.PublicStruct", true)]
+ [InlineData("AssemblyPublicClass", false)]
+ [InlineData("NoSuchType", false)]
+ public void GetType(string name, bool exists)
+ {
+ Type type = Helpers.ExecutingAssembly.GetType(name);
+ if (exists)
+ {
+ Assert.Equal(name, type.FullName);
+ }
+ else
+ {
+ Assert.Null(type);
+ }
+ }
+
+ public static IEnumerable<object[]> IsDynamic_TestData()
+ {
+ yield return new object[] { Helpers.ExecutingAssembly, false };
+ yield return new object[] { LoadSystemCollectionsAssembly(), false };
+ }
+
+ [Theory]
+ [MemberData(nameof(IsDynamic_TestData))]
+ public void IsDynamic(Assembly assembly, bool expected)
+ {
+ Assert.Equal(expected, assembly.IsDynamic);
+ }
+
+ public static IEnumerable<object[]> Load_TestData()
+ {
+ yield return new object[] { new AssemblyName(typeof(int).GetTypeInfo().Assembly.FullName) };
+ yield return new object[] { new AssemblyName(typeof(List<int>).GetTypeInfo().Assembly.FullName) };
+ yield return new object[] { new AssemblyName(typeof(AssemblyName).GetTypeInfo().Assembly.FullName) };
+ }
+
+ [Theory]
+ [MemberData(nameof(Load_TestData))]
+ public void Load(AssemblyName assemblyRef)
+ {
+ Assert.NotNull(Assembly.Load(assemblyRef));
+ }
+
+ [Fact]
+ public void Load_Invalid()
+ {
+ Assert.Throws<ArgumentNullException>("assemblyRef", () => Assembly.Load(null)); // AssemblyRef is null
+ Assert.Throws<FileNotFoundException>(() => Assembly.Load(new AssemblyName("no such assembly"))); // No such assembly
+ }
+
+ [Fact]
+ public void Location_ExecutingAssembly_IsNotNull()
+ {
+ // This test applies on all platforms including .NET Native. Location must at least be non-null (it can be empty).
+ // System.Reflection.CoreCLR.Tests adds tests that expect more than that.
+ Assert.NotNull(Helpers.ExecutingAssembly.Location);
+ }
+
+ [Fact]
+ public void CodeBase()
+ {
+ Assert.NotEmpty(Helpers.ExecutingAssembly.CodeBase);
+ }
+
+ [Fact]
+ public void ImageRuntimeVersion()
+ {
+ Assert.NotEmpty(Helpers.ExecutingAssembly.ImageRuntimeVersion);
+ }
+
+ public static IEnumerable<object[]> CreateInstance_TestData()
+ {
+ yield return new object[] { Helpers.ExecutingAssembly, typeof(AssemblyPublicClass).FullName, typeof(AssemblyPublicClass) };
+ yield return new object[] { typeof(int).GetTypeInfo().Assembly, typeof(int).FullName, typeof(int) };
+ yield return new object[] { typeof(int).GetTypeInfo().Assembly, typeof(Dictionary<int, string>).FullName, typeof(Dictionary<int, string>) };
+ }
+
+ [Theory]
+ [MemberData(nameof(CreateInstance_TestData))]
+ public void CreateInstance(Assembly assembly, string typeName, Type expectedType)
+ {
+ Assert.IsType(expectedType, assembly.CreateInstance(typeName));
+ Assert.IsType(expectedType, assembly.CreateInstance(typeName, false));
+ Assert.IsType(expectedType, assembly.CreateInstance(typeName, true));
+
+ Assert.IsType(expectedType, assembly.CreateInstance(typeName.ToUpper(), true));
+ Assert.IsType(expectedType, assembly.CreateInstance(typeName.ToLower(), true));
+ }
+
+ public static IEnumerable<object[]> CreateInstance_Invalid_TestData()
+ {
+ yield return new object[] { "", typeof(ArgumentException) };
+ yield return new object[] { null, typeof(ArgumentNullException) };
+ yield return new object[] { typeof(AssemblyClassWithPrivateCtor).FullName, typeof(MissingMethodException) };
+ yield return new object[] { typeof(AssemblyClassWithNoDefaultCtor).FullName, typeof(MissingMethodException) };
+ }
+
+ [Theory]
+ [MemberData(nameof(CreateInstance_Invalid_TestData))]
+ public void CreateInstance_Invalid(string typeName, Type exceptionType)
+ {
+ Assembly assembly = Helpers.ExecutingAssembly;
+ Assert.Throws(exceptionType, () => Helpers.ExecutingAssembly.CreateInstance(typeName));
+ Assert.Throws(exceptionType, () => Helpers.ExecutingAssembly.CreateInstance(typeName, true));
+ Assert.Throws(exceptionType, () => Helpers.ExecutingAssembly.CreateInstance(typeName, false));
+ }
+
+ [Fact]
+ public void CreateQualifiedName()
+ {
+ string assemblyName = Helpers.ExecutingAssembly.ToString();
+ Assert.Equal(typeof(AssemblyTests).FullName + ", " + assemblyName, Assembly.CreateQualifiedName(assemblyName, typeof(AssemblyTests).FullName));
+ }
+
+ [Fact]
+ public void GetReferencedAssemblies()
+ {
+ // It is too brittle to depend on the assembly references so we just call the method and check that it does not throw.
+ AssemblyName[] assemblies = Helpers.ExecutingAssembly.GetReferencedAssemblies();
+ Assert.NotEmpty(assemblies);
+ }
+
+ public static IEnumerable<object[]> Modules_TestData()
+ {
+ yield return new object[] { LoadSystemCollectionsAssembly() };
+ yield return new object[] { LoadSystemReflectionAssembly() };
+ }
+
+ [Theory]
+ [MemberData(nameof(Modules_TestData))]
+ public void Modules(Assembly assembly)
+ {
+ Assert.NotEmpty(assembly.Modules);
+ foreach (Module module in assembly.Modules)
+ {
+ Assert.NotNull(module);
+ }
+ }
+
+ public IEnumerable<object[]> ToString_TestData()
+ {
+ yield return new object[] { Helpers.ExecutingAssembly, "System.Reflection.Tests" };
+ yield return new object[] { Assembly.Load(new AssemblyName(typeof(List<int>).GetTypeInfo().Assembly.FullName)), "PublicKeyToken=" };
+ }
+
+ [Theory]
+ public void ToString(Assembly assembly, string expected)
+ {
+ Assert.True(assembly.ToString().Contains(expected));
+ Assert.Equal(assembly.ToString(), assembly.FullName);
+ }
+
+ private static Assembly LoadSystemCollectionsAssembly()
+ {
+ // Force System.collections to be linked statically
+ List<int> li = new List<int>();
+ li.Add(1);
+ return Assembly.Load(new AssemblyName(typeof(List<int>).GetTypeInfo().Assembly.FullName));
+ }
+
+ private static Assembly LoadSystemReflectionAssembly()
+ {
+ // Force System.Reflection to be linked statically
+ return Assembly.Load(new AssemblyName(typeof(AssemblyName).GetTypeInfo().Assembly.FullName));
+ }
+
+ private static Assembly LoadSystemRuntimeAssembly()
+ {
+ // Load System.Runtime
+ return Assembly.Load(new AssemblyName(typeof(int).GetTypeInfo().Assembly.FullName)); ;
+ }
+ }
+
+ public struct PublicStruct { }
+
+ public class AssemblyPublicClass
+ {
+ public class PublicNestedClass { }
+ }
+
+ public class AssemblyGenericPublicClass<T> { }
+ internal class AssemblyInternalClass { }
+
+ public class AssemblyClassWithPrivateCtor
+ {
+ private AssemblyClassWithPrivateCtor() { }
+ }
+
+ public class AssemblyClassWithNoDefaultCtor
+ {
+ public AssemblyClassWithNoDefaultCtor(int x) { }
+ }
+}
diff --git a/src/System.Reflection/tests/Common.cs b/src/System.Reflection/tests/Common.cs
new file mode 100644
index 0000000000..e4a35db85b
--- /dev/null
+++ b/src/System.Reflection/tests/Common.cs
@@ -0,0 +1,109 @@
+// 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.
+
+namespace System.Reflection.Tests
+{
+ public enum PublicEnum
+ {
+ Case1 = 1,
+ Case2 = 2,
+ Case3 = 3
+ }
+
+ [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
+ public class Attr : Attribute
+ {
+ public Attr(int i)
+ {
+ value = i;
+ }
+
+ public override string ToString() => $"{value}, {name}";
+
+ public string name;
+ public int value;
+ }
+
+ [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
+ public class Int32Attr : Attribute
+ {
+ public Int32Attr(int i)
+ {
+ value = i;
+ }
+
+ public string name;
+ public readonly int value;
+ }
+
+ [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
+ public class Int64Attr : Attribute
+ {
+ public Int64Attr(long l)
+ {
+ value = l;
+ }
+
+ public string name;
+ public readonly long value;
+
+ public override string ToString() => $"{value}, {name}";
+ }
+
+ [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
+ public class EnumAttr : Attribute
+ {
+ public EnumAttr(PublicEnum e)
+ {
+ value = e;
+ }
+
+ public string name;
+ public readonly PublicEnum value;
+ }
+
+ [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
+ public class StringAttr : Attribute
+ {
+ public StringAttr(string s)
+ {
+ value = s;
+ }
+
+ public string name;
+ public readonly string value;
+ }
+
+ [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
+ public class TypeAttr : Attribute
+ {
+ public TypeAttr(Type t)
+ {
+ value = t;
+ }
+
+ public string name;
+ public readonly Type value;
+ }
+
+ [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
+ public class ObjectAttr : Attribute
+ {
+ public ObjectAttr(object v)
+ {
+ value = v;
+ }
+
+ public string name;
+ public readonly object value;
+ }
+
+ [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
+ public class NullAttr : Attribute { }
+
+ public class Helpers
+ {
+ public static Assembly ExecutingAssembly => typeof(Helpers).GetTypeInfo().Assembly;
+ }
+}
diff --git a/src/System.Reflection/tests/Common/ReflectionTestData.cs b/src/System.Reflection/tests/Common/ReflectionTestData.cs
index a87b7cd69e..e69de29bb2 100644
--- a/src/System.Reflection/tests/Common/ReflectionTestData.cs
+++ b/src/System.Reflection/tests/Common/ReflectionTestData.cs
@@ -1,328 +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 Xunit;
-using System;
-using System.Text;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-//
-// This is the "Type Library" we are going to reflect on
-//
-
-namespace System.Reflection.CustomAttributesTests.Data
-{
- public enum MyColorEnum
- {
- RED = 1,
- BLUE = 2,
- GREEN = 3
- }
-
- public class Util
- {
- public static string ObjectToString(Object o)
- {
- string s = string.Empty;
- if (o != null)
- {
- if (o is Array)
- {
- Array a = (Array)o;
- for (int i = 0; i < a.Length; i += 1)
- {
- if (i > 0)
- {
- s = s + ", ";
- }
- if (a.GetValue(i) is Array)
- s = s + Util.ObjectToString((Array)a.GetValue(i));
- else
- s = s + a.GetValue(i).ToString();
- }
- }
- else
- s = s + o.ToString();
- }
- return s;
- }
- }
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- public class Attr : Attribute
- {
- public Attr()
- {
- }
-
- public Attr(int i)
- {
- value = i;
- sValue = null;
- }
-
- public Attr(int i, string s)
- {
- value = i;
- sValue = s;
- }
-
- public override string ToString()
- {
- return "Attr ToString : " + value.ToString() + " " + sValue;
- }
-
- public string name;
- public int value;
- public string sValue;
- }
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- public class Int32Attr : Attribute
- {
- public Int32Attr(int i)
- {
- value = i;
- arrayValue = null;
- }
-
- public Int32Attr(int i, int[] a)
- {
- value = i;
- arrayValue = a;
- }
-
- public string name;
- public readonly int value;
- public int field;
- public readonly int[] arrayValue;
- public int[] arrayField;
- private int _property = 0;
- public int property { get { return _property; } set { _property = value; } }
- private int[] _arrayProperty;
- public int[] arrayProperty { get { return _arrayProperty; } set { _arrayProperty = value; } }
-
- public override string ToString()
- {
- return GetType().ToString() + " - name : " + name
- + "; value : " + Util.ObjectToString(value)
- + "; field : " + Util.ObjectToString(field)
- + "; property : " + Util.ObjectToString(property)
- + "; array value : " + Util.ObjectToString(arrayValue)
- + "; array field : " + Util.ObjectToString(arrayField)
- + "; array property : " + Util.ObjectToString(arrayProperty);
- }
- }
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- public class Int64Attr : Attribute
- {
- public Int64Attr(long l)
- {
- value = l;
- arrayValue = null;
- }
-
- public Int64Attr(long l, long[] a)
- {
- value = l;
- arrayValue = a;
- }
-
- public string name;
- public readonly long value;
- public long field;
- public readonly long[] arrayValue;
- public long[] arrayField;
- private long _property = 0;
- public long property { get { return _property; } set { _property = value; } }
- private long[] _arrayProperty;
- public long[] arrayProperty { get { return _arrayProperty; } set { _arrayProperty = value; } }
-
- public override string ToString()
- {
- return GetType().ToString() + " - name : " + name
- + "; value : " + Util.ObjectToString(value)
- + "; field : " + Util.ObjectToString(field)
- + "; property : " + Util.ObjectToString(property)
- + "; array value : " + Util.ObjectToString(arrayValue)
- + "; array field : " + Util.ObjectToString(arrayField)
- + "; array property : " + Util.ObjectToString(arrayProperty);
- }
- }
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- public class EnumAttr : Attribute
- {
- public EnumAttr(MyColorEnum e)
- {
- value = e;
- arrayValue = null;
- }
-
- public EnumAttr(MyColorEnum e, MyColorEnum[] a)
- {
- value = e;
- arrayValue = a;
- }
-
- public string name;
- public readonly MyColorEnum value;
- public MyColorEnum field;
- public readonly MyColorEnum[] arrayValue;
- public MyColorEnum[] arrayField;
- private MyColorEnum _property = 0;
- public MyColorEnum property { get { return _property; } set { _property = value; } }
- private MyColorEnum[] _arrayProperty;
- public MyColorEnum[] arrayProperty { get { return _arrayProperty; } set { _arrayProperty = value; } }
-
- public override string ToString()
- {
- return GetType().ToString() + " - name : " + name
- + "; value : " + Util.ObjectToString(value)
- + "; field : " + Util.ObjectToString(field)
- + "; property : " + Util.ObjectToString(property)
- + "; array value : " + Util.ObjectToString(arrayValue)
- + "; array field : " + Util.ObjectToString(arrayField)
- + "; array property : " + Util.ObjectToString(arrayProperty);
- }
- }
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- public class StringAttr : Attribute
- {
- public StringAttr(string s)
- {
- value = s;
- arrayValue = null;
- }
-
- public StringAttr(string s, string[] a)
- {
- value = s;
- arrayValue = a;
- }
-
- public string name;
- public readonly string value;
- public string field;
- public readonly string[] arrayValue;
- public string[] arrayField;
- private string _property;
- public string property { get { return _property; } set { _property = value; } }
- private string[] _arrayProperty;
- public string[] arrayProperty { get { return _arrayProperty; } set { _arrayProperty = value; } }
-
- public override string ToString()
- {
- return GetType().ToString() + " - name : " + name
- + "; value : " + Util.ObjectToString(value)
- + "; field : " + Util.ObjectToString(field)
- + "; property : " + Util.ObjectToString(property)
- + "; array value : " + Util.ObjectToString(arrayValue)
- + "; array field : " + Util.ObjectToString(arrayField)
- + "; array property : " + Util.ObjectToString(arrayProperty);
- }
- }
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- public class TypeAttr : Attribute
- {
- public TypeAttr(Type t)
- {
- value = t;
- arrayValue = null;
- }
-
- public TypeAttr(Type t, Type[] a)
- {
- value = t;
- arrayValue = a;
- }
-
-
- public string name;
- public readonly Type value;
- public Type field;
- public readonly Type[] arrayValue;
- public Type[] arrayField;
- private Type _property;
- public Type property { get { return _property; } set { _property = value; } }
- private Type[] _arrayProperty;
- public Type[] arrayProperty { get { return _arrayProperty; } set { _arrayProperty = value; } }
-
- public override string ToString()
- {
- return GetType().ToString() + " - name : " + name
- + "; value : " + Util.ObjectToString(value)
- + "; field : " + Util.ObjectToString(field)
- + "; property : " + Util.ObjectToString(property)
- + "; array value : " + Util.ObjectToString(arrayValue)
- + "; array field : " + Util.ObjectToString(arrayField)
- + "; array property : " + Util.ObjectToString(arrayProperty);
- }
- }
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- public class ObjectAttr : Attribute
- {
- public ObjectAttr(Object v)
- {
- value = v;
- arrayValue = null;
- }
-
- public ObjectAttr(Object v, Object[] a)
- {
- value = v;
- arrayValue = a;
- }
-
- public string name;
- public readonly Object value;
- public Object field;
- public readonly Object[] arrayValue;
- public Object[] arrayField;
- private Object _property = 0;
- public Object property { get { return _property; } set { _property = value; } }
- private Object[] _arrayProperty;
- public Object[] arrayProperty { get { return _arrayProperty; } set { _arrayProperty = value; } }
-
- public override string ToString()
- {
- return GetType().ToString() + " - name : " + name
- + "; value : " + Util.ObjectToString(value)
- + "; field : " + Util.ObjectToString(field)
- + "; property : " + Util.ObjectToString(property)
- + "; array value : " + Util.ObjectToString(arrayValue)
- + "; array field : " + Util.ObjectToString(arrayField)
- + "; array property : " + Util.ObjectToString(arrayProperty);
- }
- }
-
- [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
- public class NullAttr : Attribute
- {
- public NullAttr(string s, Type t, int[] a)
- {
- }
-
- public NullAttr(String s)
- {
- }
-
- public string name;
-
- public string stringField;
- public Type typeField;
- public int[] arrayField;
- public string stringProperty { get { return null; } set { } }
- public Type typeProperty { get { return null; } set { } }
- public int[] arrayProperty { get { return null; } set { } }
- }
-}
-
diff --git a/src/System.Reflection/tests/ExceptionTests.cs b/src/System.Reflection/tests/ExceptionTests.cs
index 67b056eedd..adcd9c516f 100644
--- a/src/System.Reflection/tests/ExceptionTests.cs
+++ b/src/System.Reflection/tests/ExceptionTests.cs
@@ -1,3 +1,7 @@
+// 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 Xunit;
using System;
using System.Reflection;
diff --git a/src/System.Reflection/tests/FieldInfo/FieldInfo_CustomAttributeTests.cs b/src/System.Reflection/tests/FieldInfo/FieldInfo_CustomAttributeTests.cs
index 9a9b753c7b..e80403f16e 100644
--- a/src/System.Reflection/tests/FieldInfo/FieldInfo_CustomAttributeTests.cs
+++ b/src/System.Reflection/tests/FieldInfo/FieldInfo_CustomAttributeTests.cs
@@ -4,7 +4,7 @@
using Xunit;
using System.Collections.Generic;
-using System.Reflection.CustomAttributesTests.Data;
+using System.Linq;
// Need to disable warning related to CLS Compliance as using Array as custom attribute is not CLS compliant
#pragma warning disable 3016
@@ -13,15 +13,13 @@ namespace System.Reflection.Tests
{
public class FieldInfoTestClass
{
- public FieldInfoTestClass()
- {
- }
+ public FieldInfoTestClass() { }
[Attr(77, name = "AttrSimple"),
Int32Attr(77, name = "Int32AttrSimple"),
Int64Attr(77, name = "Int64AttrSimple"),
StringAttr("hello", name = "StringAttrSimple"),
- EnumAttr(MyColorEnum.RED, name = "EnumAttrSimple"),
+ EnumAttr(PublicEnum.Case1, name = "EnumAttrSimple"),
TypeAttr(typeof(object), name = "TypeAttrSimple")]
public string MyField = "MyField";
@@ -36,16 +34,17 @@ namespace System.Reflection.Tests
public class FieldInfoCustomAttributeTests
{
[Theory]
- [InlineData(typeof(Int32Attr), "[System.Reflection.CustomAttributesTests.Data.Int32Attr((Int32)77, name = \"Int32AttrSimple\")]")]
- [InlineData(typeof(Int64Attr), "[System.Reflection.CustomAttributesTests.Data.Int64Attr((Int64)77, name = \"Int64AttrSimple\")]")]
- [InlineData(typeof(StringAttr), "[System.Reflection.CustomAttributesTests.Data.StringAttr(\"hello\", name = \"StringAttrSimple\")]")]
- [InlineData(typeof(EnumAttr), "[System.Reflection.CustomAttributesTests.Data.EnumAttr((System.Reflection.CustomAttributesTests.Data.MyColorEnum)1, name = \"EnumAttrSimple\")]")]
- [InlineData(typeof(TypeAttr), "[System.Reflection.CustomAttributesTests.Data.TypeAttr(typeof(System.Object), name = \"TypeAttrSimple\")]")]
- [InlineData(typeof(Attr), "[System.Reflection.CustomAttributesTests.Data.Attr((Int32)77, name = \"AttrSimple\")]")]
- public static void TestCustomAttributeDetails(Type type, string attributeStr)
+ [InlineData(typeof(Int32Attr), "[System.Reflection.Tests.Int32Attr((Int32)77, name = \"Int32AttrSimple\")]")]
+ [InlineData(typeof(Int64Attr), "[System.Reflection.Tests.Int64Attr((Int64)77, name = \"Int64AttrSimple\")]")]
+ [InlineData(typeof(StringAttr), "[System.Reflection.Tests.StringAttr(\"hello\", name = \"StringAttrSimple\")]")]
+ [InlineData(typeof(EnumAttr), "[System.Reflection.Tests.EnumAttr((System.Reflection.Tests.PublicEnum)1, name = \"EnumAttrSimple\")]")]
+ [InlineData(typeof(TypeAttr), "[System.Reflection.Tests.TypeAttr(typeof(System.Object), name = \"TypeAttrSimple\")]")]
+ [InlineData(typeof(Attr), "[System.Reflection.Tests.Attr((Int32)77, name = \"AttrSimple\")]")]
+ public static void TestCustomAttributeDetails(Type type, string expectedToString)
{
FieldInfo fi = GetField("MyField");
- Assert.Contains(fi.CustomAttributes, attr => attr.AttributeType.Equals(type) && attr.ToString().Equals(attributeStr));
+ CustomAttributeData attributeData = fi.CustomAttributes.First(attribute => attribute.AttributeType.Equals(type));
+ Assert.Equal(expectedToString, attributeData.ToString());
}
// Helper method to get field from Type type
diff --git a/src/System.Reflection/tests/MemberInfoTests.cs b/src/System.Reflection/tests/MemberInfoTests.cs
index 952fa69243..0be82d3c03 100644
--- a/src/System.Reflection/tests/MemberInfoTests.cs
+++ b/src/System.Reflection/tests/MemberInfoTests.cs
@@ -1,3 +1,7 @@
+// 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 Xunit;
using System;
using System.Linq;
diff --git a/src/System.Reflection/tests/MethodInfo/MethodInfo_CustomAttributeTests.cs b/src/System.Reflection/tests/MethodInfo/MethodInfo_CustomAttributeTests.cs
index 33cd2a1cde..d478a7d3e9 100644
--- a/src/System.Reflection/tests/MethodInfo/MethodInfo_CustomAttributeTests.cs
+++ b/src/System.Reflection/tests/MethodInfo/MethodInfo_CustomAttributeTests.cs
@@ -2,14 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using Xunit;
-using System;
-using System.Text;
-using System.Reflection;
-using System.Collections;
using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Reflection.CustomAttributesTests.Data;
+using Xunit;
// Need to disable warning related to CLS Compliance as using Array as custom attribute is not CLS compliant
#pragma warning disable 3016
@@ -24,15 +18,15 @@ namespace System.Reflection.Tests
[Attr(77, name = "AttrSimple"),
Int32Attr(77, name = "Int32AttrSimple"),
- Int64Attr((Int64)77, name = "Int64AttrSimple"),
+ Int64Attr(77, name = "Int64AttrSimple"),
StringAttr("hello", name = "StringAttrSimple"),
- EnumAttr(MyColorEnum.RED, name = "EnumAttrSimple"),
+ EnumAttr(PublicEnum.Case1, name = "EnumAttrSimple"),
TypeAttr(typeof(object), name = "TypeAttrSimple")]
[return:Attr(77, name = "AttrSimple"),
Int32Attr(77, name = "Int32AttrSimple"),
- Int64Attr((Int64)77, name = "Int64AttrSimple"),
+ Int64Attr(77, name = "Int64AttrSimple"),
StringAttr("hello", name = "StringAttrSimple"),
- EnumAttr(MyColorEnum.RED, name = "EnumAttrSimple"),
+ EnumAttr(PublicEnum.Case1, name = "EnumAttrSimple"),
TypeAttr(typeof(object), name = "TypeAttrSimple")]
public void MyMethod() { }
@@ -49,12 +43,12 @@ namespace System.Reflection.Tests
//Test for custom Attribute of type Int32AttrSimple
[Theory]
- [InlineData(typeof(Int32Attr), "[System.Reflection.CustomAttributesTests.Data.Int32Attr((Int32)77, name = \"Int32AttrSimple\")]")]
- [InlineData(typeof(Int64Attr), "[System.Reflection.CustomAttributesTests.Data.Int64Attr((Int64)77, name = \"Int64AttrSimple\")]")]
- [InlineData(typeof(StringAttr), "[System.Reflection.CustomAttributesTests.Data.StringAttr(\"hello\", name = \"StringAttrSimple\")]")]
- [InlineData(typeof(EnumAttr), "[System.Reflection.CustomAttributesTests.Data.EnumAttr((System.Reflection.CustomAttributesTests.Data.MyColorEnum)1, name = \"EnumAttrSimple\")]")]
- [InlineData(typeof(TypeAttr), "[System.Reflection.CustomAttributesTests.Data.TypeAttr(typeof(System.Object), name = \"TypeAttrSimple\")]")]
- [InlineData(typeof(Attr), "[System.Reflection.CustomAttributesTests.Data.Attr((Int32)77, name = \"AttrSimple\")]")]
+ [InlineData(typeof(Int32Attr), "[System.Reflection.Tests.Int32Attr((Int32)77, name = \"Int32AttrSimple\")]")]
+ [InlineData(typeof(Int64Attr), "[System.Reflection.Tests.Int64Attr((Int64)77, name = \"Int64AttrSimple\")]")]
+ [InlineData(typeof(StringAttr), "[System.Reflection.Tests.StringAttr(\"hello\", name = \"StringAttrSimple\")]")]
+ [InlineData(typeof(EnumAttr), "[System.Reflection.Tests.EnumAttr((System.Reflection.Tests.MyColorEnum)1, name = \"EnumAttrSimple\")]")]
+ [InlineData(typeof(TypeAttr), "[System.Reflection.Tests.TypeAttr(typeof(System.Object), name = \"TypeAttrSimple\")]")]
+ [InlineData(typeof(Attr), "[System.Reflection.Tests.Attr((Int32)77, name = \"AttrSimple\")]")]
private void Test_Attr(Type type, string attributeStr)
diff --git a/src/System.Reflection/tests/Module/ModuleTests.cs b/src/System.Reflection/tests/Module/ModuleTests.cs
index c5795bc12c..d55613e641 100644
--- a/src/System.Reflection/tests/Module/ModuleTests.cs
+++ b/src/System.Reflection/tests/Module/ModuleTests.cs
@@ -2,19 +2,16 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using Xunit;
-using System;
using System.Collections.Generic;
using System.Linq;
-using System.Reflection;
-using System.Reflection.CustomAttributesTests.Data;
+using System.Reflection.Tests;
+using Xunit;
[module: Attr(77, name = "AttrSimple")]
[module: Int32Attr(77, name = "Int32AttrSimple")]
-[module: Int64Attr((Int64)77, name = "Int64AttrSimple")]
+[module: Int64Attr(77, name = "Int64AttrSimple")]
[module: StringAttr("hello", name = "StringAttrSimple")]
-[module: EnumAttr(MyColorEnum.GREEN, name = "EnumAttrSimple")]
-
+[module: EnumAttr(PublicEnum.Case1, name = "EnumAttrSimple")]
namespace System.Reflection.Tests
{
@@ -46,7 +43,7 @@ namespace System.Reflection.Tests
[InlineData(typeof(Int32Attr), 77, "Int32AttrSimple")]
[InlineData(typeof(Int64Attr), (Int64)77, "Int64AttrSimple")]
[InlineData(typeof(StringAttr), "hello", "StringAttrSimple")]
- [InlineData(typeof(EnumAttr), MyColorEnum.GREEN, "EnumAttrSimple")]
+ [InlineData(typeof(EnumAttr), PublicEnum.Case1, "EnumAttrSimple")]
public static void CustomAttributesTest<CtorArg, NamedArg>(Type attrType, CtorArg expectedCtorValue, NamedArg expectedNamedValue)
{
Module module = typeof(ModuleTest).GetTypeInfo().Module;
diff --git a/src/System.Reflection/tests/Assembly/EmbeddedImage.png b/src/System.Reflection/tests/Resources/EmbeddedImage.png
index 97ef4f97ba..97ef4f97ba 100644
--- a/src/System.Reflection/tests/Assembly/EmbeddedImage.png
+++ b/src/System.Reflection/tests/Resources/EmbeddedImage.png
Binary files differ
diff --git a/src/System.Reflection/tests/ManifestResourceInfo/ResourceTextFile.txt b/src/System.Reflection/tests/Resources/ResourceTextFile.txt
index 5f282702bb..5f282702bb 100644
--- a/src/System.Reflection/tests/ManifestResourceInfo/ResourceTextFile.txt
+++ b/src/System.Reflection/tests/Resources/ResourceTextFile.txt
diff --git a/src/System.Reflection/tests/System.Reflection.Tests.csproj b/src/System.Reflection/tests/System.Reflection.Tests.csproj
index 345db8abb5..713f26792d 100644
--- a/src/System.Reflection/tests/System.Reflection.Tests.csproj
+++ b/src/System.Reflection/tests/System.Reflection.Tests.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
@@ -24,21 +24,7 @@
<Compile Include="AssemblyName\AssemblyName_ProcessorArchitectureTests.cs" />
<Compile Include="AssemblyName\AssemblyName_PropertyTests.cs" />
<Compile Include="AssemblyName\CultureName.cs" />
- <Compile Include="Assembly\Assembly_CustomAttributeTests.cs" />
- <Compile Include="Assembly\Assembly_DefinedTypeTests.cs" />
- <Compile Include="Assembly\Assembly_EntryPointTests.cs" />
- <Compile Include="Assembly\Assembly_EmbeddedFiles.cs" />
- <Compile Include="Assembly\Assembly_EqualsTests.cs" />
- <Compile Include="Assembly\Assembly_ExportedTypesTests.cs" />
- <Compile Include="Assembly\Assembly_GetHashcodeTests.cs" />
- <Compile Include="Assembly\Assembly_GetTypeTests.cs" />
- <Compile Include="Assembly\Assembly_IsDynamicTests.cs" />
- <Compile Include="Assembly\Assembly_LoadTests.cs" />
- <Compile Include="Assembly\Assembly_LocationTests.cs" />
- <Compile Include="Assembly\Assembly_Members.cs" />
- <Compile Include="Assembly\Assembly_ModulesTests.cs" />
- <Compile Include="Assembly\Assembly_ToStringTests.cs" />
- <Compile Include="Assembly\Assembly_GetEntryAssembly.cs" />
+ <Compile Include="AssemblyTests.cs" />
<Compile Include="Common\ReflectionTestData.cs" />
<Compile Include="ConstructorInfoTests.cs" />
<Compile Include="EventInfo\EventInfo_Members.cs" />
@@ -65,6 +51,7 @@
<Compile Include="MethodInfo\MethodInfo_SpecialReturnTypeTests.cs" />
<Compile Include="MethodInfo\MethodInfo_ToStringTests.cs" />
<Compile Include="Module\ModuleTests.cs" />
+ <Compile Include="Common.cs" />
<Compile Include="ParameterInfoTests.cs" />
<Compile Include="PropertyInfo\PropertyInfo_GetConstantValueTests.cs" />
<Compile Include="PropertyInfo\PropertyInfo_GetSetMethodTests.cs" />
@@ -97,10 +84,10 @@
<Compile Include="ExceptionTests.cs" />
</ItemGroup>
<ItemGroup>
- <EmbeddedResource Include="Assembly\EmbeddedImage.png">
+ <EmbeddedResource Include="Resources\EmbeddedImage.png">
<LogicalName>EmbeddedImage.png</LogicalName>
</EmbeddedResource>
- <EmbeddedResource Include="ManifestResourceInfo\ResourceTextFile.txt">
+ <EmbeddedResource Include="Resources\ResourceTextFile.txt">
<LogicalName>ResourceTextFile.txt</LogicalName>
</EmbeddedResource>
</ItemGroup>
diff --git a/src/System.Resources.Reader/dir.props b/src/System.Resources.Reader/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Resources.Reader/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Resources.Reader/ref/System.Resources.Reader.csproj b/src/System.Resources.Reader/ref/System.Resources.Reader.csproj
index dd960ce098..e27628a9a6 100644
--- a/src/System.Resources.Reader/ref/System.Resources.Reader.csproj
+++ b/src/System.Resources.Reader/ref/System.Resources.Reader.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Resources.Reader/src/System.Resources.Reader.csproj b/src/System.Resources.Reader/src/System.Resources.Reader.csproj
index 13f692ea73..b7c17b5cbf 100644
--- a/src/System.Resources.Reader/src/System.Resources.Reader.csproj
+++ b/src/System.Resources.Reader/src/System.Resources.Reader.csproj
@@ -4,10 +4,8 @@
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>System.Resources.Reader</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<RootNamespace>System.Resources</RootNamespace>
<ProjectGuid>{16EE5522-F387-4C9E-9EF2-B5134B043F37}</ProjectGuid>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Resources.ResourceManager/dir.props b/src/System.Resources.ResourceManager/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Resources.ResourceManager/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Resources.ResourceManager/pkg/System.Resources.ResourceManager.pkgproj b/src/System.Resources.ResourceManager/pkg/System.Resources.ResourceManager.pkgproj
index d964797f62..1e4c5c89f2 100644
--- a/src/System.Resources.ResourceManager/pkg/System.Resources.ResourceManager.pkgproj
+++ b/src/System.Resources.ResourceManager/pkg/System.Resources.ResourceManager.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Resources.ResourceManager.csproj">
diff --git a/src/System.Resources.ResourceManager/pkg/ValidationSuppression.txt b/src/System.Resources.ResourceManager/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Resources.ResourceManager/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Resources.ResourceManager/pkg/aot/System.Resources.ResourceManager.pkgproj b/src/System.Resources.ResourceManager/pkg/aot/System.Resources.ResourceManager.pkgproj
index 47d414eaa9..849847035a 100644
--- a/src/System.Resources.ResourceManager/pkg/aot/System.Resources.ResourceManager.pkgproj
+++ b/src/System.Resources.ResourceManager/pkg/aot/System.Resources.ResourceManager.pkgproj
@@ -3,7 +3,6 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.0.2.0</Version>
<PackageTargetRuntime>aot</PackageTargetRuntime>
<PreventImplementationReference>true</PreventImplementationReference>
</PropertyGroup>
diff --git a/src/System.Resources.ResourceManager/ref/System.Resources.ResourceManager.csproj b/src/System.Resources.ResourceManager/ref/System.Resources.ResourceManager.csproj
index 5670d68b49..387ed6a9e0 100644
--- a/src/System.Resources.ResourceManager/ref/System.Resources.ResourceManager.csproj
+++ b/src/System.Resources.ResourceManager/ref/System.Resources.ResourceManager.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Resources.ResourceManager/src/System.Resources.ResourceManager.csproj b/src/System.Resources.ResourceManager/src/System.Resources.ResourceManager.csproj
index 59b0deafdd..5d910ca1c9 100644
--- a/src/System.Resources.ResourceManager/src/System.Resources.ResourceManager.csproj
+++ b/src/System.Resources.ResourceManager/src/System.Resources.ResourceManager.csproj
@@ -3,11 +3,9 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Resources.ResourceManager</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' != 'netcore50aot'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' != 'netcore50aot'">None</ResourcesSourceOutputDirectory>
<SkipCommonResourcesIncludes Condition="'$(TargetGroup)'=='netcore50aot'">true</SkipCommonResourcesIncludes>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Resources.Writer/dir.props b/src/System.Resources.Writer/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Resources.Writer/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Resources.Writer/ref/System.Resources.Writer.csproj b/src/System.Resources.Writer/ref/System.Resources.Writer.csproj
index 7f57d3c266..90647b6c51 100644
--- a/src/System.Resources.Writer/ref/System.Resources.Writer.csproj
+++ b/src/System.Resources.Writer/ref/System.Resources.Writer.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Resources.Writer/src/System.Resources.Writer.csproj b/src/System.Resources.Writer/src/System.Resources.Writer.csproj
index 7834c8ac5d..ddaf23ae87 100644
--- a/src/System.Resources.Writer/src/System.Resources.Writer.csproj
+++ b/src/System.Resources.Writer/src/System.Resources.Writer.csproj
@@ -4,9 +4,7 @@
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>System.Resources.Writer</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<RootNamespace>System.Resources</RootNamespace>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.il b/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.il
index 0c13f9cfca..0f28a171bf 100644
--- a/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.il
+++ b/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.il
@@ -41,7 +41,7 @@
01 00 00 00 00
) // false
.hash algorithm 0x00008004
- .ver 4:0:0:0
+ .ver 4:0:2:0
}
.module System.Runtime.CompilerServices.Unsafe.dll
// MVID: {1E97D84A-565B-49C5-B60A-F31A1A4ACE13}
diff --git a/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.ilproj b/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.ilproj
index 1d015dec99..49655c2316 100644
--- a/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.ilproj
+++ b/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.ilproj
@@ -3,7 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
+ <NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
<DocumentationFile>$(MSBuildThisFileDirectory)System.Runtime.CompilerServices.Unsafe.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.CompilerServices.VisualC/dir.props b/src/System.Runtime.CompilerServices.VisualC/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Runtime.CompilerServices.VisualC/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.csproj b/src/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.csproj
index 72d89ed1c6..ffe86b23a4 100644
--- a/src/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.csproj
+++ b/src/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.CompilerServices.VisualC/src/System.Runtime.CompilerServices.VisualC.csproj b/src/System.Runtime.CompilerServices.VisualC/src/System.Runtime.CompilerServices.VisualC.csproj
index ccb269211b..a21c9e1104 100644
--- a/src/System.Runtime.CompilerServices.VisualC/src/System.Runtime.CompilerServices.VisualC.csproj
+++ b/src/System.Runtime.CompilerServices.VisualC/src/System.Runtime.CompilerServices.VisualC.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Runtime.CompilerServices.VisualC</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Runtime.Extensions/dir.props b/src/System.Runtime.Extensions/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.Runtime.Extensions/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Runtime.Extensions/ref/4.0.0/System.Runtime.Extensions.depproj b/src/System.Runtime.Extensions/ref/4.0.0/System.Runtime.Extensions.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Runtime.Extensions/ref/4.0.0/System.Runtime.Extensions.depproj
+++ b/src/System.Runtime.Extensions/ref/4.0.0/System.Runtime.Extensions.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.Extensions/ref/4.0.10/System.Runtime.Extensions.depproj b/src/System.Runtime.Extensions/ref/4.0.10/System.Runtime.Extensions.depproj
index 61ed42e3a5..e67a3176b2 100644
--- a/src/System.Runtime.Extensions/ref/4.0.10/System.Runtime.Extensions.depproj
+++ b/src/System.Runtime.Extensions/ref/4.0.10/System.Runtime.Extensions.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.Extensions/ref/System.Runtime.Extensions.csproj b/src/System.Runtime.Extensions/ref/System.Runtime.Extensions.csproj
index 0206d13605..e94f49d319 100644
--- a/src/System.Runtime.Extensions/ref/System.Runtime.Extensions.csproj
+++ b/src/System.Runtime.Extensions/ref/System.Runtime.Extensions.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.2.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj b/src/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj
index 61a832eaf5..c410426306 100644
--- a/src/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj
+++ b/src/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj
@@ -7,7 +7,6 @@
<PropertyGroup>
<ProjectGuid>{845D2B72-D8A4-42E5-9BE9-17639EC4FC1A}</ProjectGuid>
<AssemblyName>System.Runtime.Extensions</AssemblyName>
- <AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)'=='netstandard1.5' Or '$(TargetGroup)'=='net462' Or '$(TargetGroup)'=='netcore50' Or '$(TargetGroup)'=='netcore50aot' Or '$(TargetGroup)'=='netstandard15aot'">4.1.1.0</AssemblyVersion>
<ContractProject Condition="'$(AssemblyVersion)'=='4.1.1.0'">../ref/4.1.0/System.Runtime.Extensions.depproj</ContractProject>
<OutputType>Library</OutputType>
@@ -16,7 +15,7 @@
<!-- System.IO.Path conflicts between type in partial facade and in mscorlib -->
<NoWarn>0436</NoWarn>
<PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.7</PackageTargetFramework>
- <NuGetTargetMoniker Condition="'$(TargetGroup)'=='netstandard1.5'">.NETCoreApp,Version=v1.0</NuGetTargetMoniker>
+ <NuGetTargetMoniker Condition="'$(TargetGroup)'=='netstandard1.5'">.NETStandard,Version=v1.5</NuGetTargetMoniker>
<CoreClrOrCorRt Condition="'$(TargetGroup)' == '' Or '$(TargetGroup)' == 'netstandard1.5' Or '$(TargetGroup)' == 'netstandard15aot'">true</CoreClrOrCorRt>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Runtime.Extensions/src/netstandard15aot/project.json b/src/System.Runtime.Extensions/src/netstandard15aot/project.json
new file mode 100644
index 0000000000..3e5a615752
--- /dev/null
+++ b/src/System.Runtime.Extensions/src/netstandard15aot/project.json
@@ -0,0 +1,12 @@
+{
+ "frameworks": {
+ "netstandard1.5": {
+ "imports": [
+ "netcore50"
+ ],
+ "dependencies": {
+ "Microsoft.TargetingPack.Private.NETNative": "1.0.1-beta-24430-00"
+ }
+ }
+ }
+}
diff --git a/src/System.Runtime.Extensions/src/project.json b/src/System.Runtime.Extensions/src/project.json
index f2dd39fa2e..3d2b6985a4 100644
--- a/src/System.Runtime.Extensions/src/project.json
+++ b/src/System.Runtime.Extensions/src/project.json
@@ -1,6 +1,6 @@
{
"frameworks": {
- "netcoreapp1.0": {
+ "netstandard1.5": {
"dependencies": {
"Microsoft.TargetingPack.Private.CoreCLR": "1.1.0-beta-24431-03"
},
diff --git a/src/System.Runtime.Handles/dir.props b/src/System.Runtime.Handles/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Runtime.Handles/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Runtime.Handles/pkg/System.Runtime.Handles.pkgproj b/src/System.Runtime.Handles/pkg/System.Runtime.Handles.pkgproj
index dd5bf771ae..2d7fb3e0ff 100644
--- a/src/System.Runtime.Handles/pkg/System.Runtime.Handles.pkgproj
+++ b/src/System.Runtime.Handles/pkg/System.Runtime.Handles.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Runtime.Handles.csproj">
diff --git a/src/System.Runtime.Handles/pkg/ValidationSuppression.txt b/src/System.Runtime.Handles/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Runtime.Handles/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Runtime.Handles/ref/System.Runtime.Handles.csproj b/src/System.Runtime.Handles/ref/System.Runtime.Handles.csproj
index 77b000b072..936e70a486 100644
--- a/src/System.Runtime.Handles/ref/System.Runtime.Handles.csproj
+++ b/src/System.Runtime.Handles/ref/System.Runtime.Handles.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.Handles/src/System.Runtime.Handles.csproj b/src/System.Runtime.Handles/src/System.Runtime.Handles.csproj
index 7c2622adfe..fc36d24a2d 100644
--- a/src/System.Runtime.Handles/src/System.Runtime.Handles.csproj
+++ b/src/System.Runtime.Handles/src/System.Runtime.Handles.csproj
@@ -4,9 +4,7 @@
<PropertyGroup>
<ProjectGuid>{D85EE71C-F05B-4331-9300-8E2833D49E19}</ProjectGuid>
<AssemblyName>System.Runtime.Handles</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Runtime.InteropServices.RuntimeInformation/dir.props b/src/System.Runtime.InteropServices.RuntimeInformation/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Runtime.InteropServices.RuntimeInformation/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Runtime.InteropServices.RuntimeInformation/ref/System.Runtime.InteropServices.RuntimeInformation.csproj b/src/System.Runtime.InteropServices.RuntimeInformation/ref/System.Runtime.InteropServices.RuntimeInformation.csproj
index 1be23cbbf7..f64bc686c3 100644
--- a/src/System.Runtime.InteropServices.RuntimeInformation/ref/System.Runtime.InteropServices.RuntimeInformation.csproj
+++ b/src/System.Runtime.InteropServices.RuntimeInformation/ref/System.Runtime.InteropServices.RuntimeInformation.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.InteropServices.RuntimeInformation/src/System.Runtime.InteropServices.RuntimeInformation.csproj b/src/System.Runtime.InteropServices.RuntimeInformation/src/System.Runtime.InteropServices.RuntimeInformation.csproj
index 5ae30b8804..09ff6edc36 100644
--- a/src/System.Runtime.InteropServices.RuntimeInformation/src/System.Runtime.InteropServices.RuntimeInformation.csproj
+++ b/src/System.Runtime.InteropServices.RuntimeInformation/src/System.Runtime.InteropServices.RuntimeInformation.csproj
@@ -10,9 +10,7 @@
<OutputType>Library</OutputType>
<RootNamespace>System.Runtime.InteropServices</RootNamespace>
<AssemblyName>System.Runtime.InteropServices.RuntimeInformation</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<ProjectGuid>{F9DF2357-81B4-4317-908E-512DA9395583}</ProjectGuid>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.1</PackageTargetFramework>
<DefineConstants Condition="'$(TargetGroup)'=='net45'">net45</DefineConstants>
<DefineConstants Condition="'$(TargetGroup)'=='wpa81'">wpa81</DefineConstants>
<DefineConstants Condition="'$(TargetGroup)'=='win8'">win8</DefineConstants>
diff --git a/src/System.Runtime.InteropServices.WindowsRuntime/dir.props b/src/System.Runtime.InteropServices.WindowsRuntime/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Runtime.InteropServices.WindowsRuntime/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Runtime.InteropServices.WindowsRuntime/pkg/System.Runtime.InteropServices.WindowsRuntime.pkgproj b/src/System.Runtime.InteropServices.WindowsRuntime/pkg/System.Runtime.InteropServices.WindowsRuntime.pkgproj
index 07f643eb3b..14187fc366 100644
--- a/src/System.Runtime.InteropServices.WindowsRuntime/pkg/System.Runtime.InteropServices.WindowsRuntime.pkgproj
+++ b/src/System.Runtime.InteropServices.WindowsRuntime/pkg/System.Runtime.InteropServices.WindowsRuntime.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Runtime.InteropServices.WindowsRuntime.csproj">
diff --git a/src/System.Runtime.InteropServices.WindowsRuntime/pkg/ValidationSuppression.txt b/src/System.Runtime.InteropServices.WindowsRuntime/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Runtime.InteropServices.WindowsRuntime/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Runtime.InteropServices.WindowsRuntime/ref/System.Runtime.InteropServices.WindowsRuntime.csproj b/src/System.Runtime.InteropServices.WindowsRuntime/ref/System.Runtime.InteropServices.WindowsRuntime.csproj
index deb48d48e7..000abdbf90 100644
--- a/src/System.Runtime.InteropServices.WindowsRuntime/ref/System.Runtime.InteropServices.WindowsRuntime.csproj
+++ b/src/System.Runtime.InteropServices.WindowsRuntime/ref/System.Runtime.InteropServices.WindowsRuntime.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.InteropServices.WindowsRuntime/src/System.Runtime.InteropServices.WindowsRuntime.csproj b/src/System.Runtime.InteropServices.WindowsRuntime/src/System.Runtime.InteropServices.WindowsRuntime.csproj
index 34e2672e06..7cecaa983c 100644
--- a/src/System.Runtime.InteropServices.WindowsRuntime/src/System.Runtime.InteropServices.WindowsRuntime.csproj
+++ b/src/System.Runtime.InteropServices.WindowsRuntime/src/System.Runtime.InteropServices.WindowsRuntime.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Runtime.InteropServices.WindowsRuntime</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)'==''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Runtime.InteropServices/dir.props b/src/System.Runtime.InteropServices/dir.props
new file mode 100644
index 0000000000..ec6b27dedd
--- /dev/null
+++ b/src/System.Runtime.InteropServices/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.2.0.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Runtime.InteropServices/pkg/aot/System.Runtime.InteropServices.pkgproj b/src/System.Runtime.InteropServices/pkg/aot/System.Runtime.InteropServices.pkgproj
index e6caff9151..6b30cdf063 100644
--- a/src/System.Runtime.InteropServices/pkg/aot/System.Runtime.InteropServices.pkgproj
+++ b/src/System.Runtime.InteropServices/pkg/aot/System.Runtime.InteropServices.pkgproj
@@ -3,7 +3,6 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.1.1</Version>
<PackageTargetRuntime>aot</PackageTargetRuntime>
<PreventImplementationReference>true</PreventImplementationReference>
</PropertyGroup>
diff --git a/src/System.Runtime.InteropServices/ref/4.0.0/System.Runtime.InteropServices.depproj b/src/System.Runtime.InteropServices/ref/4.0.0/System.Runtime.InteropServices.depproj
index 29f2b6abda..5df1469c14 100644
--- a/src/System.Runtime.InteropServices/ref/4.0.0/System.Runtime.InteropServices.depproj
+++ b/src/System.Runtime.InteropServices/ref/4.0.0/System.Runtime.InteropServices.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.InteropServices/ref/4.0.10/System.Runtime.InteropServices.depproj b/src/System.Runtime.InteropServices/ref/4.0.10/System.Runtime.InteropServices.depproj
index 7aa0e70c3a..364b923bfc 100644
--- a/src/System.Runtime.InteropServices/ref/4.0.10/System.Runtime.InteropServices.depproj
+++ b/src/System.Runtime.InteropServices/ref/4.0.10/System.Runtime.InteropServices.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.2</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.2</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.InteropServices/ref/4.0.20/System.Runtime.InteropServices.depproj b/src/System.Runtime.InteropServices/ref/4.0.20/System.Runtime.InteropServices.depproj
index 2c8e3437c1..53806b0292 100644
--- a/src/System.Runtime.InteropServices/ref/4.0.20/System.Runtime.InteropServices.depproj
+++ b/src/System.Runtime.InteropServices/ref/4.0.20/System.Runtime.InteropServices.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.InteropServices/ref/4.1/System.Runtime.InteropServices.depproj b/src/System.Runtime.InteropServices/ref/4.1/System.Runtime.InteropServices.depproj
index 73aa35f607..fff837f016 100644
--- a/src/System.Runtime.InteropServices/ref/4.1/System.Runtime.InteropServices.depproj
+++ b/src/System.Runtime.InteropServices/ref/4.1/System.Runtime.InteropServices.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.5</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.5</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.csproj b/src/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.csproj
index 5082877cad..62d736496b 100644
--- a/src/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.csproj
+++ b/src/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.csproj
@@ -6,9 +6,7 @@
to its own obsolete API. -->
<NoWarn>618</NoWarn>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <AssemblyVersion>4.2.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.6</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.6</NuGetTargetMoniker>
<ProjectGuid>{B17014F1-D902-417F-89B0-271204695831}</ProjectGuid>
</PropertyGroup>
diff --git a/src/System.Runtime.InteropServices/src/System.Runtime.InteropServices.csproj b/src/System.Runtime.InteropServices/src/System.Runtime.InteropServices.csproj
index 6dce97413d..338b88a953 100644
--- a/src/System.Runtime.InteropServices/src/System.Runtime.InteropServices.csproj
+++ b/src/System.Runtime.InteropServices/src/System.Runtime.InteropServices.csproj
@@ -4,12 +4,10 @@
<PropertyGroup>
<ProjectGuid>{EC6AA4D9-B3E8-4CCA-8AB1-8BBFD89266AE}</ProjectGuid>
<AssemblyName>System.Runtime.InteropServices</AssemblyName>
- <AssemblyVersion>4.2.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<!-- Force string resources to be excluded for full facades. -->
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' != ''">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.6</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.6</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.cs b/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.cs
index d8982abf91..89915abbe5 100644
--- a/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.cs
+++ b/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.cs
@@ -128,5 +128,15 @@ namespace System.Runtime.InteropServices
Assert.Equal((byte)i, Marshal.ReadByte(p + i));
}
}
+
+ [Fact]
+ public static void GetHRForException()
+ {
+ Assert.Equal(0, Marshal.GetHRForException(null));
+
+ Exception e = new Exception();
+ Assert.InRange(Marshal.GetHRForException(e), int.MinValue, -1);
+ Assert.Equal(e.HResult, Marshal.GetHRForException(e));
+ }
}
}
diff --git a/src/System.Runtime.Loader/dir.props b/src/System.Runtime.Loader/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Runtime.Loader/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Runtime.Loader/ref/System.Runtime.Loader.csproj b/src/System.Runtime.Loader/ref/System.Runtime.Loader.csproj
index 33d5b702c4..7f63f74d88 100644
--- a/src/System.Runtime.Loader/ref/System.Runtime.Loader.csproj
+++ b/src/System.Runtime.Loader/ref/System.Runtime.Loader.csproj
@@ -2,10 +2,8 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <PackageTargetFramework>netstandard1.5</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.5</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.Loader/src/System.Runtime.Loader.csproj b/src/System.Runtime.Loader/src/System.Runtime.Loader.csproj
index dbf1eb3edf..dbe30f3806 100644
--- a/src/System.Runtime.Loader/src/System.Runtime.Loader.csproj
+++ b/src/System.Runtime.Loader/src/System.Runtime.Loader.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Runtime.Loader</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.5</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.5</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Runtime.Numerics/dir.props b/src/System.Runtime.Numerics/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Runtime.Numerics/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Runtime.Numerics/pkg/System.Runtime.Numerics.pkgproj b/src/System.Runtime.Numerics/pkg/System.Runtime.Numerics.pkgproj
index 253dbfa4bf..ee0bc221ea 100644
--- a/src/System.Runtime.Numerics/pkg/System.Runtime.Numerics.pkgproj
+++ b/src/System.Runtime.Numerics/pkg/System.Runtime.Numerics.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Runtime.Numerics.csproj">
diff --git a/src/System.Runtime.Numerics/pkg/ValidationSuppression.txt b/src/System.Runtime.Numerics/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Runtime.Numerics/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Runtime.Numerics/ref/System.Runtime.Numerics.csproj b/src/System.Runtime.Numerics/ref/System.Runtime.Numerics.csproj
index 5ac2995634..501e0c7d90 100644
--- a/src/System.Runtime.Numerics/ref/System.Runtime.Numerics.csproj
+++ b/src/System.Runtime.Numerics/ref/System.Runtime.Numerics.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.Numerics/src/System.Runtime.Numerics.csproj b/src/System.Runtime.Numerics/src/System.Runtime.Numerics.csproj
index 5ed903aa28..6cb96d94fd 100644
--- a/src/System.Runtime.Numerics/src/System.Runtime.Numerics.csproj
+++ b/src/System.Runtime.Numerics/src/System.Runtime.Numerics.csproj
@@ -5,12 +5,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>System.Numerics</RootNamespace>
<AssemblyName>System.Runtime.Numerics</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ProjectGuid>{D2C99D27-0BEF-4319-ADB3-05CBEBA8F69B}</ProjectGuid>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Runtime.Serialization.Formatters/dir.props b/src/System.Runtime.Serialization.Formatters/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Runtime.Serialization.Formatters/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Runtime.Serialization.Formatters/ref/System.Runtime.Serialization.Formatters.csproj b/src/System.Runtime.Serialization.Formatters/ref/System.Runtime.Serialization.Formatters.csproj
index fed1f98c9f..acffb71869 100644
--- a/src/System.Runtime.Serialization.Formatters/ref/System.Runtime.Serialization.Formatters.csproj
+++ b/src/System.Runtime.Serialization.Formatters/ref/System.Runtime.Serialization.Formatters.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.Serialization.Formatters/src/System.Runtime.Serialization.Formatters.csproj b/src/System.Runtime.Serialization.Formatters/src/System.Runtime.Serialization.Formatters.csproj
index 0121e76211..78ec5f989b 100644
--- a/src/System.Runtime.Serialization.Formatters/src/System.Runtime.Serialization.Formatters.csproj
+++ b/src/System.Runtime.Serialization.Formatters/src/System.Runtime.Serialization.Formatters.csproj
@@ -4,11 +4,8 @@
<PropertyGroup>
<ProjectGuid>{CA488507-3B6E-4494-B7BE-7B4EEEB2C4D1}</ProjectGuid>
<AssemblyName>System.Runtime.Serialization.Formatters</AssemblyName>
- <!-- rev'ed to 4.0.1.0 even though 4.0.0.0 never shipped so that we can drop pre-release down to beta -->
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<RootNamespace>System.Runtime.Serialization.Formatters</RootNamespace>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net463'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Runtime.Serialization.Json/dir.props b/src/System.Runtime.Serialization.Json/dir.props
new file mode 100644
index 0000000000..c218f90328
--- /dev/null
+++ b/src/System.Runtime.Serialization.Json/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.3.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Runtime.Serialization.Json/pkg/System.Runtime.Serialization.Json.pkgproj b/src/System.Runtime.Serialization.Json/pkg/System.Runtime.Serialization.Json.pkgproj
index af12513cee..3b3fc1eecb 100644
--- a/src/System.Runtime.Serialization.Json/pkg/System.Runtime.Serialization.Json.pkgproj
+++ b/src/System.Runtime.Serialization.Json/pkg/System.Runtime.Serialization.Json.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.3.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Runtime.Serialization.Json.csproj">
diff --git a/src/System.Runtime.Serialization.Json/pkg/ValidationSuppression.txt b/src/System.Runtime.Serialization.Json/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Runtime.Serialization.Json/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Runtime.Serialization.Json/ref/System.Runtime.Serialization.Json.csproj b/src/System.Runtime.Serialization.Json/ref/System.Runtime.Serialization.Json.csproj
index a1aad8c081..f46f15ca1b 100644
--- a/src/System.Runtime.Serialization.Json/ref/System.Runtime.Serialization.Json.csproj
+++ b/src/System.Runtime.Serialization.Json/ref/System.Runtime.Serialization.Json.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.Serialization.Json/src/System.Runtime.Serialization.Json.csproj b/src/System.Runtime.Serialization.Json/src/System.Runtime.Serialization.Json.csproj
index 689c80ff71..6b17b00d19 100644
--- a/src/System.Runtime.Serialization.Json/src/System.Runtime.Serialization.Json.csproj
+++ b/src/System.Runtime.Serialization.Json/src/System.Runtime.Serialization.Json.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Runtime.Serialization.Json</AssemblyName>
- <AssemblyVersion>4.0.3.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Runtime.Serialization.Primitives/dir.props b/src/System.Runtime.Serialization.Primitives/dir.props
new file mode 100644
index 0000000000..0e3e20c392
--- /dev/null
+++ b/src/System.Runtime.Serialization.Primitives/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Runtime.Serialization.Primitives/ref/4.0.0/System.Runtime.Serialization.Primitives.depproj b/src/System.Runtime.Serialization.Primitives/ref/4.0.0/System.Runtime.Serialization.Primitives.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Runtime.Serialization.Primitives/ref/4.0.0/System.Runtime.Serialization.Primitives.depproj
+++ b/src/System.Runtime.Serialization.Primitives/ref/4.0.0/System.Runtime.Serialization.Primitives.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.csproj b/src/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.csproj
index 0c34832477..800e9a12cd 100644
--- a/src/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.csproj
+++ b/src/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.2.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.Serialization.Primitives/src/System.Runtime.Serialization.Primitives.csproj b/src/System.Runtime.Serialization.Primitives/src/System.Runtime.Serialization.Primitives.csproj
index 4c7bde0b7e..936bbfae42 100644
--- a/src/System.Runtime.Serialization.Primitives/src/System.Runtime.Serialization.Primitives.csproj
+++ b/src/System.Runtime.Serialization.Primitives/src/System.Runtime.Serialization.Primitives.csproj
@@ -3,7 +3,6 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Runtime.Serialization.Primitives</AssemblyName>
- <AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)'=='netstandard1.3' Or '$(TargetGroup)'=='net46' Or '$(TargetGroup)'=='netcore50aot'">4.1.1.0</AssemblyVersion>
<ContractProject Condition="'$(AssemblyVersion)'=='4.1.1.0'">../ref/4.1.1/System.Runtime.Serialization.Primitives.depproj</ContractProject>
<RootNamespace>System.Runtime.Serialization.Primitives</RootNamespace>
@@ -12,7 +11,6 @@
<FileAlignment>512</FileAlignment>
<PlatformTarget>AnyCPU</PlatformTarget>
<ProjectGuid>{CDF0ACB5-1361-4E48-8ECB-22E8022F5F01}</ProjectGuid>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)'==''">netstandard1.7</PackageTargetFramework>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net46' Or '$(TargetGroup)'=='net463'">true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.Runtime.Serialization.Xml/dir.props b/src/System.Runtime.Serialization.Xml/dir.props
new file mode 100644
index 0000000000..0e3e20c392
--- /dev/null
+++ b/src/System.Runtime.Serialization.Xml/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Runtime.Serialization.Xml/pkg/ValidationSuppression.txt b/src/System.Runtime.Serialization.Xml/pkg/ValidationSuppression.txt
deleted file mode 100644
index 878d258503..0000000000
--- a/src/System.Runtime.Serialization.Xml/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Remove once we can OOB this to desktop
-PermitPortableVersionMismatch=.NETFramework,Version=v4.6.1;.NETFramework,Version=v4.6
diff --git a/src/System.Runtime.Serialization.Xml/ref/4.0.0/System.Runtime.Serialization.Xml.depproj b/src/System.Runtime.Serialization.Xml/ref/4.0.0/System.Runtime.Serialization.Xml.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Runtime.Serialization.Xml/ref/4.0.0/System.Runtime.Serialization.Xml.depproj
+++ b/src/System.Runtime.Serialization.Xml/ref/4.0.0/System.Runtime.Serialization.Xml.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.Serialization.Xml/ref/System.Runtime.Serialization.Xml.csproj b/src/System.Runtime.Serialization.Xml/ref/System.Runtime.Serialization.Xml.csproj
index 4e4101ef08..20a8a90f1e 100644
--- a/src/System.Runtime.Serialization.Xml/ref/System.Runtime.Serialization.Xml.csproj
+++ b/src/System.Runtime.Serialization.Xml/ref/System.Runtime.Serialization.Xml.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.2.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.Serialization.Xml/src/System.Runtime.Serialization.Xml.csproj b/src/System.Runtime.Serialization.Xml/src/System.Runtime.Serialization.Xml.csproj
index 33bb487092..43e556fe57 100644
--- a/src/System.Runtime.Serialization.Xml/src/System.Runtime.Serialization.Xml.csproj
+++ b/src/System.Runtime.Serialization.Xml/src/System.Runtime.Serialization.Xml.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Runtime.Serialization.Xml</AssemblyName>
- <AssemblyVersion>4.1.2.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Runtime.WindowsRuntime.UI.Xaml/dir.props b/src/System.Runtime.WindowsRuntime.UI.Xaml/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Runtime.WindowsRuntime.UI.Xaml/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Runtime.WindowsRuntime.UI.Xaml/pkg/System.Runtime.WindowsRuntime.UI.Xaml.pkgproj b/src/System.Runtime.WindowsRuntime.UI.Xaml/pkg/System.Runtime.WindowsRuntime.UI.Xaml.pkgproj
index bc1975811e..86671c2880 100644
--- a/src/System.Runtime.WindowsRuntime.UI.Xaml/pkg/System.Runtime.WindowsRuntime.UI.Xaml.pkgproj
+++ b/src/System.Runtime.WindowsRuntime.UI.Xaml/pkg/System.Runtime.WindowsRuntime.UI.Xaml.pkgproj
@@ -13,6 +13,11 @@
<InboxOnTargetFramework Include="wpa81"/>
<InboxOnTargetFramework Include="portable-win8+wpa81" />
</ItemGroup>
-
+ <ItemGroup>
+ <!-- This package is only supported on win8 and later RIDs -->
+ <ValidatePackageSuppression Include="PermitImplementation">
+ <Value>.NETCoreApp,Version=v1.1/win10-arm64</Value>
+ </ValidatePackageSuppression>
+ </ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project> \ No newline at end of file
diff --git a/src/System.Runtime.WindowsRuntime.UI.Xaml/pkg/ValidationSuppression.txt b/src/System.Runtime.WindowsRuntime.UI.Xaml/pkg/ValidationSuppression.txt
deleted file mode 100644
index 9b59987d06..0000000000
--- a/src/System.Runtime.WindowsRuntime.UI.Xaml/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1 +0,0 @@
-PermitImplementation=.NETCoreApp,Version=v1.1/win10-arm64 \ No newline at end of file
diff --git a/src/System.Runtime.WindowsRuntime.UI.Xaml/ref/System.Runtime.WindowsRuntime.UI.Xaml.csproj b/src/System.Runtime.WindowsRuntime.UI.Xaml/ref/System.Runtime.WindowsRuntime.UI.Xaml.csproj
index a8c5999f59..91328cdf53 100644
--- a/src/System.Runtime.WindowsRuntime.UI.Xaml/ref/System.Runtime.WindowsRuntime.UI.Xaml.csproj
+++ b/src/System.Runtime.WindowsRuntime.UI.Xaml/ref/System.Runtime.WindowsRuntime.UI.Xaml.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<UseECMAKey Condition="'$(UseECMAKey)' == ''">true</UseECMAKey>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.WindowsRuntime.UI.Xaml/src/System.Runtime.WindowsRuntime.UI.Xaml.csproj b/src/System.Runtime.WindowsRuntime.UI.Xaml/src/System.Runtime.WindowsRuntime.UI.Xaml.csproj
index 518c35f947..2435962dcc 100644
--- a/src/System.Runtime.WindowsRuntime.UI.Xaml/src/System.Runtime.WindowsRuntime.UI.Xaml.csproj
+++ b/src/System.Runtime.WindowsRuntime.UI.Xaml/src/System.Runtime.WindowsRuntime.UI.Xaml.csproj
@@ -5,8 +5,6 @@
<AssemblyName>System.Runtime.WindowsRuntime.UI.Xaml</AssemblyName>
<ProjectGuid>{263DA4F1-C3BC-4B43-98E7-9F38B419A131}</ProjectGuid>
<UseECMAKey Condition="'$(UseECMAKey)' == ''">true</UseECMAKey>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)'==''">netstandard1.3</PackageTargetFramework>
<PackageTargetRuntime>win8</PackageTargetRuntime>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.Runtime.WindowsRuntime/dir.props b/src/System.Runtime.WindowsRuntime/dir.props
new file mode 100644
index 0000000000..d16ef39bdb
--- /dev/null
+++ b/src/System.Runtime.WindowsRuntime/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.12.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Runtime.WindowsRuntime/pkg/System.Runtime.WindowsRuntime.pkgproj b/src/System.Runtime.WindowsRuntime/pkg/System.Runtime.WindowsRuntime.pkgproj
index 3d81fe9f17..497cc61b21 100644
--- a/src/System.Runtime.WindowsRuntime/pkg/System.Runtime.WindowsRuntime.pkgproj
+++ b/src/System.Runtime.WindowsRuntime/pkg/System.Runtime.WindowsRuntime.pkgproj
@@ -17,6 +17,11 @@
<InboxOnTargetFramework Include="wpa81" />
<InboxOnTargetFramework Include="portable-win8+wp8+wpa81" />
</ItemGroup>
-
+ <ItemGroup>
+ <!-- This package is only supported on win8 and later RIDs -->
+ <ValidatePackageSuppression Include="PermitImplementation">
+ <Value>.NETCoreApp,Version=v1.1/win10-arm64</Value>
+ </ValidatePackageSuppression>
+ </ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project> \ No newline at end of file
diff --git a/src/System.Runtime.WindowsRuntime/pkg/ValidationSuppression.txt b/src/System.Runtime.WindowsRuntime/pkg/ValidationSuppression.txt
deleted file mode 100644
index 9b59987d06..0000000000
--- a/src/System.Runtime.WindowsRuntime/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1 +0,0 @@
-PermitImplementation=.NETCoreApp,Version=v1.1/win10-arm64 \ No newline at end of file
diff --git a/src/System.Runtime.WindowsRuntime/ref/4.0.0/System.Runtime.WindowsRuntime.depproj b/src/System.Runtime.WindowsRuntime/ref/4.0.0/System.Runtime.WindowsRuntime.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Runtime.WindowsRuntime/ref/4.0.0/System.Runtime.WindowsRuntime.depproj
+++ b/src/System.Runtime.WindowsRuntime/ref/4.0.0/System.Runtime.WindowsRuntime.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.WindowsRuntime/ref/System.Runtime.WindowsRuntime.csproj b/src/System.Runtime.WindowsRuntime/ref/System.Runtime.WindowsRuntime.csproj
index 56331a2035..a6dbd183db 100644
--- a/src/System.Runtime.WindowsRuntime/ref/System.Runtime.WindowsRuntime.csproj
+++ b/src/System.Runtime.WindowsRuntime/ref/System.Runtime.WindowsRuntime.csproj
@@ -13,9 +13,7 @@
match the output assembly name 'System.Runtime.WindowsRuntime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
-->
<NoWarn>1698</NoWarn>
- <AssemblyVersion>4.0.12.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.2</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.2</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime.WindowsRuntime/src/System.Runtime.WindowsRuntime.csproj b/src/System.Runtime.WindowsRuntime/src/System.Runtime.WindowsRuntime.csproj
index 9bf1769ce3..bc02c52a00 100644
--- a/src/System.Runtime.WindowsRuntime/src/System.Runtime.WindowsRuntime.csproj
+++ b/src/System.Runtime.WindowsRuntime/src/System.Runtime.WindowsRuntime.csproj
@@ -12,10 +12,8 @@
<!-- CS1698 - Disable warning about reference to 4.0.0.0 System.Runtime.WindowsRuntime having same simple name as target assembly -->
<NoWarn>$(NoWarn)1698</NoWarn>
<ProjectGuid>{844A2A0B-4169-49C3-B367-AFDC4894E487}</ProjectGuid>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<PackageTargetRuntime>win8</PackageTargetRuntime>
<PackageTargetRuntime Condition="'$(TargetGroup)' == 'netcore50aot'">win8-aot</PackageTargetRuntime>
- <AssemblyVersion>4.0.12.0</AssemblyVersion>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetGroup)'==''">
diff --git a/src/System.Runtime/dir.props b/src/System.Runtime/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.Runtime/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Runtime/pkg/aot/System.Runtime.pkgproj b/src/System.Runtime/pkg/aot/System.Runtime.pkgproj
index 585d004f8d..1e15e59c22 100644
--- a/src/System.Runtime/pkg/aot/System.Runtime.pkgproj
+++ b/src/System.Runtime/pkg/aot/System.Runtime.pkgproj
@@ -3,7 +3,6 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <Version>4.1.1</Version>
<PackageTargetRuntime>aot</PackageTargetRuntime>
<PreventImplementationReference>true</PreventImplementationReference>
</PropertyGroup>
diff --git a/src/System.Runtime/ref/4.0.0/System.Runtime.depproj b/src/System.Runtime/ref/4.0.0/System.Runtime.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Runtime/ref/4.0.0/System.Runtime.depproj
+++ b/src/System.Runtime/ref/4.0.0/System.Runtime.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime/ref/4.0.10/System.Runtime.depproj b/src/System.Runtime/ref/4.0.10/System.Runtime.depproj
index 7aa0e70c3a..364b923bfc 100644
--- a/src/System.Runtime/ref/4.0.10/System.Runtime.depproj
+++ b/src/System.Runtime/ref/4.0.10/System.Runtime.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.2</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.2</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime/ref/4.0.20/System.Runtime.depproj b/src/System.Runtime/ref/4.0.20/System.Runtime.depproj
index 2c8e3437c1..53806b0292 100644
--- a/src/System.Runtime/ref/4.0.20/System.Runtime.depproj
+++ b/src/System.Runtime/ref/4.0.20/System.Runtime.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.20.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime/ref/System.Runtime.csproj b/src/System.Runtime/ref/System.Runtime.csproj
index 53b4876857..c654ab1f7b 100644
--- a/src/System.Runtime/ref/System.Runtime.csproj
+++ b/src/System.Runtime/ref/System.Runtime.csproj
@@ -3,10 +3,8 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <AssemblyVersion>4.2.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
<IsCoreAssembly>true</IsCoreAssembly>
- <PackageTargetFramework>netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.5</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Runtime/src/System.Runtime.csproj b/src/System.Runtime/src/System.Runtime.csproj
index b6cea84ca4..500b28ca81 100644
--- a/src/System.Runtime/src/System.Runtime.csproj
+++ b/src/System.Runtime/src/System.Runtime.csproj
@@ -4,11 +4,9 @@
<PropertyGroup>
<ProjectGuid>{56B9D0A9-44D3-488E-8B42-C14A6E30CAB2}</ProjectGuid>
<AssemblyName>System.Runtime</AssemblyName>
- <AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)'=='net462' OR '$(TargetGroup)'=='netstandard1.5'">4.1.1.0</AssemblyVersion>
<ContractProject Condition="'$(AssemblyVersion)'=='4.1.1.0'">../ref/4.1.0/System.Runtime.depproj</ContractProject>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)'==''">netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.7</NuGetTargetMoniker>
<!-- 436 is thrown because some types conflict with existing types in mscorlib -->
<NoWarn>0436</NoWarn>
diff --git a/src/System.Runtime/tests/System/EnumTests.cs b/src/System.Runtime/tests/System/EnumTests.cs
index 65afe9000f..5f7749ef55 100644
--- a/src/System.Runtime/tests/System/EnumTests.cs
+++ b/src/System.Runtime/tests/System/EnumTests.cs
@@ -2,7 +2,9 @@
// 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.Collections.Generic;
+using System.Reflection;
+using System.Reflection.Emit;
using Xunit;
namespace System.Tests
@@ -82,94 +84,129 @@ namespace System.Tests
Assert.Throws(exceptionType, () => Enum.Parse(enumType, value, ignoreCase));
}
+ public static IEnumerable<object[]> GetName_TestData()
+ {
+ // SByte
+ yield return new object[] { typeof(SByteEnum), SByteEnum.Min, "Min" };
+ yield return new object[] { typeof(SByteEnum), SByteEnum.One, "One" };
+ yield return new object[] { typeof(SByteEnum), SByteEnum.Two, "Two" };
+ yield return new object[] { typeof(SByteEnum), SByteEnum.Max, "Max" };
+ yield return new object[] { typeof(SByteEnum), sbyte.MinValue, "Min" };
+ yield return new object[] { typeof(SByteEnum), (sbyte)1, "One" };
+ yield return new object[] { typeof(SByteEnum), (sbyte)2, "Two" };
+ yield return new object[] { typeof(SByteEnum), sbyte.MaxValue, "Max" };
+ yield return new object[] { typeof(SByteEnum), (sbyte)3, null };
+
+ // Byte
+ yield return new object[] { typeof(ByteEnum), ByteEnum.Min, "Min" };
+ yield return new object[] { typeof(ByteEnum), ByteEnum.One, "One" };
+ yield return new object[] { typeof(ByteEnum), ByteEnum.Two, "Two" };
+ yield return new object[] { typeof(ByteEnum), ByteEnum.Max, "Max" };
+ yield return new object[] { typeof(ByteEnum), byte.MinValue, "Min" };
+ yield return new object[] { typeof(ByteEnum), (byte)1, "One" };
+ yield return new object[] { typeof(ByteEnum), (byte)2, "Two" };
+ yield return new object[] { typeof(ByteEnum), byte.MaxValue, "Max" };
+ yield return new object[] { typeof(ByteEnum), (byte)3, null };
+
+ // Int16
+ yield return new object[] { typeof(Int16Enum), Int16Enum.Min, "Min" };
+ yield return new object[] { typeof(Int16Enum), Int16Enum.One, "One" };
+ yield return new object[] { typeof(Int16Enum), Int16Enum.Two, "Two" };
+ yield return new object[] { typeof(Int16Enum), Int16Enum.Max, "Max" };
+ yield return new object[] { typeof(Int16Enum), short.MinValue, "Min" };
+ yield return new object[] { typeof(Int16Enum), (short)1, "One" };
+ yield return new object[] { typeof(Int16Enum), (short)2, "Two" };
+ yield return new object[] { typeof(Int16Enum), short.MaxValue, "Max" };
+ yield return new object[] { typeof(Int16Enum), (short)3, null };
+
+ // UInt16
+ yield return new object[] { typeof(UInt16Enum), UInt16Enum.Min, "Min" };
+ yield return new object[] { typeof(UInt16Enum), UInt16Enum.One, "One" };
+ yield return new object[] { typeof(UInt16Enum), UInt16Enum.Two, "Two" };
+ yield return new object[] { typeof(UInt16Enum), UInt16Enum.Max, "Max" };
+ yield return new object[] { typeof(UInt16Enum), ushort.MinValue, "Min" };
+ yield return new object[] { typeof(UInt16Enum), (ushort)1, "One" };
+ yield return new object[] { typeof(UInt16Enum), (ushort)2, "Two" };
+ yield return new object[] { typeof(UInt16Enum), ushort.MaxValue, "Max" };
+ yield return new object[] { typeof(UInt16Enum), (ushort)3, null };
+
+ // Int32
+ yield return new object[] { typeof(Int32Enum), Int32Enum.Min, "Min" };
+ yield return new object[] { typeof(Int32Enum), Int32Enum.One, "One" };
+ yield return new object[] { typeof(Int32Enum), Int32Enum.Two, "Two" };
+ yield return new object[] { typeof(Int32Enum), Int32Enum.Max, "Max" };
+ yield return new object[] { typeof(Int32Enum), int.MinValue, "Min" };
+ yield return new object[] { typeof(Int32Enum), 1, "One" };
+ yield return new object[] { typeof(Int32Enum), 2, "Two" };
+ yield return new object[] { typeof(Int32Enum), int.MaxValue, "Max" };
+ yield return new object[] { typeof(Int32Enum), 3, null };
+
+ yield return new object[] { typeof(SimpleEnum), 99, null };
+ yield return new object[] { typeof(SimpleEnum), SimpleEnum.Red, "Red" };
+ yield return new object[] { typeof(SimpleEnum), 1, "Red" };
+
+ // UInt32
+ yield return new object[] { typeof(UInt32Enum), UInt32Enum.Min, "Min" };
+ yield return new object[] { typeof(UInt32Enum), UInt32Enum.One, "One" };
+ yield return new object[] { typeof(UInt32Enum), UInt32Enum.Two, "Two" };
+ yield return new object[] { typeof(UInt32Enum), UInt32Enum.Max, "Max" };
+ yield return new object[] { typeof(UInt32Enum), uint.MinValue, "Min" };
+ yield return new object[] { typeof(UInt32Enum), (uint)1, "One" };
+ yield return new object[] { typeof(UInt32Enum), (uint)2, "Two" };
+ yield return new object[] { typeof(UInt32Enum), uint.MaxValue, "Max" };
+ yield return new object[] { typeof(UInt32Enum), (uint)3, null };
+
+ // Int64
+ yield return new object[] { typeof(Int64Enum), Int64Enum.Min, "Min" };
+ yield return new object[] { typeof(Int64Enum), Int64Enum.One, "One" };
+ yield return new object[] { typeof(Int64Enum), Int64Enum.Two, "Two" };
+ yield return new object[] { typeof(Int64Enum), Int64Enum.Max, "Max" };
+ yield return new object[] { typeof(Int64Enum), long.MinValue, "Min" };
+ yield return new object[] { typeof(Int64Enum), (long)1, "One" };
+ yield return new object[] { typeof(Int64Enum), (long)2, "Two" };
+ yield return new object[] { typeof(Int64Enum), long.MaxValue, "Max" };
+ yield return new object[] { typeof(Int64Enum), (long)3, null };
+
+ // UInt64
+ yield return new object[] { typeof(UInt64Enum), UInt64Enum.Min, "Min" };
+ yield return new object[] { typeof(UInt64Enum), UInt64Enum.One, "One" };
+ yield return new object[] { typeof(UInt64Enum), UInt64Enum.Two, "Two" };
+ yield return new object[] { typeof(UInt64Enum), UInt64Enum.Max, "Max" };
+ yield return new object[] { typeof(UInt64Enum), ulong.MinValue, "Min" };
+ yield return new object[] { typeof(UInt64Enum), (ulong)1UL, "One" };
+ yield return new object[] { typeof(UInt64Enum), (ulong)2UL, "Two" };
+ yield return new object[] { typeof(UInt64Enum), ulong.MaxValue, "Max" };
+ yield return new object[] { typeof(UInt64Enum), (ulong)3UL, null };
+
+ // Char
+ yield return new object[] { s_charEnumType, Enum.Parse(s_charEnumType, "Value1"), "Value1" };
+ yield return new object[] { s_charEnumType, Enum.Parse(s_charEnumType, "Value2"), "Value2" };
+ yield return new object[] { s_charEnumType, (char)1, "Value1" };
+ yield return new object[] { s_charEnumType, (char)2, "Value2" };
+ yield return new object[] { s_charEnumType, (char)4, null };
+
+ // Bool
+ yield return new object[] { s_boolEnumType, Enum.Parse(s_boolEnumType, "Value1"), "Value1" };
+ yield return new object[] { s_boolEnumType, Enum.Parse(s_boolEnumType, "Value2"), "Value2" };
+ yield return new object[] { s_boolEnumType, true, "Value1" };
+ yield return new object[] { s_boolEnumType, false, "Value2" };
+ }
+
[Theory]
- [InlineData(typeof(SimpleEnum), 99, null)]
- [InlineData(typeof(SimpleEnum), 1, "Red")]
- [InlineData(typeof(SimpleEnum), SimpleEnum.Red, "Red")]
-
- [InlineData(typeof(ByteEnum), ByteEnum.Min, "Min")]
- [InlineData(typeof(ByteEnum), ByteEnum.One, "One")]
- [InlineData(typeof(ByteEnum), ByteEnum.Two, "Two")]
- [InlineData(typeof(ByteEnum), ByteEnum.Max, "Max")]
- [InlineData(typeof(ByteEnum), byte.MinValue, "Min")]
- [InlineData(typeof(ByteEnum), (Byte)1, "One")]
- [InlineData(typeof(ByteEnum), (Byte)2, "Two")]
- [InlineData(typeof(ByteEnum), byte.MaxValue, "Max")]
- [InlineData(typeof(ByteEnum), (Byte)3, null)]
-
- [InlineData(typeof(SByteEnum), SByteEnum.Min, "Min")]
- [InlineData(typeof(SByteEnum), SByteEnum.One, "One")]
- [InlineData(typeof(SByteEnum), SByteEnum.Two, "Two")]
- [InlineData(typeof(SByteEnum), SByteEnum.Max, "Max")]
- [InlineData(typeof(SByteEnum), SByte.MinValue, "Min")]
- [InlineData(typeof(SByteEnum), (SByte)1, "One")]
- [InlineData(typeof(SByteEnum), (SByte)2, "Two")]
- [InlineData(typeof(SByteEnum), SByte.MaxValue, "Max")]
- [InlineData(typeof(SByteEnum), (SByte)3, null)]
-
- [InlineData(typeof(UInt16Enum), UInt16Enum.Min, "Min")]
- [InlineData(typeof(UInt16Enum), UInt16Enum.One, "One")]
- [InlineData(typeof(UInt16Enum), UInt16Enum.Two, "Two")]
- [InlineData(typeof(UInt16Enum), UInt16Enum.Max, "Max")]
- [InlineData(typeof(UInt16Enum), UInt16.MinValue, "Min")]
- [InlineData(typeof(UInt16Enum), (UInt16)1, "One")]
- [InlineData(typeof(UInt16Enum), (UInt16)2, "Two")]
- [InlineData(typeof(UInt16Enum), UInt16.MaxValue, "Max")]
- [InlineData(typeof(UInt16Enum), (UInt16)3, null)]
-
- [InlineData(typeof(Int16Enum), Int16Enum.Min, "Min")]
- [InlineData(typeof(Int16Enum), Int16Enum.One, "One")]
- [InlineData(typeof(Int16Enum), Int16Enum.Two, "Two")]
- [InlineData(typeof(Int16Enum), Int16Enum.Max, "Max")]
- [InlineData(typeof(Int16Enum), Int16.MinValue, "Min")]
- [InlineData(typeof(Int16Enum), (Int16)1, "One")]
- [InlineData(typeof(Int16Enum), (Int16)2, "Two")]
- [InlineData(typeof(Int16Enum), Int16.MaxValue, "Max")]
- [InlineData(typeof(Int16Enum), (Int16)3, null)]
-
- [InlineData(typeof(UInt32Enum), UInt32Enum.Min, "Min")]
- [InlineData(typeof(UInt32Enum), UInt32Enum.One, "One")]
- [InlineData(typeof(UInt32Enum), UInt32Enum.Two, "Two")]
- [InlineData(typeof(UInt32Enum), UInt32Enum.Max, "Max")]
- [InlineData(typeof(UInt32Enum), UInt32.MinValue, "Min")]
- [InlineData(typeof(UInt32Enum), (UInt32)1, "One")]
- [InlineData(typeof(UInt32Enum), (UInt32)2, "Two")]
- [InlineData(typeof(UInt32Enum), UInt32.MaxValue, "Max")]
- [InlineData(typeof(UInt32Enum), (UInt32)3, null)]
-
- [InlineData(typeof(Int32Enum), Int32Enum.Min, "Min")]
- [InlineData(typeof(Int32Enum), Int32Enum.One, "One")]
- [InlineData(typeof(Int32Enum), Int32Enum.Two, "Two")]
- [InlineData(typeof(Int32Enum), Int32Enum.Max, "Max")]
- [InlineData(typeof(Int32Enum), Int32.MinValue, "Min")]
- [InlineData(typeof(Int32Enum), (Int32)1, "One")]
- [InlineData(typeof(Int32Enum), (Int32)2, "Two")]
- [InlineData(typeof(Int32Enum), Int32.MaxValue, "Max")]
- [InlineData(typeof(Int32Enum), (Int32)3, null)]
-
- [InlineData(typeof(UInt64Enum), UInt64Enum.Min, "Min")]
- [InlineData(typeof(UInt64Enum), UInt64Enum.One, "One")]
- [InlineData(typeof(UInt64Enum), UInt64Enum.Two, "Two")]
- [InlineData(typeof(UInt64Enum), UInt64Enum.Max, "Max")]
- [InlineData(typeof(UInt64Enum), UInt64.MinValue, "Min")]
- [InlineData(typeof(UInt64Enum), (UInt64)1UL, "One")]
- [InlineData(typeof(UInt64Enum), (UInt64)2UL, "Two")]
- [InlineData(typeof(UInt64Enum), UInt64.MaxValue, "Max")]
- [InlineData(typeof(UInt64Enum), (UInt64)3UL, null)]
-
- [InlineData(typeof(Int64Enum), Int64Enum.Min, "Min")]
- [InlineData(typeof(Int64Enum), Int64Enum.One, "One")]
- [InlineData(typeof(Int64Enum), Int64Enum.Two, "Two")]
- [InlineData(typeof(Int64Enum), Int64Enum.Max, "Max")]
- [InlineData(typeof(Int64Enum), Int64.MinValue, "Min")]
- [InlineData(typeof(Int64Enum), (Int64)1, "One")]
- [InlineData(typeof(Int64Enum), (Int64)2, "Two")]
- [InlineData(typeof(Int64Enum), Int64.MaxValue, "Max")]
- [InlineData(typeof(Int64Enum), (Int64)3, null)]
+ [MemberData(nameof(GetName_TestData))]
public static void GetName(Type enumType, object value, string expected)
{
- string s = Enum.GetName(enumType, value);
- Assert.Equal(expected, s);
+ Assert.Equal(expected, Enum.GetName(enumType, value));
+
+ // The format "G" should return the name of the enum case
+ if (value.GetType() == enumType)
+ {
+ ToString_Format((Enum)value, "G", expected);
+ }
+ else
+ {
+ Format(enumType, value, "G", expected);
+ }
}
[Fact]
@@ -213,18 +250,94 @@ namespace System.Tests
Assert.Equal(expected, Enum.GetName(enumType, value));
}
+ public static IEnumerable<object[]> IsDefined_TestData()
+ {
+ // SByte
+ yield return new object[] { typeof(SByteEnum), "One", true };
+ yield return new object[] { typeof(SByteEnum), "None", false };
+ yield return new object[] { typeof(SByteEnum), SByteEnum.One, true };
+ yield return new object[] { typeof(SByteEnum), (SByteEnum)99, false };
+ yield return new object[] { typeof(SByteEnum), (sbyte)1, true };
+ yield return new object[] { typeof(SByteEnum), (sbyte)99, false };
+
+ // Byte
+ yield return new object[] { typeof(ByteEnum), "One", true };
+ yield return new object[] { typeof(ByteEnum), "None", false };
+ yield return new object[] { typeof(ByteEnum), ByteEnum.One, true };
+ yield return new object[] { typeof(ByteEnum), (ByteEnum)99, false };
+ yield return new object[] { typeof(ByteEnum), (Byte)1, true };
+ yield return new object[] { typeof(ByteEnum), (Byte)99, false };
+
+ // Int16
+ yield return new object[] { typeof(Int16Enum), "One", true };
+ yield return new object[] { typeof(Int16Enum), "None", false };
+ yield return new object[] { typeof(Int16Enum), Int16Enum.One, true };
+ yield return new object[] { typeof(Int16Enum), (Int16Enum)99, false };
+ yield return new object[] { typeof(Int16Enum), (short)1, true };
+ yield return new object[] { typeof(Int16Enum), (short)99, false };
+
+ // UInt16
+ yield return new object[] { typeof(UInt16Enum), "One", true };
+ yield return new object[] { typeof(UInt16Enum), "None", false };
+ yield return new object[] { typeof(UInt16Enum), UInt16Enum.One, true };
+ yield return new object[] { typeof(UInt16Enum), (UInt16Enum)99, false };
+ yield return new object[] { typeof(UInt16Enum), (ushort)1, true };
+ yield return new object[] { typeof(UInt16Enum), (ushort)99, false };
+
+ // Int32
+ yield return new object[] { typeof(SimpleEnum), "Red", true };
+ yield return new object[] { typeof(SimpleEnum), "Green", true };
+ yield return new object[] { typeof(SimpleEnum), "Blue", true };
+ yield return new object[] { typeof(SimpleEnum), " Blue ", false };
+ yield return new object[] { typeof(SimpleEnum), " blue ", false };
+ yield return new object[] { typeof(SimpleEnum), SimpleEnum.Red, true };
+ yield return new object[] { typeof(SimpleEnum), (SimpleEnum)99, false };
+ yield return new object[] { typeof(SimpleEnum), 1, true };
+ yield return new object[] { typeof(SimpleEnum), 99, false };
+ yield return new object[] { typeof(Int32Enum), 0x1 | 0x02, false };
+
+ // UInt32
+ yield return new object[] { typeof(UInt32Enum), "One", true };
+ yield return new object[] { typeof(UInt32Enum), "None", false };
+ yield return new object[] { typeof(UInt32Enum), UInt32Enum.One, true };
+ yield return new object[] { typeof(UInt32Enum), (UInt32Enum)99, false };
+ yield return new object[] { typeof(UInt32Enum), (uint)1, true };
+ yield return new object[] { typeof(UInt32Enum), (uint)99, false };
+
+ // Int64
+ yield return new object[] { typeof(Int64Enum), "One", true };
+ yield return new object[] { typeof(Int64Enum), "None", false };
+ yield return new object[] { typeof(Int64Enum), Int64Enum.One, true };
+ yield return new object[] { typeof(Int64Enum), (Int64Enum)99, false };
+ yield return new object[] { typeof(Int64Enum), (long)1, true };
+ yield return new object[] { typeof(Int64Enum), (long)99, false };
+
+ // UInt64
+ yield return new object[] { typeof(UInt64Enum), "One", true };
+ yield return new object[] { typeof(UInt64Enum), "None", false };
+ yield return new object[] { typeof(UInt64Enum), UInt64Enum.One, true };
+ yield return new object[] { typeof(UInt64Enum), (UInt64Enum)99, false };
+ yield return new object[] { typeof(UInt64Enum), (ulong)1, true };
+ yield return new object[] { typeof(UInt64Enum), (ulong)99, false };
+
+ // Char
+ yield return new object[] { s_charEnumType, "Value1", true };
+ yield return new object[] { s_charEnumType, "None", false };
+ yield return new object[] { s_charEnumType, Enum.Parse(s_charEnumType, "Value1"), true };
+ yield return new object[] { s_charEnumType, (char)1, true };
+ yield return new object[] { s_charEnumType, (char)99, false };
+
+ // Boolean
+ yield return new object[] { s_boolEnumType, "Value1", true };
+ yield return new object[] { s_boolEnumType, "None", false };
+ yield return new object[] { s_boolEnumType, Enum.Parse(s_boolEnumType, "Value1"), true };
+ yield return new object[] { s_boolEnumType, "Value1", true };
+ yield return new object[] { s_boolEnumType, true, true };
+ yield return new object[] { s_boolEnumType, false, true };
+ }
+
[Theory]
- [InlineData(typeof(SimpleEnum), "Red", true)] // String
- [InlineData(typeof(SimpleEnum), "Green", true)]
- [InlineData(typeof(SimpleEnum), "Blue", true)]
- [InlineData(typeof(SimpleEnum), " Blue", false)]
- [InlineData(typeof(SimpleEnum), "blue", false)]
- [InlineData(typeof(SimpleEnum), "", false)]
- [InlineData(typeof(SimpleEnum), SimpleEnum.Red, true)] // Enum
- [InlineData(typeof(SimpleEnum), (SimpleEnum)99, false)]
- [InlineData(typeof(SimpleEnum), 1, true)] // Integer
- [InlineData(typeof(SimpleEnum), 99, false)]
- [InlineData(typeof(Int32Enum), 0x1 | 0x02, false)] // "Combos" do not pass
+ [MemberData(nameof(IsDefined_TestData))]
public static void IsDefined(Type enumType, object value, bool expected)
{
Assert.Equal(expected, Enum.IsDefined(enumType, value));
@@ -250,13 +363,98 @@ namespace System.Tests
Assert.Throws<InvalidOperationException>(() => Enum.IsDefined(t, 5.5f));
}
+ public static IEnumerable<object[]> HasFlag_TestData()
+ {
+ // SByte
+ yield return new object[] { (SByteEnum)0x36, (SByteEnum)0x30, true };
+ yield return new object[] { (SByteEnum)0x36, (SByteEnum)0x06, true };
+ yield return new object[] { (SByteEnum)0x36, (SByteEnum)0x10, true };
+ yield return new object[] { (SByteEnum)0x36, (SByteEnum)0x00, true };
+ yield return new object[] { (SByteEnum)0x36, (SByteEnum)0x36, true };
+ yield return new object[] { (SByteEnum)0x36, (SByteEnum)0x05, false };
+ yield return new object[] { (SByteEnum)0x36, (SByteEnum)0x46, false };
+
+ // Byte
+ yield return new object[] { (ByteEnum)0x36, (ByteEnum)0x30, true };
+ yield return new object[] { (ByteEnum)0x36, (ByteEnum)0x06, true };
+ yield return new object[] { (ByteEnum)0x36, (ByteEnum)0x10, true };
+ yield return new object[] { (ByteEnum)0x36, (ByteEnum)0x00, true };
+ yield return new object[] { (ByteEnum)0x36, (ByteEnum)0x36, true };
+ yield return new object[] { (ByteEnum)0x36, (ByteEnum)0x05, false };
+ yield return new object[] { (ByteEnum)0x36, (ByteEnum)0x46, false };
+
+ // Int16
+ yield return new object[] { (Int16Enum)0x3f06, (Int16Enum)0x3000, true };
+ yield return new object[] { (Int16Enum)0x3f06, (Int16Enum)0x0f06, true };
+ yield return new object[] { (Int16Enum)0x3f06, (Int16Enum)0x1000, true };
+ yield return new object[] { (Int16Enum)0x3f06, (Int16Enum)0x0000, true };
+ yield return new object[] { (Int16Enum)0x3f06, (Int16Enum)0x3f06, true };
+ yield return new object[] { (Int16Enum)0x3f06, (Int16Enum)0x0010, false };
+ yield return new object[] { (Int16Enum)0x3f06, (Int16Enum)0x3f16, false };
+
+ // UInt16
+ yield return new object[] { (UInt16Enum)0x3f06, (UInt16Enum)0x3000, true };
+ yield return new object[] { (UInt16Enum)0x3f06, (UInt16Enum)0x0f06, true };
+ yield return new object[] { (UInt16Enum)0x3f06, (UInt16Enum)0x1000, true };
+ yield return new object[] { (UInt16Enum)0x3f06, (UInt16Enum)0x0000, true };
+ yield return new object[] { (UInt16Enum)0x3f06, (UInt16Enum)0x3f06, true };
+ yield return new object[] { (UInt16Enum)0x3f06, (UInt16Enum)0x0010, false };
+ yield return new object[] { (UInt16Enum)0x3f06, (UInt16Enum)0x3f16, false };
+
+ // Int32
+ yield return new object[] { (Int32Enum)0x3f06, (Int32Enum)0x3000, true };
+ yield return new object[] { (Int32Enum)0x3f06, (Int32Enum)0x0f06, true };
+ yield return new object[] { (Int32Enum)0x3f06, (Int32Enum)0x1000, true };
+ yield return new object[] { (Int32Enum)0x3f06, (Int32Enum)0x0000, true };
+ yield return new object[] { (Int32Enum)0x3f06, (Int32Enum)0x3f06, true };
+ yield return new object[] { (Int32Enum)0x3f06, (Int32Enum)0x0010, false };
+ yield return new object[] { (Int32Enum)0x3f06, (Int32Enum)0x3f16, false };
+
+ // UInt32
+ yield return new object[] { (UInt32Enum)0x3f06, (UInt32Enum)0x3000, true };
+ yield return new object[] { (UInt32Enum)0x3f06, (UInt32Enum)0x0f06, true };
+ yield return new object[] { (UInt32Enum)0x3f06, (UInt32Enum)0x1000, true };
+ yield return new object[] { (UInt32Enum)0x3f06, (UInt32Enum)0x0000, true };
+ yield return new object[] { (UInt32Enum)0x3f06, (UInt32Enum)0x3f06, true };
+ yield return new object[] { (UInt32Enum)0x3f06, (UInt32Enum)0x0010, false };
+ yield return new object[] { (UInt32Enum)0x3f06, (UInt32Enum)0x3f16, false };
+
+ // Int64
+ yield return new object[] { (Int64Enum)0x3f06, (Int64Enum)0x3000, true };
+ yield return new object[] { (Int64Enum)0x3f06, (Int64Enum)0x0f06, true };
+ yield return new object[] { (Int64Enum)0x3f06, (Int64Enum)0x1000, true };
+ yield return new object[] { (Int64Enum)0x3f06, (Int64Enum)0x0000, true };
+ yield return new object[] { (Int64Enum)0x3f06, (Int64Enum)0x3f06, true };
+ yield return new object[] { (Int64Enum)0x3f06, (Int64Enum)0x0010, false };
+ yield return new object[] { (Int64Enum)0x3f06, (Int64Enum)0x3f16, false };
+
+ // UInt64
+ yield return new object[] { (UInt64Enum)0x3f06, (UInt64Enum)0x3000, true };
+ yield return new object[] { (UInt64Enum)0x3f06, (UInt64Enum)0x0f06, true };
+ yield return new object[] { (UInt64Enum)0x3f06, (UInt64Enum)0x1000, true };
+ yield return new object[] { (UInt64Enum)0x3f06, (UInt64Enum)0x0000, true };
+ yield return new object[] { (UInt64Enum)0x3f06, (UInt64Enum)0x3f06, true };
+ yield return new object[] { (UInt64Enum)0x3f06, (UInt64Enum)0x0010, false };
+ yield return new object[] { (UInt64Enum)0x3f06, (UInt64Enum)0x3f16, false };
+
+ // Char
+ yield return new object[] { Enum.Parse(s_charEnumType, "Value0x3f06"), Enum.Parse(s_charEnumType, "Value0x3000"), true };
+ yield return new object[] { Enum.Parse(s_charEnumType, "Value0x3f06"), Enum.Parse(s_charEnumType, "Value0x0f06"), true };
+ yield return new object[] { Enum.Parse(s_charEnumType, "Value0x3f06"), Enum.Parse(s_charEnumType, "Value0x1000"), true };
+ yield return new object[] { Enum.Parse(s_charEnumType, "Value0x3f06"), Enum.Parse(s_charEnumType, "Value0x0000"), true };
+ yield return new object[] { Enum.Parse(s_charEnumType, "Value0x3f06"), Enum.Parse(s_charEnumType, "Value0x3f06"), true };
+ yield return new object[] { Enum.Parse(s_charEnumType, "Value0x3f06"), Enum.Parse(s_charEnumType, "Value0x0010"), false };
+ yield return new object[] { Enum.Parse(s_charEnumType, "Value0x3f06"), Enum.Parse(s_charEnumType, "Value0x3f16"), false };
+
+ // Bool
+ yield return new object[] { Enum.Parse(s_boolEnumType, "Value1"), Enum.Parse(s_boolEnumType, "Value1"), true };
+ yield return new object[] { Enum.Parse(s_boolEnumType, "Value1"), Enum.Parse(s_boolEnumType, "Value2"), true };
+ yield return new object[] { Enum.Parse(s_boolEnumType, "Value2"), Enum.Parse(s_boolEnumType, "Value2"), true };
+ yield return new object[] { Enum.Parse(s_boolEnumType, "Value2"), Enum.Parse(s_boolEnumType, "Value1"), false };
+ }
+
[Theory]
- [InlineData((Int32Enum)0x3f06, (Int32Enum)0x3000, true)]
- [InlineData((Int32Enum)0x3f06, (Int32Enum)0x1000, true)]
- [InlineData((Int32Enum)0x3f06, (Int32Enum)0x0000, true)]
- [InlineData((Int32Enum)0x3f06, (Int32Enum)0x3f06, true)]
- [InlineData((Int32Enum)0x3f06, (Int32Enum)0x0010, false)]
- [InlineData((Int32Enum)0x3f06, (Int32Enum)0x3f16, false)]
+ [MemberData(nameof(HasFlag_TestData))]
public static void HasFlag(Enum e, Enum flag, bool expected)
{
Assert.Equal(expected, e.HasFlag(flag));
@@ -285,38 +483,184 @@ namespace System.Tests
Assert.Equal(expected, Enum.ToObject(enumType, value));
}
+ public static IEnumerable<object[]> ToObject_InvalidEnumType_TestData()
+ {
+ yield return new object[] { null, typeof(ArgumentNullException) };
+ yield return new object[] { typeof(Enum), typeof(ArgumentException) };
+ yield return new object[] { typeof(object), typeof(ArgumentException) };
+ yield return new object[] { GetNonRuntimeEnumTypeBuilder(typeof(int)).AsType(), typeof(ArgumentException) };
+ }
+
+ [Theory]
+ [MemberData(nameof(ToObject_InvalidEnumType_TestData))]
+ public static void ToObject_InvalidEnumType_ThrowsException(Type enumType, Type exceptionType)
+ {
+ Assert.Throws(exceptionType, () => Enum.ToObject(enumType, 5));
+ Assert.Throws(exceptionType, () => Enum.ToObject(enumType, (sbyte)5));
+ Assert.Throws(exceptionType, () => Enum.ToObject(enumType, (short)5));
+ Assert.Throws(exceptionType, () => Enum.ToObject(enumType, (long)5));
+ Assert.Throws(exceptionType, () => Enum.ToObject(enumType, (uint)5));
+ Assert.Throws(exceptionType, () => Enum.ToObject(enumType, (byte)5));
+ Assert.Throws(exceptionType, () => Enum.ToObject(enumType, (ushort)5));
+ Assert.Throws(exceptionType, () => Enum.ToObject(enumType, (ulong)5));
+ Assert.Throws(exceptionType, () => Enum.ToObject(enumType, 'a'));
+ Assert.Throws(exceptionType, () => Enum.ToObject(enumType, true));
+ }
+
[Fact]
- public static void ToObject_Invalid()
+ public static void ToObject_InvalidValue_ThrowsException()
{
- Assert.Throws<ArgumentNullException>("enumType", () => Enum.ToObject(null, 3)); // Enum type is null
Assert.Throws<ArgumentNullException>("value", () => Enum.ToObject(typeof(SimpleEnum), null)); // Value is null
- Assert.Throws<ArgumentException>("enumType", () => Enum.ToObject(typeof(Enum), 1)); // Enum type is simply an enum
Assert.Throws<ArgumentException>("value", () => Enum.ToObject(typeof(SimpleEnum), "Hello")); // Value is not a supported enum type
}
+ public static IEnumerable<object[]> Equals_TestData()
+ {
+ // SByte
+ yield return new object[] { SByteEnum.One, SByteEnum.One, true };
+ yield return new object[] { SByteEnum.One, SByteEnum.Two, false };
+ yield return new object[] { SByteEnum.One, ByteEnum.One, false };
+ yield return new object[] { SByteEnum.One, (sbyte)1, false };
+ yield return new object[] { SByteEnum.One, null, false };
+
+ // Byte
+ yield return new object[] { ByteEnum.One, ByteEnum.One, true };
+ yield return new object[] { ByteEnum.One, ByteEnum.Two, false };
+ yield return new object[] { ByteEnum.One, SByteEnum.One, false };
+ yield return new object[] { ByteEnum.One, (byte)1, false };
+ yield return new object[] { ByteEnum.One, null, false };
+
+ // Int16
+ yield return new object[] { Int16Enum.One, Int16Enum.One, true };
+ yield return new object[] { Int16Enum.One, Int16Enum.Two, false };
+ yield return new object[] { Int16Enum.One, UInt16Enum.One, false };
+ yield return new object[] { Int16Enum.One, (short)1, false };
+ yield return new object[] { Int16Enum.One, null, false };
+
+ // UInt16
+ yield return new object[] { UInt16Enum.One, UInt16Enum.One, true };
+ yield return new object[] { UInt16Enum.One, UInt16Enum.Two, false };
+ yield return new object[] { UInt16Enum.One, Int16Enum.One, false };
+ yield return new object[] { UInt16Enum.One, (ushort)1, false };
+ yield return new object[] { UInt16Enum.One, null, false };
+
+ // Int32
+ yield return new object[] { Int32Enum.One, Int32Enum.One, true };
+ yield return new object[] { Int32Enum.One, Int32Enum.Two, false };
+ yield return new object[] { Int32Enum.One, UInt32Enum.One, false };
+ yield return new object[] { Int32Enum.One, (short)1, false };
+ yield return new object[] { Int32Enum.One, null, false };
+
+ // UInt32
+ yield return new object[] { UInt32Enum.One, UInt32Enum.One, true };
+ yield return new object[] { UInt32Enum.One, UInt32Enum.Two, false };
+ yield return new object[] { UInt32Enum.One, Int32Enum.One, false };
+ yield return new object[] { UInt32Enum.One, (ushort)1, false };
+ yield return new object[] { UInt32Enum.One, null, false };
+
+ // Int64
+ yield return new object[] { Int64Enum.One, Int64Enum.One, true };
+ yield return new object[] { Int64Enum.One, Int64Enum.Two, false };
+ yield return new object[] { Int64Enum.One, UInt64Enum.One, false };
+ yield return new object[] { Int64Enum.One, (long)1, false };
+ yield return new object[] { Int64Enum.One, null, false };
+
+ // UInt64
+ yield return new object[] { UInt64Enum.One, UInt64Enum.One, true };
+ yield return new object[] { UInt64Enum.One, UInt64Enum.Two, false };
+ yield return new object[] { UInt64Enum.One, Int64Enum.One, false };
+ yield return new object[] { UInt64Enum.One, (ulong)1, false };
+ yield return new object[] { UInt64Enum.One, null, false };
+
+ // Char
+ yield return new object[] { Enum.Parse(s_charEnumType, "Value1"), Enum.Parse(s_charEnumType, "Value1"), true };
+ yield return new object[] { Enum.Parse(s_charEnumType, "Value1"), Enum.Parse(s_charEnumType, "Value2"), false };
+ yield return new object[] { Enum.Parse(s_charEnumType, "Value1"), UInt16Enum.One, false };
+ yield return new object[] { Enum.Parse(s_charEnumType, "Value1"), (char)1, false };
+ yield return new object[] { Enum.Parse(s_charEnumType, "Value1"), null, false };
+
+ // Bool
+ yield return new object[] { Enum.Parse(s_boolEnumType, "Value1"), Enum.Parse(s_boolEnumType, "Value1"), true };
+ yield return new object[] { Enum.Parse(s_boolEnumType, "Value1"), Enum.Parse(s_boolEnumType, "Value2"), false };
+ yield return new object[] { Enum.Parse(s_boolEnumType, "Value1"), UInt16Enum.One, false };
+ yield return new object[] { Enum.Parse(s_boolEnumType, "Value1"), true, false };
+ yield return new object[] { Enum.Parse(s_boolEnumType, "Value1"), null, false };
+ }
+
[Theory]
- [InlineData((Int64Enum)42, (Int64Enum)42, true, true)]
- [InlineData((Int64Enum)42, null, false, false)]
- [InlineData((Int64Enum)42, (long)42, false, true)]
- [InlineData((Int64Enum)42, (Int32Enum)42, false, true)]
- [InlineData((Int64Enum)42, (Int64Enum)43, false, false)]
- [InlineData((Int64Enum)42, (Int64Enum)0x700000000000002aL, false, false)]
- public static void Equals(Enum e, object obj, bool expected, bool hashExpected)
+ [MemberData(nameof(Equals_TestData))]
+ public static void Equals(Enum e, object obj, bool expected)
{
Assert.Equal(expected, e.Equals(obj));
Assert.Equal(e.GetHashCode(), e.GetHashCode());
- if (obj != null)
- {
- Assert.Equal(hashExpected, e.GetHashCode().Equals(obj.GetHashCode()));
- }
+ }
+
+ public static IEnumerable<object[]> CompareTo_TestData()
+ {
+ // SByte
+ yield return new object[] { SByteEnum.One, SByteEnum.One, 0 };
+ yield return new object[] { SByteEnum.One, SByteEnum.Min, 1 };
+ yield return new object[] { SByteEnum.One, SByteEnum.Max, -1 };
+ yield return new object[] { SByteEnum.One, null, 1 };
+
+ // Byte
+ yield return new object[] { ByteEnum.One, ByteEnum.One, 0 };
+ yield return new object[] { ByteEnum.One, ByteEnum.Min, 1 };
+ yield return new object[] { ByteEnum.One, ByteEnum.Max, -1 };
+ yield return new object[] { ByteEnum.One, null, 1 };
+
+ // Int16
+ yield return new object[] { Int16Enum.One, Int16Enum.One, 0 };
+ yield return new object[] { Int16Enum.One, Int16Enum.Min, 1 };
+ yield return new object[] { Int16Enum.One, Int16Enum.Max, -1 };
+ yield return new object[] { Int16Enum.One, null, 1 };
+
+ // UInt16
+ yield return new object[] { UInt16Enum.One, UInt16Enum.One, 0 };
+ yield return new object[] { UInt16Enum.One, UInt16Enum.Min, 1 };
+ yield return new object[] { UInt16Enum.One, UInt16Enum.Max, -1 };
+ yield return new object[] { UInt16Enum.One, null, 1 };
+
+ // Int32
+ yield return new object[] { SimpleEnum.Red, SimpleEnum.Red, 0 };
+ yield return new object[] { SimpleEnum.Red, (SimpleEnum)0, 1 };
+ yield return new object[] { SimpleEnum.Red, (SimpleEnum)2, -1 };
+ yield return new object[] { SimpleEnum.Green, SimpleEnum.Green_a, 0 };
+ yield return new object[] { SimpleEnum.Green, null, 1 };
+
+ // UInt32
+ yield return new object[] { UInt32Enum.One, UInt32Enum.One, 0 };
+ yield return new object[] { UInt32Enum.One, UInt32Enum.Min, 1 };
+ yield return new object[] { UInt32Enum.One, UInt32Enum.Max, -1 };
+ yield return new object[] { UInt32Enum.One, null, 1 };
+
+ // Int64
+ yield return new object[] { Int64Enum.One, Int64Enum.One, 0 };
+ yield return new object[] { Int64Enum.One, Int64Enum.Min, 1 };
+ yield return new object[] { Int64Enum.One, Int64Enum.Max, -1 };
+ yield return new object[] { Int64Enum.One, null, 1 };
+
+ // UInt64
+ yield return new object[] { UInt64Enum.One, UInt64Enum.One, 0 };
+ yield return new object[] { UInt64Enum.One, UInt64Enum.Min, 1 };
+ yield return new object[] { UInt64Enum.One, UInt64Enum.Max, -1 };
+ yield return new object[] { UInt64Enum.One, null, 1 };
+
+ // Char
+ yield return new object[] { Enum.Parse(s_charEnumType, "Value2"), Enum.Parse(s_charEnumType, "Value2"), 0 };
+ yield return new object[] { Enum.Parse(s_charEnumType, "Value2"), Enum.Parse(s_charEnumType, "Value1"), 1 };
+ yield return new object[] { Enum.Parse(s_charEnumType, "Value2"), Enum.Parse(s_charEnumType, "Value3"), -1 };
+ yield return new object[] { Enum.Parse(s_charEnumType, "Value2"), null, 1 };
+
+ // Bool
+ yield return new object[] { Enum.Parse(s_boolEnumType, "Value1"), Enum.Parse(s_boolEnumType, "Value1"), 0 };
+ yield return new object[] { Enum.Parse(s_boolEnumType, "Value1"), Enum.Parse(s_boolEnumType, "Value2"), 1 };
+ yield return new object[] { Enum.Parse(s_boolEnumType, "Value2"), Enum.Parse(s_boolEnumType, "Value1"), -1 };
+ yield return new object[] { Enum.Parse(s_boolEnumType, "Value1"), null, 1 };
}
[Theory]
- [InlineData(SimpleEnum.Red, SimpleEnum.Red, 0)]
- [InlineData(SimpleEnum.Red, (SimpleEnum)0, 1)]
- [InlineData(SimpleEnum.Red, (SimpleEnum)2, -1)]
- [InlineData(SimpleEnum.Green, SimpleEnum.Green_a, 0)]
- [InlineData(SimpleEnum.Red, null, 1)]
+ [MemberData(nameof(CompareTo_TestData))]
public static void CompareTo(Enum e, object target, int expected)
{
Assert.Equal(expected, Math.Sign(e.CompareTo(target)));
@@ -329,15 +673,22 @@ namespace System.Tests
Assert.Throws<ArgumentException>(null, () => SimpleEnum.Red.CompareTo(Int32Enum.One)); //Target is a different enum type
}
+ public static IEnumerable<object[]> GetUnderlyingType_TestData()
+ {
+ yield return new object[] { typeof(SByteEnum), typeof(sbyte) };
+ yield return new object[] { typeof(ByteEnum), typeof(byte) };
+ yield return new object[] { typeof(Int16Enum), typeof(short) };
+ yield return new object[] { typeof(UInt16Enum), typeof(ushort) };
+ yield return new object[] { typeof(Int32Enum), typeof(int) };
+ yield return new object[] { typeof(UInt32Enum), typeof(uint) };
+ yield return new object[] { typeof(Int64Enum), typeof(long) };
+ yield return new object[] { typeof(UInt64Enum), typeof(ulong) };
+ yield return new object[] { s_boolEnumType, typeof(bool) };
+ yield return new object[] { s_charEnumType, typeof(char) };
+ }
+
[Theory]
- [InlineData(typeof(SByteEnum), typeof(sbyte))]
- [InlineData(typeof(ByteEnum), typeof(byte))]
- [InlineData(typeof(Int16Enum), typeof(short))]
- [InlineData(typeof(UInt16Enum), typeof(ushort))]
- [InlineData(typeof(Int32Enum), typeof(int))]
- [InlineData(typeof(UInt32Enum), typeof(uint))]
- [InlineData(typeof(Int64Enum), typeof(long))]
- [InlineData(typeof(UInt64Enum), typeof(ulong))]
+ [MemberData(nameof(GetUnderlyingType_TestData))]
public static void GetUnderlyingType(Type enumType, Type expected)
{
Assert.Equal(expected, Enum.GetUnderlyingType(enumType));
@@ -571,59 +922,33 @@ namespace System.Tests
// Format "G": If value is equal to a named enumerated constant, the name of that constant is returned.
// Otherwise, if "[Flags]" present, do as Format "F" - else return the decimal value of "value".
- [InlineData(SimpleEnum.Red, "G", "Red")]
- [InlineData(SimpleEnum.Blue, "G", "Blue")]
[InlineData((SimpleEnum)99, "G", "99")]
[InlineData((SimpleEnum)0, "G", "0")] // Not found
[InlineData((ByteEnum)(byte)0, "G", "Min")]
- [InlineData((ByteEnum)0xff, "F", "Max")] // Larger values take precedence (and remove the bits from consideration.)
-
- [InlineData(ByteEnum.Min, "G", "Min")]
- [InlineData(ByteEnum.One, "G", "One")]
- [InlineData(ByteEnum.Two, "G", "Two")]
+ [InlineData((ByteEnum)0xff, "G", "Max")]
+
[InlineData((ByteEnum)(byte)3, "G", "3")] // No [Flags] attribute
[InlineData(ByteEnum.Max, "G", "Max")]
-
- [InlineData(SByteEnum.Min, "G", "Min")]
- [InlineData(SByteEnum.One, "G", "One")]
- [InlineData(SByteEnum.Two, "G", "Two")]
+
[InlineData((SByteEnum)(sbyte)3, "G", "3")] // No [Flags] attribute
[InlineData(SByteEnum.Max, "G", "Max")]
-
- [InlineData(UInt16Enum.Min, "G", "Min")]
- [InlineData(UInt16Enum.One, "G", "One")]
- [InlineData(UInt16Enum.Two, "G", "Two")]
+
[InlineData((UInt16Enum)(ushort)3, "G", "3")] // No [Flags] attribute
[InlineData(UInt16Enum.Max, "G", "Max")]
-
- [InlineData(Int16Enum.Min, "G", "Min")]
- [InlineData(Int16Enum.One, "G", "One")]
- [InlineData(Int16Enum.Two, "G", "Two")]
+
[InlineData((Int16Enum)(short)3, "G", "3")] // No [Flags] attribute
[InlineData(Int16Enum.Max, "G", "Max")]
-
- [InlineData(UInt32Enum.Min, "G", "Min")]
- [InlineData(UInt32Enum.One, "G", "One")]
- [InlineData(UInt32Enum.Two, "G", "Two")]
+
[InlineData((UInt32Enum)(UInt32)3, "G", "3")] // No [Flags] attribute
[InlineData(UInt32Enum.Max, "G", "Max")]
-
- [InlineData(Int32Enum.Min, "G", "Min")]
- [InlineData(Int32Enum.One, "G", "One")]
- [InlineData(Int32Enum.Two, "G", "Two")]
+
[InlineData((Int32Enum)(Int32)3, "G", "3")] // No [Flags] attribute
[InlineData(Int32Enum.Max, "G", "Max")]
-
- [InlineData(UInt64Enum.Min, "G", "Min")]
- [InlineData(UInt64Enum.One, "G", "One")]
- [InlineData(UInt64Enum.Two, "G", "Two")]
+
[InlineData((UInt64Enum)(UInt64)3, "G", "3")] // No [Flags] attribute
[InlineData(UInt64Enum.Max, "G", "Max")]
-
- [InlineData(Int64Enum.Min, "G", "Min")]
- [InlineData(Int64Enum.One, "G", "One")]
- [InlineData(Int64Enum.Two, "G", "Two")]
+
[InlineData((Int64Enum)(Int64)3, "G", "3")] // No [Flags] attribute
[InlineData(Int64Enum.Max, "G", "Max")]
@@ -642,6 +967,8 @@ namespace System.Tests
Assert.Equal(expected, e.ToString(format));
Assert.Equal(expected, e.ToString(format.ToUpperInvariant()));
Assert.Equal(expected, e.ToString(format.ToLowerInvariant()));
+
+ Format(e.GetType(), e, format, expected);
}
[Fact]
@@ -670,84 +997,9 @@ namespace System.Tests
// Format: X
[InlineData(typeof(SimpleEnum), SimpleEnum.Red, "X", "00000001")]
[InlineData(typeof(SimpleEnum), 1, "X", "00000001")]
- // Format: G
- [InlineData(typeof(SimpleEnum), SimpleEnum.Red, "G", "Red")]
- [InlineData(typeof(SimpleEnum), 1, "G", "Red")]
// Format: F
[InlineData(typeof(SimpleEnum), SimpleEnum.Red, "F", "Red")]
[InlineData(typeof(SimpleEnum), 1, "F", "Red")]
-
- [InlineData(typeof(ByteEnum), ByteEnum.Min, "G", "Min")]
- [InlineData(typeof(ByteEnum), ByteEnum.One, "G", "One")]
- [InlineData(typeof(ByteEnum), ByteEnum.Two, "G", "Two")]
- [InlineData(typeof(ByteEnum), ByteEnum.Max, "G", "Max")]
- [InlineData(typeof(ByteEnum), byte.MinValue, "G", "Min")]
- [InlineData(typeof(ByteEnum), (Byte)1, "G", "One")]
- [InlineData(typeof(ByteEnum), (Byte)2, "G", "Two")]
- [InlineData(typeof(ByteEnum), byte.MaxValue, "G", "Max")]
-
- [InlineData(typeof(SByteEnum), SByteEnum.Min, "G", "Min")]
- [InlineData(typeof(SByteEnum), SByteEnum.One, "G", "One")]
- [InlineData(typeof(SByteEnum), SByteEnum.Two, "G", "Two")]
- [InlineData(typeof(SByteEnum), SByteEnum.Max, "G", "Max")]
- [InlineData(typeof(SByteEnum), SByte.MinValue, "G", "Min")]
- [InlineData(typeof(SByteEnum), (SByte)1, "G", "One")]
- [InlineData(typeof(SByteEnum), (SByte)2, "G", "Two")]
- [InlineData(typeof(SByteEnum), SByte.MaxValue, "G", "Max")]
-
- [InlineData(typeof(UInt16Enum), UInt16Enum.Min, "G", "Min")]
- [InlineData(typeof(UInt16Enum), UInt16Enum.One, "G", "One")]
- [InlineData(typeof(UInt16Enum), UInt16Enum.Two, "G", "Two")]
- [InlineData(typeof(UInt16Enum), UInt16Enum.Max, "G", "Max")]
- [InlineData(typeof(UInt16Enum), UInt16.MinValue, "G", "Min")]
- [InlineData(typeof(UInt16Enum), (UInt16)1, "G", "One")]
- [InlineData(typeof(UInt16Enum), (UInt16)2, "G", "Two")]
- [InlineData(typeof(UInt16Enum), UInt16.MaxValue, "G", "Max")]
-
- [InlineData(typeof(Int16Enum), Int16Enum.Min, "G", "Min")]
- [InlineData(typeof(Int16Enum), Int16Enum.One, "G", "One")]
- [InlineData(typeof(Int16Enum), Int16Enum.Two, "G", "Two")]
- [InlineData(typeof(Int16Enum), Int16Enum.Max, "G", "Max")]
- [InlineData(typeof(Int16Enum), Int16.MinValue, "G", "Min")]
- [InlineData(typeof(Int16Enum), (Int16)1, "G", "One")]
- [InlineData(typeof(Int16Enum), (Int16)2, "G", "Two")]
- [InlineData(typeof(Int16Enum), Int16.MaxValue, "G", "Max")]
-
- [InlineData(typeof(UInt32Enum), UInt32Enum.Min, "G", "Min")]
- [InlineData(typeof(UInt32Enum), UInt32Enum.One, "G", "One")]
- [InlineData(typeof(UInt32Enum), UInt32Enum.Two, "G", "Two")]
- [InlineData(typeof(UInt32Enum), UInt32Enum.Max, "G", "Max")]
- [InlineData(typeof(UInt32Enum), UInt32.MinValue, "G", "Min")]
- [InlineData(typeof(UInt32Enum), (UInt32)1, "G", "One")]
- [InlineData(typeof(UInt32Enum), (UInt32)2, "G", "Two")]
- [InlineData(typeof(UInt32Enum), UInt32.MaxValue, "G", "Max")]
-
- [InlineData(typeof(Int32Enum), Int32Enum.Min, "G", "Min")]
- [InlineData(typeof(Int32Enum), Int32Enum.One, "G", "One")]
- [InlineData(typeof(Int32Enum), Int32Enum.Two, "G", "Two")]
- [InlineData(typeof(Int32Enum), Int32Enum.Max, "G", "Max")]
- [InlineData(typeof(Int32Enum), Int32.MinValue, "G", "Min")]
- [InlineData(typeof(Int32Enum), (Int32)1, "G", "One")]
- [InlineData(typeof(Int32Enum), (Int32)2, "G", "Two")]
- [InlineData(typeof(Int32Enum), Int32.MaxValue, "G", "Max")]
-
- [InlineData(typeof(UInt64Enum), UInt64Enum.Min, "G", "Min")]
- [InlineData(typeof(UInt64Enum), UInt64Enum.One, "G", "One")]
- [InlineData(typeof(UInt64Enum), UInt64Enum.Two, "G", "Two")]
- [InlineData(typeof(UInt64Enum), UInt64Enum.Max, "G", "Max")]
- [InlineData(typeof(UInt64Enum), UInt64.MinValue, "G", "Min")]
- [InlineData(typeof(UInt64Enum), (object)(UInt64)1, "G", "One")]
- [InlineData(typeof(UInt64Enum), (object)(UInt64)2, "G", "Two")]
- [InlineData(typeof(UInt64Enum), UInt64.MaxValue, "G", "Max")]
-
- [InlineData(typeof(Int64Enum), Int64Enum.Min, "G", "Min")]
- [InlineData(typeof(Int64Enum), Int64Enum.One, "G", "One")]
- [InlineData(typeof(Int64Enum), Int64Enum.Two, "G", "Two")]
- [InlineData(typeof(Int64Enum), Int64Enum.Max, "G", "Max")]
- [InlineData(typeof(Int64Enum), Int64.MinValue, "G", "Min")]
- [InlineData(typeof(Int64Enum), (object)(Int64)1, "G", "One")]
- [InlineData(typeof(Int64Enum), (object)(Int64)2, "G", "Two")]
- [InlineData(typeof(Int64Enum), Int64.MaxValue, "G", "Max")]
public static void Format(Type enumType, object value, string format, string expected)
{
// Format string is case insensitive
@@ -847,5 +1099,42 @@ namespace System.Tests
Two = 2,
Max = long.MaxValue,
}
+
+ private static EnumBuilder GetNonRuntimeEnumTypeBuilder(Type underlyingType)
+ {
+ AssemblyBuilder assembly = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Name"), AssemblyBuilderAccess.Run);
+ ModuleBuilder module = assembly.DefineDynamicModule("Name");
+
+ return module.DefineEnum("TestName", TypeAttributes.Public, underlyingType);
+ }
+
+ private static Type s_boolEnumType = GetBoolEnumType();
+ private static Type GetBoolEnumType()
+ {
+ EnumBuilder enumBuilder = GetNonRuntimeEnumTypeBuilder(typeof(bool));
+ enumBuilder.DefineLiteral("Value1", true);
+ enumBuilder.DefineLiteral("Value2", false);
+
+ return enumBuilder.CreateTypeInfo().AsType();
+ }
+
+ private static Type s_charEnumType = GetCharEnumType();
+ private static Type GetCharEnumType()
+ {
+ EnumBuilder enumBuilder = GetNonRuntimeEnumTypeBuilder(typeof(char));
+ enumBuilder.DefineLiteral("Value1", (char)1);
+ enumBuilder.DefineLiteral("Value2", (char)2);
+ enumBuilder.DefineLiteral("Value3", (char)3);
+
+ enumBuilder.DefineLiteral("Value0x3f06", (char)0x3f06);
+ enumBuilder.DefineLiteral("Value0x3000", (char)0x3000);
+ enumBuilder.DefineLiteral("Value0x0f06", (char)0x0f06);
+ enumBuilder.DefineLiteral("Value0x1000", (char)0x1000);
+ enumBuilder.DefineLiteral("Value0x0000", (char)0x0000);
+ enumBuilder.DefineLiteral("Value0x0010", (char)0x0010);
+ enumBuilder.DefineLiteral("Value0x3f16", (char)0x3f16);
+
+ return enumBuilder.CreateTypeInfo().AsType();
+ }
}
}
diff --git a/src/System.Runtime/tests/System/GCTests.cs b/src/System.Runtime/tests/System/GCTests.cs
index 6768bba529..ff06d5fe1a 100644
--- a/src/System.Runtime/tests/System/GCTests.cs
+++ b/src/System.Runtime/tests/System/GCTests.cs
@@ -19,7 +19,7 @@ namespace System.Tests
if (s_is32Bits)
{
- Assert.Throws<ArgumentOutOfRangeException>("bytesAllocated", () => GC.AddMemoryPressure((long)int.MaxValue + 1)); // Bytes allocated > int.MaxValue on 32 bit platforms
+ Assert.Throws<ArgumentOutOfRangeException>("pressure", () => GC.AddMemoryPressure((long)int.MaxValue + 1)); // Bytes allocated > int.MaxValue on 32 bit platforms
}
}
diff --git a/src/System.Runtime/tests/System/IntPtrTests.cs b/src/System.Runtime/tests/System/IntPtrTests.cs
index a697002b1b..5cbe67aa43 100644
--- a/src/System.Runtime/tests/System/IntPtrTests.cs
+++ b/src/System.Runtime/tests/System/IntPtrTests.cs
@@ -164,7 +164,7 @@ namespace System.Tests
Assert.Equal(expected32, ptr.ToInt32());
Assert.Equal(expected.ToString(), ptr.ToString());
- Assert.Equal(expected.ToString("x"), ptr.ToString("x"));
+ Assert.Equal(IntPtr.Size == 4 ? expected32.ToString("x") : expected.ToString("x"), ptr.ToString("x"));
Assert.Equal(ptr, new IntPtr(expected));
Assert.True(ptr == new IntPtr(expected));
diff --git a/src/System.Runtime/tests/System/StringTests.cs b/src/System.Runtime/tests/System/StringTests.cs
index 5286f5cd6a..1152c8f639 100644
--- a/src/System.Runtime/tests/System/StringTests.cs
+++ b/src/System.Runtime/tests/System/StringTests.cs
@@ -285,6 +285,7 @@ namespace System.Tests
validate(string.Concat(values));
validate(string.Concat((IEnumerable<string>)values));
+ validate(string.Concat<string>((IEnumerable<string>)values)); // Call the generic IEnumerable<T>-based overload
}
[Fact]
@@ -333,8 +334,12 @@ namespace System.Tests
public static IEnumerable<object[]> Concat_Objects_TestData()
{
+ yield return new object[] { new object[] { }, "" };
+
yield return new object[] { new object[] { 1 }, "1" };
yield return new object[] { new object[] { null }, "" };
+ // dotnet/coreclr#6785, this will be null for the Concat(object) overload but "" for the object[]/IEnumerable<object> overload
+ // yield return new object[] { new object[] { new ObjectWithNullToString() }, "" };
yield return new object[] { new object[] { 1, 2 }, "12" };
yield return new object[] { new object[] { null, 1 }, "1" };
@@ -391,6 +396,7 @@ namespace System.Tests
public static void Concat_Invalid()
{
Assert.Throws<ArgumentNullException>("values", () => string.Concat((IEnumerable<string>)null)); // Values is null
+ Assert.Throws<ArgumentNullException>("values", () => string.Concat<string>((IEnumerable<string>)null)); // Generic overload
Assert.Throws<ArgumentNullException>("values", () => string.Concat(null)); // Values is null
Assert.Throws<ArgumentNullException>("args", () => string.Concat((object[])null)); // Values is null
@@ -447,8 +453,14 @@ namespace System.Tests
[InlineData(null, 0, null, 0, 0, StringComparison.CurrentCulture, 0)]
[InlineData("Hello", 0, null, 0, 0, StringComparison.CurrentCulture, 1)]
[InlineData(null, 0, "Hello", 0, 0, StringComparison.CurrentCulture, -1)]
+ [InlineData(null, -1, null, -1, -1, StringComparison.CurrentCulture, 0)]
+ [InlineData("foo", -1, null, -1, -1, StringComparison.CurrentCulture, 1)]
+ [InlineData(null, -1, "foo", -1, -1, StringComparison.CurrentCulture, -1)]
// CurrentCultureIgnoreCase
[InlineData("HELLO", 0, "hello", 0, 5, StringComparison.CurrentCultureIgnoreCase, 0)]
+ [InlineData("Hello", 0, "Hello", 0, 5, StringComparison.CurrentCultureIgnoreCase, 0)]
+ [InlineData("Hello", 2, "Hello", 2, 3, StringComparison.CurrentCultureIgnoreCase, 0)]
+ [InlineData("Hello", 2, "Yellow", 2, 3, StringComparison.CurrentCultureIgnoreCase, 0)]
[InlineData("Hello", 0, "Goodbye", 0, 5, StringComparison.CurrentCultureIgnoreCase, 1)]
[InlineData("Goodbye", 0, "Hello", 0, 5, StringComparison.CurrentCultureIgnoreCase, -1)]
[InlineData("HELLO", 2, "hello", 2, 3, StringComparison.CurrentCultureIgnoreCase, 0)]
@@ -456,6 +468,9 @@ namespace System.Tests
[InlineData(null, 0, null, 0, 0, StringComparison.CurrentCultureIgnoreCase, 0)]
[InlineData("Hello", 0, null, 0, 0, StringComparison.CurrentCultureIgnoreCase, 1)]
[InlineData(null, 0, "Hello", 0, 0, StringComparison.CurrentCultureIgnoreCase, -1)]
+ [InlineData(null, -1, null, -1, -1, StringComparison.CurrentCultureIgnoreCase, 0)]
+ [InlineData("foo", -1, null, -1, -1, StringComparison.CurrentCultureIgnoreCase, 1)]
+ [InlineData(null, -1, "foo", -1, -1, StringComparison.CurrentCultureIgnoreCase, -1)]
// InvariantCulture (not exposed as enum case, but is valid)
[InlineData("Hello", 0, "Hello", 0, 5, (StringComparison)2, 0)]
[InlineData("Hello", 0, "Goodbye", 0, 5, (StringComparison)2, 1)]
@@ -467,6 +482,9 @@ namespace System.Tests
[InlineData(null, 0, "Hello", 0, 5, (StringComparison)2, -1)]
// InvariantCultureIgnoreCase (not exposed as enum case, but is valid)
[InlineData("HELLO", 0, "hello", 0, 5, (StringComparison)3, 0)]
+ [InlineData("Hello", 0, "Hello", 0, 5, (StringComparison)3, 0)]
+ [InlineData("Hello", 2, "Hello", 2, 3, (StringComparison)3, 0)]
+ [InlineData("Hello", 2, "Yellow", 2, 3, (StringComparison)3, 0)]
[InlineData("Hello", 0, "Goodbye", 0, 5, (StringComparison)3, 1)]
[InlineData("Goodbye", 0, "Hello", 0, 5, (StringComparison)3, -1)]
[InlineData("HELLO", 2, "hello", 2, 3, (StringComparison)3, 0)]
@@ -520,8 +538,14 @@ namespace System.Tests
[InlineData(null, 0, null, 0, 0, StringComparison.Ordinal, 0)]
[InlineData("Hello", 0, null, 0, 5, StringComparison.Ordinal, 1)]
[InlineData(null, 0, "Hello", 0, 5, StringComparison.Ordinal, -1)]
+ [InlineData(null, -1, null, -1, -1, StringComparison.Ordinal, 0)]
+ [InlineData("foo", -1, null, -1, -1, StringComparison.Ordinal, 1)]
+ [InlineData(null, -1, "foo", -1, -1, StringComparison.Ordinal, -1)]
// OrdinalIgnoreCase
[InlineData("HELLO", 0, "hello", 0, 5, StringComparison.OrdinalIgnoreCase, 0)]
+ [InlineData("Hello", 0, "Hello", 0, 5, StringComparison.OrdinalIgnoreCase, 0)]
+ [InlineData("Hello", 2, "Hello", 2, 3, StringComparison.OrdinalIgnoreCase, 0)]
+ [InlineData("Hello", 2, "Yellow", 2, 3, StringComparison.OrdinalIgnoreCase, 0)]
[InlineData("Hello", 0, "Goodbye", 0, 5, StringComparison.OrdinalIgnoreCase, 1)]
[InlineData("Goodbye", 0, "Hello", 0, 5, StringComparison.OrdinalIgnoreCase, -1)]
[InlineData("HELLO", 2, "hello", 2, 3, StringComparison.OrdinalIgnoreCase, 0)]
@@ -532,14 +556,15 @@ namespace System.Tests
public static void Compare(string strA, int indexA, string strB, int indexB, int length, StringComparison comparisonType, int expected)
{
bool hasNullInputs = (strA == null || strB == null);
- bool indexesReferToEntireString = (strA != null && strB != null && indexA == 0 && indexB == 0 && (length == strB.Length || length == strA.Length));
- if (hasNullInputs || indexesReferToEntireString)
+ bool indicesReferToEntireString = (strA != null && strB != null && indexA == 0 && indexB == 0 && (length == strB.Length || length == strA.Length));
+ bool skipNonComparisonOverloads = length != 0 && ((strA == null && indexA != 0) || (strB == null && indexB != 0));
+ if (hasNullInputs || indicesReferToEntireString)
{
if (comparisonType == StringComparison.CurrentCulture)
{
// Use Compare(string, string) or Compare(string, string, false) or CompareTo(string)
Assert.Equal(expected, Math.Sign(string.Compare(strA, strB)));
- Assert.Equal(expected, Math.Sign(string.Compare(strA, strB, false)));
+ Assert.Equal(expected, Math.Sign(string.Compare(strA, strB, ignoreCase: false)));
if (strA != null)
{
Assert.Equal(expected, Math.Sign(strA.CompareTo(strB)));
@@ -547,31 +572,58 @@ namespace System.Tests
IComparable iComparable = strA;
Assert.Equal(expected, Math.Sign(iComparable.CompareTo(strB)));
}
+ if (strB != null)
+ {
+ Assert.Equal(expected, -Math.Sign(strB.CompareTo(strA)));
+
+ IComparable iComparable = strB;
+ Assert.Equal(expected, -Math.Sign(iComparable.CompareTo(strA)));
+ }
}
else if (comparisonType == StringComparison.CurrentCultureIgnoreCase)
{
// Use Compare(string, string, true)
- Assert.Equal(expected, Math.Sign(string.Compare(strA, strB, true)));
+ Assert.Equal(expected, Math.Sign(string.Compare(strA, strB, ignoreCase: true)));
}
else if (comparisonType == StringComparison.Ordinal)
{
// Use CompareOrdinal(string, string)
Assert.Equal(expected, Math.Sign(string.CompareOrdinal(strA, strB)));
}
- // Use CompareOrdinal(string, string, StringComparisonType)
+ // Use CompareOrdinal(string, string, StringComparison)
Assert.Equal(expected, Math.Sign(string.Compare(strA, strB, comparisonType)));
}
if (comparisonType == StringComparison.CurrentCulture)
{
- // Use Compare(string, int, string, int, int)
- Assert.Equal(expected, Math.Sign(string.Compare(strA, indexA, strB, indexB, length)));
+ // This may have different behavior than the overload accepting a StringComparison
+ // for a combination of null/invalid inputs; see notes in Compare_Invalid for more
+
+ if (!skipNonComparisonOverloads)
+ {
+ // Use Compare(string, int, string, int, int) or Compare(string, int, string, int, int, false)
+ Assert.Equal(expected, Math.Sign(string.Compare(strA, indexA, strB, indexB, length)));
+ // Uncomment when this is exposed in .NET Core (dotnet/corefx#10066)
+ // Assert.Equal(expected, Math.Sign(string.Compare(strA, indexA, strB, indexB, length, ignoreCase: false)));
+ }
+ }
+ else if (comparisonType == StringComparison.CurrentCultureIgnoreCase)
+ {
+ // This may have different behavior than the overload accepting a StringComparison
+ // for a combination of null/invalid inputs; see notes in Compare_Invalid for more
+
+ if (!skipNonComparisonOverloads)
+ {
+ // Use Compare(string, int, string, int, int, true)
+ // Uncomment when this is exposed in .NET Core (dotnet/corefx#10066)
+ // Assert.Equal(expected, Math.Sign(string.Compare(strA, indexA, strB, indexB, length, ignoreCase: true)));
+ }
}
else if (comparisonType == StringComparison.Ordinal)
{
// Use CompareOrdinal(string, int, string, int, int)
Assert.Equal(expected, Math.Sign(string.CompareOrdinal(strA, indexA, strB, indexB, length)));
}
- // Use Compare(string, int, string, int, int, StringComparisonType)
+ // Use Compare(string, int, string, int, int, StringComparison)
Assert.Equal(expected, Math.Sign(string.Compare(strA, indexA, strB, indexB, length, comparisonType)));
}
@@ -610,6 +662,32 @@ namespace System.Tests
// Length < 0
Assert.Throws<ArgumentOutOfRangeException>("length1", () => string.Compare("a", 0, "bb", 0, -1));
Assert.Throws<ArgumentOutOfRangeException>("length", () => string.Compare("a", 0, "bb", 0, -1, StringComparison.CurrentCulture));
+
+ // There is a subtle behavior difference between the string.Compare that accepts a StringComparison parameter,
+ // and the one that does not. The former includes short-circuiting logic for nulls BEFORE the length/
+ // index parameters are validated (but after the StringComparison is), while the latter does not. As a result,
+ // this will not throw:
+ // string.Compare(null, -1, null, -1, -1, StringComparison.CurrentCulture)
+ // but this will:
+ // string.Compare(null, -1, null, -1, -1)
+
+ // These tests ensure that the argument validation stays in order.
+
+ // Compare accepting StringComparison
+ Assert.Throws<ArgumentException>("comparisonType", () => string.Compare(null, 0, null, 0, 0, StringComparison.CurrentCulture - 1)); // comparisonType should be validated before null short-circuiting...
+ // Tests to ensure null is short-circuited before validating the arguments are in the Compare() theory
+ Assert.Throws<ArgumentOutOfRangeException>("length", () => string.Compare("foo", -1, "foo", -1, -1, StringComparison.CurrentCulture)); // length should be validated before indexA/indexB
+ Assert.Throws<ArgumentOutOfRangeException>("indexA", () => string.Compare("foo", -1, "foo", -1, 3, StringComparison.CurrentCulture)); // then indexA
+ Assert.Throws<ArgumentOutOfRangeException>("indexB", () => string.Compare("foo", 0, "foo", -1, 3, StringComparison.CurrentCulture)); // then indexB
+ // Then the optimization where we short-circuit if strA == strB && indexA == indexB, or length == 0, is tested in the Compare() theory.
+
+ // Compare not accepting StringComparison
+ Assert.Throws<ArgumentOutOfRangeException>("length1", () => string.Compare(null, -1, null, -1, -1));
+ Assert.Throws<ArgumentOutOfRangeException>("length2", () => string.Compare(null, 0, "bar", 4, 0));
+ Assert.Throws<ArgumentOutOfRangeException>("offset1", () => string.Compare(null, -1, null, -1, 0));
+ Assert.Throws<ArgumentOutOfRangeException>("offset2", () => string.Compare(null, 0, null, -1, 0));
+ Assert.Throws<ArgumentOutOfRangeException>("string1", () => string.Compare(null, 1, null, 1, 1));
+ Assert.Throws<ArgumentOutOfRangeException>("string2", () => string.Compare("bar", 1, null, 1, 1));
}
[Fact]
@@ -625,6 +703,14 @@ namespace System.Tests
// Length < 0
Assert.Throws<ArgumentOutOfRangeException>("length", () => string.CompareOrdinal("a", 0, "bb", 0, -1));
+
+ // We must validate arguments before any short-circuiting is done (besides for nulls)
+ Assert.Throws<ArgumentOutOfRangeException>("length", () => string.CompareOrdinal("foo", -1, "foo", -1, -1)); // length should be validated first
+ Assert.Throws<ArgumentOutOfRangeException>("indexA", () => string.CompareOrdinal("foo", -1, "foo", -1, 0)); // then indexA
+ Assert.Throws<ArgumentOutOfRangeException>("indexB", () => string.CompareOrdinal("foo", 0, "foo", -1, 0)); // then indexB
+ Assert.Throws<ArgumentOutOfRangeException>("indexA", () => string.CompareOrdinal("foo", 4, "foo", 4, 0)); // indexA > strA.Length first
+ Assert.Throws<ArgumentOutOfRangeException>("indexB", () => string.CompareOrdinal("foo", 3, "foo", 4, 0)); // then indexB > strB.Length
+ Assert.Throws<ArgumentOutOfRangeException>("length", () => string.CompareOrdinal("foo", 0, "foo", 0, -1)); // early return should not kick in if length is invalid
}
[Theory]
@@ -941,7 +1027,7 @@ namespace System.Tests
// Use Equals(string, string)
Assert.Equal(expected, string.Equals(s1, s2));
}
- // Use Equals(string, string, StringComparisonType)
+ // Use Equals(string, string, StringComparison)
Assert.Equal(expected, string.Equals(s1, s2, comparisonType));
// If two strings are equal ordinally, then they must have the same hash code.
@@ -1405,22 +1491,31 @@ namespace System.Tests
[InlineData("$$", new string[] { "Foo", "Bar", "Baz" }, 0, 3, "Foo$$Bar$$Baz")]
[InlineData("$$", new string[] { "Foo", "Bar", "Baz" }, 3, 0, "")]
[InlineData("$$", new string[] { "Foo", "Bar", "Baz" }, 1, 1, "Bar")]
- public static void Join_StringArray(string seperator, string[] values, int startIndex, int count, string expected)
+ public static void Join_StringArray(string separator, string[] values, int startIndex, int count, string expected)
{
if (startIndex + count == values.Length && count != 0)
{
- Assert.Equal(expected, string.Join(seperator, values));
+ Assert.Equal(expected, string.Join(separator, values));
var iEnumerableStringOptimized = new List<string>(values);
- Assert.Equal(expected, string.Join(seperator, iEnumerableStringOptimized));
+ Assert.Equal(expected, string.Join(separator, iEnumerableStringOptimized));
+ Assert.Equal(expected, string.Join<string>(separator, iEnumerableStringOptimized)); // Call the generic IEnumerable<T>-based overload
var iEnumerableStringNotOptimized = new Queue<string>(values);
- Assert.Equal(expected, string.Join(seperator, iEnumerableStringNotOptimized));
+ Assert.Equal(expected, string.Join(separator, iEnumerableStringNotOptimized));
+ Assert.Equal(expected, string.Join<string>(separator, iEnumerableStringNotOptimized));
var iEnumerableObject = new List<object>(values);
- Assert.Equal(expected, string.Join(seperator, iEnumerableObject));
+ Assert.Equal(expected, string.Join(separator, iEnumerableObject));
+
+ // Bug/Documented behavior: Join(string, object[]) returns "" when the first item in the array is null
+ if (values.Length == 0 || values[0] != null)
+ {
+ var arrayOfObjects = (object[])values;
+ Assert.Equal(expected, string.Join(separator, arrayOfObjects));
+ }
}
- Assert.Equal(expected, string.Join(seperator, values, startIndex, count));
+ Assert.Equal(expected, string.Join(separator, values, startIndex, count));
}
[Fact]
@@ -1430,11 +1525,12 @@ namespace System.Tests
Assert.Throws<ArgumentNullException>("value", () => string.Join("$$", null));
Assert.Throws<ArgumentNullException>("value", () => string.Join("$$", null, 0, 0));
Assert.Throws<ArgumentNullException>("values", () => string.Join("|", (IEnumerable<string>)null));
+ Assert.Throws<ArgumentNullException>("values", () => string.Join<string>("|", (IEnumerable<string>)null)); // Generic overload
Assert.Throws<ArgumentOutOfRangeException>("startIndex", () => string.Join("$$", new string[] { "Foo" }, -1, 0)); // Start index < 0
Assert.Throws<ArgumentOutOfRangeException>("count", () => string.Join("$$", new string[] { "Foo" }, 0, -1)); // Count < 0
- // Start index > seperators.Length
+ // Start index > separators.Length
Assert.Throws<ArgumentOutOfRangeException>("startIndex", () => string.Join("$$", new string[] { "Foo" }, 2, 1));
Assert.Throws<ArgumentOutOfRangeException>("startIndex", () => string.Join("$$", new string[] { "Foo" }, 0, 2));
}
@@ -1442,6 +1538,7 @@ namespace System.Tests
public static IEnumerable<object[]> Join_ObjectArray_TestData()
{
yield return new object[] { "$$", new object[] { }, "" };
+ yield return new object[] { "$$", new object[] { new ObjectWithNullToString() }, "" };
yield return new object[] { "$$", new object[] { "Foo" }, "Foo" };
yield return new object[] { "$$", new object[] { "Foo", "Bar", "Baz" }, "Foo$$Bar$$Baz" };
yield return new object[] { null, new object[] { "Foo", "Bar", "Baz" }, "FooBarBaz" };
@@ -1456,12 +1553,12 @@ namespace System.Tests
[Theory]
[MemberData(nameof(Join_ObjectArray_TestData))]
- public static void Join_ObjectArray(string seperator, object[] values, string expected)
+ public static void Join_ObjectArray(string separator, object[] values, string expected)
{
- Assert.Equal(expected, string.Join(seperator, values));
+ Assert.Equal(expected, string.Join(separator, values));
if (!(values.Length > 0 && values[0] == null))
{
- Assert.Equal(expected, string.Join(seperator, (IEnumerable<object>)values));
+ Assert.Equal(expected, string.Join(separator, (IEnumerable<object>)values));
}
}
diff --git a/src/System.Security.AccessControl/dir.props b/src/System.Security.AccessControl/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Security.AccessControl/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Security.AccessControl/ref/System.Security.AccessControl.csproj b/src/System.Security.AccessControl/ref/System.Security.AccessControl.csproj
index c0db029172..dfc2fd1297 100644
--- a/src/System.Security.AccessControl/ref/System.Security.AccessControl.csproj
+++ b/src/System.Security.AccessControl/ref/System.Security.AccessControl.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.AccessControl/src/System.Security.AccessControl.csproj b/src/System.Security.AccessControl/src/System.Security.AccessControl.csproj
index affbcfa44c..9c0bf0ae3e 100644
--- a/src/System.Security.AccessControl/src/System.Security.AccessControl.csproj
+++ b/src/System.Security.AccessControl/src/System.Security.AccessControl.csproj
@@ -4,10 +4,8 @@
<PropertyGroup>
<Configuration Condition="'$(Configuration)'==''">Windows_Debug</Configuration>
<AssemblyName>System.Security.AccessControl</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net46'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<GeneratePlatformNotSupportedAssembly Condition="'$(TargetsUnix)' == 'true'">true</GeneratePlatformNotSupportedAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.Security.AccessControl/tests/System.Security.AccessControl.Tests.csproj b/src/System.Security.AccessControl/tests/System.Security.AccessControl.Tests.csproj
index 494b661363..0d3c068947 100644
--- a/src/System.Security.AccessControl/tests/System.Security.AccessControl.Tests.csproj
+++ b/src/System.Security.AccessControl/tests/System.Security.AccessControl.Tests.csproj
@@ -2,7 +2,6 @@
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<Configuration Condition="'$(Configuration)'==''">Windows_Debug</Configuration>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
diff --git a/src/System.Security.Claims/dir.props b/src/System.Security.Claims/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Security.Claims/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Security.Claims/ref/System.Security.Claims.csproj b/src/System.Security.Claims/ref/System.Security.Claims.csproj
index 25f95fcb75..755c53d383 100644
--- a/src/System.Security.Claims/ref/System.Security.Claims.csproj
+++ b/src/System.Security.Claims/ref/System.Security.Claims.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.Claims/src/System.Security.Claims.csproj b/src/System.Security.Claims/src/System.Security.Claims.csproj
index 8471e9d2bd..e52e8cde19 100644
--- a/src/System.Security.Claims/src/System.Security.Claims.csproj
+++ b/src/System.Security.Claims/src/System.Security.Claims.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Security.Claims</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<ProjectGuid>{A70BEC0D-5A1C-4DA0-8A0F-69F3BF565D52}</ProjectGuid>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)'==''">netstandard1.3</PackageTargetFramework>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net46'">true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.Security.Cryptography.Algorithms/System.Security.Cryptography.Algorithms.sln b/src/System.Security.Cryptography.Algorithms/System.Security.Cryptography.Algorithms.sln
index 37785895bb..ad065209d6 100644
--- a/src/System.Security.Cryptography.Algorithms/System.Security.Cryptography.Algorithms.sln
+++ b/src/System.Security.Cryptography.Algorithms/System.Security.Cryptography.Algorithms.sln
@@ -9,12 +9,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Security.Cryptograph
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ OSX_Debug|Any CPU = OSX_Debug|Any CPU
+ OSX_Release|Any CPU = OSX_Release|Any CPU
Unix_Debug|Any CPU = Unix_Debug|Any CPU
Unix_Release|Any CPU = Unix_Release|Any CPU
Windows_Debug|Any CPU = Windows_Debug|Any CPU
Windows_Release|Any CPU = Windows_Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {81A05E2E-E3AE-4246-B4E6-DD5F31FB71F9}.OSX_Debug|Any CPU.ActiveCfg = OSX_Debug|Any CPU
+ {81A05E2E-E3AE-4246-B4E6-DD5F31FB71F9}.OSX_Debug|Any CPU.Build.0 = OSX_Debug|Any CPU
+ {81A05E2E-E3AE-4246-B4E6-DD5F31FB71F9}.OSX_Release|Any CPU.ActiveCfg = OSX_Release|Any CPU
+ {81A05E2E-E3AE-4246-B4E6-DD5F31FB71F9}.OSX_Release|Any CPU.Build.0 = OSX_Release|Any CPU
{81A05E2E-E3AE-4246-B4E6-DD5F31FB71F9}.Unix_Debug|Any CPU.ActiveCfg = Unix_Debug|Any CPU
{81A05E2E-E3AE-4246-B4E6-DD5F31FB71F9}.Unix_Debug|Any CPU.Build.0 = Unix_Debug|Any CPU
{81A05E2E-E3AE-4246-B4E6-DD5F31FB71F9}.Unix_Release|Any CPU.ActiveCfg = Unix_Release|Any CPU
@@ -23,6 +29,10 @@ Global
{81A05E2E-E3AE-4246-B4E6-DD5F31FB71F9}.Windows_Debug|Any CPU.Build.0 = Windows_Debug|Any CPU
{81A05E2E-E3AE-4246-B4E6-DD5F31FB71F9}.Windows_Release|Any CPU.ActiveCfg = Windows_Release|Any CPU
{81A05E2E-E3AE-4246-B4E6-DD5F31FB71F9}.Windows_Release|Any CPU.Build.0 = Windows_Release|Any CPU
+ {508A7D81-6462-459C-9F8F-B58FCCCFC8E7}.OSX_Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {508A7D81-6462-459C-9F8F-B58FCCCFC8E7}.OSX_Debug|Any CPU.Build.0 = Debug|Any CPU
+ {508A7D81-6462-459C-9F8F-B58FCCCFC8E7}.OSX_Release|Any CPU.ActiveCfg = Debug|Any CPU
+ {508A7D81-6462-459C-9F8F-B58FCCCFC8E7}.OSX_Release|Any CPU.Build.0 = Debug|Any CPU
{508A7D81-6462-459C-9F8F-B58FCCCFC8E7}.Unix_Debug|Any CPU.ActiveCfg = Debug|Any CPU
{508A7D81-6462-459C-9F8F-B58FCCCFC8E7}.Unix_Debug|Any CPU.Build.0 = Debug|Any CPU
{508A7D81-6462-459C-9F8F-B58FCCCFC8E7}.Unix_Release|Any CPU.ActiveCfg = Debug|Any CPU
diff --git a/src/System.Security.Cryptography.Algorithms/dir.props b/src/System.Security.Cryptography.Algorithms/dir.props
new file mode 100644
index 0000000000..c10ad4d643
--- /dev/null
+++ b/src/System.Security.Cryptography.Algorithms/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.2.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Security.Cryptography.Algorithms/ref/4.0/System.Security.Cryptography.Algorithms.depproj b/src/System.Security.Cryptography.Algorithms/ref/4.0/System.Security.Cryptography.Algorithms.depproj
index 7f7271ecb7..7a6488143e 100644
--- a/src/System.Security.Cryptography.Algorithms/ref/4.0/System.Security.Cryptography.Algorithms.depproj
+++ b/src/System.Security.Cryptography.Algorithms/ref/4.0/System.Security.Cryptography.Algorithms.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.Cryptography.Algorithms/ref/4.1/System.Security.Cryptography.Algorithms.depproj b/src/System.Security.Cryptography.Algorithms/ref/4.1/System.Security.Cryptography.Algorithms.depproj
index 352d84343c..b44e1f7f7e 100644
--- a/src/System.Security.Cryptography.Algorithms/ref/4.1/System.Security.Cryptography.Algorithms.depproj
+++ b/src/System.Security.Cryptography.Algorithms/ref/4.1/System.Security.Cryptography.Algorithms.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.4</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.4</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.csproj b/src/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.csproj
index e507544ec8..846905e02f 100644
--- a/src/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.csproj
+++ b/src/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.3.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.OSX.cs b/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.OSX.cs
new file mode 100644
index 0000000000..410e2003ac
--- /dev/null
+++ b/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.OSX.cs
@@ -0,0 +1,34 @@
+// 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.Security.Cryptography;
+
+namespace Internal.Cryptography
+{
+ internal partial class AesImplementation
+ {
+ private static ICryptoTransform CreateTransformCore(
+ CipherMode cipherMode,
+ PaddingMode paddingMode,
+ byte[] key,
+ byte[] iv,
+ int blockSize,
+ bool encrypting)
+ {
+ BasicSymmetricCipher cipher = new AppleCCCryptor(
+ Interop.AppleCrypto.PAL_SymmetricAlgorithm.AES,
+ cipherMode,
+ blockSize,
+ key,
+ iv,
+ encrypting);
+
+ return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
+ }
+
+ // -----------------------------
+ // ---- PAL layer ends here ----
+ // -----------------------------
+ }
+}
diff --git a/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AppleCCCryptor.cs b/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AppleCCCryptor.cs
new file mode 100644
index 0000000000..0ff7b32fe1
--- /dev/null
+++ b/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AppleCCCryptor.cs
@@ -0,0 +1,225 @@
+// 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.Diagnostics;
+using System.Security.Cryptography;
+
+namespace Internal.Cryptography
+{
+ internal sealed class AppleCCCryptor : BasicSymmetricCipher
+ {
+ private readonly bool _encrypting;
+ private SafeAppleCryptorHandle _cryptor;
+
+ public AppleCCCryptor(
+ Interop.AppleCrypto.PAL_SymmetricAlgorithm algorithm,
+ CipherMode cipherMode,
+ int blockSizeInBytes,
+ byte[] key,
+ byte[] iv,
+ bool encrypting)
+ : base(cipherMode.GetCipherIv(iv), blockSizeInBytes)
+ {
+ _encrypting = encrypting;
+
+ OpenCryptor(algorithm, cipherMode, key);
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ _cryptor?.Dispose();
+ _cryptor = null;
+ }
+
+ base.Dispose(disposing);
+ }
+
+ public override int Transform(byte[] input, int inputOffset, int count, byte[] output, int outputOffset)
+ {
+ Debug.Assert(input != null, "Expected valid input, got null");
+ Debug.Assert(inputOffset >= 0, $"Expected non-negative inputOffset, got {inputOffset}");
+ Debug.Assert(count > 0, $"Expected positive count, got {count}");
+ Debug.Assert((count % BlockSizeInBytes) == 0, $"Expected count aligned to block size {BlockSizeInBytes}, got {count}");
+ Debug.Assert(input.Length - inputOffset >= count, $"Expected valid input length/offset/count triplet, got {input.Length}/{inputOffset}/{count}");
+ Debug.Assert(output != null, "Expected valid output, got null");
+ Debug.Assert(outputOffset >= 0, $"Expected non-negative outputOffset, got {outputOffset}");
+ Debug.Assert(output.Length - outputOffset >= count, $"Expected valid output length/offset/count triplet, got {output.Length}/{outputOffset}/{count}");
+
+ return CipherUpdate(input, inputOffset, count, output, outputOffset);
+ }
+
+ public override byte[] TransformFinal(byte[] input, int inputOffset, int count)
+ {
+ Debug.Assert(input != null, "Expected valid input, got null");
+ Debug.Assert(inputOffset >= 0, $"Expected non-negative inputOffset, got {inputOffset}");
+ Debug.Assert(count > 0, $"Expected positive count, got {count}");
+ Debug.Assert((count % BlockSizeInBytes) == 0, $"Expected count aligned to block size {BlockSizeInBytes}, got {count}");
+ Debug.Assert(input.Length - inputOffset >= count, $"Expected valid input length/offset/count triplet, got {input.Length}/{inputOffset}/{count}");
+
+ byte[] output = ProcessFinalBlock(input, inputOffset, count);
+ Reset();
+ return output;
+ }
+
+ private unsafe byte[] ProcessFinalBlock(byte[] input, int inputOffset, int count)
+ {
+ if (count == 0)
+ {
+ return Array.Empty<byte>();
+ }
+
+ byte[] output = new byte[count];
+ int outputBytes = CipherUpdate(input, inputOffset, count, output, 0);
+ int ret;
+ int errorCode;
+
+ fixed (byte* outputStart = output)
+ {
+ byte* outputCurrent = outputStart + outputBytes;
+ int bytesWritten;
+
+ ret = Interop.AppleCrypto.CryptorFinal(
+ _cryptor,
+ outputCurrent,
+ output.Length - outputBytes,
+ out bytesWritten,
+ out errorCode);
+
+ outputBytes += bytesWritten;
+ }
+
+ ProcessInteropError(ret, errorCode);
+
+ if (outputBytes == output.Length)
+ {
+ return output;
+ }
+
+ if (outputBytes == 0)
+ {
+ return Array.Empty<byte>();
+ }
+
+ byte[] userData = new byte[outputBytes];
+ Buffer.BlockCopy(output, 0, userData, 0, outputBytes);
+ return userData;
+ }
+
+ private unsafe int CipherUpdate(byte[] input, int inputOffset, int count, byte[] output, int outputOffset)
+ {
+ int ret;
+ int ccStatus;
+ int bytesWritten;
+
+ if (count == 0)
+ {
+ return 0;
+ }
+
+ fixed (byte* inputStart = input)
+ fixed (byte* outputStart = output)
+ {
+ byte* inputCurrent = inputStart + inputOffset;
+ byte* outputCurrent = outputStart + outputOffset;
+
+ ret = Interop.AppleCrypto.CryptorUpdate(
+ _cryptor,
+ inputCurrent,
+ count,
+ outputCurrent,
+ output.Length - outputOffset,
+ out bytesWritten,
+ out ccStatus);
+ }
+
+ ProcessInteropError(ret, ccStatus);
+
+ return bytesWritten;
+ }
+
+ private unsafe void OpenCryptor(
+ Interop.AppleCrypto.PAL_SymmetricAlgorithm algorithm,
+ CipherMode cipherMode,
+ byte[] key)
+ {
+ int ret;
+ int ccStatus;
+
+ byte[] iv = IV;
+
+ fixed (byte* pbKey = key)
+ fixed (byte* pbIv = iv)
+ {
+ ret = Interop.AppleCrypto.CryptorCreate(
+ _encrypting
+ ? Interop.AppleCrypto.PAL_SymmetricOperation.Encrypt
+ : Interop.AppleCrypto.PAL_SymmetricOperation.Decrypt,
+ algorithm,
+ GetPalChainMode(cipherMode),
+ Interop.AppleCrypto.PAL_PaddingMode.None,
+ pbKey,
+ key.Length,
+ pbIv,
+ Interop.AppleCrypto.PAL_SymmetricOptions.None,
+ out _cryptor,
+ out ccStatus);
+ }
+
+ ProcessInteropError(ret, ccStatus);
+ }
+
+ private Interop.AppleCrypto.PAL_ChainingMode GetPalChainMode(CipherMode cipherMode)
+ {
+ switch (cipherMode)
+ {
+ case CipherMode.CBC:
+ return Interop.AppleCrypto.PAL_ChainingMode.CBC;
+ case CipherMode.ECB:
+ return Interop.AppleCrypto.PAL_ChainingMode.ECB;
+ default:
+ throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CipherModeNotSupported, cipherMode));
+ }
+ }
+
+ private unsafe void Reset()
+ {
+ int ret;
+ int ccStatus;
+
+ byte[] iv = IV;
+
+ fixed (byte* pbIv = iv)
+ {
+ ret = Interop.AppleCrypto.CryptorReset(_cryptor, pbIv, out ccStatus);
+ }
+
+ ProcessInteropError(ret, ccStatus);
+ }
+
+ private static void ProcessInteropError(int functionReturnCode, int ccStatus)
+ {
+ // Success
+ if (functionReturnCode == 1)
+ {
+ return;
+ }
+
+ // Platform error
+ if (functionReturnCode == 0)
+ {
+ Debug.Assert(ccStatus != 0, "Interop function returned 0 but a system code of success");
+ throw Interop.AppleCrypto.CreateExceptionForCCError(
+ ccStatus,
+ Interop.AppleCrypto.CCCryptorStatus);
+ }
+
+ // Usually this will be -1, a general indication of bad inputs.
+ Debug.Fail($"Interop boundary returned unexpected value {functionReturnCode}");
+ throw new CryptographicException();
+ }
+ }
+}
diff --git a/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.OSX.cs b/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.OSX.cs
new file mode 100644
index 0000000000..ea9fbaa465
--- /dev/null
+++ b/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.OSX.cs
@@ -0,0 +1,247 @@
+// 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.Diagnostics;
+using System.Security.Cryptography;
+using System.Security.Cryptography.Apple;
+
+namespace Internal.Cryptography
+{
+ internal static partial class HashProviderDispenser
+ {
+ public static HashProvider CreateHashProvider(string hashAlgorithmId)
+ {
+ switch (hashAlgorithmId)
+ {
+ case HashAlgorithmNames.MD5:
+ return new AppleDigestProvider(Interop.AppleCrypto.PAL_HashAlgorithm.Md5);
+ case HashAlgorithmNames.SHA1:
+ return new AppleDigestProvider(Interop.AppleCrypto.PAL_HashAlgorithm.Sha1);
+ case HashAlgorithmNames.SHA256:
+ return new AppleDigestProvider(Interop.AppleCrypto.PAL_HashAlgorithm.Sha256);
+ case HashAlgorithmNames.SHA384:
+ return new AppleDigestProvider(Interop.AppleCrypto.PAL_HashAlgorithm.Sha384);
+ case HashAlgorithmNames.SHA512:
+ return new AppleDigestProvider(Interop.AppleCrypto.PAL_HashAlgorithm.Sha512);
+ }
+
+ throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithmId));
+ }
+
+ public static HashProvider CreateMacProvider(string hashAlgorithmId, byte[] key)
+ {
+ switch (hashAlgorithmId)
+ {
+ case HashAlgorithmNames.MD5:
+ return new AppleHmacProvider(Interop.AppleCrypto.PAL_HashAlgorithm.Md5, key);
+ case HashAlgorithmNames.SHA1:
+ return new AppleHmacProvider(Interop.AppleCrypto.PAL_HashAlgorithm.Sha1, key);
+ case HashAlgorithmNames.SHA256:
+ return new AppleHmacProvider(Interop.AppleCrypto.PAL_HashAlgorithm.Sha256, key);
+ case HashAlgorithmNames.SHA384:
+ return new AppleHmacProvider(Interop.AppleCrypto.PAL_HashAlgorithm.Sha384, key);
+ case HashAlgorithmNames.SHA512:
+ return new AppleHmacProvider(Interop.AppleCrypto.PAL_HashAlgorithm.Sha512, key);
+ }
+
+ throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithmId));
+ }
+
+ // -----------------------------
+ // ---- PAL layer ends here ----
+ // -----------------------------
+
+ private sealed class AppleHmacProvider : HashProvider
+ {
+ private readonly byte[] _key;
+ private readonly SafeHmacHandle _ctx;
+
+ private bool _running;
+
+ public override int HashSizeInBytes { get; }
+
+ internal AppleHmacProvider(Interop.AppleCrypto.PAL_HashAlgorithm algorithm, byte[] key)
+ {
+ _key = key.CloneByteArray();
+ int hashSizeInBytes = 0;
+ _ctx = Interop.AppleCrypto.HmacCreate(algorithm, ref hashSizeInBytes);
+
+ if (hashSizeInBytes < 0)
+ {
+ _ctx.Dispose();
+ throw new PlatformNotSupportedException(
+ SR.Format(
+ SR.Cryptography_UnknownHashAlgorithm,
+ Enum.GetName(typeof(Interop.AppleCrypto.PAL_HashAlgorithm), algorithm)));
+ }
+
+ if (_ctx.IsInvalid)
+ {
+ _ctx.Dispose();
+ throw new CryptographicException();
+ }
+
+ HashSizeInBytes = hashSizeInBytes;
+ }
+
+ public override unsafe void AppendHashDataCore(byte[] data, int offset, int count)
+ {
+ Debug.Assert(data != null);
+ Debug.Assert(offset >= 0);
+ Debug.Assert(offset < data.Length);
+ Debug.Assert(count >= 0);
+ Debug.Assert(data.Length - offset > count);
+
+ if (!_running)
+ {
+ SetKey();
+ }
+
+ int ret;
+
+ fixed (byte* pData = data)
+ {
+ byte* pbData = pData + offset;
+ ret = Interop.AppleCrypto.HmacUpdate(_ctx, pbData, count);
+ }
+
+ if (ret != 1)
+ {
+ throw new CryptographicException();
+ }
+ }
+
+ private unsafe void SetKey()
+ {
+ int ret;
+
+ fixed (byte* pbKey = _key)
+ {
+ ret = Interop.AppleCrypto.HmacInit(_ctx, pbKey, _key.Length);
+ }
+
+ if (ret != 1)
+ {
+ throw new CryptographicException();
+ }
+
+ _running = true;
+ }
+
+ public override unsafe byte[] FinalizeHashAndReset()
+ {
+ if (!_running)
+ {
+ SetKey();
+ }
+
+ byte[] output = new byte[HashSizeInBytes];
+ int ret;
+
+ fixed (byte* pbOutput = output)
+ {
+ ret = Interop.AppleCrypto.HmacFinal(_ctx, pbOutput, output.Length);
+ }
+
+ if (ret != 1)
+ {
+ throw new CryptographicException();
+ }
+
+ _running = false;
+ return output;
+ }
+
+ public override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ _ctx?.Dispose();
+ Array.Clear(_key, 0, _key.Length);
+ }
+ }
+ }
+
+ private sealed class AppleDigestProvider : HashProvider
+ {
+ private readonly SafeDigestCtxHandle _ctx;
+
+ public override int HashSizeInBytes { get; }
+
+ internal AppleDigestProvider(Interop.AppleCrypto.PAL_HashAlgorithm algorithm)
+ {
+ int hashSizeInBytes;
+ _ctx = Interop.AppleCrypto.DigestCreate(algorithm, out hashSizeInBytes);
+
+ if (hashSizeInBytes < 0)
+ {
+ _ctx.Dispose();
+ throw new PlatformNotSupportedException(
+ SR.Format(
+ SR.Cryptography_UnknownHashAlgorithm,
+ Enum.GetName(typeof(Interop.AppleCrypto.PAL_HashAlgorithm), algorithm)));
+ }
+
+ if (_ctx.IsInvalid)
+ {
+ _ctx.Dispose();
+ throw new CryptographicException();
+ }
+
+ HashSizeInBytes = hashSizeInBytes;
+ }
+
+ public override unsafe void AppendHashDataCore(byte[] data, int offset, int count)
+ {
+ Debug.Assert(data != null);
+ Debug.Assert(offset >= 0);
+ Debug.Assert(offset < data.Length);
+ Debug.Assert(count >= 0);
+ Debug.Assert(data.Length - offset > count);
+
+ int ret;
+
+ fixed (byte* pData = data)
+ {
+ byte* pbData = pData + offset;
+ ret = Interop.AppleCrypto.DigestUpdate(_ctx, pbData, count);
+ }
+
+ if (ret != 1)
+ {
+ Debug.Assert(ret == 0, $"DigestUpdate return value {ret} was not 0 or 1");
+ throw new CryptographicException();
+ }
+ }
+
+ public override unsafe byte[] FinalizeHashAndReset()
+ {
+ byte[] hash = new byte[HashSizeInBytes];
+ int ret;
+
+ fixed (byte* pHash = hash)
+ {
+ ret = Interop.AppleCrypto.DigestFinal(_ctx, pHash, hash.Length);
+ }
+
+ if (ret != 1)
+ {
+ Debug.Assert(ret == 0, $"DigestFinal return value {ret} was not 0 or 1");
+ throw new CryptographicException();
+ }
+
+ return hash;
+ }
+
+ public override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ _ctx?.Dispose();
+ }
+ }
+ }
+ }
+}
diff --git a/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.OSX.cs b/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.OSX.cs
new file mode 100644
index 0000000000..da5cefcdb7
--- /dev/null
+++ b/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.OSX.cs
@@ -0,0 +1,34 @@
+// 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.Security.Cryptography;
+
+namespace Internal.Cryptography
+{
+ partial class TripleDesImplementation
+ {
+ private static ICryptoTransform CreateTransformCore(
+ CipherMode cipherMode,
+ PaddingMode paddingMode,
+ byte[] key,
+ byte[] iv,
+ int blockSize,
+ bool encrypting)
+ {
+ BasicSymmetricCipher cipher = new AppleCCCryptor(
+ Interop.AppleCrypto.PAL_SymmetricAlgorithm.TripleDES,
+ cipherMode,
+ blockSize,
+ key,
+ iv,
+ encrypting);
+
+ return UniversalCryptoTransform.Create(paddingMode, cipher, encrypting);
+ }
+
+ // -----------------------------
+ // ---- PAL layer ends here ----
+ // -----------------------------
+ }
+}
diff --git a/src/System.Security.Cryptography.Algorithms/src/Resources/Strings.resx b/src/System.Security.Cryptography.Algorithms/src/Resources/Strings.resx
index dbb5dae52d..381729c2ed 100644
--- a/src/System.Security.Cryptography.Algorithms/src/Resources/Strings.resx
+++ b/src/System.Security.Cryptography.Algorithms/src/Resources/Strings.resx
@@ -243,6 +243,9 @@
<data name="Cryptography_TransformBeyondEndOfBuffer" xml:space="preserve">
<value>Attempt to transform beyond end of buffer.</value>
</data>
+ <data name="Cryptography_CipherModeNotSupported" xml:space="preserve">
+ <value>The specified CipherMode '{0}' is not supported.</value>
+ </data>
<data name="Cryptography_UnknownHashAlgorithm" xml:space="preserve">
<value>'{0}' is not a known hash algorithm.</value>
</data>
diff --git a/src/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj b/src/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj
index cb8c6480ea..088312db81 100644
--- a/src/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj
+++ b/src/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj
@@ -10,7 +10,6 @@
<ProjectGuid>{81A05E2E-E3AE-4246-B4E6-DD5F31FB71F9}</ProjectGuid>
<OutputType>Library</OutputType>
<AssemblyName>System.Security.Cryptography.Algorithms</AssemblyName>
- <AssemblyVersion>4.3.0.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)'=='net46'">4.0.0.0</AssemblyVersion>
<ContractProject Condition="'$(AssemblyVersion)' == '4.0.0.0'">..\ref\4.0\System.Security.Cryptography.Algorithms.depproj</ContractProject>
<AssemblyVersion Condition="'$(TargetGroup)'=='net461' or '$(TargetGroup)' == 'netcore50'">4.1.0.0</AssemblyVersion>
@@ -20,10 +19,11 @@
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net46' OR '$(TargetGroup)'=='net461' OR '$(TargetGroup)'=='net463'">true</IsPartialFacadeAssembly>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>INTERNAL_ASYMMETRIC_IMPLEMENTATIONS</DefineConstants>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)'==''">netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.7</NuGetTargetMoniker>
<GenFacadesArgs Condition="'$(TargetGroup)'=='net463' OR '$(TargetGroup)'=='netstandard1.6' OR '$(TargetGroup)'=='netstandard1.7'">$(GenFacadesArgs) -ignoreMissingTypes</GenFacadesArgs>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'OSX_Debug|AnyCPU'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'OSX_Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Unix_Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Unix_Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Windows_Debug|AnyCPU'" />
@@ -250,26 +250,60 @@
</Compile>
</ItemGroup>
<ItemGroup Condition=" '$(TargetsUnix)' == 'true' AND '$(TargetsOSX)' != 'true' ">
+ <Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.cs">
+ <Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.cs</Link>
+ </Compile>
+ <Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.Cipher.cs">
+ <Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.Cipher.cs</Link>
+ </Compile>
+ <Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.Hmac.cs">
+ <Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.Hmac.cs</Link>
+ </Compile>
+ <Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeEvpCipherCtxHandle.Unix.cs">
+ <Link>Common\Microsoft\Win32\SafeHandles\SafeEvpCipherCtxHandle.Unix.cs</Link>
+ </Compile>
+ <Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeEvpMdCtxHandle.Unix.cs">
+ <Link>Common\Microsoft\Win32\SafeHandles\SafeEvpMdCtxHandle.Unix.cs</Link>
+ </Compile>
+ <Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeHmacCtxHandle.Unix.cs">
+ <Link>Common\Microsoft\Win32\SafeHandles\SafeHmacCtxHandle.Unix.cs</Link>
+ </Compile>
+ <Compile Include="Internal\Cryptography\AesImplementation.Unix.cs" />
+ <Compile Include="Internal\Cryptography\HashProviderDispenser.Unix.cs" />
+ <Compile Include="Internal\Cryptography\OpenSslCipher.cs" />
+ <Compile Include="Internal\Cryptography\TripleDesImplementation.Unix.cs" />
<Compile Include="System\Security\Cryptography\RNGCryptoServiceProvider.Unix.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetsOSX)' == 'true' ">
<Compile Include="$(CommonPath)\Interop\OSX\Interop.Libraries.cs">
<Link>Common\Interop\OSX\Interop.Libraries.cs</Link>
</Compile>
+ <Compile Include="$(CommonPath)\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.Digest.cs">
+ <Link>Common\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.Digest.cs</Link>
+ </Compile>
<Compile Include="$(CommonPath)\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.Err.cs">
<Link>Common\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.Err.cs</Link>
</Compile>
+ <Compile Include="$(CommonPath)\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.Hmac.cs">
+ <Link>Common\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.Hmac.cs</Link>
+ </Compile>
+ <Compile Include="$(CommonPath)\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.PAL_HashAlgorithm.cs">
+ <Link>Common\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.PAL_HashAlgorithm.cs</Link>
+ </Compile>
<Compile Include="$(CommonPath)\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.Random.cs">
<Link>Common\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.Random.cs</Link>
</Compile>
+ <Compile Include="$(CommonPath)\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.Symmetric.cs">
+ <Link>Common\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.Symmetric.cs</Link>
+ </Compile>
+ <Compile Include="Internal\Cryptography\AesImplementation.OSX.cs" />
+ <Compile Include="Internal\Cryptography\AppleCCCryptor.cs" />
+ <Compile Include="Internal\Cryptography\HashProviderDispenser.OSX.cs" />
+ <Compile Include="Internal\Cryptography\TripleDesImplementation.OSX.cs" />
<Compile Include="System\Security\Cryptography\RNGCryptoServiceProvider.OSX.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetsUnix)' == 'true' ">
<Compile Include="System\Security\Cryptography\ECDsaOpenSsl.cs" />
- <Compile Include="Internal\Cryptography\AesImplementation.Unix.cs" />
- <Compile Include="Internal\Cryptography\HashProviderDispenser.Unix.cs" />
- <Compile Include="Internal\Cryptography\OpenSslCipher.cs" />
- <Compile Include="Internal\Cryptography\TripleDesImplementation.Unix.cs" />
<Compile Include="$(CommonPath)\Internal\Cryptography\OpenSslAsymmetricAlgorithmCore.cs">
<Link>Common\Internal\Cryptography\OpenSslAsymmetricAlgorithmCore.cs</Link>
</Compile>
@@ -300,21 +334,12 @@
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.ERR.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.ERR.cs</Link>
</Compile>
- <Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.cs">
- <Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.cs</Link>
- </Compile>
- <Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.Cipher.cs">
- <Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.Cipher.cs</Link>
- </Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.Initialization.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.Initialization.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.RAND.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.RAND.cs</Link>
</Compile>
- <Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.Hmac.cs">
- <Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.Hmac.cs</Link>
- </Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.Rsa.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.Rsa.cs</Link>
</Compile>
@@ -333,15 +358,6 @@
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeEcKeyHandle.Unix.cs">
<Link>Common\Microsoft\Win32\SafeHandles\SafeEcKeyHandle.Unix.cs</Link>
</Compile>
- <Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeEvpCipherCtxHandle.Unix.cs">
- <Link>Common\Microsoft\Win32\SafeHandles\SafeEvpCipherCtxHandle.Unix.cs</Link>
- </Compile>
- <Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeEvpMdCtxHandle.Unix.cs">
- <Link>Common\Microsoft\Win32\SafeHandles\SafeEvpMdCtxHandle.Unix.cs</Link>
- </Compile>
- <Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeHmacCtxHandle.Unix.cs">
- <Link>Common\Microsoft\Win32\SafeHandles\SafeHmacCtxHandle.Unix.cs</Link>
- </Compile>
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeRsaHandle.Unix.cs">
<Link>Common\Microsoft\Win32\SafeHandles\SafeRsaHandle.Unix.cs</Link>
</Compile>
@@ -382,4 +398,4 @@
<None Include="project.json" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/System.Security.Cryptography.Algorithms/tests/HashAlgorithmTest.cs b/src/System.Security.Cryptography.Algorithms/tests/HashAlgorithmTest.cs
index 18ee067056..724af71406 100644
--- a/src/System.Security.Cryptography.Algorithms/tests/HashAlgorithmTest.cs
+++ b/src/System.Security.Cryptography.Algorithms/tests/HashAlgorithmTest.cs
@@ -53,6 +53,101 @@ namespace System.Security.Cryptography.Hashing.Algorithms.Tests
}
}
+ [Fact]
+ public void InvalidInput_Null()
+ {
+ using (HashAlgorithm hash = Create())
+ {
+ Assert.Throws<ArgumentNullException>("buffer", () => hash.ComputeHash((byte[])null));
+ Assert.Throws<ArgumentNullException>("buffer", () => hash.ComputeHash(null, 0, 0));
+ Assert.Throws<NullReferenceException>(() => hash.ComputeHash((Stream)null));
+ }
+ }
+
+ [Fact]
+ public void InvalidInput_NegativeOffset()
+ {
+ using (HashAlgorithm hash = Create())
+ {
+ Assert.Throws<ArgumentOutOfRangeException>("offset", () => hash.ComputeHash(Array.Empty<byte>(), -1, 0));
+ }
+ }
+
+ [Fact]
+ public void InvalidInput_NegativeCount()
+ {
+ using (HashAlgorithm hash = Create())
+ {
+ Assert.Throws<ArgumentException>(null, () => hash.ComputeHash(Array.Empty<byte>(), 0, -1));
+ }
+ }
+
+ [Fact]
+ public void InvalidInput_TooBigOffset()
+ {
+ using (HashAlgorithm hash = Create())
+ {
+ Assert.Throws<ArgumentException>(null, () => hash.ComputeHash(Array.Empty<byte>(), 1, 0));
+ }
+ }
+
+ [Fact]
+ public void InvalidInput_TooBigCount()
+ {
+ byte[] nonEmpty = new byte[53];
+
+ using (HashAlgorithm hash = Create())
+ {
+ Assert.Throws<ArgumentException>(null, () => hash.ComputeHash(nonEmpty, 0, nonEmpty.Length + 1));
+ Assert.Throws<ArgumentException>(null, () => hash.ComputeHash(nonEmpty, 1, nonEmpty.Length));
+ Assert.Throws<ArgumentException>(null, () => hash.ComputeHash(nonEmpty, 2, nonEmpty.Length - 1));
+ Assert.Throws<ArgumentException>(null, () => hash.ComputeHash(Array.Empty<byte>(), 0, 1));
+ }
+ }
+
+ [Fact]
+ public void BoundaryCondition_Count0()
+ {
+ byte[] nonEmpty = new byte[53];
+
+ using (HashAlgorithm hash = Create())
+ {
+ byte[] emptyHash = hash.ComputeHash(Array.Empty<byte>());
+ byte[] shouldBeEmptyHash = hash.ComputeHash(nonEmpty, nonEmpty.Length, 0);
+
+ Assert.Equal(emptyHash, shouldBeEmptyHash);
+
+ shouldBeEmptyHash = hash.ComputeHash(nonEmpty, 0, 0);
+ Assert.Equal(emptyHash, shouldBeEmptyHash);
+
+ nonEmpty[0] = 0xFF;
+ nonEmpty[nonEmpty.Length - 1] = 0x77;
+
+ shouldBeEmptyHash = hash.ComputeHash(nonEmpty, nonEmpty.Length, 0);
+ Assert.Equal(emptyHash, shouldBeEmptyHash);
+
+ shouldBeEmptyHash = hash.ComputeHash(nonEmpty, 0, 0);
+ Assert.Equal(emptyHash, shouldBeEmptyHash);
+ }
+ }
+
+ [Fact]
+ public void OffsetAndCountRespected()
+ {
+ byte[] dataA = { 1, 1, 2, 3, 5, 8 };
+ byte[] dataB = { 0, 1, 1, 2, 3, 5, 8, 13 };
+
+ using (HashAlgorithm hash = Create())
+ {
+ byte[] baseline = hash.ComputeHash(dataA);
+
+ // Skip the 0 byte, and stop short of the 13.
+ byte[] offsetData = hash.ComputeHash(dataB, 1, dataA.Length);
+
+ Assert.Equal(baseline, offsetData);
+ }
+ }
+
protected class DataRepeatingStream : Stream
{
private int _remaining;
diff --git a/src/System.Security.Cryptography.Algorithms/tests/HmacTests.cs b/src/System.Security.Cryptography.Algorithms/tests/HmacTests.cs
index a4796db3cc..7e11279558 100644
--- a/src/System.Security.Cryptography.Algorithms/tests/HmacTests.cs
+++ b/src/System.Security.Cryptography.Algorithms/tests/HmacTests.cs
@@ -2,6 +2,7 @@
// 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.IO;
using Test.Cryptography;
using Xunit;
@@ -93,5 +94,100 @@ namespace System.Security.Cryptography.Hashing.Algorithms.Tests
Assert.Equal<byte>(expectedHash, actualHash);
}
}
+
+ [Fact]
+ public void InvalidInput_Null()
+ {
+ using (HMAC hash = Create())
+ {
+ Assert.Throws<ArgumentNullException>("buffer", () => hash.ComputeHash((byte[])null));
+ Assert.Throws<ArgumentNullException>("buffer", () => hash.ComputeHash(null, 0, 0));
+ Assert.Throws<NullReferenceException>(() => hash.ComputeHash((Stream)null));
+ }
+ }
+
+ [Fact]
+ public void InvalidInput_NegativeOffset()
+ {
+ using (HMAC hash = Create())
+ {
+ Assert.Throws<ArgumentOutOfRangeException>("offset", () => hash.ComputeHash(Array.Empty<byte>(), -1, 0));
+ }
+ }
+
+ [Fact]
+ public void InvalidInput_NegativeCount()
+ {
+ using (HMAC hash = Create())
+ {
+ Assert.Throws<ArgumentException>(null, () => hash.ComputeHash(Array.Empty<byte>(), 0, -1));
+ }
+ }
+
+ [Fact]
+ public void InvalidInput_TooBigOffset()
+ {
+ using (HMAC hash = Create())
+ {
+ Assert.Throws<ArgumentException>(null, () => hash.ComputeHash(Array.Empty<byte>(), 1, 0));
+ }
+ }
+
+ [Fact]
+ public void InvalidInput_TooBigCount()
+ {
+ byte[] nonEmpty = new byte[53];
+
+ using (HMAC hash = Create())
+ {
+ Assert.Throws<ArgumentException>(null, () => hash.ComputeHash(nonEmpty, 0, nonEmpty.Length + 1));
+ Assert.Throws<ArgumentException>(null, () => hash.ComputeHash(nonEmpty, 1, nonEmpty.Length));
+ Assert.Throws<ArgumentException>(null, () => hash.ComputeHash(nonEmpty, 2, nonEmpty.Length - 1));
+ Assert.Throws<ArgumentException>(null, () => hash.ComputeHash(Array.Empty<byte>(), 0, 1));
+ }
+ }
+
+ [Fact]
+ public void BoundaryCondition_Count0()
+ {
+ byte[] nonEmpty = new byte[53];
+
+ using (HMAC hash = Create())
+ {
+ byte[] emptyHash = hash.ComputeHash(Array.Empty<byte>());
+ byte[] shouldBeEmptyHash = hash.ComputeHash(nonEmpty, nonEmpty.Length, 0);
+
+ Assert.Equal(emptyHash, shouldBeEmptyHash);
+
+ shouldBeEmptyHash = hash.ComputeHash(nonEmpty, 0, 0);
+ Assert.Equal(emptyHash, shouldBeEmptyHash);
+
+ nonEmpty[0] = 0xFF;
+ nonEmpty[nonEmpty.Length - 1] = 0x77;
+
+ shouldBeEmptyHash = hash.ComputeHash(nonEmpty, nonEmpty.Length, 0);
+ Assert.Equal(emptyHash, shouldBeEmptyHash);
+
+ shouldBeEmptyHash = hash.ComputeHash(nonEmpty, 0, 0);
+ Assert.Equal(emptyHash, shouldBeEmptyHash);
+ }
+ }
+
+ [Fact]
+ public void OffsetAndCountRespected()
+ {
+ byte[] dataA = { 1, 1, 2, 3, 5, 8 };
+ byte[] dataB = { 0, 1, 1, 2, 3, 5, 8, 13 };
+
+ using (HMAC hash = Create())
+ {
+ byte[] baseline = hash.ComputeHash(dataA);
+
+ // Skip the 0 byte, and stop short of the 13.
+ byte[] offsetData = hash.ComputeHash(dataB, 1, dataA.Length);
+
+ Assert.Equal(baseline, offsetData);
+ }
+ }
}
}
diff --git a/src/System.Security.Cryptography.Algorithms/tests/Sha1Tests.cs b/src/System.Security.Cryptography.Algorithms/tests/Sha1Tests.cs
index 38ea26e655..30dde3a83f 100644
--- a/src/System.Security.Cryptography.Algorithms/tests/Sha1Tests.cs
+++ b/src/System.Security.Cryptography.Algorithms/tests/Sha1Tests.cs
@@ -13,6 +13,12 @@ namespace System.Security.Cryptography.Hashing.Algorithms.Tests
return SHA1.Create();
}
+ [Fact]
+ public void Sha1_Empty()
+ {
+ Verify(Array.Empty<byte>(), "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709");
+ }
+
// SHA1 tests are defined somewhat obliquely within RFC 3174, section 7.3
// The same tests appear in http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf Appendix A
[Fact]
diff --git a/src/System.Security.Cryptography.Algorithms/tests/Sha256Tests.cs b/src/System.Security.Cryptography.Algorithms/tests/Sha256Tests.cs
index c328ca8f03..85cf406e0e 100644
--- a/src/System.Security.Cryptography.Algorithms/tests/Sha256Tests.cs
+++ b/src/System.Security.Cryptography.Algorithms/tests/Sha256Tests.cs
@@ -13,6 +13,14 @@ namespace System.Security.Cryptography.Hashing.Algorithms.Tests
return SHA256.Create();
}
+ [Fact]
+ public void Sha256_Empty()
+ {
+ Verify(
+ Array.Empty<byte>(),
+ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855");
+ }
+
// These test cases are from http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf Appendix B
[Fact]
public void Sha256_Fips180_1()
diff --git a/src/System.Security.Cryptography.Algorithms/tests/Sha384Tests.cs b/src/System.Security.Cryptography.Algorithms/tests/Sha384Tests.cs
index 52f30aaa74..3525283a5a 100644
--- a/src/System.Security.Cryptography.Algorithms/tests/Sha384Tests.cs
+++ b/src/System.Security.Cryptography.Algorithms/tests/Sha384Tests.cs
@@ -13,6 +13,14 @@ namespace System.Security.Cryptography.Hashing.Algorithms.Tests
return SHA384.Create();
}
+ [Fact]
+ public void Sha384_Empty()
+ {
+ Verify(
+ Array.Empty<byte>(),
+ "38B060A751AC96384CD9327EB1B1E36A21FDB71114BE07434C0CC7BF63F6E1DA274EDEBFE76F65FBD51AD2F14898B95B");
+ }
+
// These test cases are from http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA_All.pdf
[Fact]
public void Sha384_NistShaAll_1()
diff --git a/src/System.Security.Cryptography.Algorithms/tests/Sha512Tests.cs b/src/System.Security.Cryptography.Algorithms/tests/Sha512Tests.cs
index 0c39df409f..d3a35cff1a 100644
--- a/src/System.Security.Cryptography.Algorithms/tests/Sha512Tests.cs
+++ b/src/System.Security.Cryptography.Algorithms/tests/Sha512Tests.cs
@@ -13,6 +13,14 @@ namespace System.Security.Cryptography.Hashing.Algorithms.Tests
return SHA512.Create();
}
+ [Fact]
+ public void Sha512_Empty()
+ {
+ Verify(
+ Array.Empty<byte>(),
+ "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e");
+ }
+
// These test cases are from http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf Appendix C
[Fact]
public void Sha512_Fips180_1()
diff --git a/src/System.Security.Cryptography.Cng/dir.props b/src/System.Security.Cryptography.Cng/dir.props
new file mode 100644
index 0000000000..c10ad4d643
--- /dev/null
+++ b/src/System.Security.Cryptography.Cng/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.2.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Security.Cryptography.Cng/ref/4.0/System.Security.Cryptography.Cng.depproj b/src/System.Security.Cryptography.Cng/ref/4.0/System.Security.Cryptography.Cng.depproj
index 7f7271ecb7..7a6488143e 100644
--- a/src/System.Security.Cryptography.Cng/ref/4.0/System.Security.Cryptography.Cng.depproj
+++ b/src/System.Security.Cryptography.Cng/ref/4.0/System.Security.Cryptography.Cng.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.Cryptography.Cng/ref/4.1/System.Security.Cryptography.Cng.depproj b/src/System.Security.Cryptography.Cng/ref/4.1/System.Security.Cryptography.Cng.depproj
index 352d84343c..b44e1f7f7e 100644
--- a/src/System.Security.Cryptography.Cng/ref/4.1/System.Security.Cryptography.Cng.depproj
+++ b/src/System.Security.Cryptography.Cng/ref/4.1/System.Security.Cryptography.Cng.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.4</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.4</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.csproj b/src/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.csproj
index 222b58c2eb..fca0d221dd 100644
--- a/src/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.csproj
+++ b/src/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.2.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.6</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.6</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj b/src/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj
index 04375f1f74..4a3c33b149 100644
--- a/src/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj
+++ b/src/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj
@@ -8,7 +8,6 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<AssemblyName>System.Security.Cryptography.Cng</AssemblyName>
<ProjectGuid>{4C1BD451-6A99-45E7-9339-79C77C42EE9E}</ProjectGuid>
- <AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)'=='net46'">4.0.0.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)'=='net461'">4.1.0.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -16,7 +15,6 @@
<ContractProject Condition="'$(AssemblyVersion)' == '4.1.0.0'">..\ref\4.1\System.Security.Cryptography.Cng.depproj</ContractProject>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46' OR '$(TargetGroup)' == 'net461' OR '$(TargetGroup)' == 'net463'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(IsPartialFacadeAssembly)' == 'true'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.6</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.6</NuGetTargetMoniker>
<GeneratePlatformNotSupportedAssembly Condition="'$(TargetsUnix)' == 'true'">true</GeneratePlatformNotSupportedAssembly>
</PropertyGroup>
diff --git a/src/System.Security.Cryptography.Csp/dir.props b/src/System.Security.Cryptography.Csp/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Security.Cryptography.Csp/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.csproj b/src/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.csproj
index d57054ddb8..84eb5c4241 100644
--- a/src/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.csproj
+++ b/src/System.Security.Cryptography.Csp/ref/System.Security.Cryptography.Csp.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj b/src/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj
index 8eb275c817..97a2e48311 100644
--- a/src/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj
+++ b/src/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj
@@ -5,11 +5,9 @@
<Configuration Condition="'$(Configuration)'==''">Windows_NT_Debug</Configuration>
<ProjectGuid>{3B7F91D7-0677-40CA-B4E7-D4E09D89A74E}</ProjectGuid>
<AssemblyName>System.Security.Cryptography.Csp</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<GeneratePlatformNotSupportedAssembly Condition="'$(TargetsUnix)' == 'true'">true</GeneratePlatformNotSupportedAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.Security.Cryptography.Encoding/dir.props b/src/System.Security.Cryptography.Encoding/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Security.Cryptography.Encoding/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Security.Cryptography.Encoding/ref/System.Security.Cryptography.Encoding.csproj b/src/System.Security.Cryptography.Encoding/ref/System.Security.Cryptography.Encoding.csproj
index e8aed6ab7a..fb9b809089 100644
--- a/src/System.Security.Cryptography.Encoding/ref/System.Security.Cryptography.Encoding.csproj
+++ b/src/System.Security.Cryptography.Encoding/ref/System.Security.Cryptography.Encoding.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.Cryptography.Encoding/src/System.Security.Cryptography.Encoding.csproj b/src/System.Security.Cryptography.Encoding/src/System.Security.Cryptography.Encoding.csproj
index f9f7e58421..65bf5f93b6 100644
--- a/src/System.Security.Cryptography.Encoding/src/System.Security.Cryptography.Encoding.csproj
+++ b/src/System.Security.Cryptography.Encoding/src/System.Security.Cryptography.Encoding.csproj
@@ -7,11 +7,9 @@
<PropertyGroup>
<ProjectGuid>{AA81E343-5E54-40B0-9381-C459419BE780}</ProjectGuid>
<AssemblyName>System.Security.Cryptography.Encoding</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Unix_Debug|AnyCPU'" />
diff --git a/src/System.Security.Cryptography.OpenSsl/dir.props b/src/System.Security.Cryptography.OpenSsl/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Security.Cryptography.OpenSsl/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.csproj b/src/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.csproj
index 2313bf0877..c6e29ab566 100644
--- a/src/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.csproj
+++ b/src/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.6</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.6</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.Cryptography.OpenSsl/src/System.Security.Cryptography.OpenSsl.csproj b/src/System.Security.Cryptography.OpenSsl/src/System.Security.Cryptography.OpenSsl.csproj
index 9576e8b1c6..8be837ac0c 100644
--- a/src/System.Security.Cryptography.OpenSsl/src/System.Security.Cryptography.OpenSsl.csproj
+++ b/src/System.Security.Cryptography.OpenSsl/src/System.Security.Cryptography.OpenSsl.csproj
@@ -8,9 +8,7 @@
<ProjectGuid>{78452F3E-BA91-47E7-BB0F-02E8A5C116C4}</ProjectGuid>
<OutputType>Library</OutputType>
<AssemblyName>System.Security.Cryptography.OpenSsl</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <PackageTargetFramework>netstandard1.6</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.6</NuGetTargetMoniker>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetsWindows)' == 'true'">
diff --git a/src/System.Security.Cryptography.Pkcs/dir.props b/src/System.Security.Cryptography.Pkcs/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Security.Cryptography.Pkcs/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Security.Cryptography.Pkcs/ref/System.Security.Cryptography.Pkcs.csproj b/src/System.Security.Cryptography.Pkcs/ref/System.Security.Cryptography.Pkcs.csproj
index 75c25721fd..62ee37aa33 100644
--- a/src/System.Security.Cryptography.Pkcs/ref/System.Security.Cryptography.Pkcs.csproj
+++ b/src/System.Security.Cryptography.Pkcs/ref/System.Security.Cryptography.Pkcs.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj b/src/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj
index 22dae5b6a2..3675fca3dc 100644
--- a/src/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj
+++ b/src/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj
@@ -7,13 +7,11 @@
<PropertyGroup>
<ProjectGuid>{03D84CBD-896D-4B2F-9A22-07034F51E73D}</ProjectGuid>
<AssemblyName>System.Security.Cryptography.Pkcs</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(IsPartialFacadeAssembly)' == 'true'">None</ResourcesSourceOutputDirectory>
<GeneratePlatformNotSupportedAssembly Condition="'$(TargetsUnix)' == 'true'">true</GeneratePlatformNotSupportedAssembly>
<UsePackageTargetRuntimeDefaults Condition="'$(IsPartialFacadeAssembly)' != 'true'">true</UsePackageTargetRuntimeDefaults>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)'==''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Don't delete these clauses even if they look useless. They tell the VS IDE that "Windows_Debug", etc., are
diff --git a/src/System.Security.Cryptography.Primitives/dir.props b/src/System.Security.Cryptography.Primitives/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Security.Cryptography.Primitives/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Security.Cryptography.Primitives/ref/System.Security.Cryptography.Primitives.csproj b/src/System.Security.Cryptography.Primitives/ref/System.Security.Cryptography.Primitives.csproj
index 4c49fd8303..167d83a16a 100644
--- a/src/System.Security.Cryptography.Primitives/ref/System.Security.Cryptography.Primitives.csproj
+++ b/src/System.Security.Cryptography.Primitives/ref/System.Security.Cryptography.Primitives.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.Cryptography.Primitives/src/System.Security.Cryptography.Primitives.csproj b/src/System.Security.Cryptography.Primitives/src/System.Security.Cryptography.Primitives.csproj
index 482035c688..60c57d16dd 100644
--- a/src/System.Security.Cryptography.Primitives/src/System.Security.Cryptography.Primitives.csproj
+++ b/src/System.Security.Cryptography.Primitives/src/System.Security.Cryptography.Primitives.csproj
@@ -4,10 +4,8 @@
<PropertyGroup>
<ProjectGuid>{DF73E985-E143-4BF5-9FA4-E199E7D36235}</ProjectGuid>
<AssemblyName>System.Security.Cryptography.Primitives</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
diff --git a/src/System.Security.Cryptography.ProtectedData/dir.props b/src/System.Security.Cryptography.ProtectedData/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Security.Cryptography.ProtectedData/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Security.Cryptography.ProtectedData/ref/System.Security.Cryptography.ProtectedData.csproj b/src/System.Security.Cryptography.ProtectedData/ref/System.Security.Cryptography.ProtectedData.csproj
index e997f86c6a..4492cd76fc 100644
--- a/src/System.Security.Cryptography.ProtectedData/ref/System.Security.Cryptography.ProtectedData.csproj
+++ b/src/System.Security.Cryptography.ProtectedData/ref/System.Security.Cryptography.ProtectedData.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.Cryptography.ProtectedData/src/System.Security.Cryptography.ProtectedData.csproj b/src/System.Security.Cryptography.ProtectedData/src/System.Security.Cryptography.ProtectedData.csproj
index 6a97706fe3..35c08b0339 100644
--- a/src/System.Security.Cryptography.ProtectedData/src/System.Security.Cryptography.ProtectedData.csproj
+++ b/src/System.Security.Cryptography.ProtectedData/src/System.Security.Cryptography.ProtectedData.csproj
@@ -4,12 +4,10 @@
<PropertyGroup>
<ProjectGuid>{FB39F994-1504-4B96-9588-E0385D3B73F1}</ProjectGuid>
<AssemblyName>System.Security.Cryptography.ProtectedData</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
<GeneratePlatformNotSupportedAssembly Condition="'$(TargetsUnix)' == 'true'">true</GeneratePlatformNotSupportedAssembly>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Windows_Debug|AnyCPU'" />
diff --git a/src/System.Security.Cryptography.X509Certificates/dir.props b/src/System.Security.Cryptography.X509Certificates/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.Security.Cryptography.X509Certificates/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Security.Cryptography.X509Certificates/ref/4.0/System.Security.Cryptography.X509Certificates.csproj b/src/System.Security.Cryptography.X509Certificates/ref/4.0/System.Security.Cryptography.X509Certificates.csproj
index c966617823..aaf63b182b 100644
--- a/src/System.Security.Cryptography.X509Certificates/ref/4.0/System.Security.Cryptography.X509Certificates.csproj
+++ b/src/System.Security.Cryptography.X509Certificates/ref/4.0/System.Security.Cryptography.X509Certificates.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.Cryptography.X509Certificates/ref/System.Security.Cryptography.X509Certificates.csproj b/src/System.Security.Cryptography.X509Certificates/ref/System.Security.Cryptography.X509Certificates.csproj
index 839db2c466..743654d0e9 100644
--- a/src/System.Security.Cryptography.X509Certificates/ref/System.Security.Cryptography.X509Certificates.csproj
+++ b/src/System.Security.Cryptography.X509Certificates/ref/System.Security.Cryptography.X509Certificates.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.4</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.4</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/DirectoryBasedStoreProvider.cs b/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/DirectoryBasedStoreProvider.cs
index 94687490ce..38c6c527cf 100644
--- a/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/DirectoryBasedStoreProvider.cs
+++ b/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/DirectoryBasedStoreProvider.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Security.Cryptography;
@@ -91,11 +92,23 @@ namespace Internal.Cryptography.Pal
return;
}
+ var loadedCerts = new HashSet<X509Certificate2>();
+
foreach (string filePath in Directory.EnumerateFiles(_storePath, PfxWildcard))
{
try
{
- collection.Add(new X509Certificate2(filePath));
+ var cert = new X509Certificate2(filePath);
+
+ // If we haven't already loaded a cert .Equal to this one, copy it to the collection.
+ if (loadedCerts.Add(cert))
+ {
+ collection.Add(cert);
+ }
+ else
+ {
+ cert.Dispose();
+ }
}
catch (CryptographicException)
{
@@ -185,19 +198,24 @@ namespace Internal.Cryptography.Pal
using (X509Certificate2 copy = new X509Certificate2(cert.DuplicateHandles()))
{
- bool hadCandidates;
- string currentFilename = FindExistingFilename(copy, _storePath, out hadCandidates);
+ string currentFilename;
- if (currentFilename != null)
+ do
{
- if (_readOnly)
+ bool hadCandidates;
+ currentFilename = FindExistingFilename(copy, _storePath, out hadCandidates);
+
+ if (currentFilename != null)
{
- // Windows compatibility, the readonly check isn't done until after a match is found.
- throw new CryptographicException(SR.Cryptography_X509_StoreReadOnly);
- }
+ if (_readOnly)
+ {
+ // Windows compatibility, the readonly check isn't done until after a match is found.
+ throw new CryptographicException(SR.Cryptography_X509_StoreReadOnly);
+ }
- File.Delete(currentFilename);
- }
+ File.Delete(currentFilename);
+ }
+ } while (currentFilename != null);
}
}
diff --git a/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs b/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs
index bac8dd9e49..16d04b0f7a 100644
--- a/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs
+++ b/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs
@@ -500,17 +500,25 @@ namespace Internal.Cryptography.Pal
// fill the system trusted collection
foreach (X509Certificate2 userRootCert in userRootCerts)
{
- systemTrusted.Add(userRootCert);
+ if (!systemTrusted.Add(userRootCert))
+ {
+ // If we have already (effectively) added another instance of this certificate,
+ // then this one provides no value. A Disposed cert won't harm the matching logic.
+ userRootCert.Dispose();
+ }
}
foreach (X509Certificate2 systemRootCert in systemRootCerts)
{
- systemTrusted.Add(systemRootCert);
+ if (!systemTrusted.Add(systemRootCert))
+ {
+ // If we have already (effectively) added another instance of this certificate,
+ // (for example, because another copy of it was in the user store)
+ // then this one provides no value. A Disposed cert won't harm the matching logic.
+ systemRootCert.Dispose();
+ }
}
- // ordering in storesToCheck must match how we read into the systemTrusted collection, that is
- // first in first checked due to how we eventually use the collection in candidatesByReference
-
X509Certificate2Collection[] storesToCheck =
{
extraStore,
@@ -550,26 +558,35 @@ namespace Internal.Cryptography.Pal
candidates,
ReferenceEqualityComparer<X509Certificate2>.Instance);
- // Dispose any certificates we cloned in, but didn't end up needing.
- // Since extraStore was provided by users, don't dispose anything it contains.
- Debug.Assert(storesToCheck.Length > 0, "storesToCheck.Length > 0");
- Debug.Assert(storesToCheck[0] == extraStore, "storesToCheck[0] == extraStore");
+ // Certificates come from 5 sources:
+ // 1) extraStore.
+ // These are cert objects that are provided by the user, we shouldn't dispose them.
+ // 2) the machine root store
+ // These certs are moving on to the "was I a system trust?" test, and we shouldn't dispose them.
+ // 3) the user root store
+ // These certs are moving on to the "was I a system trust?" test, and we shouldn't dispose them.
+ // 4) the machine intermediate store
+ // These certs were either path candidates, or not. If they were, don't dispose them. Otherwise do.
+ // 5) the user intermediate store
+ // These certs were either path candidates, or not. If they were, don't dispose them. Otherwise do.
+ DisposeUnreferenced(candidatesByReference, systemIntermediateCerts);
+ DisposeUnreferenced(candidatesByReference, userIntermediateCerts);
+ }
- for (int i = 1; i < storesToCheck.Length; i++)
- {
- X509Certificate2Collection collection = storesToCheck[i];
+ return candidates;
+ }
- foreach (X509Certificate2 cert in collection)
- {
- if (!candidatesByReference.Contains(cert))
- {
- cert.Dispose();
- }
- }
+ private static void DisposeUnreferenced(
+ ISet<X509Certificate2> referencedSet,
+ X509Certificate2Collection storeCerts)
+ {
+ foreach (X509Certificate2 cert in storeCerts)
+ {
+ if (!referencedSet.Contains(cert))
+ {
+ cert.Dispose();
}
}
-
- return candidates;
}
private static HashSet<X509Certificate2> FindIssuer(
@@ -592,7 +609,14 @@ namespace Internal.Cryptography.Pal
foreach (X509Certificate2 candidate in store)
{
- SafeX509Handle candidateHandle = ((OpenSslX509CertificateReader)candidate.Pal).SafeHandle;
+ var certPal = (OpenSslX509CertificateReader)candidate.Pal;
+
+ if (certPal == null)
+ {
+ continue;
+ }
+
+ SafeX509Handle candidateHandle = certPal.SafeHandle;
int issuerError = Interop.Crypto.X509CheckIssued(candidateHandle, certHandle);
diff --git a/src/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj b/src/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj
index bfa6c574ba..3ea6a5ddf0 100644
--- a/src/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj
+++ b/src/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj
@@ -10,10 +10,8 @@
<ProjectGuid>{6F8576C2-6CD0-4DF3-8394-00B002D82E40}</ProjectGuid>
<OutputType>Library</OutputType>
<AssemblyName>System.Security.Cryptography.X509Certificates</AssemblyName>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)'=='net46'">4.0.0.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.6</PackageTargetFramework>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net46' OR '$(TargetGroup)'=='net461'">true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)'==''">.NETStandard,Version=v1.6</NuGetTargetMoniker>
</PropertyGroup>
@@ -313,4 +311,4 @@
<TargetingPackReference Include="System.Core" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/System.Security.Cryptography.X509Certificates/tests/FindTests.cs b/src/System.Security.Cryptography.X509Certificates/tests/FindTests.cs
index ecb5c55c4a..444d2f930d 100644
--- a/src/System.Security.Cryptography.X509Certificates/tests/FindTests.cs
+++ b/src/System.Security.Cryptography.X509Certificates/tests/FindTests.cs
@@ -216,6 +216,82 @@ namespace System.Security.Cryptography.X509Certificates.Tests
}
}
+ [Fact]
+ public static void FindByValidThumbprint_RootCert()
+ {
+ using (X509Store machineRoot = new X509Store(StoreName.Root, StoreLocation.LocalMachine))
+ {
+ machineRoot.Open(OpenFlags.ReadOnly);
+
+ using (var watchedStoreCerts = new ImportedCollection(machineRoot.Certificates))
+ {
+ X509Certificate2Collection storeCerts = watchedStoreCerts.Collection;
+ X509Certificate2 rootCert = null;
+ TimeSpan tolerance = TimeSpan.FromHours(12);
+
+ // These APIs use local time, so use DateTime.Now, not DateTime.UtcNow.
+ DateTime notBefore = DateTime.Now;
+ DateTime notAfter = DateTime.Now.Subtract(tolerance);
+
+ foreach (X509Certificate2 cert in storeCerts)
+ {
+ if (cert.NotBefore < notBefore && cert.NotAfter > notAfter)
+ {
+ X509KeyUsageExtension keyUsageExtension = null;
+
+ foreach (X509Extension extension in cert.Extensions)
+ {
+ keyUsageExtension = extension as X509KeyUsageExtension;
+
+ if (keyUsageExtension != null)
+ {
+ break;
+ }
+ }
+
+ // Some tool is putting the com.apple.systemdefault utility cert in the
+ // LM\Root store on OSX machines; but it gets rejected by OpenSSL as an
+ // invalid root for not having the Certificate Signing key usage value.
+ //
+ // While the real problem seems to be with whatever tool is putting it
+ // in the bundle; we can work around it here.
+ const X509KeyUsageFlags RequiredFlags = X509KeyUsageFlags.KeyCertSign;
+
+ // No key usage extension means "good for all usages"
+ if (keyUsageExtension == null ||
+ (keyUsageExtension.KeyUsages & RequiredFlags) == RequiredFlags)
+ {
+ rootCert = cert;
+ break;
+ }
+ }
+ }
+
+ // Just in case someone has a system with no valid trusted root certs whatsoever.
+ if (rootCert != null)
+ {
+ X509Certificate2Collection matches =
+ storeCerts.Find(X509FindType.FindByThumbprint, rootCert.Thumbprint, true);
+
+ using (new ImportedCollection(matches))
+ {
+ // Improve the debuggability, since the root cert found on each
+ // machine might be different
+ if (matches.Count == 0)
+ {
+ Assert.True(
+ false,
+ $"Root certificate '{rootCert.Subject}' ({rootCert.NotBefore} - {rootCert.NotAfter}) is findable with thumbprint '{rootCert.Thumbprint}' and validOnly=true");
+ }
+
+ Assert.NotSame(rootCert, matches[0]);
+ Assert.Equal(rootCert, matches[0]);
+ }
+ }
+ }
+ }
+ }
+
[Theory]
[InlineData("Nothing")]
[InlineData("US, Redmond, Microsoft Corporation, MOPR, Microsoft Corporation")]
diff --git a/src/System.Security.Cryptography.X509Certificates/tests/X509FilesystemTests.Unix.cs b/src/System.Security.Cryptography.X509Certificates/tests/X509FilesystemTests.Unix.cs
index 9e27cfa9ac..070247a001 100644
--- a/src/System.Security.Cryptography.X509Certificates/tests/X509FilesystemTests.Unix.cs
+++ b/src/System.Security.Cryptography.X509Certificates/tests/X509FilesystemTests.Unix.cs
@@ -138,14 +138,17 @@ namespace System.Security.Cryptography.X509Certificates.Tests
Assert.True(Directory.Exists(storeDirectory), "Directory.Exists(storeDirectory)");
Assert.Equal(1, Directory.GetFiles(storeDirectory).Length);
- X509Certificate2Collection storeCerts = store.Certificates;
+ using (var coll = new ImportedCollection(store.Certificates))
+ {
+ X509Certificate2Collection storeCerts = coll.Collection;
- Assert.Equal(1, storeCerts.Count);
+ Assert.Equal(1, storeCerts.Count);
- using (X509Certificate2 storeCert = storeCerts[0])
- {
- Assert.Equal(cert, storeCert);
- Assert.NotSame(cert, storeCert);
+ using (X509Certificate2 storeCert = storeCerts[0])
+ {
+ Assert.Equal(cert, storeCert);
+ Assert.NotSame(cert, storeCert);
+ }
}
}
});
@@ -175,14 +178,17 @@ namespace System.Security.Cryptography.X509Certificates.Tests
Assert.True(Directory.Exists(storeDirectory), "Directory.Exists(storeDirectory)");
Assert.Equal(1, Directory.GetFiles(storeDirectory).Length);
- X509Certificate2Collection storeCerts = store.Certificates;
+ using (var coll = new ImportedCollection(store.Certificates))
+ {
+ X509Certificate2Collection storeCerts = coll.Collection;
- Assert.Equal(1, storeCerts.Count);
+ Assert.Equal(1, storeCerts.Count);
- using (X509Certificate2 storeCert = storeCerts[0])
- {
- Assert.Equal(cert, storeCert);
- Assert.NotSame(cert, storeCert);
+ using (X509Certificate2 storeCert = storeCerts[0])
+ {
+ Assert.Equal(cert, storeCert);
+ Assert.NotSame(cert, storeCert);
+ }
}
}
});
@@ -570,6 +576,49 @@ namespace System.Security.Cryptography.X509Certificates.Tests
});
}
+ [Fact]
+ [OuterLoop( /* Alters user/machine state */)]
+ private static void X509Store_FiltersDuplicateOnLoad()
+ {
+ RunX509StoreTest(
+ (store, storeDirectory) =>
+ {
+ using (var certA = new X509Certificate2(TestData.MsCertificate))
+ {
+ store.Open(OpenFlags.ReadWrite);
+
+ store.Add(certA);
+
+ // Emulate a race condition of parallel adds with the following flow
+ // AdderA: Notice [thumbprint].pfx is available, create it (0 bytes)
+ // AdderB: Notice [thumbprint].pfx already exists, but can't be read, move to [thumbprint].1.pfx
+ // AdderA: finish write
+ // AdderB: finish write
+
+ string[] files = Directory.GetFiles(storeDirectory, "*.pfx");
+ Assert.Equal(1, files.Length);
+
+ string srcFile = files[0];
+ string baseName = Path.GetFileNameWithoutExtension(srcFile);
+ string destFile = Path.Combine(storeDirectory, srcFile + ".1.pfx");
+ File.Copy(srcFile, destFile);
+
+ using (var coll = new ImportedCollection(store.Certificates))
+ {
+ Assert.Equal(1, coll.Collection.Count);
+ Assert.Equal(certA, coll.Collection[0]);
+ }
+
+ // Also check that remove removes both files.
+
+ store.Remove(certA);
+
+ string[] filesAfter = Directory.GetFiles(storeDirectory, "*.pfx");
+ Assert.Equal(0, filesAfter.Length);
+ }
+ });
+ }
+
private static void AssertEqualContents(X509Store storeA, X509Store storeB)
{
Assert.NotSame(storeA, storeB);
diff --git a/src/System.Security.Cryptography.X509Certificates/tests/X509StoreTests.cs b/src/System.Security.Cryptography.X509Certificates/tests/X509StoreTests.cs
index b0cda7aa4e..97391158ba 100644
--- a/src/System.Security.Cryptography.X509Certificates/tests/X509StoreTests.cs
+++ b/src/System.Security.Cryptography.X509Certificates/tests/X509StoreTests.cs
@@ -24,11 +24,15 @@ namespace System.Security.Cryptography.X509Certificates.Tests
using (X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser))
{
store.Open(OpenFlags.ReadOnly);
- int certCount = store.Certificates.Count;
- // This assert is just so certCount appears to be used, the test really
- // is that store.get_Certificates didn't throw.
- Assert.True(certCount >= 0);
+ using (var coll = new ImportedCollection(store.Certificates))
+ {
+ int certCount = coll.Collection.Count;
+
+ // This assert is just so certCount appears to be used, the test really
+ // is that store.get_Certificates didn't throw.
+ Assert.True(certCount >= 0);
+ }
}
}
@@ -49,12 +53,15 @@ namespace System.Security.Cryptography.X509Certificates.Tests
{
store.Open(OpenFlags.ReadOnly);
- // Add only throws when it has to do work. If, for some reason, this certificate
- // is already present in the CurrentUser\My store, we can't really test this
- // functionality.
- if (!store.Certificates.Contains(cert))
+ using (var coll = new ImportedCollection(store.Certificates))
{
- Assert.ThrowsAny<CryptographicException>(() => store.Add(cert));
+ // Add only throws when it has to do work. If, for some reason, this certificate
+ // is already present in the CurrentUser\My store, we can't really test this
+ // functionality.
+ if (!coll.Collection.Contains(cert))
+ {
+ Assert.ThrowsAny<CryptographicException>(() => store.Add(cert));
+ }
}
}
}
@@ -71,12 +78,15 @@ namespace System.Security.Cryptography.X509Certificates.Tests
// Look through the certificates to find one with no private key to call add on.
// (The private key restriction is so that in the event of an "accidental success"
// that no potential permissions would be modified)
- foreach (X509Certificate2 cert in store.Certificates)
+ using (var coll = new ImportedCollection(store.Certificates))
{
- if (!cert.HasPrivateKey)
+ foreach (X509Certificate2 cert in coll.Collection)
{
- toAdd = cert;
- break;
+ if (!cert.HasPrivateKey)
+ {
+ toAdd = cert;
+ break;
+ }
}
}
@@ -104,9 +114,12 @@ namespace System.Security.Cryptography.X509Certificates.Tests
{
store.Open(OpenFlags.ReadOnly);
- if (store.Certificates.Contains(cert))
+ using (var coll = new ImportedCollection(store.Certificates))
{
- Assert.ThrowsAny<CryptographicException>(() => store.Remove(cert));
+ if (coll.Collection.Contains(cert))
+ {
+ Assert.ThrowsAny<CryptographicException>(() => store.Remove(cert));
+ }
}
}
}
diff --git a/src/System.Security.Principal.Windows/dir.props b/src/System.Security.Principal.Windows/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Security.Principal.Windows/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Security.Principal.Windows/ref/System.Security.Principal.Windows.csproj b/src/System.Security.Principal.Windows/ref/System.Security.Principal.Windows.csproj
index 4ca9e815ef..02203a91a8 100644
--- a/src/System.Security.Principal.Windows/ref/System.Security.Principal.Windows.csproj
+++ b/src/System.Security.Principal.Windows/ref/System.Security.Principal.Windows.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.Principal.Windows/src/System.Security.Principal.Windows.csproj b/src/System.Security.Principal.Windows/src/System.Security.Principal.Windows.csproj
index 7430529845..49b8f00ded 100644
--- a/src/System.Security.Principal.Windows/src/System.Security.Principal.Windows.csproj
+++ b/src/System.Security.Principal.Windows/src/System.Security.Principal.Windows.csproj
@@ -7,11 +7,9 @@
<PropertyGroup>
<ProjectGuid>{F9E9894E-2513-4085-9046-311AD49D8AE6}</ProjectGuid>
<AssemblyName>System.Security.Principal.Windows</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<GeneratePlatformNotSupportedAssembly Condition="'$(TargetsUnix)' == 'true'">true</GeneratePlatformNotSupportedAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.Security.Principal/dir.props b/src/System.Security.Principal/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Security.Principal/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Security.Principal/pkg/System.Security.Principal.pkgproj b/src/System.Security.Principal/pkg/System.Security.Principal.pkgproj
index 5bbb099488..e8502abe7a 100644
--- a/src/System.Security.Principal/pkg/System.Security.Principal.pkgproj
+++ b/src/System.Security.Principal/pkg/System.Security.Principal.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Security.Principal.csproj">
diff --git a/src/System.Security.Principal/pkg/ValidationSuppression.txt b/src/System.Security.Principal/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Security.Principal/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Security.Principal/ref/System.Security.Principal.csproj b/src/System.Security.Principal/ref/System.Security.Principal.csproj
index 89c5f474a1..8937e5ad3e 100644
--- a/src/System.Security.Principal/ref/System.Security.Principal.csproj
+++ b/src/System.Security.Principal/ref/System.Security.Principal.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.Principal/src/System.Security.Principal.csproj b/src/System.Security.Principal/src/System.Security.Principal.csproj
index 776076d082..4c8dc312fe 100644
--- a/src/System.Security.Principal/src/System.Security.Principal.csproj
+++ b/src/System.Security.Principal/src/System.Security.Principal.csproj
@@ -4,11 +4,9 @@
<PropertyGroup>
<AssemblyName>System.Security.Principal</AssemblyName>
<ProjectGuid>{FBE16BC8-AE2D-422C-861E-861814F53AF7}</ProjectGuid>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the options -->
diff --git a/src/System.Security.SecureString/dir.props b/src/System.Security.SecureString/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Security.SecureString/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Security.SecureString/ref/System.Security.SecureString.csproj b/src/System.Security.SecureString/ref/System.Security.SecureString.csproj
index c2ea57ca1a..5df8a733a6 100644
--- a/src/System.Security.SecureString/ref/System.Security.SecureString.csproj
+++ b/src/System.Security.SecureString/ref/System.Security.SecureString.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Security.SecureString/src/System.Security.SecureString.csproj b/src/System.Security.SecureString/src/System.Security.SecureString.csproj
index a743b619c8..ce761c4317 100644
--- a/src/System.Security.SecureString/src/System.Security.SecureString.csproj
+++ b/src/System.Security.SecureString/src/System.Security.SecureString.csproj
@@ -8,10 +8,8 @@
<ProjectGuid>{A958BBDD-3238-4E58-AB7F-390AB6D88233}</ProjectGuid>
<RootNamespace>System.Security.SecureString</RootNamespace>
<AssemblyName>System.Security.SecureString</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.ServiceProcess.ServiceController/dir.props b/src/System.ServiceProcess.ServiceController/dir.props
new file mode 100644
index 0000000000..34b2edfd20
--- /dev/null
+++ b/src/System.ServiceProcess.ServiceController/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.csproj b/src/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.csproj
index a1e7551087..056a5df797 100644
--- a/src/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.csproj
+++ b/src/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.4</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.4</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj b/src/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj
index 8f0017e8be..6628e8da04 100644
--- a/src/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj
+++ b/src/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj
@@ -7,12 +7,10 @@
<PropertyGroup>
<RootNamespace>System.ServiceProcess.ServiceController</RootNamespace>
<AssemblyName>System.ServiceProcess.ServiceController</AssemblyName>
- <AssemblyVersion>4.1.1.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ProjectGuid>{F4821CB6-91A3-4546-BC4F-E00DBFBDAA05}</ProjectGuid>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net461'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net461'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.5</PackageTargetFramework>
<GeneratePlatformNotSupportedAssembly Condition="'$(TargetsUnix)' == 'true'">true</GeneratePlatformNotSupportedAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.5</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.Text.Encoding.CodePages/dir.props b/src/System.Text.Encoding.CodePages/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Text.Encoding.CodePages/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Text.Encoding.CodePages/ref/System.Text.Encoding.CodePages.csproj b/src/System.Text.Encoding.CodePages/ref/System.Text.Encoding.CodePages.csproj
index 794a7dacc8..bdf0d97c8a 100644
--- a/src/System.Text.Encoding.CodePages/ref/System.Text.Encoding.CodePages.csproj
+++ b/src/System.Text.Encoding.CodePages/ref/System.Text.Encoding.CodePages.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Text.Encoding.CodePages/src/System.Text.Encoding.CodePages.csproj b/src/System.Text.Encoding.CodePages/src/System.Text.Encoding.CodePages.csproj
index 458410c95e..fe1b1569f1 100644
--- a/src/System.Text.Encoding.CodePages/src/System.Text.Encoding.CodePages.csproj
+++ b/src/System.Text.Encoding.CodePages/src/System.Text.Encoding.CodePages.csproj
@@ -11,19 +11,15 @@
<OutputType>Library</OutputType>
<RootNamespace>System.Text.Encoding.CodePages</RootNamespace>
<AssemblyName>System.Text.Encoding.CodePages</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <PackageTargetFramework Condition="'$(TargetsUnix)' == 'true'">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup Condition="'$(TargetsWindows)' == 'true'">
- <PackageDestination Include="runtimes/win/lib/netstandard1.3">
- <TargetFramework>netstandard1.3</TargetFramework>
- </PackageDestination>
+ <PackageTargetFramework Include="netstandard1.3" />
<!-- need to support rid-less restore for packages.config -->
- <PackageDestination Include="lib/net46">
- <TargetFramework>net46</TargetFramework>
- </PackageDestination>
+ <PackageTargetFramework Include="net46">
+ <TargetRuntime></TargetRuntime>
+ </PackageTargetFramework>
</ItemGroup>
<!-- Help VS understand available configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Unix_Debug|AnyCPU'" />
diff --git a/src/System.Text.Encoding.CodePages/src/System/Text/EncodingTable.cs b/src/System.Text.Encoding.CodePages/src/System/Text/EncodingTable.cs
index 3b818e300e..96c8749a67 100644
--- a/src/System.Text.Encoding.CodePages/src/System/Text/EncodingTable.cs
+++ b/src/System.Text.Encoding.CodePages/src/System/Text/EncodingTable.cs
@@ -61,7 +61,7 @@ namespace System.Text
return codePage;
}
- unsafe private static int InternalGetCodePageFromName(string name)
+ private static int InternalGetCodePageFromName(string name)
{
int left = 0;
int right = s_encodingNameIndices.Length - 2;
@@ -128,17 +128,17 @@ namespace System.Text
return s1.Length - length;
}
- unsafe internal static string GetWebNameFromCodePage(int codePage)
+ internal static string GetWebNameFromCodePage(int codePage)
{
return GetNameFromCodePage(codePage, s_webNames, s_webNameIndices, s_codePageToWebNameCache);
}
- unsafe internal static string GetEnglishNameFromCodePage(int codePage)
+ internal static string GetEnglishNameFromCodePage(int codePage)
{
return GetNameFromCodePage(codePage, s_englishNames, s_englishNameIndices, s_codePageToEnglishNameCache);
}
- unsafe private static string GetNameFromCodePage(int codePage, string names, int[] indices, Dictionary<int, string> cache)
+ private static string GetNameFromCodePage(int codePage, string names, int[] indices, Dictionary<int, string> cache)
{
string name;
@@ -161,10 +161,7 @@ namespace System.Text
}
else
{
- fixed (char* pChar = names)
- {
- name = new String(pChar, indices[i], indices[i + 1] - indices[i]);
- }
+ name = names.Substring(indices[i], indices[i + 1] - indices[i]);
s_cacheLock.EnterWriteLock();
try
diff --git a/src/System.Text.Encoding.Extensions/dir.props b/src/System.Text.Encoding.Extensions/dir.props
new file mode 100644
index 0000000000..d16ef39bdb
--- /dev/null
+++ b/src/System.Text.Encoding.Extensions/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.12.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Text.Encoding.Extensions/pkg/System.Text.Encoding.Extensions.pkgproj b/src/System.Text.Encoding.Extensions/pkg/System.Text.Encoding.Extensions.pkgproj
index d9c2d650e7..79f694ee82 100644
--- a/src/System.Text.Encoding.Extensions/pkg/System.Text.Encoding.Extensions.pkgproj
+++ b/src/System.Text.Encoding.Extensions/pkg/System.Text.Encoding.Extensions.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.12.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\4.0.0\System.Text.Encoding.Extensions.depproj">
diff --git a/src/System.Text.Encoding.Extensions/pkg/ValidationSuppression.txt b/src/System.Text.Encoding.Extensions/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Text.Encoding.Extensions/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Text.Encoding.Extensions/ref/4.0.0/System.Text.Encoding.Extensions.depproj b/src/System.Text.Encoding.Extensions/ref/4.0.0/System.Text.Encoding.Extensions.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Text.Encoding.Extensions/ref/4.0.0/System.Text.Encoding.Extensions.depproj
+++ b/src/System.Text.Encoding.Extensions/ref/4.0.0/System.Text.Encoding.Extensions.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Text.Encoding.Extensions/ref/System.Text.Encoding.Extensions.csproj b/src/System.Text.Encoding.Extensions/ref/System.Text.Encoding.Extensions.csproj
index 10db45e6fa..6ddb23ab93 100644
--- a/src/System.Text.Encoding.Extensions/ref/System.Text.Encoding.Extensions.csproj
+++ b/src/System.Text.Encoding.Extensions/ref/System.Text.Encoding.Extensions.csproj
@@ -5,7 +5,6 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Text.Encoding.Extensions/src/System.Text.Encoding.Extensions.csproj b/src/System.Text.Encoding.Extensions/src/System.Text.Encoding.Extensions.csproj
index 4efb434812..496330df6b 100644
--- a/src/System.Text.Encoding.Extensions/src/System.Text.Encoding.Extensions.csproj
+++ b/src/System.Text.Encoding.Extensions/src/System.Text.Encoding.Extensions.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Text.Encoding.Extensions</AssemblyName>
- <AssemblyVersion>4.0.12.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Text.Encoding/dir.props b/src/System.Text.Encoding/dir.props
new file mode 100644
index 0000000000..d16ef39bdb
--- /dev/null
+++ b/src/System.Text.Encoding/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.12.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Text.Encoding/pkg/System.Text.Encoding.pkgproj b/src/System.Text.Encoding/pkg/System.Text.Encoding.pkgproj
index 9d62135707..b79cc7fac0 100644
--- a/src/System.Text.Encoding/pkg/System.Text.Encoding.pkgproj
+++ b/src/System.Text.Encoding/pkg/System.Text.Encoding.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.12.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Text.Encoding.csproj">
diff --git a/src/System.Text.Encoding/pkg/ValidationSuppression.txt b/src/System.Text.Encoding/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Text.Encoding/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Text.Encoding/ref/4.0.0/System.Text.Encoding.depproj b/src/System.Text.Encoding/ref/4.0.0/System.Text.Encoding.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Text.Encoding/ref/4.0.0/System.Text.Encoding.depproj
+++ b/src/System.Text.Encoding/ref/4.0.0/System.Text.Encoding.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Text.Encoding/ref/System.Text.Encoding.csproj b/src/System.Text.Encoding/ref/System.Text.Encoding.csproj
index ed162683d0..e47138f7de 100644
--- a/src/System.Text.Encoding/ref/System.Text.Encoding.csproj
+++ b/src/System.Text.Encoding/ref/System.Text.Encoding.csproj
@@ -5,7 +5,6 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Text.Encoding/src/System.Text.Encoding.csproj b/src/System.Text.Encoding/src/System.Text.Encoding.csproj
index 937a765ad6..38df8a9de0 100644
--- a/src/System.Text.Encoding/src/System.Text.Encoding.csproj
+++ b/src/System.Text.Encoding/src/System.Text.Encoding.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Text.Encoding</AssemblyName>
- <AssemblyVersion>4.1.0.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Text.Encodings.Web/dir.props b/src/System.Text.Encodings.Web/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Text.Encodings.Web/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Text.Encodings.Web/src/System.Text.Encodings.Web.csproj b/src/System.Text.Encodings.Web/src/System.Text.Encodings.Web.csproj
index 8b87464863..1165480be3 100644
--- a/src/System.Text.Encodings.Web/src/System.Text.Encodings.Web.csproj
+++ b/src/System.Text.Encodings.Web/src/System.Text.Encodings.Web.csproj
@@ -5,9 +5,7 @@
<ProjectGuid>{1DD0FF15-6234-4BD6-850A-317F05479554}</ProjectGuid>
<RootNamespace>System.Text.Encodings.Web</RootNamespace>
<AssemblyName>System.Text.Encodings.Web</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<UseOpenKey Condition="'$(UseOpenKey)'==''">true</UseOpenKey>
<DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
diff --git a/src/System.Text.RegularExpressions/dir.props b/src/System.Text.RegularExpressions/dir.props
new file mode 100644
index 0000000000..ec6b27dedd
--- /dev/null
+++ b/src/System.Text.RegularExpressions/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.2.0.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Text.RegularExpressions/pkg/ValidationSuppression.txt b/src/System.Text.RegularExpressions/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Text.RegularExpressions/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Text.RegularExpressions/ref/4.0.0/System.Text.RegularExpressions.depproj b/src/System.Text.RegularExpressions/ref/4.0.0/System.Text.RegularExpressions.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Text.RegularExpressions/ref/4.0.0/System.Text.RegularExpressions.depproj
+++ b/src/System.Text.RegularExpressions/ref/4.0.0/System.Text.RegularExpressions.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Text.RegularExpressions/ref/4.0.10/System.Text.RegularExpressions.depproj b/src/System.Text.RegularExpressions/ref/4.0.10/System.Text.RegularExpressions.depproj
index f4a2240f05..fe3d172e30 100644
--- a/src/System.Text.RegularExpressions/ref/4.0.10/System.Text.RegularExpressions.depproj
+++ b/src/System.Text.RegularExpressions/ref/4.0.10/System.Text.RegularExpressions.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.csproj b/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.csproj
index de93dd0248..09c39bb897 100644
--- a/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.csproj
+++ b/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.2.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.6</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.6</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj b/src/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj
index fde5b755bd..9770c309df 100644
--- a/src/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj
+++ b/src/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj
@@ -4,10 +4,8 @@
<PropertyGroup>
<ProjectGuid>{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}</ProjectGuid>
<AssemblyName>System.Text.RegularExpressions</AssemblyName>
- <AssemblyVersion>4.2.0.0</AssemblyVersion>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net463'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net463'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.6</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.6</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Text.RegularExpressions/tests/PrecompiledRegexScenarioTest.cs b/src/System.Text.RegularExpressions/tests/PrecompiledRegexScenarioTest.cs
index ea9b05cff3..cdca929c0e 100644
--- a/src/System.Text.RegularExpressions/tests/PrecompiledRegexScenarioTest.cs
+++ b/src/System.Text.RegularExpressions/tests/PrecompiledRegexScenarioTest.cs
@@ -1,4 +1,8 @@
-using System;
+// 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.Text.RegularExpressions;
using RegexTestNamespace;
using Xunit;
diff --git a/src/System.Text.RegularExpressions/tests/Regex.Groups.Tests.cs b/src/System.Text.RegularExpressions/tests/Regex.Groups.Tests.cs
index bfbfac2379..46f19e7d5a 100644
--- a/src/System.Text.RegularExpressions/tests/Regex.Groups.Tests.cs
+++ b/src/System.Text.RegularExpressions/tests/Regex.Groups.Tests.cs
@@ -613,12 +613,16 @@ namespace System.Text.RegularExpressions.Tests
[MemberData(nameof(Groups_CustomCulture_TestData))]
public void Groups(string pattern, string input, RegexOptions options, CultureInfo cultureInfo, string[] expectedGroups)
{
- CultureInfo originalCulture = null;
+ CultureInfo originalCulture = CultureInfo.CurrentCulture;
try
{
+ // In invariant culture, the unicode char matches differ from expected values provided.
+ if (originalCulture.Equals(CultureInfo.InvariantCulture))
+ {
+ CultureInfo.CurrentCulture = s_enUSCulture;
+ }
if (cultureInfo != null)
{
- originalCulture = CultureInfo.CurrentCulture;
CultureInfo.CurrentCulture = cultureInfo;
}
Regex regex = new Regex(pattern, options);
@@ -626,7 +630,7 @@ namespace System.Text.RegularExpressions.Tests
Assert.True(match.Success);
Assert.Equal(expectedGroups.Length, match.Groups.Count);
- Assert.Equal(expectedGroups[0], match.Value);
+ Assert.True(expectedGroups[0] == match.Value, string.Format("Culture used: {0}", CultureInfo.CurrentCulture));
int[] groupNumbers = regex.GetGroupNumbers();
string[] groupNames = regex.GetGroupNames();
@@ -641,7 +645,7 @@ namespace System.Text.RegularExpressions.Tests
}
finally
{
- if (cultureInfo != null)
+ if (cultureInfo != null || originalCulture.Equals(CultureInfo.InvariantCulture))
{
CultureInfo.CurrentCulture = originalCulture;
}
diff --git a/src/System.Text.RegularExpressions/tests/RegexGroupNameTests.cs b/src/System.Text.RegularExpressions/tests/RegexGroupNameTests.cs
index 47d2037707..d84ee1a72f 100644
--- a/src/System.Text.RegularExpressions/tests/RegexGroupNameTests.cs
+++ b/src/System.Text.RegularExpressions/tests/RegexGroupNameTests.cs
@@ -1,5 +1,6 @@
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+// 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 Xunit;
using System;
diff --git a/src/System.Threading.AccessControl/dir.props b/src/System.Threading.AccessControl/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Threading.AccessControl/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Threading.AccessControl/ref/System.Threading.AccessControl.csproj b/src/System.Threading.AccessControl/ref/System.Threading.AccessControl.csproj
index 2d465c442f..798d1c83d7 100644
--- a/src/System.Threading.AccessControl/ref/System.Threading.AccessControl.csproj
+++ b/src/System.Threading.AccessControl/ref/System.Threading.AccessControl.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Threading.AccessControl/src/System.Threading.AccessControl.csproj b/src/System.Threading.AccessControl/src/System.Threading.AccessControl.csproj
index 7311fb0d90..c869382d96 100644
--- a/src/System.Threading.AccessControl/src/System.Threading.AccessControl.csproj
+++ b/src/System.Threading.AccessControl/src/System.Threading.AccessControl.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Threading.AccessControl</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<ProjectGuid>{E3ED83FD-3015-4BD8-A1B8-6294986E6CFA}</ProjectGuid>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<GeneratePlatformNotSupportedAssembly Condition="'$(TargetsUnix)' == 'true'">true</GeneratePlatformNotSupportedAssembly>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net46'">true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
diff --git a/src/System.Threading.Overlapped/dir.props b/src/System.Threading.Overlapped/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Threading.Overlapped/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Threading.Overlapped/ref/System.Threading.Overlapped.csproj b/src/System.Threading.Overlapped/ref/System.Threading.Overlapped.csproj
index ec646e780e..b5d684c332 100644
--- a/src/System.Threading.Overlapped/ref/System.Threading.Overlapped.csproj
+++ b/src/System.Threading.Overlapped/ref/System.Threading.Overlapped.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Threading.Overlapped/src/System.Threading.Overlapped.csproj b/src/System.Threading.Overlapped/src/System.Threading.Overlapped.csproj
index 686cf00f31..3010c57b5c 100644
--- a/src/System.Threading.Overlapped/src/System.Threading.Overlapped.csproj
+++ b/src/System.Threading.Overlapped/src/System.Threading.Overlapped.csproj
@@ -5,12 +5,10 @@
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyName>System.Threading.Overlapped</AssemblyName>
<ProjectGuid>{6A07CCB8-3E59-47e7-B3DD-DB1F6FC501D5}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='' OR '$(TargetGroup)'=='net46'">true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<GeneratePlatformNotSupportedAssembly Condition="'$(TargetsUnix)' == 'true'">true</GeneratePlatformNotSupportedAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.Threading.Tasks.Dataflow/dir.props b/src/System.Threading.Tasks.Dataflow/dir.props
new file mode 100644
index 0000000000..ed924fe058
--- /dev/null
+++ b/src/System.Threading.Tasks.Dataflow/dir.props
@@ -0,0 +1,8 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <PackageVersion>4.7.0</PackageVersion>
+ <AssemblyVersion>4.6.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Threading.Tasks.Dataflow/src/System.Threading.Tasks.Dataflow.WP8.csproj b/src/System.Threading.Tasks.Dataflow/src/System.Threading.Tasks.Dataflow.WP8.csproj
index 32c9f2815c..94579b60a4 100644
--- a/src/System.Threading.Tasks.Dataflow/src/System.Threading.Tasks.Dataflow.WP8.csproj
+++ b/src/System.Threading.Tasks.Dataflow/src/System.Threading.Tasks.Dataflow.WP8.csproj
@@ -5,9 +5,7 @@
<ProjectGuid>{0C10C503-FD37-4990-BD0F-B79FE22203DD}</ProjectGuid>
<RootNamespace>System.Threading.Tasks.Dataflow</RootNamespace>
<AssemblyName>System.Threading.Tasks.Dataflow</AssemblyName>
- <AssemblyVersion>4.6.1.0</AssemblyVersion>
<DocumentationFile>$(OutputPath)System.Threading.Tasks.Dataflow.XML</DocumentationFile>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<ProjectJson>wp8/project.json</ProjectJson>
<ProjectLockJson>wp8/project.lock.json</ProjectLockJson>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
diff --git a/src/System.Threading.Tasks.Dataflow/src/System.Threading.Tasks.Dataflow.csproj b/src/System.Threading.Tasks.Dataflow/src/System.Threading.Tasks.Dataflow.csproj
index e332065c17..1aa4932f72 100644
--- a/src/System.Threading.Tasks.Dataflow/src/System.Threading.Tasks.Dataflow.csproj
+++ b/src/System.Threading.Tasks.Dataflow/src/System.Threading.Tasks.Dataflow.csproj
@@ -5,21 +5,11 @@
<ProjectGuid>{1DD0FF15-6234-4BD6-850A-317F05479554}</ProjectGuid>
<RootNamespace>System.Threading.Tasks.Dataflow</RootNamespace>
<AssemblyName>System.Threading.Tasks.Dataflow</AssemblyName>
- <AssemblyVersion>4.6.1.0</AssemblyVersion>
<DocumentationFile>$(OutputPath)System.Threading.Tasks.Dataflow.XML</DocumentationFile>
<DefineConstants>$(DefineConstants);CONCURRENT_COLLECTIONS;FEATURE_TRACING</DefineConstants>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.1</NuGetTargetMoniker>
+ <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.1;portable-net45+win8+wpa81</PackageTargetFramework>
</PropertyGroup>
- <ItemGroup>
- <PackageDestination Include="lib/netstandard1.1">
- <TargetFramework>netstandard1.1</TargetFramework>
- </PackageDestination>
- <!-- Support targets that were supported in previous package versions -->
- <PackageDestination Include="lib/portable-net45+win8+wpa81">
- <TargetFramework>portable-net45+win8+wpa81</TargetFramework>
- </PackageDestination>
- </ItemGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
diff --git a/src/System.Threading.Tasks.Extensions/dir.props b/src/System.Threading.Tasks.Extensions/dir.props
new file mode 100644
index 0000000000..0769c12aaa
--- /dev/null
+++ b/src/System.Threading.Tasks.Extensions/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.0.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Threading.Tasks.Extensions/src/System.Threading.Tasks.Extensions.csproj b/src/System.Threading.Tasks.Extensions/src/System.Threading.Tasks.Extensions.csproj
index 2c4ae67226..95844536d2 100644
--- a/src/System.Threading.Tasks.Extensions/src/System.Threading.Tasks.Extensions.csproj
+++ b/src/System.Threading.Tasks.Extensions/src/System.Threading.Tasks.Extensions.csproj
@@ -4,25 +4,18 @@
<PropertyGroup>
<ProjectGuid>{F24D3391-2928-4E83-AADE-B34423498750}</ProjectGuid>
<AssemblyName>System.Threading.Tasks.Extensions</AssemblyName>
- <AssemblyVersion>4.1.0.0</AssemblyVersion>
<DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile>
<UseOpenKey Condition="'$(UseOpenKey)'==''">true</UseOpenKey>
+ <NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
+ <PackageTargetFramework Condition="'$(TargetGroup)' == ''">netstandard1.0;portable-net45+win8+wp8+wpa81</PackageTargetFramework>
</PropertyGroup>
- <ItemGroup Condition="'$(PackageTargetFramework)' == ''">
- <PackageDestination Include="lib/netstandard1.0">
- <TargetFramework>netstandard1.0</TargetFramework>
- </PackageDestination>
- <!-- Support downlevel targets -->
- <PackageDestination Include="lib/portable-net45+win8+wp8+wpa81">
- <TargetFramework>portable-net45+win8+wp8+wpa81</TargetFramework>
- </PackageDestination>
- </ItemGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
<ItemGroup>
- <Compile Include="System\Runtime\CompilerServices\ConfiguredValueTaskAwaitable.cs" />
+ <Compile Include="System\Runtime\CompilerServices\AsyncBuilderAttribute.cs" />
<Compile Include="System\Runtime\CompilerServices\AsyncValueTaskMethodBuilder.cs" />
+ <Compile Include="System\Runtime\CompilerServices\ConfiguredValueTaskAwaitable.cs" />
<Compile Include="System\Runtime\CompilerServices\ValueTaskAwaiter.cs" />
<Compile Include="System\Threading\Tasks\ValueTask.cs" />
</ItemGroup>
diff --git a/src/System.Threading.Tasks.Extensions/src/System/Runtime/CompilerServices/AsyncBuilderAttribute.cs b/src/System.Threading.Tasks.Extensions/src/System/Runtime/CompilerServices/AsyncBuilderAttribute.cs
new file mode 100644
index 0000000000..960b4e2457
--- /dev/null
+++ b/src/System.Threading.Tasks.Extensions/src/System/Runtime/CompilerServices/AsyncBuilderAttribute.cs
@@ -0,0 +1,18 @@
+// 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.
+
+namespace System.Runtime.CompilerServices
+{
+ /// <summary>
+ /// Indicates the async method builder that should be used by the C# compiler to build
+ /// the attributed type when used as the return type of an async method.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false, AllowMultiple = false)]
+ internal sealed class AsyncBuilderAttribute : Attribute
+ {
+ /// <summary>Initializes the <see cref="AsyncBuilderAttribute"/>.</summary>
+ /// <param name="builderType">The associated builder type.</param>
+ public AsyncBuilderAttribute(Type builderType) { }
+ }
+}
diff --git a/src/System.Threading.Tasks.Extensions/src/System/Threading/Tasks/ValueTask.cs b/src/System.Threading.Tasks.Extensions/src/System/Threading/Tasks/ValueTask.cs
index 7109ec5c6f..b979df37c0 100644
--- a/src/System.Threading.Tasks.Extensions/src/System/Threading/Tasks/ValueTask.cs
+++ b/src/System.Threading.Tasks.Extensions/src/System/Threading/Tasks/ValueTask.cs
@@ -48,6 +48,7 @@ namespace System.Threading.Tasks
/// a <see cref="Task"/>-returning method completes synchronously and successfully.
/// </para>
/// </remarks>
+ [AsyncBuilder(typeof(AsyncValueTaskMethodBuilder<>))]
[StructLayout(LayoutKind.Auto)]
public struct ValueTask<TResult> : IEquatable<ValueTask<TResult>>
{
@@ -176,6 +177,8 @@ namespace System.Threading.Tasks
}
}
+ // TODO: Remove CreateAsyncMethodBuilder once the C# compiler relies on the AsyncBuilder attribute.
+
/// <summary>Creates a method builder for use with an async method.</summary>
/// <returns>The created builder.</returns>
[EditorBrowsable(EditorBrowsableState.Never)] // intended only for compiler consumption
diff --git a/src/System.Threading.Tasks.Extensions/src/project.json b/src/System.Threading.Tasks.Extensions/src/project.json
index 26767d75a2..f790660471 100644
--- a/src/System.Threading.Tasks.Extensions/src/project.json
+++ b/src/System.Threading.Tasks.Extensions/src/project.json
@@ -7,9 +7,9 @@
"System.Threading.Tasks": "4.0.0"
},
"frameworks": {
- "netcoreapp1.0": {
+ "netstandard1.0": {
"imports": [
- "dnxcore50"
+ "dotnet5.1"
]
}
}
diff --git a/src/System.Threading.Tasks.Extensions/tests/ValueTaskTests.cs b/src/System.Threading.Tasks.Extensions/tests/ValueTaskTests.cs
index b6651222ff..d4fac8e029 100644
--- a/src/System.Threading.Tasks.Extensions/tests/ValueTaskTests.cs
+++ b/src/System.Threading.Tasks.Extensions/tests/ValueTaskTests.cs
@@ -2,6 +2,9 @@
// 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.Linq;
+using System.Reflection;
+using System.Runtime.CompilerServices;
using Xunit;
namespace System.Threading.Tasks.Tests
@@ -311,6 +314,18 @@ namespace System.Threading.Tasks.Tests
Assert.Same(string.Empty, new ValueTask<DateTime>(new TaskCompletionSource<DateTime>().Task).ToString());
}
+ [Theory]
+ [InlineData(typeof(ValueTask<>))]
+ [InlineData(typeof(ValueTask<int>))]
+ [InlineData(typeof(ValueTask<string>))]
+ public void AsyncBuilderAttribute_ValueTaskAttributed(Type valueTaskType)
+ {
+ CustomAttributeData aba = valueTaskType.GetTypeInfo().CustomAttributes.Single(
+ attr => attr.AttributeType.FullName == "System.Runtime.CompilerServices.AsyncBuilderAttribute");
+ Assert.True(aba.AttributeType.GetTypeInfo().IsNotPublic);
+ Assert.Equal(typeof(AsyncValueTaskMethodBuilder<>), aba.ConstructorArguments[0].Value);
+ }
+
private sealed class TrackingSynchronizationContext : SynchronizationContext
{
internal int Posts { get; set; }
diff --git a/src/System.Threading.Tasks.Parallel/dir.props b/src/System.Threading.Tasks.Parallel/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Threading.Tasks.Parallel/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Threading.Tasks.Parallel/pkg/System.Threading.Tasks.Parallel.pkgproj b/src/System.Threading.Tasks.Parallel/pkg/System.Threading.Tasks.Parallel.pkgproj
index 075d33c35d..05288c27d1 100644
--- a/src/System.Threading.Tasks.Parallel/pkg/System.Threading.Tasks.Parallel.pkgproj
+++ b/src/System.Threading.Tasks.Parallel/pkg/System.Threading.Tasks.Parallel.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Threading.Tasks.Parallel.csproj">
diff --git a/src/System.Threading.Tasks.Parallel/pkg/ValidationSuppression.txt b/src/System.Threading.Tasks.Parallel/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Threading.Tasks.Parallel/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Threading.Tasks.Parallel/ref/System.Threading.Tasks.Parallel.csproj b/src/System.Threading.Tasks.Parallel/ref/System.Threading.Tasks.Parallel.csproj
index e10f8b851d..93706565dc 100644
--- a/src/System.Threading.Tasks.Parallel/ref/System.Threading.Tasks.Parallel.csproj
+++ b/src/System.Threading.Tasks.Parallel/ref/System.Threading.Tasks.Parallel.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.1</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.1</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Threading.Tasks.Parallel/src/System.Threading.Tasks.Parallel.csproj b/src/System.Threading.Tasks.Parallel/src/System.Threading.Tasks.Parallel.csproj
index 7f8346d37d..9f28f41033 100644
--- a/src/System.Threading.Tasks.Parallel/src/System.Threading.Tasks.Parallel.csproj
+++ b/src/System.Threading.Tasks.Parallel/src/System.Threading.Tasks.Parallel.csproj
@@ -5,13 +5,11 @@
<ProjectGuid>{A6BA5DF2-772E-4DA1-BC2D-89FF4A21EE4F}</ProjectGuid>
<RootNamespace>System.Threading.Tasks.Parallel</RootNamespace>
<AssemblyName>System.Threading.Tasks.Parallel</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<FileAlignment>512</FileAlignment>
<DefineConstants>$(DefineConstants);CONCURRENT_COLLECTIONS;FEATURE_TRACING</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net46'">None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
diff --git a/src/System.Threading.Tasks/dir.props b/src/System.Threading.Tasks/dir.props
new file mode 100644
index 0000000000..d16ef39bdb
--- /dev/null
+++ b/src/System.Threading.Tasks/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.12.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Threading.Tasks/pkg/System.Threading.Tasks.pkgproj b/src/System.Threading.Tasks/pkg/System.Threading.Tasks.pkgproj
index 808f152859..13638c259f 100644
--- a/src/System.Threading.Tasks/pkg/System.Threading.Tasks.pkgproj
+++ b/src/System.Threading.Tasks/pkg/System.Threading.Tasks.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.12.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\4.0.0\System.Threading.Tasks.depproj">
diff --git a/src/System.Threading.Tasks/pkg/ValidationSuppression.txt b/src/System.Threading.Tasks/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Threading.Tasks/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Threading.Tasks/ref/4.0.0/System.Threading.Tasks.depproj b/src/System.Threading.Tasks/ref/4.0.0/System.Threading.Tasks.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Threading.Tasks/ref/4.0.0/System.Threading.Tasks.depproj
+++ b/src/System.Threading.Tasks/ref/4.0.0/System.Threading.Tasks.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Threading.Tasks/ref/System.Threading.Tasks.csproj b/src/System.Threading.Tasks/ref/System.Threading.Tasks.csproj
index 2ce8c29eb1..e034219a5e 100644
--- a/src/System.Threading.Tasks/ref/System.Threading.Tasks.csproj
+++ b/src/System.Threading.Tasks/ref/System.Threading.Tasks.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Threading.Tasks/src/System.Threading.Tasks.csproj b/src/System.Threading.Tasks/src/System.Threading.Tasks.csproj
index 36d89ae79e..695b1d1ba8 100644
--- a/src/System.Threading.Tasks/src/System.Threading.Tasks.csproj
+++ b/src/System.Threading.Tasks/src/System.Threading.Tasks.csproj
@@ -4,9 +4,7 @@
<PropertyGroup>
<ProjectGuid>{3BCAEAA6-3A29-49EC-B334-6E7BE8BE9ABA}</ProjectGuid>
<AssemblyName>System.Threading.Tasks</AssemblyName>
- <AssemblyVersion>4.0.12.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Threading.Thread/dir.props b/src/System.Threading.Thread/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.Threading.Thread/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Threading.Thread/ref/System.Threading.Thread.csproj b/src/System.Threading.Thread/ref/System.Threading.Thread.csproj
index 25d3ffc7b3..9c02067621 100644
--- a/src/System.Threading.Thread/ref/System.Threading.Thread.csproj
+++ b/src/System.Threading.Thread/ref/System.Threading.Thread.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Threading.Thread/src/System.Threading.Thread.csproj b/src/System.Threading.Thread/src/System.Threading.Thread.csproj
index d847b3ebf8..b5ec538af4 100644
--- a/src/System.Threading.Thread/src/System.Threading.Thread.csproj
+++ b/src/System.Threading.Thread/src/System.Threading.Thread.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Threading.Thread</AssemblyName>
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Threading.ThreadPool/dir.props b/src/System.Threading.ThreadPool/dir.props
new file mode 100644
index 0000000000..2f3e2af6a8
--- /dev/null
+++ b/src/System.Threading.ThreadPool/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.11.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Threading.ThreadPool/ref/System.Threading.ThreadPool.csproj b/src/System.Threading.ThreadPool/ref/System.Threading.ThreadPool.csproj
index 0778080909..42bfeeb0cf 100644
--- a/src/System.Threading.ThreadPool/ref/System.Threading.ThreadPool.csproj
+++ b/src/System.Threading.ThreadPool/ref/System.Threading.ThreadPool.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.11.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Threading.ThreadPool/src/System.Threading.ThreadPool.csproj b/src/System.Threading.ThreadPool/src/System.Threading.ThreadPool.csproj
index 0ec606a249..63739b805f 100644
--- a/src/System.Threading.ThreadPool/src/System.Threading.ThreadPool.csproj
+++ b/src/System.Threading.ThreadPool/src/System.Threading.ThreadPool.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Threading.ThreadPool</AssemblyName>
- <AssemblyVersion>4.0.11.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Threading.Timer/dir.props b/src/System.Threading.Timer/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Threading.Timer/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Threading.Timer/pkg/System.Threading.Timer.pkgproj b/src/System.Threading.Timer/pkg/System.Threading.Timer.pkgproj
index da6b060cb9..87ec458a7a 100644
--- a/src/System.Threading.Timer/pkg/System.Threading.Timer.pkgproj
+++ b/src/System.Threading.Timer/pkg/System.Threading.Timer.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.2.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Threading.Timer.csproj">
diff --git a/src/System.Threading.Timer/pkg/ValidationSuppression.txt b/src/System.Threading.Timer/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Threading.Timer/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Threading.Timer/ref/System.Threading.Timer.csproj b/src/System.Threading.Timer/ref/System.Threading.Timer.csproj
index 87f348c690..daef877cf4 100644
--- a/src/System.Threading.Timer/ref/System.Threading.Timer.csproj
+++ b/src/System.Threading.Timer/ref/System.Threading.Timer.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.2</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.2</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Threading.Timer/src/System.Threading.Timer.csproj b/src/System.Threading.Timer/src/System.Threading.Timer.csproj
index 7f3949598c..e7b63c753f 100644
--- a/src/System.Threading.Timer/src/System.Threading.Timer.csproj
+++ b/src/System.Threading.Timer/src/System.Threading.Timer.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Threading.Timer</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
diff --git a/src/System.Threading/dir.props b/src/System.Threading/dir.props
new file mode 100644
index 0000000000..d16ef39bdb
--- /dev/null
+++ b/src/System.Threading/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.12.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Threading/pkg/System.Threading.pkgproj b/src/System.Threading/pkg/System.Threading.pkgproj
index 50d89d2b3f..ca91df9b1b 100644
--- a/src/System.Threading/pkg/System.Threading.pkgproj
+++ b/src/System.Threading/pkg/System.Threading.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.12.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\4.0.0\System.Threading.depproj">
diff --git a/src/System.Threading/pkg/ValidationSuppression.txt b/src/System.Threading/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Threading/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Threading/ref/4.0.0/System.Threading.depproj b/src/System.Threading/ref/4.0.0/System.Threading.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Threading/ref/4.0.0/System.Threading.depproj
+++ b/src/System.Threading/ref/4.0.0/System.Threading.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Threading/ref/System.Threading.csproj b/src/System.Threading/ref/System.Threading.csproj
index 4775476f93..43babdf84c 100644
--- a/src/System.Threading/ref/System.Threading.csproj
+++ b/src/System.Threading/ref/System.Threading.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Threading/src/System.Threading.csproj b/src/System.Threading/src/System.Threading.csproj
index 5df3c2f181..48061f56ab 100644
--- a/src/System.Threading/src/System.Threading.csproj
+++ b/src/System.Threading/src/System.Threading.csproj
@@ -4,10 +4,8 @@
<PropertyGroup>
<ProjectGuid>{604027F5-1DFC-42F4-B4FE-61F8789BA647}</ProjectGuid>
<AssemblyName>System.Threading</AssemblyName>
- <AssemblyVersion>4.0.12.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' != ''">None</ResourcesSourceOutputDirectory>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.ValueTuple/dir.props b/src/System.ValueTuple/dir.props
new file mode 100644
index 0000000000..38aaf93ed7
--- /dev/null
+++ b/src/System.ValueTuple/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.1.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.ValueTuple/src/System.ValueTuple.csproj b/src/System.ValueTuple/src/System.ValueTuple.csproj
index 3ecf38d901..b0b0390f33 100644
--- a/src/System.ValueTuple/src/System.ValueTuple.csproj
+++ b/src/System.ValueTuple/src/System.ValueTuple.csproj
@@ -3,9 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<!-- rev'ed to 4.0.1.0 even though 4.0.0.0 never shipped so that we can drop pre-release down to beta -->
- <AssemblyVersion>4.0.1.0</AssemblyVersion>
<ProjectGuid>{4C2655DB-BD9E-4C86-83A6-744ECDDBDF29}</ProjectGuid>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile>
<UseOpenKey Condition="'$(UseOpenKey)'==''">true</UseOpenKey>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.0</NuGetTargetMoniker>
@@ -30,4 +28,4 @@
<None Include="project.json" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/System.ValueTuple/src/System/ValueTuple/ValueTuple.cs b/src/System.ValueTuple/src/System/ValueTuple/ValueTuple.cs
index 1eff96eeb8..9903f38987 100644
--- a/src/System.ValueTuple/src/System/ValueTuple/ValueTuple.cs
+++ b/src/System.ValueTuple/src/System/ValueTuple/ValueTuple.cs
@@ -6,6 +6,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Numerics.Hashing;
+using System.Runtime.InteropServices;
namespace System
{
@@ -430,6 +431,7 @@ namespace System
/// </summary>
/// <typeparam name="T1">The type of the tuple's first component.</typeparam>
/// <typeparam name="T2">The type of the tuple's second component.</typeparam>
+ [StructLayout(LayoutKind.Auto)]
public struct ValueTuple<T1, T2>
: IEquatable<ValueTuple<T1, T2>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1, T2>>, ITupleInternal
{
@@ -616,6 +618,7 @@ namespace System
/// <typeparam name="T1">The type of the tuple's first component.</typeparam>
/// <typeparam name="T2">The type of the tuple's second component.</typeparam>
/// <typeparam name="T3">The type of the tuple's third component.</typeparam>
+ [StructLayout(LayoutKind.Auto)]
public struct ValueTuple<T1, T2, T3>
: IEquatable<ValueTuple<T1, T2, T3>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1, T2, T3>>, ITupleInternal
{
@@ -798,6 +801,7 @@ namespace System
/// <typeparam name="T2">The type of the tuple's second component.</typeparam>
/// <typeparam name="T3">The type of the tuple's third component.</typeparam>
/// <typeparam name="T4">The type of the tuple's fourth component.</typeparam>
+ [StructLayout(LayoutKind.Auto)]
public struct ValueTuple<T1, T2, T3, T4>
: IEquatable<ValueTuple<T1, T2, T3, T4>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1, T2, T3, T4>>, ITupleInternal
{
@@ -997,6 +1001,7 @@ namespace System
/// <typeparam name="T3">The type of the tuple's third component.</typeparam>
/// <typeparam name="T4">The type of the tuple's fourth component.</typeparam>
/// <typeparam name="T5">The type of the tuple's fifth component.</typeparam>
+ [StructLayout(LayoutKind.Auto)]
public struct ValueTuple<T1, T2, T3, T4, T5>
: IEquatable<ValueTuple<T1, T2, T3, T4, T5>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1, T2, T3, T4, T5>>, ITupleInternal
{
@@ -1213,6 +1218,7 @@ namespace System
/// <typeparam name="T4">The type of the tuple's fourth component.</typeparam>
/// <typeparam name="T5">The type of the tuple's fifth component.</typeparam>
/// <typeparam name="T6">The type of the tuple's sixth component.</typeparam>
+ [StructLayout(LayoutKind.Auto)]
public struct ValueTuple<T1, T2, T3, T4, T5, T6>
: IEquatable<ValueTuple<T1, T2, T3, T4, T5, T6>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1, T2, T3, T4, T5, T6>>, ITupleInternal
{
@@ -1446,6 +1452,7 @@ namespace System
/// <typeparam name="T5">The type of the tuple's fifth component.</typeparam>
/// <typeparam name="T6">The type of the tuple's sixth component.</typeparam>
/// <typeparam name="T7">The type of the tuple's seventh component.</typeparam>
+ [StructLayout(LayoutKind.Auto)]
public struct ValueTuple<T1, T2, T3, T4, T5, T6, T7>
: IEquatable<ValueTuple<T1, T2, T3, T4, T5, T6, T7>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1, T2, T3, T4, T5, T6, T7>>, ITupleInternal
{
@@ -1696,6 +1703,7 @@ namespace System
/// <typeparam name="T6">The type of the tuple's sixth component.</typeparam>
/// <typeparam name="T7">The type of the tuple's seventh component.</typeparam>
/// <typeparam name="TRest">The type of the tuple's eighth component.</typeparam>
+ [StructLayout(LayoutKind.Auto)]
public struct ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>
: IEquatable<ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>>, ITupleInternal
where TRest : struct
diff --git a/src/System.ValueTuple/tests/ExtensionsTests.cs b/src/System.ValueTuple/tests/ExtensionsTests.cs
new file mode 100644
index 0000000000..7f05b32aeb
--- /dev/null
+++ b/src/System.ValueTuple/tests/ExtensionsTests.cs
@@ -0,0 +1,703 @@
+// 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.Text;
+using Xunit;
+
+namespace System.Tests
+{
+ public class ExtensionsTests
+ {
+ #region Deconstruct
+ [Fact]
+ public static void Deconstruct1()
+ {
+ var tuple = Tuple.Create(1);
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1);
+ Assert.Equal("1", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct2()
+ {
+ var tuple = Tuple.Create(1, 2);
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2);
+ Assert.Equal("1 2", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct3()
+ {
+ var tuple = Tuple.Create(1, 2, 3);
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3);
+ Assert.Equal("1 2 3", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct4()
+ {
+ var tuple = Tuple.Create(1, 2, 3, 4);
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4);
+ Assert.Equal("1 2 3 4", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct5()
+ {
+ var tuple = Tuple.Create(1, 2, 3, 4, 5);
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5);
+ Assert.Equal("1 2 3 4 5", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct6()
+ {
+ var tuple = Tuple.Create(1, 2, 3, 4, 5, 6);
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6);
+ Assert.Equal("1 2 3 4 5 6", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct7()
+ {
+ var tuple = Tuple.Create(1, 2, 3, 4, 5, 6, 7);
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7);
+ Assert.Equal("1 2 3 4 5 6 7", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct8()
+ {
+ var tuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8));
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8);
+ Assert.Equal("1 2 3 4 5 6 7 8", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct9()
+ {
+ var tuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9));
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9);
+ Assert.Equal("1 2 3 4 5 6 7 8 9", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct10()
+ {
+ var tuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10));
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10);
+ Assert.Equal("1 2 3 4 5 6 7 8 9 10", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct11()
+ {
+ var tuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11));
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11);
+ Assert.Equal("1 2 3 4 5 6 7 8 9 10 11", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct12()
+ {
+ var tuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11, 12));
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12);
+ Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct13()
+ {
+ var tuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11, 12, 13));
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12, out h.x13);
+ Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12 13", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct14()
+ {
+ var tuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11, 12, 13, 14));
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12, out h.x13, out h.x14);
+ Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12 13 14", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct15()
+ {
+ var tuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15)));
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12, out h.x13, out h.x14, out h.x15);
+ Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12 13 14 15", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct16()
+ {
+ var tuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16)));
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12, out h.x13, out h.x14, out h.x15, out h.x16);
+ Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct17()
+ {
+ var tuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17)));
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12, out h.x13, out h.x14, out h.x15, out h.x16, out h.x17);
+ Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct18()
+ {
+ var tuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17, 18)));
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12, out h.x13, out h.x14, out h.x15, out h.x16, out h.x17, out h.x18);
+ Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct19()
+ {
+ var tuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17, 18, 19)));
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12, out h.x13, out h.x14, out h.x15, out h.x16, out h.x17, out h.x18, out h.x19);
+ Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct20()
+ {
+ var tuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17, 18, 19, 20)));
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12, out h.x13, out h.x14, out h.x15, out h.x16, out h.x17, out h.x18, out h.x19, out h.x20);
+ Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20", h.ToString());
+ }
+
+ [Fact]
+ public static void Deconstruct21()
+ {
+ var tuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17, 18, 19, 20, 21)));
+ var h = new IntHolder();
+
+ tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12, out h.x13, out h.x14, out h.x15, out h.x16, out h.x17, out h.x18, out h.x19, out h.x20, out h.x21);
+ Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21", h.ToString());
+ }
+ #endregion
+
+ #region ToTuple
+ [Fact]
+ public static void ConvertToRef1()
+ {
+ var refTuple = Tuple.Create(-1);
+ var valueTuple = ValueTuple.Create(1);
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef2()
+ {
+ var refTuple = Tuple.Create(-1, -1);
+ var valueTuple = ValueTuple.Create(1, 2);
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef3()
+ {
+ var refTuple = Tuple.Create(-1, -1, -1);
+ var valueTuple = ValueTuple.Create(1, 2, 3);
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef4()
+ {
+ var refTuple = Tuple.Create(-1, -1, -1, -1);
+ var valueTuple = ValueTuple.Create(1, 2, 3, 4);
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3, 4)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef5()
+ {
+ var refTuple = Tuple.Create(-1, -1, -1, -1, -1);
+ var valueTuple = ValueTuple.Create(1, 2, 3, 4, 5);
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3, 4, 5)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef6()
+ {
+ var refTuple = Tuple.Create(-1, -1, -1, -1, -1, -1);
+ var valueTuple = ValueTuple.Create(1, 2, 3, 4, 5, 6);
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef7()
+ {
+ var refTuple = Tuple.Create(-1, -1, -1, -1, -1, -1, -1);
+ var valueTuple = ValueTuple.Create(1, 2, 3, 4, 5, 6, 7);
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef8()
+ {
+ var refTuple = ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1));
+ var valueTuple = ValueTupleTests.CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8));
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef9()
+ {
+ var refTuple = ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1));
+ var valueTuple = ValueTupleTests.CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9));
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef10()
+ {
+ var refTuple = ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1));
+ var valueTuple = ValueTupleTests.CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10));
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef11()
+ {
+ var refTuple = ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1, -1));
+ var valueTuple = ValueTupleTests.CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11));
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef12()
+ {
+ var refTuple = ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1, -1, -1));
+ var valueTuple = ValueTupleTests.CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12));
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef13()
+ {
+ var refTuple = ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1, -1, -1, -1));
+ var valueTuple = ValueTupleTests.CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12, 13));
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef14()
+ {
+ var refTuple = ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1, -1, -1, -1, -1));
+ var valueTuple = ValueTupleTests.CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12, 13, 14));
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef15()
+ {
+ var refTuple = ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1)));
+ var valueTuple = ValueTupleTests.CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15)));
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef16()
+ {
+ var refTuple = ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1)));
+ var valueTuple = ValueTupleTests.CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15, 16)));
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef17()
+ {
+ var refTuple = ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1)));
+ var valueTuple = ValueTupleTests.CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15, 16, 17)));
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef18()
+ {
+ var refTuple = ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1, -1)));
+ var valueTuple = ValueTupleTests.CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15, 16, 17, 18)));
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef19()
+ {
+ var refTuple = ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1, -1, -1)));
+ var valueTuple = ValueTupleTests.CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15, 16, 17, 18, 19)));
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef20()
+ {
+ var refTuple = ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1, -1, -1, -1)));
+ var valueTuple = ValueTupleTests.CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15, 16, 17, 18, 19, 20)));
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)", refTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToRef21()
+ {
+ var refTuple = ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, ValueTupleTests.CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1, -1, -1, -1, -1)));
+ var valueTuple = ValueTupleTests.CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15, 16, 17, 18, 19, 20, 21)));
+
+ refTuple = valueTuple.ToTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)", refTuple.ToString());
+ }
+ #endregion
+
+ #region ToValue
+ [Fact]
+ public static void ConvertToValue1()
+ {
+ var valueTuple = ValueTuple.Create(-1);
+ var refTuple = Tuple.Create(1);
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue2()
+ {
+ var valueTuple = ValueTuple.Create(-1, -1);
+ var refTuple = Tuple.Create(1, 2);
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue3()
+ {
+ var valueTuple = ValueTuple.Create(-1, -1, -1);
+ var refTuple = Tuple.Create(1, 2, 3);
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue4()
+ {
+ var valueTuple = ValueTuple.Create(-1, -1, -1, -1);
+ var refTuple = Tuple.Create(1, 2, 3, 4);
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3, 4)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue5()
+ {
+ var valueTuple = ValueTuple.Create(-1, -1, -1, -1, -1);
+ var refTuple = Tuple.Create(1, 2, 3, 4, 5);
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3, 4, 5)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue6()
+ {
+ var valueTuple = ValueTuple.Create(-1, -1, -1, -1, -1, -1);
+ var refTuple = Tuple.Create(1, 2, 3, 4, 5, 6);
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue7()
+ {
+ var valueTuple = ValueTuple.Create(-1, -1, -1, -1, -1, -1, -1);
+ var refTuple = Tuple.Create(1, 2, 3, 4, 5, 6, 7);
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue8()
+ {
+ var valueTuple = ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1));
+ var refTuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8));
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue9()
+ {
+ var valueTuple = ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1));
+ var refTuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9));
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue10()
+ {
+ var valueTuple = ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1));
+ var refTuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10));
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue11()
+ {
+ var valueTuple = ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1, -1));
+ var refTuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11));
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue12()
+ {
+ var valueTuple = ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1, -1, -1));
+ var refTuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11, 12));
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue13()
+ {
+ var valueTuple = ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1, -1, -1, -1));
+ var refTuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11, 12, 13));
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue14()
+ {
+ var valueTuple = ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1, -1, -1, -1, -1));
+ var refTuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11, 12, 13, 14));
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue15()
+ {
+ var valueTuple = ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1)));
+ var refTuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15)));
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue16()
+ {
+ var valueTuple = ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1)));
+ var refTuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16)));
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue17()
+ {
+ var valueTuple = ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1)));
+ var refTuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17)));
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue18()
+ {
+ var valueTuple = ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1, -1)));
+ var refTuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17, 18)));
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue19()
+ {
+ var valueTuple = ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1, -1, -1)));
+ var refTuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17, 18, 19)));
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue20()
+ {
+ var valueTuple = ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1, -1, -1, -1)));
+ var refTuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17, 18, 19, 20)));
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)", valueTuple.ToString());
+ }
+
+ [Fact]
+ public static void ConvertToValue21()
+ {
+ var valueTuple = ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTupleTests.CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1, -1, -1, -1, -1)));
+ var refTuple = ValueTupleTests.CreateLongRef(1, 2, 3, 4, 5, 6, 7, ValueTupleTests.CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17, 18, 19, 20, 21)));
+
+ valueTuple = refTuple.ToValueTuple();
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)", valueTuple.ToString());
+ }
+ #endregion
+
+ // Holds 21 int values
+ private struct IntHolder
+ {
+ public int x1;
+ public int x2;
+ public int x3;
+ public int x4;
+ public int x5;
+ public int x6;
+ public int x7;
+ public int x8;
+ public int x9;
+ public int x10;
+ public int x11;
+ public int x12;
+ public int x13;
+ public int x14;
+ public int x15;
+ public int x16;
+ public int x17;
+ public int x18;
+ public int x19;
+ public int x20;
+ public int x21;
+
+ public override string ToString()
+ {
+ var builder = new StringBuilder();
+ if (x1 > 0) { builder.Append(x1); }
+ if (x2 > 0) { builder.Append(" " + x2); }
+ if (x3 > 0) { builder.Append(" " + x3); }
+ if (x4 > 0) { builder.Append(" " + x4); }
+ if (x5 > 0) { builder.Append(" " + x5); }
+ if (x6 > 0) { builder.Append(" " + x6); }
+ if (x7 > 0) { builder.Append(" " + x7); }
+ if (x8 > 0) { builder.Append(" " + x8); }
+ if (x9 > 0) { builder.Append(" " + x9); }
+ if (x10 > 0) { builder.Append(" " + x10); }
+ if (x11 > 0) { builder.Append(" " + x11); }
+ if (x12 > 0) { builder.Append(" " + x12); }
+ if (x13 > 0) { builder.Append(" " + x13); }
+ if (x14 > 0) { builder.Append(" " + x14); }
+ if (x15 > 0) { builder.Append(" " + x15); }
+ if (x16 > 0) { builder.Append(" " + x16); }
+ if (x17 > 0) { builder.Append(" " + x17); }
+ if (x18 > 0) { builder.Append(" " + x18); }
+ if (x19 > 0) { builder.Append(" " + x19); }
+ if (x20 > 0) { builder.Append(" " + x20); }
+ if (x21 > 0) { builder.Append(" " + x21); }
+
+ return builder.ToString();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.ValueTuple/tests/System.ValueTuple.Tests.csproj b/src/System.ValueTuple/tests/System.ValueTuple.Tests.csproj
index ff75a7fbd7..08f3461145 100644
--- a/src/System.ValueTuple/tests/System.ValueTuple.Tests.csproj
+++ b/src/System.ValueTuple/tests/System.ValueTuple.Tests.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
@@ -9,10 +9,13 @@
<AssemblyName>System.ValueTuple.Tests</AssemblyName>
<NugetTargetMoniker>.NETStandard,Version=v1.3</NugetTargetMoniker>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
+ <LangVersion>5</LangVersion>
+ </PropertyGroup>
<ItemGroup>
- <Compile Include="TupleElementNamesAttribute\UnitTests.cs" />
- <Compile Include="ValueTuple\ExtensionsTests.cs" />
- <Compile Include="ValueTuple\UnitTests.cs" />
+ <Compile Include="TupleElementNamesTests.cs" />
+ <Compile Include="ExtensionsTests.cs" />
+ <Compile Include="ValueTupleTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\pkg\System.ValueTuple.pkgproj">
diff --git a/src/System.ValueTuple/tests/TupleElementNamesAttribute/UnitTests.cs b/src/System.ValueTuple/tests/TupleElementNamesAttribute/UnitTests.cs
deleted file mode 100644
index 3b71182900..0000000000
--- a/src/System.ValueTuple/tests/TupleElementNamesAttribute/UnitTests.cs
+++ /dev/null
@@ -1,43 +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.Runtime.CompilerServices;
-using Xunit;
-
-public class TupleElementNamesAttributeTests
-{
- [Fact]
- public static void Constructor()
- {
- var attribute = new TupleElementNamesAttribute(new string[] { "name1", "name2" });
- Assert.NotNull(attribute.TransformNames);
- Assert.Equal(new string[] { "name1", "name2" }, attribute.TransformNames);
-
- Assert.Throws<ArgumentNullException>(() => new TupleElementNamesAttribute(null));
- }
-
- [TupleElementNames(new string[] { null, "name1", "name2" })]
- public object appliedToField = null;
-
- public static void AppliedToParameter([TupleElementNames(new string[] { "name1", null })] object parameter) { }
-
- [TupleElementNames(new string[] { null, "name1", "name2" })]
- public static object AppliedToProperty { get; set; }
-
- [event: TupleElementNames(new[] { null, "name1", "name2" })]
- public static event Func<int> AppliedToEvent;
-
- [return: TupleElementNames(new[] { null, "name1", "name2" })]
- public static void AppliedToReturn()
- {
- AppliedToEvent();
- }
-
- [TupleElementNames(new string[] { null, "name1", "name2" })]
- public class AppliedToClass { }
-
- [TupleElementNames(new string[] { null, "name1", "name2" })]
- public class AppliedToStruct { }
-}
diff --git a/src/System.ValueTuple/tests/TupleElementNamesTests.cs b/src/System.ValueTuple/tests/TupleElementNamesTests.cs
new file mode 100644
index 0000000000..d131fb5afe
--- /dev/null
+++ b/src/System.ValueTuple/tests/TupleElementNamesTests.cs
@@ -0,0 +1,46 @@
+// 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.Runtime.CompilerServices;
+using Xunit;
+
+namespace System.Tests
+{
+ public class TupleElementNamesAttributeTests
+ {
+ [Fact]
+ public static void Constructor()
+ {
+ var attribute = new TupleElementNamesAttribute(new string[] { "name1", "name2" });
+ Assert.NotNull(attribute.TransformNames);
+ Assert.Equal(new string[] { "name1", "name2" }, attribute.TransformNames);
+
+ Assert.Throws<ArgumentNullException>(() => new TupleElementNamesAttribute(null));
+ }
+
+ [TupleElementNames(new string[] { null, "name1", "name2" })]
+ public object appliedToField = null;
+
+ public static void AppliedToParameter([TupleElementNames(new string[] { "name1", null })] object parameter) { }
+
+ [TupleElementNames(new string[] { null, "name1", "name2" })]
+ public static object AppliedToProperty { get; set; }
+
+ [event: TupleElementNames(new[] { null, "name1", "name2" })]
+ public static event Func<int> AppliedToEvent;
+
+ [return: TupleElementNames(new[] { null, "name1", "name2" })]
+ public static void AppliedToReturn()
+ {
+ AppliedToEvent();
+ }
+
+ [TupleElementNames(new string[] { null, "name1", "name2" })]
+ public class AppliedToClass { }
+
+ [TupleElementNames(new string[] { null, "name1", "name2" })]
+ public class AppliedToStruct { }
+ }
+}
diff --git a/src/System.ValueTuple/tests/ValueTuple/ExtensionsTests.cs b/src/System.ValueTuple/tests/ValueTuple/ExtensionsTests.cs
deleted file mode 100644
index b2de364e51..0000000000
--- a/src/System.ValueTuple/tests/ValueTuple/ExtensionsTests.cs
+++ /dev/null
@@ -1,701 +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.Text;
-using Xunit;
-using static ValueTupleTests;
-
-public class ExtensionsTests
-{
- #region Deconstruct
- [Fact]
- public void Deconstruct1()
- {
- var tuple = Tuple.Create(1);
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1);
- Assert.Equal("1", h.ToString());
- }
-
- [Fact]
- public void Deconstruct2()
- {
- var tuple = Tuple.Create(1, 2);
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2);
- Assert.Equal("1 2", h.ToString());
- }
-
- [Fact]
- public void Deconstruct3()
- {
- var tuple = Tuple.Create(1, 2, 3);
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3);
- Assert.Equal("1 2 3", h.ToString());
- }
-
- [Fact]
- public void Deconstruct4()
- {
- var tuple = Tuple.Create(1, 2, 3, 4);
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4);
- Assert.Equal("1 2 3 4", h.ToString());
- }
-
- [Fact]
- public void Deconstruct5()
- {
- var tuple = Tuple.Create(1, 2, 3, 4, 5);
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5);
- Assert.Equal("1 2 3 4 5", h.ToString());
- }
-
- [Fact]
- public void Deconstruct6()
- {
- var tuple = Tuple.Create(1, 2, 3, 4, 5, 6);
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6);
- Assert.Equal("1 2 3 4 5 6", h.ToString());
- }
-
- [Fact]
- public void Deconstruct7()
- {
- var tuple = Tuple.Create(1, 2, 3, 4, 5, 6, 7);
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7);
- Assert.Equal("1 2 3 4 5 6 7", h.ToString());
- }
-
- [Fact]
- public void Deconstruct8()
- {
- var tuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8));
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8);
- Assert.Equal("1 2 3 4 5 6 7 8", h.ToString());
- }
-
- [Fact]
- public void Deconstruct9()
- {
- var tuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9));
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9);
- Assert.Equal("1 2 3 4 5 6 7 8 9", h.ToString());
- }
-
- [Fact]
- public void Deconstruct10()
- {
- var tuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10));
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10);
- Assert.Equal("1 2 3 4 5 6 7 8 9 10", h.ToString());
- }
-
- [Fact]
- public void Deconstruct11()
- {
- var tuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11));
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11);
- Assert.Equal("1 2 3 4 5 6 7 8 9 10 11", h.ToString());
- }
-
- [Fact]
- public void Deconstruct12()
- {
- var tuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11, 12));
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12);
- Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12", h.ToString());
- }
-
- [Fact]
- public void Deconstruct13()
- {
- var tuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11, 12, 13));
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12, out h.x13);
- Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12 13", h.ToString());
- }
-
- [Fact]
- public void Deconstruct14()
- {
- var tuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11, 12, 13, 14));
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12, out h.x13, out h.x14);
- Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12 13 14", h.ToString());
- }
-
- [Fact]
- public void Deconstruct15()
- {
- var tuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15)));
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12, out h.x13, out h.x14, out h.x15);
- Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12 13 14 15", h.ToString());
- }
-
- [Fact]
- public void Deconstruct16()
- {
- var tuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16)));
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12, out h.x13, out h.x14, out h.x15, out h.x16);
- Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16", h.ToString());
- }
-
- [Fact]
- public void Deconstruct17()
- {
- var tuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17)));
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12, out h.x13, out h.x14, out h.x15, out h.x16, out h.x17);
- Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17", h.ToString());
- }
-
- [Fact]
- public void Deconstruct18()
- {
- var tuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17, 18)));
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12, out h.x13, out h.x14, out h.x15, out h.x16, out h.x17, out h.x18);
- Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18", h.ToString());
- }
-
- [Fact]
- public void Deconstruct19()
- {
- var tuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17, 18, 19)));
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12, out h.x13, out h.x14, out h.x15, out h.x16, out h.x17, out h.x18, out h.x19);
- Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19", h.ToString());
- }
-
- [Fact]
- public void Deconstruct20()
- {
- var tuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17, 18, 19, 20)));
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12, out h.x13, out h.x14, out h.x15, out h.x16, out h.x17, out h.x18, out h.x19, out h.x20);
- Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20", h.ToString());
- }
-
- [Fact]
- public void Deconstruct21()
- {
- var tuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17, 18, 19, 20, 21)));
- var h = new IntHolder();
-
- tuple.Deconstruct(out h.x1, out h.x2, out h.x3, out h.x4, out h.x5, out h.x6, out h.x7, out h.x8, out h.x9, out h.x10, out h.x11, out h.x12, out h.x13, out h.x14, out h.x15, out h.x16, out h.x17, out h.x18, out h.x19, out h.x20, out h.x21);
- Assert.Equal("1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21", h.ToString());
- }
- #endregion
-
- #region ToTuple
- [Fact]
- public void ConvertToRef1()
- {
- var refTuple = Tuple.Create(-1);
- var valueTuple = ValueTuple.Create(1);
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef2()
- {
- var refTuple = Tuple.Create(-1, -1);
- var valueTuple = ValueTuple.Create(1, 2);
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef3()
- {
- var refTuple = Tuple.Create(-1, -1, -1);
- var valueTuple = ValueTuple.Create(1, 2, 3);
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef4()
- {
- var refTuple = Tuple.Create(-1, -1, -1, -1);
- var valueTuple = ValueTuple.Create(1, 2, 3, 4);
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3, 4)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef5()
- {
- var refTuple = Tuple.Create(-1, -1, -1, -1, -1);
- var valueTuple = ValueTuple.Create(1, 2, 3, 4, 5);
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3, 4, 5)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef6()
- {
- var refTuple = Tuple.Create(-1, -1, -1, -1, -1, -1);
- var valueTuple = ValueTuple.Create(1, 2, 3, 4, 5, 6);
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef7()
- {
- var refTuple = Tuple.Create(-1, -1, -1, -1, -1, -1, -1);
- var valueTuple = ValueTuple.Create(1, 2, 3, 4, 5, 6, 7);
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef8()
- {
- var refTuple = CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1));
- var valueTuple = CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8));
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef9()
- {
- var refTuple = CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1));
- var valueTuple = CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9));
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef10()
- {
- var refTuple = CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1));
- var valueTuple = CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10));
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef11()
- {
- var refTuple = CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1, -1));
- var valueTuple = CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11));
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef12()
- {
- var refTuple = CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1, -1, -1));
- var valueTuple = CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12));
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef13()
- {
- var refTuple = CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1, -1, -1, -1));
- var valueTuple = CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12, 13));
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef14()
- {
- var refTuple = CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1, -1, -1, -1, -1));
- var valueTuple = CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12, 13, 14));
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef15()
- {
- var refTuple = CreateLongRef(-1, -1, -1, -1, -1, -1, -1, CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1)));
- var valueTuple = CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15)));
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef16()
- {
- var refTuple = CreateLongRef(-1, -1, -1, -1, -1, -1, -1, CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1)));
- var valueTuple = CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15, 16)));
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef17()
- {
- var refTuple = CreateLongRef(-1, -1, -1, -1, -1, -1, -1, CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1)));
- var valueTuple = CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15, 16, 17)));
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef18()
- {
- var refTuple = CreateLongRef(-1, -1, -1, -1, -1, -1, -1, CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1, -1)));
- var valueTuple = CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15, 16, 17, 18)));
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef19()
- {
- var refTuple = CreateLongRef(-1, -1, -1, -1, -1, -1, -1, CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1, -1, -1)));
- var valueTuple = CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15, 16, 17, 18, 19)));
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef20()
- {
- var refTuple = CreateLongRef(-1, -1, -1, -1, -1, -1, -1, CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1, -1, -1, -1)));
- var valueTuple = CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15, 16, 17, 18, 19, 20)));
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)", refTuple.ToString());
- }
-
- [Fact]
- public void ConvertToRef21()
- {
- var refTuple = CreateLongRef(-1, -1, -1, -1, -1, -1, -1, CreateLongRef(-1, -1, -1, -1, -1, -1, -1, Tuple.Create(-1, -1, -1, -1, -1, -1, -1)));
- var valueTuple = CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15, 16, 17, 18, 19, 20, 21)));
-
- refTuple = valueTuple.ToTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)", refTuple.ToString());
- }
- #endregion
-
- #region ToValue
- [Fact]
- public void ConvertToValue1()
- {
- var valueTuple = ValueTuple.Create(-1);
- var refTuple = Tuple.Create(1);
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue2()
- {
- var valueTuple = ValueTuple.Create(-1, -1);
- var refTuple = Tuple.Create(1, 2);
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue3()
- {
- var valueTuple = ValueTuple.Create(-1, -1, -1);
- var refTuple = Tuple.Create(1, 2, 3);
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue4()
- {
- var valueTuple = ValueTuple.Create(-1, -1, -1, -1);
- var refTuple = Tuple.Create(1, 2, 3, 4);
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3, 4)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue5()
- {
- var valueTuple = ValueTuple.Create(-1, -1, -1, -1, -1);
- var refTuple = Tuple.Create(1, 2, 3, 4, 5);
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3, 4, 5)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue6()
- {
- var valueTuple = ValueTuple.Create(-1, -1, -1, -1, -1, -1);
- var refTuple = Tuple.Create(1, 2, 3, 4, 5, 6);
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue7()
- {
- var valueTuple = ValueTuple.Create(-1, -1, -1, -1, -1, -1, -1);
- var refTuple = Tuple.Create(1, 2, 3, 4, 5, 6, 7);
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue8()
- {
- var valueTuple = CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1));
- var refTuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8));
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue9()
- {
- var valueTuple = CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1));
- var refTuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9));
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue10()
- {
- var valueTuple = CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1));
- var refTuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10));
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue11()
- {
- var valueTuple = CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1, -1));
- var refTuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11));
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue12()
- {
- var valueTuple = CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1, -1, -1));
- var refTuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11, 12));
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue13()
- {
- var valueTuple = CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1, -1, -1, -1));
- var refTuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11, 12, 13));
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue14()
- {
- var valueTuple = CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1, -1, -1, -1, -1));
- var refTuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11, 12, 13, 14));
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue15()
- {
- var valueTuple = CreateLong(-1, -1, -1, -1, -1, -1, -1, CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1)));
- var refTuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15)));
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue16()
- {
- var valueTuple = CreateLong(-1, -1, -1, -1, -1, -1, -1, CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1)));
- var refTuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16)));
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue17()
- {
- var valueTuple = CreateLong(-1, -1, -1, -1, -1, -1, -1, CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1)));
- var refTuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17)));
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue18()
- {
- var valueTuple = CreateLong(-1, -1, -1, -1, -1, -1, -1, CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1, -1)));
- var refTuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17, 18)));
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue19()
- {
- var valueTuple = CreateLong(-1, -1, -1, -1, -1, -1, -1, CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1, -1, -1)));
- var refTuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17, 18, 19)));
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue20()
- {
- var valueTuple = CreateLong(-1, -1, -1, -1, -1, -1, -1, CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1, -1, -1, -1)));
- var refTuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17, 18, 19, 20)));
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)", valueTuple.ToString());
- }
-
- [Fact]
- public void ConvertToValue21()
- {
- var valueTuple = CreateLong(-1, -1, -1, -1, -1, -1, -1, CreateLong(-1, -1, -1, -1, -1, -1, -1, ValueTuple.Create(-1, -1, -1, -1, -1, -1, -1)));
- var refTuple = CreateLongRef(1, 2, 3, 4, 5, 6, 7, CreateLongRef(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16, 17, 18, 19, 20, 21)));
-
- valueTuple = refTuple.ToValueTuple();
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)", valueTuple.ToString());
- }
- #endregion
-
- // Holds 21 int values
- private struct IntHolder
- {
- public int x1;
- public int x2;
- public int x3;
- public int x4;
- public int x5;
- public int x6;
- public int x7;
- public int x8;
- public int x9;
- public int x10;
- public int x11;
- public int x12;
- public int x13;
- public int x14;
- public int x15;
- public int x16;
- public int x17;
- public int x18;
- public int x19;
- public int x20;
- public int x21;
-
- public override string ToString()
- {
- var builder = new StringBuilder();
- if (x1 > 0) { builder.Append($"{x1}"); }
- if (x2 > 0) { builder.Append($" {x2}"); }
- if (x3 > 0) { builder.Append($" {x3}"); }
- if (x4 > 0) { builder.Append($" {x4}"); }
- if (x5 > 0) { builder.Append($" {x5}"); }
- if (x6 > 0) { builder.Append($" {x6}"); }
- if (x7 > 0) { builder.Append($" {x7}"); }
- if (x8 > 0) { builder.Append($" {x8}"); }
- if (x9 > 0) { builder.Append($" {x9}"); }
- if (x10 > 0) { builder.Append($" {x10}"); }
- if (x11 > 0) { builder.Append($" {x11}"); }
- if (x12 > 0) { builder.Append($" {x12}"); }
- if (x13 > 0) { builder.Append($" {x13}"); }
- if (x14 > 0) { builder.Append($" {x14}"); }
- if (x15 > 0) { builder.Append($" {x15}"); }
- if (x16 > 0) { builder.Append($" {x16}"); }
- if (x17 > 0) { builder.Append($" {x17}"); }
- if (x18 > 0) { builder.Append($" {x18}"); }
- if (x19 > 0) { builder.Append($" {x19}"); }
- if (x20 > 0) { builder.Append($" {x20}"); }
- if (x21 > 0) { builder.Append($" {x21}"); }
-
- return builder.ToString();
- }
- }
-} \ No newline at end of file
diff --git a/src/System.ValueTuple/tests/ValueTuple/UnitTests.cs b/src/System.ValueTuple/tests/ValueTuple/UnitTests.cs
deleted file mode 100644
index eb647cb080..0000000000
--- a/src/System.ValueTuple/tests/ValueTuple/UnitTests.cs
+++ /dev/null
@@ -1,1209 +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.Collections;
-using System.Collections.Generic;
-using Xunit;
-
-public class ValueTupleTests
-{
- private class ValueTupleTestDriver<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
- {
- private int _nItems;
-
- private readonly object valueTuple;
- private readonly ValueTuple valueTuple0;
- private readonly ValueTuple<T1> valueTuple1;
- private readonly ValueTuple<T1, T2> valueTuple2;
- private readonly ValueTuple<T1, T2, T3> valueTuple3;
- private readonly ValueTuple<T1, T2, T3, T4> valueTuple4;
- private readonly ValueTuple<T1, T2, T3, T4, T5> valueTuple5;
- private readonly ValueTuple<T1, T2, T3, T4, T5, T6> valueTuple6;
- private readonly ValueTuple<T1, T2, T3, T4, T5, T6, T7> valueTuple7;
- private readonly ValueTuple<T1, T2, T3, T4, T5, T6, T7, ValueTuple<T8>> valueTuple8;
- private readonly ValueTuple<T1, T2, T3, T4, T5, T6, T7, ValueTuple<T8, T9>> valueTuple9;
- private readonly ValueTuple<T1, T2, T3, T4, T5, T6, T7, ValueTuple<T8, T9, T10>> valueTuple10;
-
- internal ValueTupleTestDriver(params object[] values)
- {
- if (values.Length > 10)
- throw new ArgumentOutOfRangeException(nameof(values), "You must provide at most 10 values");
-
- _nItems = values.Length;
- switch (_nItems)
- {
- case 0:
- valueTuple0 = ValueTuple.Create();
- valueTuple = valueTuple0;
- break;
- case 1:
- valueTuple1 = ValueTuple.Create((T1)values[0]);
- valueTuple = valueTuple1;
- break;
- case 2:
- valueTuple2 = ValueTuple.Create((T1)values[0], (T2)values[1]);
- valueTuple = valueTuple2;
- break;
- case 3:
- valueTuple3 = ValueTuple.Create((T1)values[0], (T2)values[1], (T3)values[2]);
- valueTuple = valueTuple3;
- break;
- case 4:
- valueTuple4 = ValueTuple.Create((T1)values[0], (T2)values[1], (T3)values[2], (T4)values[3]);
- valueTuple = valueTuple4;
- break;
- case 5:
- valueTuple5 = ValueTuple.Create((T1)values[0], (T2)values[1], (T3)values[2], (T4)values[3], (T5)values[4]);
- valueTuple = valueTuple5;
- break;
- case 6:
- valueTuple6 = ValueTuple.Create((T1)values[0], (T2)values[1], (T3)values[2], (T4)values[3],
- (T5)values[4], (T6)values[5]);
- valueTuple = valueTuple6;
- break;
- case 7:
- valueTuple7 = ValueTuple.Create((T1)values[0], (T2)values[1], (T3)values[2], (T4)values[3],
- (T5)values[4], (T6)values[5], (T7)values[6]);
- valueTuple = valueTuple7;
- break;
- case 8:
- valueTuple8 = ValueTuple.Create((T1)values[0], (T2)values[1], (T3)values[2], (T4)values[3],
- (T5)values[4], (T6)values[5], (T7)values[6], (T8)values[7]);
- valueTuple = valueTuple8;
- break;
- case 9:
- valueTuple9 = new ValueTuple<T1, T2, T3, T4, T5, T6, T7, ValueTuple<T8, T9>>((T1)values[0], (T2)values[1], (T3)values[2], (T4)values[3], (T5)values[4], (T6)values[5], (T7)values[6], new ValueTuple<T8, T9>((T8)values[7], (T9)values[8]));
- valueTuple = valueTuple9;
- break;
- case 10:
- valueTuple10 = new ValueTuple<T1, T2, T3, T4, T5, T6, T7, ValueTuple<T8, T9, T10>>((T1)values[0], (T2)values[1], (T3)values[2], (T4)values[3], (T5)values[4], (T6)values[5], (T7)values[6], new ValueTuple<T8, T9, T10>((T8)values[7], (T9)values[8], (T10)values[9]));
- valueTuple = valueTuple10;
- break;
- }
- }
-
- private void VerifyItem(int itemPos, object Item1, object Item2)
- {
- Assert.True(object.Equals(Item1, Item2));
- }
-
- public void TestConstructor(params object[] expectedValue)
- {
- if (expectedValue.Length != _nItems)
- throw new ArgumentOutOfRangeException("expectedValues", "You must provide " + _nItems + " expectedvalues");
-
- switch (_nItems)
- {
- case 0:
- break;
- case 1:
- VerifyItem(1, valueTuple1.Item1, expectedValue[0]);
- break;
- case 2:
- VerifyItem(1, valueTuple2.Item1, expectedValue[0]);
- VerifyItem(2, valueTuple2.Item2, expectedValue[1]);
- break;
- case 3:
- VerifyItem(1, valueTuple3.Item1, expectedValue[0]);
- VerifyItem(2, valueTuple3.Item2, expectedValue[1]);
- VerifyItem(3, valueTuple3.Item3, expectedValue[2]);
- break;
- case 4:
- VerifyItem(1, valueTuple4.Item1, expectedValue[0]);
- VerifyItem(2, valueTuple4.Item2, expectedValue[1]);
- VerifyItem(3, valueTuple4.Item3, expectedValue[2]);
- VerifyItem(4, valueTuple4.Item4, expectedValue[3]);
- break;
- case 5:
- VerifyItem(1, valueTuple5.Item1, expectedValue[0]);
- VerifyItem(2, valueTuple5.Item2, expectedValue[1]);
- VerifyItem(3, valueTuple5.Item3, expectedValue[2]);
- VerifyItem(4, valueTuple5.Item4, expectedValue[3]);
- VerifyItem(5, valueTuple5.Item5, expectedValue[4]);
- break;
- case 6:
- VerifyItem(1, valueTuple6.Item1, expectedValue[0]);
- VerifyItem(2, valueTuple6.Item2, expectedValue[1]);
- VerifyItem(3, valueTuple6.Item3, expectedValue[2]);
- VerifyItem(4, valueTuple6.Item4, expectedValue[3]);
- VerifyItem(5, valueTuple6.Item5, expectedValue[4]);
- VerifyItem(6, valueTuple6.Item6, expectedValue[5]);
- break;
- case 7:
- VerifyItem(1, valueTuple7.Item1, expectedValue[0]);
- VerifyItem(2, valueTuple7.Item2, expectedValue[1]);
- VerifyItem(3, valueTuple7.Item3, expectedValue[2]);
- VerifyItem(4, valueTuple7.Item4, expectedValue[3]);
- VerifyItem(5, valueTuple7.Item5, expectedValue[4]);
- VerifyItem(6, valueTuple7.Item6, expectedValue[5]);
- VerifyItem(7, valueTuple7.Item7, expectedValue[6]);
- break;
- case 8: // Extended ValueTuple
- VerifyItem(1, valueTuple8.Item1, expectedValue[0]);
- VerifyItem(2, valueTuple8.Item2, expectedValue[1]);
- VerifyItem(3, valueTuple8.Item3, expectedValue[2]);
- VerifyItem(4, valueTuple8.Item4, expectedValue[3]);
- VerifyItem(5, valueTuple8.Item5, expectedValue[4]);
- VerifyItem(6, valueTuple8.Item6, expectedValue[5]);
- VerifyItem(7, valueTuple8.Item7, expectedValue[6]);
- VerifyItem(8, valueTuple8.Rest.Item1, expectedValue[7]);
- break;
- case 9: // Extended ValueTuple
- VerifyItem(1, valueTuple9.Item1, expectedValue[0]);
- VerifyItem(2, valueTuple9.Item2, expectedValue[1]);
- VerifyItem(3, valueTuple9.Item3, expectedValue[2]);
- VerifyItem(4, valueTuple9.Item4, expectedValue[3]);
- VerifyItem(5, valueTuple9.Item5, expectedValue[4]);
- VerifyItem(6, valueTuple9.Item6, expectedValue[5]);
- VerifyItem(7, valueTuple9.Item7, expectedValue[6]);
- VerifyItem(8, valueTuple9.Rest.Item1, expectedValue[7]);
- VerifyItem(9, valueTuple9.Rest.Item2, expectedValue[8]);
- break;
- case 10: // Extended ValueTuple
- VerifyItem(1, valueTuple10.Item1, expectedValue[0]);
- VerifyItem(2, valueTuple10.Item2, expectedValue[1]);
- VerifyItem(3, valueTuple10.Item3, expectedValue[2]);
- VerifyItem(4, valueTuple10.Item4, expectedValue[3]);
- VerifyItem(5, valueTuple10.Item5, expectedValue[4]);
- VerifyItem(6, valueTuple10.Item6, expectedValue[5]);
- VerifyItem(7, valueTuple10.Item7, expectedValue[6]);
- VerifyItem(8, valueTuple10.Rest.Item1, expectedValue[7]);
- VerifyItem(9, valueTuple10.Rest.Item2, expectedValue[8]);
- VerifyItem(10, valueTuple10.Rest.Item3, expectedValue[9]);
- break;
- default:
- throw new ArgumentException("Must specify between 0 and 10 expected values (inclusive).");
- }
- }
-
- public void TestToString(string expected)
- {
- Assert.Equal(expected, valueTuple.ToString());
- }
-
- public void TestEquals_GetHashCode(ValueTupleTestDriver<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> other, bool expectEqual, bool expectStructuallyEqual)
- {
- if (expectEqual)
- {
- Assert.True(valueTuple.Equals(other.valueTuple));
- Assert.Equal(valueTuple.GetHashCode(), other.valueTuple.GetHashCode());
- }
- else
- {
- Assert.False(valueTuple.Equals(other.valueTuple));
- Assert.NotEqual(valueTuple.GetHashCode(), other.valueTuple.GetHashCode());
- }
-
- if (expectStructuallyEqual)
- {
- var equatable = ((IStructuralEquatable)valueTuple);
- var otherEquatable = ((IStructuralEquatable)other.valueTuple);
- Assert.True(equatable.Equals(other.valueTuple, TestEqualityComparer.Instance));
- Assert.Equal(equatable.GetHashCode(TestEqualityComparer.Instance), otherEquatable.GetHashCode(TestEqualityComparer.Instance));
- }
- else
- {
- var equatable = ((IStructuralEquatable)valueTuple);
- var otherEquatable = ((IStructuralEquatable)other.valueTuple);
- Assert.False(equatable.Equals(other.valueTuple, TestEqualityComparer.Instance));
- Assert.NotEqual(equatable.GetHashCode(TestEqualityComparer.Instance), otherEquatable.GetHashCode(TestEqualityComparer.Instance));
- }
-
- Assert.False(valueTuple.Equals(null));
- Assert.False(((IStructuralEquatable)valueTuple).Equals(null));
- }
-
- public void TestCompareTo(ValueTupleTestDriver<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> other, int expectedResult, int expectedStructuralResult)
- {
- Assert.Equal(expectedResult, ((IComparable)valueTuple).CompareTo(other.valueTuple));
- Assert.Equal(expectedStructuralResult, ((IStructuralComparable)valueTuple).CompareTo(other.valueTuple, DummyTestComparer.Instance));
- Assert.Equal(1, ((IComparable)valueTuple).CompareTo(null));
- }
-
- public void TestNotEqual()
- {
- ValueTuple<int> ValueTupleB = new ValueTuple<int>((int)10000);
- Assert.NotEqual(valueTuple, ValueTupleB);
- }
-
- internal void TestCompareToThrows()
- {
- ValueTuple<int> ValueTupleB = new ValueTuple<int>((int)10000);
- Assert.Throws<ArgumentException>(() => ((IComparable)valueTuple).CompareTo(ValueTupleB));
- }
- }
-
- [Fact]
- public static void TestConstructor()
- {
- ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan> ValueTupleDriverA;
- //ValueTuple-0
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>();
- ValueTupleDriverA.TestConstructor();
-
- //ValueTuple-1
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MaxValue);
- ValueTupleDriverA.TestConstructor(short.MaxValue);
-
- //ValueTuple-2
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue, int.MaxValue);
- ValueTupleDriverA.TestConstructor(short.MinValue, int.MaxValue);
-
- //ValueTuple-3
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)0, (int)0, long.MaxValue);
- ValueTupleDriverA.TestConstructor((short)0, (int)0, long.MaxValue);
-
- //ValueTuple-4
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)1, (int)1, long.MinValue, "This");
- ValueTupleDriverA.TestConstructor((short)1, (int)1, long.MinValue, "This");
-
- //ValueTuple-5
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-1), (int)(-1), (long)0, "is", 'A');
- ValueTupleDriverA.TestConstructor((short)(-1), (int)(-1), (long)0, "is", 'A');
-
- //ValueTuple-6
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10, (int)100, (long)1, "testing", 'Z', Single.MaxValue);
- ValueTupleDriverA.TestConstructor((short)10, (int)100, (long)1, "testing", 'Z', Single.MaxValue);
-
- //ValueTuple-7
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-100), (int)(-1000), (long)(-1), "ValueTuples", ' ', Single.MinValue, Double.MaxValue);
- ValueTupleDriverA.TestConstructor((short)(-100), (int)(-1000), (long)(-1), "ValueTuples", ' ', Single.MinValue, Double.MaxValue);
-
- object myObj = new object();
- //ValueTuple-10
- DateTime now = DateTime.Now;
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', (Single)0.0001, (Double)0.0000001, now, ValueTuple.Create(false, myObj), TimeSpan.Zero);
- ValueTupleDriverA.TestConstructor((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', (Single)0.0001, (Double)0.0000001, now, ValueTuple.Create(false, myObj), TimeSpan.Zero);
- }
-
- [Fact]
- public static void TestToString()
- {
- ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan> ValueTupleDriverA;
- //ValueTuple-0
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>();
- ValueTupleDriverA.TestToString("()");
-
- //ValueTuple-1
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MaxValue);
- ValueTupleDriverA.TestToString("(" + short.MaxValue + ")");
-
- //ValueTuple-2
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue, int.MaxValue);
- ValueTupleDriverA.TestToString("(" + short.MinValue + ", " + int.MaxValue + ")");
-
- //ValueTuple-3
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)0, (int)0, long.MaxValue);
- ValueTupleDriverA.TestToString("(" + ((short)0) + ", " + ((int)0) + ", " + long.MaxValue + ")");
-
- //ValueTuple-4
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)1, (int)1, long.MinValue, "This");
- ValueTupleDriverA.TestConstructor((short)1, (int)1, long.MinValue, "This");
- ValueTupleDriverA.TestToString("(" + ((short)1) + ", " + ((int)1) + ", " + long.MinValue + ", This)");
-
- //ValueTuple-5
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-1), (int)(-1), (long)0, "is", 'A');
- ValueTupleDriverA.TestToString("(" + ((short)(-1)) + ", " + ((int)(-1)) + ", " + ((long)0) + ", is, A)");
-
- //ValueTuple-6
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10, (int)100, (long)1, "testing", 'Z', Single.MaxValue);
- ValueTupleDriverA.TestToString("(" + ((short)10) + ", " + ((int)100) + ", " + ((long)1) + ", testing, Z, " + Single.MaxValue + ")");
-
- //ValueTuple-7
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-100), (int)(-1000), (long)(-1), "ValueTuples", ' ', Single.MinValue, Double.MaxValue);
- ValueTupleDriverA.TestToString("(" + ((short)(-100)) + ", " + ((int)(-1000)) + ", " + ((long)(-1)) + ", ValueTuples, , " + Single.MinValue + ", " + Double.MaxValue + ")");
-
- object myObj = new object();
- //ValueTuple-10
- DateTime now = DateTime.Now;
-
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', (Single)0.0001, (Double)0.0000001, now, ValueTuple.Create(false, myObj), TimeSpan.Zero);
- // .NET Native bug 438149 - object.ToString in incorrect
- ValueTupleDriverA.TestToString("(" + ((short)10000) + ", " + ((int)1000000) + ", " + ((long)10000000) + ", 2008?7?2?, 0, " + ((Single)0.0001) + ", " + ((Double)0.0000001) + ", " + now + ", (False, System.Object), " + TimeSpan.Zero + ")");
- }
-
- [ActiveIssue(10207, Xunit.PlatformID.AnyUnix)]
- [Fact]
- public static void TestEquals_GetHashCode()
- {
- ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan> ValueTupleDriverA, ValueTupleDriverB, ValueTupleDriverC, ValueTupleDriverD;
- //ValueTuple-0
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>();
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>();
- ValueTupleDriverD = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MaxValue, int.MaxValue);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverD, false, false);
-
- //ValueTuple-1
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MaxValue);
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MaxValue);
- ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue);
- ValueTupleDriverD = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MaxValue, int.MaxValue);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverC, false, false);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverD, false, false);
-
- //ValueTuple-2
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue, int.MaxValue);
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue, int.MaxValue);
- ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue, int.MinValue);
- ValueTupleDriverD = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-1), (int)(-1), long.MinValue);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverC, false, false);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverD, false, false);
-
- //ValueTuple-3
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)0, (int)0, long.MaxValue);
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)0, (int)0, long.MaxValue);
- ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-1), (int)(-1), long.MinValue);
- ValueTupleDriverD = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)1, (int)1, long.MinValue, "this");
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverC, false, false);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverD, false, false);
-
- //ValueTuple-4
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)1, (int)1, long.MinValue, "This");
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)1, (int)1, long.MinValue, "This");
- ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)1, (int)1, long.MinValue, "this");
- ValueTupleDriverD = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)0, (int)0, (long)1, "IS", 'a');
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverC, false, false);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverD, false, false);
-
- //ValueTuple-5
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-1), (int)(-1), (long)0, "is", 'A');
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-1), (int)(-1), (long)0, "is", 'A');
- ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)0, (int)0, (long)1, "IS", 'a');
- ValueTupleDriverD = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10, (int)100, (long)1, "testing", 'Z', Single.MinValue);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverC, false, false);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverD, false, false);
-
- //ValueTuple-6
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10, (int)100, (long)1, "testing", 'Z', Single.MaxValue);
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10, (int)100, (long)1, "testing", 'Z', Single.MaxValue);
- ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10, (int)100, (long)1, "testing", 'Z', Single.MinValue);
- ValueTupleDriverD = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-101), (int)(-1001), (long)(-2), "ValueTuples", ' ', Single.MinValue, (Double)0.0);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverC, false, false);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverD, false, false);
-
- //ValueTuple-7
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-100), (int)(-1000), (long)(-1), "ValueTuples", ' ', Single.MinValue, Double.MaxValue);
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-100), (int)(-1000), (long)(-1), "ValueTuples", ' ', Single.MinValue, Double.MaxValue);
- ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-101), (int)(-1001), (long)(-2), "ValueTuples", ' ', Single.MinValue, (Double)0.0);
- ValueTupleDriverD = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10001, (int)1000001, (long)10000001, "2008?7?3?", '1', (Single)0.0002, (Double)0.0000002, DateTime.Now.AddMilliseconds(1));
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverC, false, false);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverD, false, false);
-
- //ValueTuple-8
- DateTime now = DateTime.Now;
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-100), (int)(-1000), (long)(-1), "ValueTuples", ' ', Single.MinValue, Double.MaxValue, now);
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-100), (int)(-1000), (long)(-1), "ValueTuples", ' ', Single.MinValue, Double.MaxValue, now);
- ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-101), (int)(-1001), (long)(-2), "ValueTuples", ' ', Single.MinValue, (Double)0.0, now.AddMilliseconds(1));
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverC, false, false);
-
- object myObj = new object();
- //ValueTuple-10
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', (Single)0.0001, (Double)0.0000001, now, ValueTuple.Create(false, myObj), TimeSpan.Zero);
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', (Single)0.0001, (Double)0.0000001, now, ValueTuple.Create(false, myObj), TimeSpan.Zero);
- ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10001, (int)1000001, (long)10000001, "2008?7?3?", '1', (Single)0.0002, (Double)0.0000002, now.AddMilliseconds(1), ValueTuple.Create(true, myObj), TimeSpan.MaxValue);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
- ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverC, false, false);
- }
-
- [ActiveIssue(10207, Xunit.PlatformID.AnyUnix)]
- [Fact]
- public static void TestCompareTo()
- {
- ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan> ValueTupleDriverA, ValueTupleDriverB, ValueTupleDriverC;
- //ValueTuple-0
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>();
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>();
- ValueTupleDriverA.TestCompareTo(ValueTupleDriverB, 0, 0);
-
- //ValueTuple-1
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MaxValue);
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MaxValue);
- ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue);
- ValueTupleDriverA.TestCompareTo(ValueTupleDriverB, 0, 5);
- ValueTupleDriverA.TestCompareTo(ValueTupleDriverC, 65535, 5);
- //ValueTuple-2
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue, int.MaxValue);
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue, int.MaxValue);
- ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue, int.MinValue);
- ValueTupleDriverA.TestCompareTo(ValueTupleDriverB, 0, 5);
- ValueTupleDriverA.TestCompareTo(ValueTupleDriverC, 1, 5);
- //ValueTuple-3
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)0, (int)0, long.MaxValue);
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)0, (int)0, long.MaxValue);
- ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-1), (int)(-1), long.MinValue);
- ValueTupleDriverA.TestCompareTo(ValueTupleDriverB, 0, 5);
- ValueTupleDriverA.TestCompareTo(ValueTupleDriverC, 1, 5);
- //ValueTuple-4
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)1, (int)1, long.MinValue, "This");
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)1, (int)1, long.MinValue, "This");
- ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)1, (int)1, long.MinValue, "this");
- ValueTupleDriverA.TestCompareTo(ValueTupleDriverB, 0, 5);
- ValueTupleDriverA.TestCompareTo(ValueTupleDriverC, 1, 5);
- //ValueTuple-5
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-1), (int)(-1), (long)0, "is", 'A');
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-1), (int)(-1), (long)0, "is", 'A');
- ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)0, (int)0, (long)1, "IS", 'a');
- ValueTupleDriverA.TestCompareTo(ValueTupleDriverB, 0, 5);
- ValueTupleDriverA.TestCompareTo(ValueTupleDriverC, -1, 5);
- //ValueTuple-6
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10, (int)100, (long)1, "testing", 'Z', Single.MaxValue);
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10, (int)100, (long)1, "testing", 'Z', Single.MaxValue);
- ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10, (int)100, (long)1, "testing", 'Z', Single.MinValue);
- ValueTupleDriverA.TestCompareTo(ValueTupleDriverB, 0, 5);
- ValueTupleDriverA.TestCompareTo(ValueTupleDriverC, 1, 5);
- //ValueTuple-7
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-100), (int)(-1000), (long)(-1), "ValueTuples", ' ', Single.MinValue, Double.MaxValue);
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-100), (int)(-1000), (long)(-1), "ValueTuples", ' ', Single.MinValue, Double.MaxValue);
- ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-101), (int)(-1001), (long)(-2), "ValueTuples", ' ', Single.MinValue, (Double)0.0);
- ValueTupleDriverA.TestCompareTo(ValueTupleDriverB, 0, 5);
- ValueTupleDriverA.TestCompareTo(ValueTupleDriverC, 1, 5);
-
- object myObj = new object();
- //ValueTuple-10
- DateTime now = DateTime.Now;
-
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', (Single)0.0001, (Double)0.0000001, now, ValueTuple.Create(false, myObj), TimeSpan.Zero);
- ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', (Single)0.0001, (Double)0.0000001, now, ValueTuple.Create(false, myObj), TimeSpan.Zero);
- ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10001, (int)1000001, (long)10000001, "2008?7?3?", '1', (Single)0.0002, (Double)0.0000002, now.AddMilliseconds(1), ValueTuple.Create(true, myObj), TimeSpan.MaxValue);
- ValueTupleDriverA.TestCompareTo(ValueTupleDriverB, 0, 5);
- ValueTupleDriverA.TestCompareTo(ValueTupleDriverC, -1, 5);
- }
-
- [Fact]
- public static void TestNotEqual()
- {
- ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan> ValueTupleDriverA;
- //ValueTuple-0
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>();
- ValueTupleDriverA.TestNotEqual();
-
- //ValueTuple-1
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000);
- ValueTupleDriverA.TestNotEqual();
-
- // This is for code coverage purposes
- //ValueTuple-2
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000);
- ValueTupleDriverA.TestNotEqual();
-
- //ValueTuple-3
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000);
- ValueTupleDriverA.TestNotEqual();
-
- //ValueTuple-4
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?");
- ValueTupleDriverA.TestNotEqual();
-
- //ValueTuple-5
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0');
- ValueTupleDriverA.TestNotEqual();
-
- //ValueTuple-6
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', Single.NaN);
- ValueTupleDriverA.TestNotEqual();
-
- //ValueTuple-7
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', Single.NaN, Double.NegativeInfinity);
- ValueTupleDriverA.TestNotEqual();
-
- //ValueTuple-8, extended ValueTuple
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', Single.NaN, Double.NegativeInfinity, DateTime.Now);
- ValueTupleDriverA.TestNotEqual();
-
- //ValueTuple-9 and ValueTuple-10 are not necessary because they use the same code path as ValueTuple-8
- }
-
- [Fact]
- public static void IncomparableTypes()
- {
- ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan> ValueTupleDriverA;
-
- //ValueTuple-0
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>();
- ValueTupleDriverA.TestCompareToThrows();
-
- //ValueTuple-1
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000);
- ValueTupleDriverA.TestCompareToThrows();
-
- // This is for code coverage purposes
- //ValueTuple-2
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000);
- ValueTupleDriverA.TestCompareToThrows();
-
- //ValueTuple-3
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000);
- ValueTupleDriverA.TestCompareToThrows();
-
- //ValueTuple-4
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?");
- ValueTupleDriverA.TestCompareToThrows();
-
- //ValueTuple-5
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0');
- ValueTupleDriverA.TestCompareToThrows();
-
- //ValueTuple-6
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', Single.NaN);
- ValueTupleDriverA.TestCompareToThrows();
-
- //ValueTuple-7
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', Single.NaN, Double.NegativeInfinity);
- ValueTupleDriverA.TestCompareToThrows();
-
- //ValueTuple-8, extended ValueTuple
- ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', Single.NaN, Double.NegativeInfinity, DateTime.Now);
- ValueTupleDriverA.TestCompareToThrows();
-
- //ValueTuple-9 and ValueTuple-10 are not necessary because they use the same code path as ValueTuple-8
- }
-
- [Fact]
- public static void FloatingPointNaNCases()
- {
- var a = ValueTuple.Create(Double.MinValue, Double.NaN, Single.MinValue, Single.NaN);
- var b = ValueTuple.Create(Double.MinValue, Double.NaN, Single.MinValue, Single.NaN);
-
- Assert.True(a.Equals(b));
- Assert.Equal(0, ((IComparable)a).CompareTo(b));
- Assert.Equal(a.GetHashCode(), b.GetHashCode());
- Assert.True(((IStructuralEquatable)a).Equals(b, TestEqualityComparer.Instance));
- Assert.Equal(5, ((IStructuralComparable)a).CompareTo(b, DummyTestComparer.Instance));
- Assert.Equal(
- ((IStructuralEquatable)a).GetHashCode(TestEqualityComparer.Instance),
- ((IStructuralEquatable)b).GetHashCode(TestEqualityComparer.Instance));
- }
-
- [Fact]
- public static void TestCustomTypeParameter1()
- {
- // Special case of ValueTuple<T1> where T1 is a custom type
- var testClass = new TestClass();
- var a = ValueTuple.Create(testClass);
- var b = ValueTuple.Create(testClass);
-
- Assert.True(a.Equals(b));
- Assert.Equal(0, ((IComparable)a).CompareTo(b));
- Assert.Equal(a.GetHashCode(), b.GetHashCode());
- Assert.True(((IStructuralEquatable)a).Equals(b, TestEqualityComparer.Instance));
- Assert.Equal(5, ((IStructuralComparable)a).CompareTo(b, DummyTestComparer.Instance));
- Assert.Equal(
- ((IStructuralEquatable)a).GetHashCode(TestEqualityComparer.Instance),
- ((IStructuralEquatable)b).GetHashCode(TestEqualityComparer.Instance));
- }
-
- [Fact]
- public static void TestCustomTypeParameter2()
- {
- // Special case of ValueTuple<T1, T2> where T2 is a custom type
- var testClass = new TestClass(1);
- var a = ValueTuple.Create(1, testClass);
- var b = ValueTuple.Create(1, testClass);
-
- Assert.True(a.Equals(b));
- Assert.Equal(0, ((IComparable)a).CompareTo(b));
- Assert.Equal(a.GetHashCode(), b.GetHashCode());
- Assert.True(((IStructuralEquatable)a).Equals(b, TestEqualityComparer.Instance));
- Assert.Equal(5, ((IStructuralComparable)a).CompareTo(b, DummyTestComparer.Instance));
- Assert.Equal(
- ((IStructuralEquatable)a).GetHashCode(TestEqualityComparer.Instance),
- ((IStructuralEquatable)b).GetHashCode(TestEqualityComparer.Instance));
- }
-
- [Fact]
- public static void TestCustomTypeParameter3()
- {
- // Special case of ValueTuple<T1, T2> where T1 and T2 are custom types
- var testClassA = new TestClass(100);
- var testClassB = new TestClass(101);
- var a = ValueTuple.Create(testClassA, testClassB);
- var b = ValueTuple.Create(testClassB, testClassA);
-
- Assert.False(a.Equals(b));
- Assert.Equal(-1, ((IComparable)a).CompareTo(b));
- Assert.False(((IStructuralEquatable)a).Equals(b, TestEqualityComparer.Instance));
- Assert.Equal(5, ((IStructuralComparable)a).CompareTo(b, DummyTestComparer.Instance));
- // Equals(IEqualityComparer) is false, ignore hash code
- }
-
- [Fact]
- public static void TestCustomTypeParameter4()
- {
- // Special case of ValueTuple<T1, T2> where T1 and T2 are custom types
- var testClassA = new TestClass(100);
- var testClassB = new TestClass(101);
- var a = ValueTuple.Create(testClassA, testClassB);
- var b = ValueTuple.Create(testClassA, testClassA);
-
- Assert.False(a.Equals(b));
- Assert.Equal(1, ((IComparable)a).CompareTo(b));
- Assert.False(((IStructuralEquatable)a).Equals(b, TestEqualityComparer.Instance));
- Assert.Equal(5, ((IStructuralComparable)a).CompareTo(b, DummyTestComparer.Instance));
- // Equals(IEqualityComparer) is false, ignore hash code
- }
-
- [Fact]
- public static void NestedValueTuples1()
- {
- var a = ValueTuple.Create(1, 2, ValueTuple.Create(31, 32), 4, 5, 6, 7, ValueTuple.Create(8, 9));
- var b = ValueTuple.Create(1, 2, ValueTuple.Create(31, 32), 4, 5, 6, 7, ValueTuple.Create(8, 9));
-
- Assert.True(a.Equals(b));
- Assert.Equal(0, ((IComparable)a).CompareTo(b));
- Assert.Equal(a.GetHashCode(), b.GetHashCode());
- Assert.True(((IStructuralEquatable)a).Equals(b, TestEqualityComparer.Instance));
- Assert.Equal(5, ((IStructuralComparable)a).CompareTo(b, DummyTestComparer.Instance));
- Assert.Equal(
- ((IStructuralEquatable)a).GetHashCode(TestEqualityComparer.Instance),
- ((IStructuralEquatable)b).GetHashCode(TestEqualityComparer.Instance));
- Assert.Equal("(1, 2, (31, 32), 4, 5, 6, 7, (8, 9))", a.ToString());
- Assert.Equal("(31, 32)", a.Item3.ToString());
- Assert.Equal("((8, 9))", a.Rest.ToString());
- }
-
- [Fact]
- public static void NestedValueTuples2()
- {
- var a = ValueTuple.Create(0, 1, 2, 3, 4, 5, 6, ValueTuple.Create(7, 8, 9, 10, 11, 12, 13, ValueTuple.Create(14, 15)));
- var b = ValueTuple.Create(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15, 16)));
-
- Assert.False(a.Equals(b));
- Assert.Equal(-1, ((IComparable)a).CompareTo(b));
- Assert.False(((IStructuralEquatable)a).Equals(b, TestEqualityComparer.Instance));
- Assert.Equal(5, ((IStructuralComparable)a).CompareTo(b, DummyTestComparer.Instance));
-
- Assert.Equal("(0, 1, 2, 3, 4, 5, 6, (7, 8, 9, 10, 11, 12, 13, (14, 15)))", a.ToString());
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, (8, 9, 10, 11, 12, 13, 14, (15, 16)))", b.ToString());
- Assert.Equal("((7, 8, 9, 10, 11, 12, 13, (14, 15)))", a.Rest.ToString());
-
- var a2 = Tuple.Create(0, 1, 2, 3, 4, 5, 6, Tuple.Create(7, 8, 9, 10, 11, 12, 13, Tuple.Create(14, 15)));
- var b2 = Tuple.Create(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16)));
-
- Assert.Equal(a2.ToString(), a.ToString());
- Assert.Equal(b2.ToString(), b.ToString());
- Assert.Equal(a2.Rest.ToString(), a.Rest.ToString());
- }
-
- [Fact]
- public static void IncomparableTypesSpecialCase()
- {
- // Special case when T does not implement IComparable
- var testClassA = new TestClass2(100);
- var testClassB = new TestClass2(100);
- var a = ValueTuple.Create(testClassA);
- var b = ValueTuple.Create(testClassB);
-
- Assert.True(a.Equals(b));
- Assert.Throws<ArgumentException>(() => ((IComparable)a).CompareTo(b));
- Assert.Equal(a.GetHashCode(), b.GetHashCode());
- Assert.True(((IStructuralEquatable)a).Equals(b, TestEqualityComparer.Instance));
- Assert.Equal(5, ((IStructuralComparable)a).CompareTo(b, DummyTestComparer.Instance));
- Assert.Equal(
- ((IStructuralEquatable)a).GetHashCode(TestEqualityComparer.Instance),
- ((IStructuralEquatable)b).GetHashCode(TestEqualityComparer.Instance));
- Assert.Equal("([100])", a.ToString());
- }
-
- [Fact]
- public static void ZeroTuples()
- {
- var a = ValueTuple.Create();
- Assert.True(a.Equals(new ValueTuple()));
- Assert.Equal(0, a.CompareTo(new ValueTuple()));
-
- Assert.Equal(1, ((IStructuralComparable)a).CompareTo(null, DummyTestComparer.Instance));
- Assert.Throws<ArgumentException>(() => ((IStructuralComparable)a).CompareTo("string", DummyTestComparer.Instance));
-
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, )", CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple()).ToString());
- }
-
- [Fact]
- public static void OneTuples()
- {
- IComparable c = ValueTuple.Create(1);
-
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(3)));
-
- IStructuralComparable sc = (IStructuralComparable)c;
-
- Assert.Equal(1, sc.CompareTo(null, DummyTestComparer.Instance));
- Assert.Throws<ArgumentException>(() => ((IStructuralComparable)sc).CompareTo("string", DummyTestComparer.Instance));
-
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(3), TestComparer.Instance));
-
- Assert.False(((IStructuralEquatable)sc).Equals(sc, DummyTestEqualityComparer.Instance));
-
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1)", CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(1)).ToString());
-
- var vtWithNull = new ValueTuple<string>(null);
- var tupleWithNull = new Tuple<string>(null);
- Assert.Equal("()", vtWithNull.ToString());
- Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
- }
-
- [Fact]
- public static void TwoTuples()
- {
- IComparable c = ValueTuple.Create(1, 1);
-
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(3, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 3)));
-
- IStructuralComparable sc = (IStructuralComparable)c;
-
- Assert.Equal(1, sc.CompareTo(null, DummyTestComparer.Instance));
- Assert.Throws<ArgumentException>(() => ((IStructuralComparable)sc).CompareTo("string", DummyTestComparer.Instance));
-
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 3), TestComparer.Instance));
-
- Assert.False(((IStructuralEquatable)sc).Equals(sc, DummyTestEqualityComparer.Instance));
-
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 2)", CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(1, 2)).ToString());
-
- var vtWithNull = new ValueTuple<string, string>(null, null);
- var tupleWithNull = new Tuple<string, string>(null, null);
- Assert.Equal("(, )", vtWithNull.ToString());
- Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
- }
-
- [Fact]
- public static void ThreeTuples()
- {
- IComparable c = ValueTuple.Create(1, 1, 1);
-
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(3, 1, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 3, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 3)));
-
- IStructuralComparable sc = (IStructuralComparable)c;
-
- Assert.Equal(1, sc.CompareTo(null, DummyTestComparer.Instance));
- Assert.Throws<ArgumentException>(() => ((IStructuralComparable)sc).CompareTo("string", DummyTestComparer.Instance));
-
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 3, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 3), TestComparer.Instance));
-
- Assert.False(((IStructuralEquatable)sc).Equals(sc, DummyTestEqualityComparer.Instance));
-
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 2, 3)", CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(1, 2, 3)).ToString());
-
- var vtWithNull = new ValueTuple<string, string, string>(null, null, null);
- var tupleWithNull = new Tuple<string, string, string>(null, null, null);
- Assert.Equal("(, , )", vtWithNull.ToString());
- Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
- }
-
- [Fact]
- public static void FourTuples()
- {
- IComparable c = ValueTuple.Create(1, 1, 1, 1);
-
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(3, 1, 1, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 3, 1, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 3, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 3)));
-
- IStructuralComparable sc = (IStructuralComparable)c;
-
- Assert.Equal(1, sc.CompareTo(null, DummyTestComparer.Instance));
- Assert.Throws<ArgumentException>(() => ((IStructuralComparable)sc).CompareTo("string", DummyTestComparer.Instance));
-
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(3, 1, 1, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 3, 1, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 3, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 3), TestComparer.Instance));
-
- Assert.False(((IStructuralEquatable)sc).Equals(sc, DummyTestEqualityComparer.Instance));
-
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4)", CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(1, 2, 3, 4)).ToString());
-
- var vtWithNull = new ValueTuple<string, string, string, string>(null, null, null, null);
- var tupleWithNull = new Tuple<string, string, string, string>(null, null, null, null);
- Assert.Equal("(, , , )", vtWithNull.ToString());
- Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
- }
-
- [Fact]
- public static void FiveTuples()
- {
- IComparable c = ValueTuple.Create(1, 1, 1, 1, 1);
-
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(3, 1, 1, 1, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 3, 1, 1, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 3, 1, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 3, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 1, 3)));
-
- IStructuralComparable sc = (IStructuralComparable)c;
-
- Assert.Equal(1, sc.CompareTo(null, DummyTestComparer.Instance));
- Assert.Throws<ArgumentException>(() => ((IStructuralComparable)sc).CompareTo("string", DummyTestComparer.Instance));
-
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(3, 1, 1, 1, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 3, 1, 1, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 3, 1, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 3, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 1, 3), TestComparer.Instance));
-
- Assert.False(((IStructuralEquatable)sc).Equals(sc, DummyTestEqualityComparer.Instance));
-
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5)", CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(1, 2, 3, 4, 5)).ToString());
-
- var vtWithNull = new ValueTuple<string, string, string, string, string>(null, null, null, null, null);
- var tupleWithNull = new Tuple<string, string, string, string, string>(null, null, null, null, null);
- Assert.Equal("(, , , , )", vtWithNull.ToString());
- Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
- }
-
- [Fact]
- public static void SixTuples()
- {
- IComparable c = ValueTuple.Create(1, 1, 1, 1, 1, 1);
-
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(3, 1, 1, 1, 1, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 3, 1, 1, 1, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 3, 1, 1, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 3, 1, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 1, 3, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 1, 1, 3)));
-
- IStructuralComparable sc = (IStructuralComparable)c;
-
- Assert.Equal(1, sc.CompareTo(null, DummyTestComparer.Instance));
- Assert.Throws<ArgumentException>(() => ((IStructuralComparable)sc).CompareTo("string", DummyTestComparer.Instance));
-
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(3, 1, 1, 1, 1, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 3, 1, 1, 1, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 3, 1, 1, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 3, 1, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 1, 3, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 1, 1, 3), TestComparer.Instance));
-
- Assert.False(((IStructuralEquatable)sc).Equals(sc, DummyTestEqualityComparer.Instance));
-
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6)", CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(1, 2, 3, 4, 5, 6)).ToString());
-
- var vtWithNull = new ValueTuple<string, string, string, string, string, string>(null, null, null, null, null, null);
- var tupleWithNull = new Tuple<string, string, string, string, string, string>(null, null, null, null, null, null);
- Assert.Equal("(, , , , , )", vtWithNull.ToString());
- Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
- }
-
- [Fact]
- public static void SevenTuples()
- {
- IComparable c = ValueTuple.Create(1, 1, 1, 1, 1, 1, 1);
-
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(3, 1, 1, 1, 1, 1, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 3, 1, 1, 1, 1, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 3, 1, 1, 1, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 3, 1, 1, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 1, 3, 1, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 1, 1, 3, 1)));
- Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 1, 1, 1, 3)));
-
- IStructuralComparable sc = (IStructuralComparable)c;
-
- Assert.Equal(1, sc.CompareTo(null, DummyTestComparer.Instance));
- Assert.Throws<ArgumentException>(() => ((IStructuralComparable)sc).CompareTo("string", DummyTestComparer.Instance));
-
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(3, 1, 1, 1, 1, 1, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 3, 1, 1, 1, 1, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 3, 1, 1, 1, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 3, 1, 1, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 1, 3, 1, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 1, 1, 3, 1), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 1, 1, 1, 3), TestComparer.Instance));
-
- Assert.False(((IStructuralEquatable)sc).Equals(sc, DummyTestEqualityComparer.Instance));
-
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7)", CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(1, 2, 3, 4, 5, 6, 7)).ToString());
-
- var vtWithNull = new ValueTuple<string, string, string, string, string, string, string>(null, null, null, null, null, null, null);
- var tupleWithNull = new Tuple<string, string, string, string, string, string, string>(null, null, null, null, null, null, null);
- Assert.Equal("(, , , , , , )", vtWithNull.ToString());
- Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
- }
-
- public static ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> CreateLong<T1, T2, T3, T4, T5, T6, T7, TRest>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest) where TRest : struct =>
- new ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>(item1, item2, item3, item4, item5, item6, item7, rest);
-
- public static Tuple<T1, T2, T3, T4, T5, T6, T7, TRest> CreateLongRef<T1, T2, T3, T4, T5, T6, T7, TRest>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest) =>
- new Tuple<T1, T2, T3, T4, T5, T6, T7, TRest>(item1, item2, item3, item4, item5, item6, item7, rest);
-
- [Fact]
- public static void EightTuples()
- {
- var x = new Tuple<int, int, int, int, int, int, int, Tuple<string, string>>(1, 2, 3, 4, 5, 6, 7, new Tuple<string, string>("alice", "bob"));
- var y = new ValueTuple<int, int, int, int, int, int, int, ValueTuple<string, string>>(1, 2, 3, 4, 5, 6, 7, new ValueTuple<string, string>("alice", "bob"));
- Assert.Equal(x.ToString(), y.ToString());
-
- var t = CreateLong(1, 1, 1, 1, 1, 1, 1, ValueTuple.Create(1));
-
- IStructuralEquatable se = t;
- Assert.False(se.Equals(null, TestEqualityComparer.Instance));
- Assert.False(se.Equals("string", TestEqualityComparer.Instance));
- Assert.False(se.Equals(new ValueTuple(), TestEqualityComparer.Instance));
-
- IComparable c = t;
- Assert.Equal(-1, c.CompareTo(CreateLong(3, 1, 1, 1, 1, 1, 1, ValueTuple.Create(1))));
- Assert.Equal(-1, c.CompareTo(CreateLong(1, 3, 1, 1, 1, 1, 1, ValueTuple.Create(1))));
- Assert.Equal(-1, c.CompareTo(CreateLong(1, 1, 3, 1, 1, 1, 1, ValueTuple.Create(1))));
- Assert.Equal(-1, c.CompareTo(CreateLong(1, 1, 1, 3, 1, 1, 1, ValueTuple.Create(1))));
- Assert.Equal(-1, c.CompareTo(CreateLong(1, 1, 1, 1, 3, 1, 1, ValueTuple.Create(1))));
- Assert.Equal(-1, c.CompareTo(CreateLong(1, 1, 1, 1, 1, 3, 1, ValueTuple.Create(1))));
- Assert.Equal(-1, c.CompareTo(CreateLong(1, 1, 1, 1, 1, 1, 3, ValueTuple.Create(1))));
-
- IStructuralComparable sc = t;
- Assert.Equal(1, sc.CompareTo(null, DummyTestComparer.Instance));
- Assert.Throws<ArgumentException>(() => sc.CompareTo("string", DummyTestComparer.Instance));
-
- Assert.Equal(1, sc.CompareTo(CreateLong(3, 1, 1, 1, 1, 1, 1, ValueTuple.Create(1)), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(CreateLong(1, 3, 1, 1, 1, 1, 1, ValueTuple.Create(1)), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(CreateLong(1, 1, 3, 1, 1, 1, 1, ValueTuple.Create(1)), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(CreateLong(1, 1, 1, 3, 1, 1, 1, ValueTuple.Create(1)), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(CreateLong(1, 1, 1, 1, 3, 1, 1, ValueTuple.Create(1)), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(CreateLong(1, 1, 1, 1, 1, 3, 1, ValueTuple.Create(1)), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(CreateLong(1, 1, 1, 1, 1, 1, 3, ValueTuple.Create(1)), TestComparer.Instance));
- Assert.Equal(1, sc.CompareTo(CreateLong(1, 1, 1, 1, 1, 1, 1, ValueTuple.Create(3)), TestComparer.Instance));
-
- Assert.Equal(2138941962, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create()).GetHashCode());
- Assert.Equal(2138941954, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8)).GetHashCode());
- Assert.Equal(-1746596640, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9)).GetHashCode());
- Assert.Equal(121964360, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10)).GetHashCode());
- Assert.Equal(4363008, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11)).GetHashCode());
- Assert.Equal(9413384, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12)).GetHashCode());
- Assert.Equal(305131744, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12, 13)).GetHashCode());
- Assert.Equal(1479338186, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12, 13, 14)).GetHashCode());
- Assert.Equal(1573514559, CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create())).GetHashCode());
- Assert.Equal(1573514711, CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15))).GetHashCode());
-
- Assert.Equal(2138941962, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create())).GetHashCode(TestEqualityComparer.Instance));
- Assert.Equal(2138941954, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8))).GetHashCode(TestEqualityComparer.Instance));
- Assert.Equal(-1746596640, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9))).GetHashCode(TestEqualityComparer.Instance));
- Assert.Equal(121964360, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10))).GetHashCode(TestEqualityComparer.Instance));
- Assert.Equal(4363008, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11))).GetHashCode(TestEqualityComparer.Instance));
- Assert.Equal(9413384, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12))).GetHashCode(TestEqualityComparer.Instance));
- Assert.Equal(305131744, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12, 13))).GetHashCode(TestEqualityComparer.Instance));
- Assert.Equal(1479338186, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12, 13, 14))).GetHashCode(TestEqualityComparer.Instance));
- Assert.Equal(1573514559, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create()))).GetHashCode(TestEqualityComparer.Instance));
- Assert.Equal(1573514711, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15)))).GetHashCode(TestEqualityComparer.Instance));
-
- Assert.False(se.Equals(t, DummyTestEqualityComparer.Instance));
-
- // Notice that 0-tuple prints as empty position
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, )", CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create())).ToString());
-
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 1)", CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(1))).ToString());
-
- var vtWithNull = new ValueTuple<string, string, string, string, string, string, string, ValueTuple<string>>(null, null, null, null, null, null, null, new ValueTuple<string>(null));
- var tupleWithNull = new Tuple<string, string, string, string, string, string, string, Tuple<string>>(null, null, null, null, null, null, null, new Tuple<string>(null));
- Assert.Equal("(, , , , , , , )", vtWithNull.ToString());
- Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
- }
-
- [Fact]
- public static void LongTuplesWithNull()
- {
- {
- var vtWithNull = CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple<string>(null));
- var tupleWithNull = CreateLongRef(1, 2, 3, 4, 5, 6, 7, new Tuple<string>(null));
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, )", vtWithNull.ToString());
- Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
- }
-
- {
- var vtWithNull = CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple<string>(null));
- var tupleWithNull = CreateLongRef(1, 2, 3, 4, 5, 6, 7, new Tuple<string>(null));
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, )", vtWithNull.ToString());
- Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
- }
-
- {
- var vtWithNull = CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple<string, string>(null, null));
- var tupleWithNull = CreateLongRef(1, 2, 3, 4, 5, 6, 7, new Tuple<string, string>(null, null));
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, , )", vtWithNull.ToString());
- Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
- }
-
- {
- var vtWithNull = CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple<string, string, string>(null, null, null));
- var tupleWithNull = CreateLongRef(1, 2, 3, 4, 5, 6, 7, new Tuple<string, string, string>(null, null, null));
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, , , )", vtWithNull.ToString());
- Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
- }
-
- {
- var vtWithNull = CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple<string, string, string, string>(null, null, null, null));
- var tupleWithNull = CreateLongRef(1, 2, 3, 4, 5, 6, 7, new Tuple<string, string, string, string>(null, null, null, null));
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, , , , )", vtWithNull.ToString());
- Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
- }
-
- {
- var vtWithNull = CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple<string, string, string, string, string>(null, null, null, null, null));
- var tupleWithNull = CreateLongRef(1, 2, 3, 4, 5, 6, 7, new Tuple<string, string, string, string, string>(null, null, null, null, null));
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, , , , , )", vtWithNull.ToString());
- Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
- }
-
- {
- var vtWithNull = CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple<string, string, string, string, string, string>(null, null, null, null, null, null));
- var tupleWithNull = CreateLongRef(1, 2, 3, 4, 5, 6, 7, new Tuple<string, string, string, string, string, string>(null, null, null, null, null, null));
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, , , , , , )", vtWithNull.ToString());
- Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
- }
-
- {
- var vtWithNull = CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple<string, string, string, string, string, string, string>(null, null, null, null, null, null, null));
- var tupleWithNull = CreateLongRef(1, 2, 3, 4, 5, 6, 7, new Tuple<string, string, string, string, string, string, string>(null, null, null, null, null, null, null));
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, , , , , , , )", vtWithNull.ToString());
- Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
- }
- }
-
- [Fact]
- public static void EightTuplesWithBadRest()
- {
- // Change as necessary if in the future
- // the hash algorithm is modified again.
- const int ExpectedHash = 1291467969;
-
- var d = default(ValueTuple<int, int, int, int, int, int, int, int>);
- d.Item1 = 1;
- d.Rest = 42;
- Assert.Equal(ExpectedHash, d.GetHashCode());
- Assert.Equal(ExpectedHash, ((IStructuralEquatable)d).GetHashCode());
- Assert.Equal("(1, 0, 0, 0, 0, 0, 0, 42)", d.ToString());
-
- Assert.Equal(ExpectedHash, CreateLong(1, 2, 3, 4, 5, 6, 7, d).GetHashCode());
-
- // GetHashCode only tries to hash the first 7 elements when rest is not ITupleInternal
- Assert.Equal(ValueTuple.Create(1, 0, 0, 0, 0, 0, 0).GetHashCode(), d.GetHashCode());
- Assert.Equal(((IStructuralEquatable)ValueTuple.Create(1, 0, 0, 0, 0, 0, 0)).GetHashCode(TestEqualityComparer.Instance), ((IStructuralEquatable)d).GetHashCode(TestEqualityComparer.Instance));
-
- Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 0, 0, 0, 0, 0, 0, 42)", CreateLong(1, 2, 3, 4, 5, 6, 7, d).ToString());
- }
-
- private class TestClass : IComparable
- {
- private readonly int _value;
-
- internal TestClass()
- : this(0)
- { }
-
- internal TestClass(int value)
- {
- this._value = value;
- }
-
- public override string ToString()
- {
- return "{" + _value.ToString() + "}";
- }
-
- public int CompareTo(object x)
- {
- TestClass tmp = x as TestClass;
- if (tmp != null)
- return this._value.CompareTo(tmp._value);
- else
- return 1;
- }
- }
-
- private class TestClass2
- {
- private readonly int _value;
-
- internal TestClass2()
- : this(0)
- { }
-
- internal TestClass2(int value)
- {
- this._value = value;
- }
-
- public override string ToString()
- {
- return "[" + _value.ToString() + "]";
- }
-
- public override bool Equals(object x)
- {
- TestClass2 tmp = x as TestClass2;
- if (tmp != null)
- return _value.Equals(tmp._value);
- else
- return false;
- }
-
- public override int GetHashCode()
- {
- return _value.GetHashCode();
- }
- }
-
- private class DummyTestComparer : IComparer
- {
- public static readonly DummyTestComparer Instance = new DummyTestComparer();
-
- public int Compare(object x, object y)
- {
- return 5;
- }
- }
-
- private class TestComparer : IComparer
- {
- public static readonly TestComparer Instance = new TestComparer();
-
- public int Compare(object x, object y)
- {
- return x.Equals(y) ? 0 : 1;
- }
- }
-
- private class DummyTestEqualityComparer : IEqualityComparer
- {
- public static readonly DummyTestEqualityComparer Instance = new DummyTestEqualityComparer();
-
- public new bool Equals(object x, object y)
- {
- return false;
- }
-
- public int GetHashCode(object x)
- {
- return x.GetHashCode();
- }
- }
-
- private class TestEqualityComparer : IEqualityComparer
- {
- public static readonly TestEqualityComparer Instance = new TestEqualityComparer();
-
- public new bool Equals(object x, object y)
- {
- return x.Equals(y);
- }
-
- public int GetHashCode(object x)
- {
- return x.GetHashCode();
- }
- }
-}
diff --git a/src/System.ValueTuple/tests/ValueTupleTests.cs b/src/System.ValueTuple/tests/ValueTupleTests.cs
new file mode 100644
index 0000000000..70021e4c98
--- /dev/null
+++ b/src/System.ValueTuple/tests/ValueTupleTests.cs
@@ -0,0 +1,1216 @@
+// 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.Collections;
+using System.Collections.Generic;
+using Xunit;
+
+namespace System.Tests
+{
+ public class ValueTupleTests
+ {
+ private class ValueTupleTestDriver<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
+ {
+ private int _nItems;
+
+ private readonly object valueTuple;
+ private readonly ValueTuple valueTuple0;
+ private readonly ValueTuple<T1> valueTuple1;
+ private readonly ValueTuple<T1, T2> valueTuple2;
+ private readonly ValueTuple<T1, T2, T3> valueTuple3;
+ private readonly ValueTuple<T1, T2, T3, T4> valueTuple4;
+ private readonly ValueTuple<T1, T2, T3, T4, T5> valueTuple5;
+ private readonly ValueTuple<T1, T2, T3, T4, T5, T6> valueTuple6;
+ private readonly ValueTuple<T1, T2, T3, T4, T5, T6, T7> valueTuple7;
+ private readonly ValueTuple<T1, T2, T3, T4, T5, T6, T7, ValueTuple<T8>> valueTuple8;
+ private readonly ValueTuple<T1, T2, T3, T4, T5, T6, T7, ValueTuple<T8, T9>> valueTuple9;
+ private readonly ValueTuple<T1, T2, T3, T4, T5, T6, T7, ValueTuple<T8, T9, T10>> valueTuple10;
+
+ internal ValueTupleTestDriver(params object[] values)
+ {
+ if (values.Length > 10)
+ throw new ArgumentOutOfRangeException("values", "You must provide at most 10 values");
+
+ _nItems = values.Length;
+ switch (_nItems)
+ {
+ case 0:
+ valueTuple0 = ValueTuple.Create();
+ valueTuple = valueTuple0;
+ break;
+ case 1:
+ valueTuple1 = ValueTuple.Create((T1)values[0]);
+ valueTuple = valueTuple1;
+ break;
+ case 2:
+ valueTuple2 = ValueTuple.Create((T1)values[0], (T2)values[1]);
+ valueTuple = valueTuple2;
+ break;
+ case 3:
+ valueTuple3 = ValueTuple.Create((T1)values[0], (T2)values[1], (T3)values[2]);
+ valueTuple = valueTuple3;
+ break;
+ case 4:
+ valueTuple4 = ValueTuple.Create((T1)values[0], (T2)values[1], (T3)values[2], (T4)values[3]);
+ valueTuple = valueTuple4;
+ break;
+ case 5:
+ valueTuple5 = ValueTuple.Create((T1)values[0], (T2)values[1], (T3)values[2], (T4)values[3], (T5)values[4]);
+ valueTuple = valueTuple5;
+ break;
+ case 6:
+ valueTuple6 = ValueTuple.Create((T1)values[0], (T2)values[1], (T3)values[2], (T4)values[3],
+ (T5)values[4], (T6)values[5]);
+ valueTuple = valueTuple6;
+ break;
+ case 7:
+ valueTuple7 = ValueTuple.Create((T1)values[0], (T2)values[1], (T3)values[2], (T4)values[3],
+ (T5)values[4], (T6)values[5], (T7)values[6]);
+ valueTuple = valueTuple7;
+ break;
+ case 8:
+ valueTuple8 = ValueTuple.Create((T1)values[0], (T2)values[1], (T3)values[2], (T4)values[3],
+ (T5)values[4], (T6)values[5], (T7)values[6], (T8)values[7]);
+ valueTuple = valueTuple8;
+ break;
+ case 9:
+ valueTuple9 = new ValueTuple<T1, T2, T3, T4, T5, T6, T7, ValueTuple<T8, T9>>((T1)values[0], (T2)values[1], (T3)values[2], (T4)values[3], (T5)values[4], (T6)values[5], (T7)values[6], new ValueTuple<T8, T9>((T8)values[7], (T9)values[8]));
+ valueTuple = valueTuple9;
+ break;
+ case 10:
+ valueTuple10 = new ValueTuple<T1, T2, T3, T4, T5, T6, T7, ValueTuple<T8, T9, T10>>((T1)values[0], (T2)values[1], (T3)values[2], (T4)values[3], (T5)values[4], (T6)values[5], (T7)values[6], new ValueTuple<T8, T9, T10>((T8)values[7], (T9)values[8], (T10)values[9]));
+ valueTuple = valueTuple10;
+ break;
+ }
+ }
+
+ private void VerifyItem(int itemPos, object Item1, object Item2)
+ {
+ Assert.True(object.Equals(Item1, Item2));
+ }
+
+ public void TestConstructor(params object[] expectedValue)
+ {
+ if (expectedValue.Length != _nItems)
+ throw new ArgumentOutOfRangeException("expectedValues", "You must provide " + _nItems + " expectedvalues");
+
+ switch (_nItems)
+ {
+ case 0:
+ break;
+ case 1:
+ VerifyItem(1, valueTuple1.Item1, expectedValue[0]);
+ break;
+ case 2:
+ VerifyItem(1, valueTuple2.Item1, expectedValue[0]);
+ VerifyItem(2, valueTuple2.Item2, expectedValue[1]);
+ break;
+ case 3:
+ VerifyItem(1, valueTuple3.Item1, expectedValue[0]);
+ VerifyItem(2, valueTuple3.Item2, expectedValue[1]);
+ VerifyItem(3, valueTuple3.Item3, expectedValue[2]);
+ break;
+ case 4:
+ VerifyItem(1, valueTuple4.Item1, expectedValue[0]);
+ VerifyItem(2, valueTuple4.Item2, expectedValue[1]);
+ VerifyItem(3, valueTuple4.Item3, expectedValue[2]);
+ VerifyItem(4, valueTuple4.Item4, expectedValue[3]);
+ break;
+ case 5:
+ VerifyItem(1, valueTuple5.Item1, expectedValue[0]);
+ VerifyItem(2, valueTuple5.Item2, expectedValue[1]);
+ VerifyItem(3, valueTuple5.Item3, expectedValue[2]);
+ VerifyItem(4, valueTuple5.Item4, expectedValue[3]);
+ VerifyItem(5, valueTuple5.Item5, expectedValue[4]);
+ break;
+ case 6:
+ VerifyItem(1, valueTuple6.Item1, expectedValue[0]);
+ VerifyItem(2, valueTuple6.Item2, expectedValue[1]);
+ VerifyItem(3, valueTuple6.Item3, expectedValue[2]);
+ VerifyItem(4, valueTuple6.Item4, expectedValue[3]);
+ VerifyItem(5, valueTuple6.Item5, expectedValue[4]);
+ VerifyItem(6, valueTuple6.Item6, expectedValue[5]);
+ break;
+ case 7:
+ VerifyItem(1, valueTuple7.Item1, expectedValue[0]);
+ VerifyItem(2, valueTuple7.Item2, expectedValue[1]);
+ VerifyItem(3, valueTuple7.Item3, expectedValue[2]);
+ VerifyItem(4, valueTuple7.Item4, expectedValue[3]);
+ VerifyItem(5, valueTuple7.Item5, expectedValue[4]);
+ VerifyItem(6, valueTuple7.Item6, expectedValue[5]);
+ VerifyItem(7, valueTuple7.Item7, expectedValue[6]);
+ break;
+ case 8: // Extended ValueTuple
+ VerifyItem(1, valueTuple8.Item1, expectedValue[0]);
+ VerifyItem(2, valueTuple8.Item2, expectedValue[1]);
+ VerifyItem(3, valueTuple8.Item3, expectedValue[2]);
+ VerifyItem(4, valueTuple8.Item4, expectedValue[3]);
+ VerifyItem(5, valueTuple8.Item5, expectedValue[4]);
+ VerifyItem(6, valueTuple8.Item6, expectedValue[5]);
+ VerifyItem(7, valueTuple8.Item7, expectedValue[6]);
+ VerifyItem(8, valueTuple8.Rest.Item1, expectedValue[7]);
+ break;
+ case 9: // Extended ValueTuple
+ VerifyItem(1, valueTuple9.Item1, expectedValue[0]);
+ VerifyItem(2, valueTuple9.Item2, expectedValue[1]);
+ VerifyItem(3, valueTuple9.Item3, expectedValue[2]);
+ VerifyItem(4, valueTuple9.Item4, expectedValue[3]);
+ VerifyItem(5, valueTuple9.Item5, expectedValue[4]);
+ VerifyItem(6, valueTuple9.Item6, expectedValue[5]);
+ VerifyItem(7, valueTuple9.Item7, expectedValue[6]);
+ VerifyItem(8, valueTuple9.Rest.Item1, expectedValue[7]);
+ VerifyItem(9, valueTuple9.Rest.Item2, expectedValue[8]);
+ break;
+ case 10: // Extended ValueTuple
+ VerifyItem(1, valueTuple10.Item1, expectedValue[0]);
+ VerifyItem(2, valueTuple10.Item2, expectedValue[1]);
+ VerifyItem(3, valueTuple10.Item3, expectedValue[2]);
+ VerifyItem(4, valueTuple10.Item4, expectedValue[3]);
+ VerifyItem(5, valueTuple10.Item5, expectedValue[4]);
+ VerifyItem(6, valueTuple10.Item6, expectedValue[5]);
+ VerifyItem(7, valueTuple10.Item7, expectedValue[6]);
+ VerifyItem(8, valueTuple10.Rest.Item1, expectedValue[7]);
+ VerifyItem(9, valueTuple10.Rest.Item2, expectedValue[8]);
+ VerifyItem(10, valueTuple10.Rest.Item3, expectedValue[9]);
+ break;
+ default:
+ throw new ArgumentException("Must specify between 0 and 10 expected values (inclusive).");
+ }
+ }
+
+ public void TestToString(string expected)
+ {
+ Assert.Equal(expected, valueTuple.ToString());
+ }
+
+ public void TestEquals_GetHashCode(ValueTupleTestDriver<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> other, bool expectEqual, bool expectStructuallyEqual)
+ {
+ if (expectEqual)
+ {
+ Assert.True(valueTuple.Equals(other.valueTuple));
+ Assert.Equal(valueTuple.GetHashCode(), other.valueTuple.GetHashCode());
+ }
+ else
+ {
+ Assert.False(valueTuple.Equals(other.valueTuple));
+ Assert.NotEqual(valueTuple.GetHashCode(), other.valueTuple.GetHashCode());
+ }
+
+ if (expectStructuallyEqual)
+ {
+ var equatable = ((IStructuralEquatable)valueTuple);
+ var otherEquatable = ((IStructuralEquatable)other.valueTuple);
+ Assert.True(equatable.Equals(other.valueTuple, TestEqualityComparer.Instance));
+ Assert.Equal(equatable.GetHashCode(TestEqualityComparer.Instance), otherEquatable.GetHashCode(TestEqualityComparer.Instance));
+ }
+ else
+ {
+ var equatable = ((IStructuralEquatable)valueTuple);
+ var otherEquatable = ((IStructuralEquatable)other.valueTuple);
+ Assert.False(equatable.Equals(other.valueTuple, TestEqualityComparer.Instance));
+ Assert.NotEqual(equatable.GetHashCode(TestEqualityComparer.Instance), otherEquatable.GetHashCode(TestEqualityComparer.Instance));
+ }
+
+ Assert.False(valueTuple.Equals(null));
+ Assert.False(((IStructuralEquatable)valueTuple).Equals(null));
+ }
+
+ public void TestCompareTo(ValueTupleTestDriver<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> other, int expectedResult, int expectedStructuralResult)
+ {
+ Assert.Equal(expectedResult, ((IComparable)valueTuple).CompareTo(other.valueTuple));
+ Assert.Equal(expectedStructuralResult, ((IStructuralComparable)valueTuple).CompareTo(other.valueTuple, DummyTestComparer.Instance));
+ Assert.Equal(1, ((IComparable)valueTuple).CompareTo(null));
+ }
+
+ public void TestNotEqual()
+ {
+ ValueTuple<int> ValueTupleB = new ValueTuple<int>((int)10000);
+ Assert.NotEqual(valueTuple, ValueTupleB);
+ }
+
+ internal void TestCompareToThrows()
+ {
+ ValueTuple<int> ValueTupleB = new ValueTuple<int>((int)10000);
+ Assert.Throws<ArgumentException>(() => ((IComparable)valueTuple).CompareTo(ValueTupleB));
+ }
+ }
+
+ [Fact]
+ public static void TestConstructor()
+ {
+ ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan> ValueTupleDriverA;
+ //ValueTuple-0
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>();
+ ValueTupleDriverA.TestConstructor();
+
+ //ValueTuple-1
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MaxValue);
+ ValueTupleDriverA.TestConstructor(short.MaxValue);
+
+ //ValueTuple-2
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue, int.MaxValue);
+ ValueTupleDriverA.TestConstructor(short.MinValue, int.MaxValue);
+
+ //ValueTuple-3
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)0, (int)0, long.MaxValue);
+ ValueTupleDriverA.TestConstructor((short)0, (int)0, long.MaxValue);
+
+ //ValueTuple-4
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)1, (int)1, long.MinValue, "This");
+ ValueTupleDriverA.TestConstructor((short)1, (int)1, long.MinValue, "This");
+
+ //ValueTuple-5
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-1), (int)(-1), (long)0, "is", 'A');
+ ValueTupleDriverA.TestConstructor((short)(-1), (int)(-1), (long)0, "is", 'A');
+
+ //ValueTuple-6
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10, (int)100, (long)1, "testing", 'Z', Single.MaxValue);
+ ValueTupleDriverA.TestConstructor((short)10, (int)100, (long)1, "testing", 'Z', Single.MaxValue);
+
+ //ValueTuple-7
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-100), (int)(-1000), (long)(-1), "ValueTuples", ' ', Single.MinValue, Double.MaxValue);
+ ValueTupleDriverA.TestConstructor((short)(-100), (int)(-1000), (long)(-1), "ValueTuples", ' ', Single.MinValue, Double.MaxValue);
+
+ object myObj = new object();
+ //ValueTuple-10
+ DateTime now = DateTime.Now;
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', (Single)0.0001, (Double)0.0000001, now, ValueTuple.Create(false, myObj), TimeSpan.Zero);
+ ValueTupleDriverA.TestConstructor((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', (Single)0.0001, (Double)0.0000001, now, ValueTuple.Create(false, myObj), TimeSpan.Zero);
+ }
+
+ [Fact]
+ public static void TestToString()
+ {
+ ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan> ValueTupleDriverA;
+ //ValueTuple-0
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>();
+ ValueTupleDriverA.TestToString("()");
+
+ //ValueTuple-1
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MaxValue);
+ ValueTupleDriverA.TestToString("(" + short.MaxValue + ")");
+
+ //ValueTuple-2
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue, int.MaxValue);
+ ValueTupleDriverA.TestToString("(" + short.MinValue + ", " + int.MaxValue + ")");
+
+ //ValueTuple-3
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)0, (int)0, long.MaxValue);
+ ValueTupleDriverA.TestToString("(" + ((short)0) + ", " + ((int)0) + ", " + long.MaxValue + ")");
+
+ //ValueTuple-4
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)1, (int)1, long.MinValue, "This");
+ ValueTupleDriverA.TestConstructor((short)1, (int)1, long.MinValue, "This");
+ ValueTupleDriverA.TestToString("(" + ((short)1) + ", " + ((int)1) + ", " + long.MinValue + ", This)");
+
+ //ValueTuple-5
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-1), (int)(-1), (long)0, "is", 'A');
+ ValueTupleDriverA.TestToString("(" + ((short)(-1)) + ", " + ((int)(-1)) + ", " + ((long)0) + ", is, A)");
+
+ //ValueTuple-6
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10, (int)100, (long)1, "testing", 'Z', Single.MaxValue);
+ ValueTupleDriverA.TestToString("(" + ((short)10) + ", " + ((int)100) + ", " + ((long)1) + ", testing, Z, " + Single.MaxValue + ")");
+
+ //ValueTuple-7
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-100), (int)(-1000), (long)(-1), "ValueTuples", ' ', Single.MinValue, Double.MaxValue);
+ ValueTupleDriverA.TestToString("(" + ((short)(-100)) + ", " + ((int)(-1000)) + ", " + ((long)(-1)) + ", ValueTuples, , " + Single.MinValue + ", " + Double.MaxValue + ")");
+
+ object myObj = new object();
+ //ValueTuple-10
+ DateTime now = DateTime.Now;
+
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', (Single)0.0001, (Double)0.0000001, now, ValueTuple.Create(false, myObj), TimeSpan.Zero);
+ // .NET Native bug 438149 - object.ToString in incorrect
+ ValueTupleDriverA.TestToString("(" + ((short)10000) + ", " + ((int)1000000) + ", " + ((long)10000000) + ", 2008?7?2?, 0, " + ((Single)0.0001) + ", " + ((Double)0.0000001) + ", " + now + ", (False, System.Object), " + TimeSpan.Zero + ")");
+ }
+
+ [ActiveIssue(10207, Xunit.PlatformID.AnyUnix)]
+ [Fact]
+ public static void TestEquals_GetHashCode()
+ {
+ ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan> ValueTupleDriverA, ValueTupleDriverB, ValueTupleDriverC, ValueTupleDriverD;
+ //ValueTuple-0
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>();
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>();
+ ValueTupleDriverD = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MaxValue, int.MaxValue);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverD, false, false);
+
+ //ValueTuple-1
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MaxValue);
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MaxValue);
+ ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue);
+ ValueTupleDriverD = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MaxValue, int.MaxValue);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverC, false, false);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverD, false, false);
+
+ //ValueTuple-2
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue, int.MaxValue);
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue, int.MaxValue);
+ ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue, int.MinValue);
+ ValueTupleDriverD = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-1), (int)(-1), long.MinValue);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverC, false, false);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverD, false, false);
+
+ //ValueTuple-3
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)0, (int)0, long.MaxValue);
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)0, (int)0, long.MaxValue);
+ ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-1), (int)(-1), long.MinValue);
+ ValueTupleDriverD = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)1, (int)1, long.MinValue, "this");
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverC, false, false);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverD, false, false);
+
+ //ValueTuple-4
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)1, (int)1, long.MinValue, "This");
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)1, (int)1, long.MinValue, "This");
+ ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)1, (int)1, long.MinValue, "this");
+ ValueTupleDriverD = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)0, (int)0, (long)1, "IS", 'a');
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverC, false, false);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverD, false, false);
+
+ //ValueTuple-5
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-1), (int)(-1), (long)0, "is", 'A');
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-1), (int)(-1), (long)0, "is", 'A');
+ ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)0, (int)0, (long)1, "IS", 'a');
+ ValueTupleDriverD = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10, (int)100, (long)1, "testing", 'Z', Single.MinValue);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverC, false, false);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverD, false, false);
+
+ //ValueTuple-6
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10, (int)100, (long)1, "testing", 'Z', Single.MaxValue);
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10, (int)100, (long)1, "testing", 'Z', Single.MaxValue);
+ ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10, (int)100, (long)1, "testing", 'Z', Single.MinValue);
+ ValueTupleDriverD = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-101), (int)(-1001), (long)(-2), "ValueTuples", ' ', Single.MinValue, (Double)0.0);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverC, false, false);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverD, false, false);
+
+ //ValueTuple-7
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-100), (int)(-1000), (long)(-1), "ValueTuples", ' ', Single.MinValue, Double.MaxValue);
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-100), (int)(-1000), (long)(-1), "ValueTuples", ' ', Single.MinValue, Double.MaxValue);
+ ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-101), (int)(-1001), (long)(-2), "ValueTuples", ' ', Single.MinValue, (Double)0.0);
+ ValueTupleDriverD = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10001, (int)1000001, (long)10000001, "2008?7?3?", '1', (Single)0.0002, (Double)0.0000002, DateTime.Now.AddMilliseconds(1));
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverC, false, false);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverD, false, false);
+
+ //ValueTuple-8
+ DateTime now = DateTime.Now;
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-100), (int)(-1000), (long)(-1), "ValueTuples", ' ', Single.MinValue, Double.MaxValue, now);
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-100), (int)(-1000), (long)(-1), "ValueTuples", ' ', Single.MinValue, Double.MaxValue, now);
+ ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-101), (int)(-1001), (long)(-2), "ValueTuples", ' ', Single.MinValue, (Double)0.0, now.AddMilliseconds(1));
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverC, false, false);
+
+ object myObj = new object();
+ //ValueTuple-10
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', (Single)0.0001, (Double)0.0000001, now, ValueTuple.Create(false, myObj), TimeSpan.Zero);
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', (Single)0.0001, (Double)0.0000001, now, ValueTuple.Create(false, myObj), TimeSpan.Zero);
+ ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10001, (int)1000001, (long)10000001, "2008?7?3?", '1', (Single)0.0002, (Double)0.0000002, now.AddMilliseconds(1), ValueTuple.Create(true, myObj), TimeSpan.MaxValue);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverB, true, true);
+ ValueTupleDriverA.TestEquals_GetHashCode(ValueTupleDriverC, false, false);
+ }
+
+ [ActiveIssue(10207, Xunit.PlatformID.AnyUnix)]
+ [Fact]
+ public static void TestCompareTo()
+ {
+ ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan> ValueTupleDriverA, ValueTupleDriverB, ValueTupleDriverC;
+ //ValueTuple-0
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>();
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>();
+ ValueTupleDriverA.TestCompareTo(ValueTupleDriverB, 0, 0);
+
+ //ValueTuple-1
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MaxValue);
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MaxValue);
+ ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue);
+ ValueTupleDriverA.TestCompareTo(ValueTupleDriverB, 0, 5);
+ ValueTupleDriverA.TestCompareTo(ValueTupleDriverC, 65535, 5);
+ //ValueTuple-2
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue, int.MaxValue);
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue, int.MaxValue);
+ ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>(short.MinValue, int.MinValue);
+ ValueTupleDriverA.TestCompareTo(ValueTupleDriverB, 0, 5);
+ ValueTupleDriverA.TestCompareTo(ValueTupleDriverC, 1, 5);
+ //ValueTuple-3
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)0, (int)0, long.MaxValue);
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)0, (int)0, long.MaxValue);
+ ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-1), (int)(-1), long.MinValue);
+ ValueTupleDriverA.TestCompareTo(ValueTupleDriverB, 0, 5);
+ ValueTupleDriverA.TestCompareTo(ValueTupleDriverC, 1, 5);
+ //ValueTuple-4
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)1, (int)1, long.MinValue, "This");
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)1, (int)1, long.MinValue, "This");
+ ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)1, (int)1, long.MinValue, "this");
+ ValueTupleDriverA.TestCompareTo(ValueTupleDriverB, 0, 5);
+ ValueTupleDriverA.TestCompareTo(ValueTupleDriverC, 1, 5);
+ //ValueTuple-5
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-1), (int)(-1), (long)0, "is", 'A');
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-1), (int)(-1), (long)0, "is", 'A');
+ ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)0, (int)0, (long)1, "IS", 'a');
+ ValueTupleDriverA.TestCompareTo(ValueTupleDriverB, 0, 5);
+ ValueTupleDriverA.TestCompareTo(ValueTupleDriverC, -1, 5);
+ //ValueTuple-6
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10, (int)100, (long)1, "testing", 'Z', Single.MaxValue);
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10, (int)100, (long)1, "testing", 'Z', Single.MaxValue);
+ ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10, (int)100, (long)1, "testing", 'Z', Single.MinValue);
+ ValueTupleDriverA.TestCompareTo(ValueTupleDriverB, 0, 5);
+ ValueTupleDriverA.TestCompareTo(ValueTupleDriverC, 1, 5);
+ //ValueTuple-7
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-100), (int)(-1000), (long)(-1), "ValueTuples", ' ', Single.MinValue, Double.MaxValue);
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-100), (int)(-1000), (long)(-1), "ValueTuples", ' ', Single.MinValue, Double.MaxValue);
+ ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)(-101), (int)(-1001), (long)(-2), "ValueTuples", ' ', Single.MinValue, (Double)0.0);
+ ValueTupleDriverA.TestCompareTo(ValueTupleDriverB, 0, 5);
+ ValueTupleDriverA.TestCompareTo(ValueTupleDriverC, 1, 5);
+
+ object myObj = new object();
+ //ValueTuple-10
+ DateTime now = DateTime.Now;
+
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', (Single)0.0001, (Double)0.0000001, now, ValueTuple.Create(false, myObj), TimeSpan.Zero);
+ ValueTupleDriverB = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', (Single)0.0001, (Double)0.0000001, now, ValueTuple.Create(false, myObj), TimeSpan.Zero);
+ ValueTupleDriverC = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, ValueTuple<bool, object>, TimeSpan>((short)10001, (int)1000001, (long)10000001, "2008?7?3?", '1', (Single)0.0002, (Double)0.0000002, now.AddMilliseconds(1), ValueTuple.Create(true, myObj), TimeSpan.MaxValue);
+ ValueTupleDriverA.TestCompareTo(ValueTupleDriverB, 0, 5);
+ ValueTupleDriverA.TestCompareTo(ValueTupleDriverC, -1, 5);
+ }
+
+ [Fact]
+ public static void TestNotEqual()
+ {
+ ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan> ValueTupleDriverA;
+ //ValueTuple-0
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>();
+ ValueTupleDriverA.TestNotEqual();
+
+ //ValueTuple-1
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000);
+ ValueTupleDriverA.TestNotEqual();
+
+ // This is for code coverage purposes
+ //ValueTuple-2
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000);
+ ValueTupleDriverA.TestNotEqual();
+
+ //ValueTuple-3
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000);
+ ValueTupleDriverA.TestNotEqual();
+
+ //ValueTuple-4
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?");
+ ValueTupleDriverA.TestNotEqual();
+
+ //ValueTuple-5
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0');
+ ValueTupleDriverA.TestNotEqual();
+
+ //ValueTuple-6
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', Single.NaN);
+ ValueTupleDriverA.TestNotEqual();
+
+ //ValueTuple-7
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', Single.NaN, Double.NegativeInfinity);
+ ValueTupleDriverA.TestNotEqual();
+
+ //ValueTuple-8, extended ValueTuple
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', Single.NaN, Double.NegativeInfinity, DateTime.Now);
+ ValueTupleDriverA.TestNotEqual();
+
+ //ValueTuple-9 and ValueTuple-10 are not necessary because they use the same code path as ValueTuple-8
+ }
+
+ [Fact]
+ public static void IncomparableTypes()
+ {
+ ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan> ValueTupleDriverA;
+
+ //ValueTuple-0
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>();
+ ValueTupleDriverA.TestCompareToThrows();
+
+ //ValueTuple-1
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000);
+ ValueTupleDriverA.TestCompareToThrows();
+
+ // This is for code coverage purposes
+ //ValueTuple-2
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000);
+ ValueTupleDriverA.TestCompareToThrows();
+
+ //ValueTuple-3
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000);
+ ValueTupleDriverA.TestCompareToThrows();
+
+ //ValueTuple-4
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?");
+ ValueTupleDriverA.TestCompareToThrows();
+
+ //ValueTuple-5
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0');
+ ValueTupleDriverA.TestCompareToThrows();
+
+ //ValueTuple-6
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', Single.NaN);
+ ValueTupleDriverA.TestCompareToThrows();
+
+ //ValueTuple-7
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', Single.NaN, Double.NegativeInfinity);
+ ValueTupleDriverA.TestCompareToThrows();
+
+ //ValueTuple-8, extended ValueTuple
+ ValueTupleDriverA = new ValueTupleTestDriver<short, int, long, string, Char, Single, Double, DateTime, bool, TimeSpan>((short)10000, (int)1000000, (long)10000000, "2008?7?2?", '0', Single.NaN, Double.NegativeInfinity, DateTime.Now);
+ ValueTupleDriverA.TestCompareToThrows();
+
+ //ValueTuple-9 and ValueTuple-10 are not necessary because they use the same code path as ValueTuple-8
+ }
+
+ [Fact]
+ public static void FloatingPointNaNCases()
+ {
+ var a = ValueTuple.Create(Double.MinValue, Double.NaN, Single.MinValue, Single.NaN);
+ var b = ValueTuple.Create(Double.MinValue, Double.NaN, Single.MinValue, Single.NaN);
+
+ Assert.True(a.Equals(b));
+ Assert.Equal(0, ((IComparable)a).CompareTo(b));
+ Assert.Equal(a.GetHashCode(), b.GetHashCode());
+ Assert.True(((IStructuralEquatable)a).Equals(b, TestEqualityComparer.Instance));
+ Assert.Equal(5, ((IStructuralComparable)a).CompareTo(b, DummyTestComparer.Instance));
+ Assert.Equal(
+ ((IStructuralEquatable)a).GetHashCode(TestEqualityComparer.Instance),
+ ((IStructuralEquatable)b).GetHashCode(TestEqualityComparer.Instance));
+ }
+
+ [Fact]
+ public static void TestCustomTypeParameter1()
+ {
+ // Special case of ValueTuple<T1> where T1 is a custom type
+ var testClass = new TestClass();
+ var a = ValueTuple.Create(testClass);
+ var b = ValueTuple.Create(testClass);
+
+ Assert.True(a.Equals(b));
+ Assert.Equal(0, ((IComparable)a).CompareTo(b));
+ Assert.Equal(a.GetHashCode(), b.GetHashCode());
+ Assert.True(((IStructuralEquatable)a).Equals(b, TestEqualityComparer.Instance));
+ Assert.Equal(5, ((IStructuralComparable)a).CompareTo(b, DummyTestComparer.Instance));
+ Assert.Equal(
+ ((IStructuralEquatable)a).GetHashCode(TestEqualityComparer.Instance),
+ ((IStructuralEquatable)b).GetHashCode(TestEqualityComparer.Instance));
+ }
+
+ [Fact]
+ public static void TestCustomTypeParameter2()
+ {
+ // Special case of ValueTuple<T1, T2> where T2 is a custom type
+ var testClass = new TestClass(1);
+ var a = ValueTuple.Create(1, testClass);
+ var b = ValueTuple.Create(1, testClass);
+
+ Assert.True(a.Equals(b));
+ Assert.Equal(0, ((IComparable)a).CompareTo(b));
+ Assert.Equal(a.GetHashCode(), b.GetHashCode());
+ Assert.True(((IStructuralEquatable)a).Equals(b, TestEqualityComparer.Instance));
+ Assert.Equal(5, ((IStructuralComparable)a).CompareTo(b, DummyTestComparer.Instance));
+ Assert.Equal(
+ ((IStructuralEquatable)a).GetHashCode(TestEqualityComparer.Instance),
+ ((IStructuralEquatable)b).GetHashCode(TestEqualityComparer.Instance));
+ }
+
+ [Fact]
+ public static void TestCustomTypeParameter3()
+ {
+ // Special case of ValueTuple<T1, T2> where T1 and T2 are custom types
+ var testClassA = new TestClass(100);
+ var testClassB = new TestClass(101);
+ var a = ValueTuple.Create(testClassA, testClassB);
+ var b = ValueTuple.Create(testClassB, testClassA);
+
+ Assert.False(a.Equals(b));
+ Assert.Equal(-1, ((IComparable)a).CompareTo(b));
+ Assert.False(((IStructuralEquatable)a).Equals(b, TestEqualityComparer.Instance));
+ Assert.Equal(5, ((IStructuralComparable)a).CompareTo(b, DummyTestComparer.Instance));
+ // Equals(IEqualityComparer) is false, ignore hash code
+ }
+
+ [Fact]
+ public static void TestCustomTypeParameter4()
+ {
+ // Special case of ValueTuple<T1, T2> where T1 and T2 are custom types
+ var testClassA = new TestClass(100);
+ var testClassB = new TestClass(101);
+ var a = ValueTuple.Create(testClassA, testClassB);
+ var b = ValueTuple.Create(testClassA, testClassA);
+
+ Assert.False(a.Equals(b));
+ Assert.Equal(1, ((IComparable)a).CompareTo(b));
+ Assert.False(((IStructuralEquatable)a).Equals(b, TestEqualityComparer.Instance));
+ Assert.Equal(5, ((IStructuralComparable)a).CompareTo(b, DummyTestComparer.Instance));
+ // Equals(IEqualityComparer) is false, ignore hash code
+ }
+
+ [Fact]
+ public static void NestedValueTuples1()
+ {
+ var a = ValueTuple.Create(1, 2, ValueTuple.Create(31, 32), 4, 5, 6, 7, ValueTuple.Create(8, 9));
+ var b = ValueTuple.Create(1, 2, ValueTuple.Create(31, 32), 4, 5, 6, 7, ValueTuple.Create(8, 9));
+
+ Assert.True(a.Equals(b));
+ Assert.Equal(0, ((IComparable)a).CompareTo(b));
+ Assert.Equal(a.GetHashCode(), b.GetHashCode());
+ Assert.True(((IStructuralEquatable)a).Equals(b, TestEqualityComparer.Instance));
+ Assert.Equal(5, ((IStructuralComparable)a).CompareTo(b, DummyTestComparer.Instance));
+ Assert.Equal(
+ ((IStructuralEquatable)a).GetHashCode(TestEqualityComparer.Instance),
+ ((IStructuralEquatable)b).GetHashCode(TestEqualityComparer.Instance));
+ Assert.Equal("(1, 2, (31, 32), 4, 5, 6, 7, (8, 9))", a.ToString());
+ Assert.Equal("(31, 32)", a.Item3.ToString());
+ Assert.Equal("((8, 9))", a.Rest.ToString());
+ }
+
+ [Fact]
+ public static void NestedValueTuples2()
+ {
+ var a = ValueTuple.Create(0, 1, 2, 3, 4, 5, 6, ValueTuple.Create(7, 8, 9, 10, 11, 12, 13, ValueTuple.Create(14, 15)));
+ var b = ValueTuple.Create(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15, 16)));
+
+ Assert.False(a.Equals(b));
+ Assert.Equal(-1, ((IComparable)a).CompareTo(b));
+ Assert.False(((IStructuralEquatable)a).Equals(b, TestEqualityComparer.Instance));
+ Assert.Equal(5, ((IStructuralComparable)a).CompareTo(b, DummyTestComparer.Instance));
+
+ Assert.Equal("(0, 1, 2, 3, 4, 5, 6, (7, 8, 9, 10, 11, 12, 13, (14, 15)))", a.ToString());
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, (8, 9, 10, 11, 12, 13, 14, (15, 16)))", b.ToString());
+ Assert.Equal("((7, 8, 9, 10, 11, 12, 13, (14, 15)))", a.Rest.ToString());
+
+ var a2 = Tuple.Create(0, 1, 2, 3, 4, 5, 6, Tuple.Create(7, 8, 9, 10, 11, 12, 13, Tuple.Create(14, 15)));
+ var b2 = Tuple.Create(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16)));
+
+ Assert.Equal(a2.ToString(), a.ToString());
+ Assert.Equal(b2.ToString(), b.ToString());
+ Assert.Equal(a2.Rest.ToString(), a.Rest.ToString());
+ }
+
+ [Fact]
+ public static void IncomparableTypesSpecialCase()
+ {
+ // Special case when T does not implement IComparable
+ var testClassA = new TestClass2(100);
+ var testClassB = new TestClass2(100);
+ var a = ValueTuple.Create(testClassA);
+ var b = ValueTuple.Create(testClassB);
+
+ Assert.True(a.Equals(b));
+ Assert.Throws<ArgumentException>(() => ((IComparable)a).CompareTo(b));
+ Assert.Equal(a.GetHashCode(), b.GetHashCode());
+ Assert.True(((IStructuralEquatable)a).Equals(b, TestEqualityComparer.Instance));
+ Assert.Equal(5, ((IStructuralComparable)a).CompareTo(b, DummyTestComparer.Instance));
+ Assert.Equal(
+ ((IStructuralEquatable)a).GetHashCode(TestEqualityComparer.Instance),
+ ((IStructuralEquatable)b).GetHashCode(TestEqualityComparer.Instance));
+ Assert.Equal("([100])", a.ToString());
+ }
+
+ [Fact]
+ public static void ZeroTuples()
+ {
+ var a = ValueTuple.Create();
+ Assert.True(a.Equals(new ValueTuple()));
+ Assert.Equal(0, a.CompareTo(new ValueTuple()));
+
+ Assert.Equal(1, ((IStructuralComparable)a).CompareTo(null, DummyTestComparer.Instance));
+ Assert.Throws<ArgumentException>(() => ((IStructuralComparable)a).CompareTo("string", DummyTestComparer.Instance));
+
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, )", CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple()).ToString());
+ }
+
+ [Fact]
+ public static void OneTuples()
+ {
+ IComparable c = ValueTuple.Create(1);
+
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(3)));
+
+ IStructuralComparable sc = (IStructuralComparable)c;
+
+ Assert.Equal(1, sc.CompareTo(null, DummyTestComparer.Instance));
+ Assert.Throws<ArgumentException>(() => ((IStructuralComparable)sc).CompareTo("string", DummyTestComparer.Instance));
+
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(3), TestComparer.Instance));
+
+ Assert.False(((IStructuralEquatable)sc).Equals(sc, DummyTestEqualityComparer.Instance));
+
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1)", CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(1)).ToString());
+
+ var vtWithNull = new ValueTuple<string>(null);
+ var tupleWithNull = new Tuple<string>(null);
+ Assert.Equal("()", vtWithNull.ToString());
+ Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
+ }
+
+ [Fact]
+ public static void TwoTuples()
+ {
+ IComparable c = ValueTuple.Create(1, 1);
+
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(3, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 3)));
+
+ IStructuralComparable sc = (IStructuralComparable)c;
+
+ Assert.Equal(1, sc.CompareTo(null, DummyTestComparer.Instance));
+ Assert.Throws<ArgumentException>(() => ((IStructuralComparable)sc).CompareTo("string", DummyTestComparer.Instance));
+
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 3), TestComparer.Instance));
+
+ Assert.False(((IStructuralEquatable)sc).Equals(sc, DummyTestEqualityComparer.Instance));
+
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 2)", CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(1, 2)).ToString());
+
+ var vtWithNull = new ValueTuple<string, string>(null, null);
+ var tupleWithNull = new Tuple<string, string>(null, null);
+ Assert.Equal("(, )", vtWithNull.ToString());
+ Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
+ }
+
+ [Fact]
+ public static void ThreeTuples()
+ {
+ IComparable c = ValueTuple.Create(1, 1, 1);
+
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(3, 1, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 3, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 3)));
+
+ IStructuralComparable sc = (IStructuralComparable)c;
+
+ Assert.Equal(1, sc.CompareTo(null, DummyTestComparer.Instance));
+ Assert.Throws<ArgumentException>(() => ((IStructuralComparable)sc).CompareTo("string", DummyTestComparer.Instance));
+
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 3, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 3), TestComparer.Instance));
+
+ Assert.False(((IStructuralEquatable)sc).Equals(sc, DummyTestEqualityComparer.Instance));
+
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 2, 3)", CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(1, 2, 3)).ToString());
+
+ var vtWithNull = new ValueTuple<string, string, string>(null, null, null);
+ var tupleWithNull = new Tuple<string, string, string>(null, null, null);
+ Assert.Equal("(, , )", vtWithNull.ToString());
+ Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
+ }
+
+ [Fact]
+ public static void FourTuples()
+ {
+ IComparable c = ValueTuple.Create(1, 1, 1, 1);
+
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(3, 1, 1, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 3, 1, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 3, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 3)));
+
+ IStructuralComparable sc = (IStructuralComparable)c;
+
+ Assert.Equal(1, sc.CompareTo(null, DummyTestComparer.Instance));
+ Assert.Throws<ArgumentException>(() => ((IStructuralComparable)sc).CompareTo("string", DummyTestComparer.Instance));
+
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(3, 1, 1, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 3, 1, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 3, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 3), TestComparer.Instance));
+
+ Assert.False(((IStructuralEquatable)sc).Equals(sc, DummyTestEqualityComparer.Instance));
+
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4)", CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(1, 2, 3, 4)).ToString());
+
+ var vtWithNull = new ValueTuple<string, string, string, string>(null, null, null, null);
+ var tupleWithNull = new Tuple<string, string, string, string>(null, null, null, null);
+ Assert.Equal("(, , , )", vtWithNull.ToString());
+ Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
+ }
+
+ [Fact]
+ public static void FiveTuples()
+ {
+ IComparable c = ValueTuple.Create(1, 1, 1, 1, 1);
+
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(3, 1, 1, 1, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 3, 1, 1, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 3, 1, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 3, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 1, 3)));
+
+ IStructuralComparable sc = (IStructuralComparable)c;
+
+ Assert.Equal(1, sc.CompareTo(null, DummyTestComparer.Instance));
+ Assert.Throws<ArgumentException>(() => ((IStructuralComparable)sc).CompareTo("string", DummyTestComparer.Instance));
+
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(3, 1, 1, 1, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 3, 1, 1, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 3, 1, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 3, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 1, 3), TestComparer.Instance));
+
+ Assert.False(((IStructuralEquatable)sc).Equals(sc, DummyTestEqualityComparer.Instance));
+
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5)", CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(1, 2, 3, 4, 5)).ToString());
+
+ var vtWithNull = new ValueTuple<string, string, string, string, string>(null, null, null, null, null);
+ var tupleWithNull = new Tuple<string, string, string, string, string>(null, null, null, null, null);
+ Assert.Equal("(, , , , )", vtWithNull.ToString());
+ Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
+ }
+
+ [Fact]
+ public static void SixTuples()
+ {
+ IComparable c = ValueTuple.Create(1, 1, 1, 1, 1, 1);
+
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(3, 1, 1, 1, 1, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 3, 1, 1, 1, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 3, 1, 1, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 3, 1, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 1, 3, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 1, 1, 3)));
+
+ IStructuralComparable sc = (IStructuralComparable)c;
+
+ Assert.Equal(1, sc.CompareTo(null, DummyTestComparer.Instance));
+ Assert.Throws<ArgumentException>(() => ((IStructuralComparable)sc).CompareTo("string", DummyTestComparer.Instance));
+
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(3, 1, 1, 1, 1, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 3, 1, 1, 1, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 3, 1, 1, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 3, 1, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 1, 3, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 1, 1, 3), TestComparer.Instance));
+
+ Assert.False(((IStructuralEquatable)sc).Equals(sc, DummyTestEqualityComparer.Instance));
+
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6)", CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(1, 2, 3, 4, 5, 6)).ToString());
+
+ var vtWithNull = new ValueTuple<string, string, string, string, string, string>(null, null, null, null, null, null);
+ var tupleWithNull = new Tuple<string, string, string, string, string, string>(null, null, null, null, null, null);
+ Assert.Equal("(, , , , , )", vtWithNull.ToString());
+ Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
+ }
+
+ [Fact]
+ public static void SevenTuples()
+ {
+ IComparable c = ValueTuple.Create(1, 1, 1, 1, 1, 1, 1);
+
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(3, 1, 1, 1, 1, 1, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 3, 1, 1, 1, 1, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 3, 1, 1, 1, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 3, 1, 1, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 1, 3, 1, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 1, 1, 3, 1)));
+ Assert.Equal(-1, c.CompareTo(ValueTuple.Create(1, 1, 1, 1, 1, 1, 3)));
+
+ IStructuralComparable sc = (IStructuralComparable)c;
+
+ Assert.Equal(1, sc.CompareTo(null, DummyTestComparer.Instance));
+ Assert.Throws<ArgumentException>(() => ((IStructuralComparable)sc).CompareTo("string", DummyTestComparer.Instance));
+
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(3, 1, 1, 1, 1, 1, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 3, 1, 1, 1, 1, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 3, 1, 1, 1, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 3, 1, 1, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 1, 3, 1, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 1, 1, 3, 1), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(ValueTuple.Create(1, 1, 1, 1, 1, 1, 3), TestComparer.Instance));
+
+ Assert.False(((IStructuralEquatable)sc).Equals(sc, DummyTestEqualityComparer.Instance));
+
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7)", CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(1, 2, 3, 4, 5, 6, 7)).ToString());
+
+ var vtWithNull = new ValueTuple<string, string, string, string, string, string, string>(null, null, null, null, null, null, null);
+ var tupleWithNull = new Tuple<string, string, string, string, string, string, string>(null, null, null, null, null, null, null);
+ Assert.Equal("(, , , , , , )", vtWithNull.ToString());
+ Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
+ }
+
+ public static ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> CreateLong<T1, T2, T3, T4, T5, T6, T7, TRest>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest) where TRest : struct
+ {
+ return new ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>(item1, item2, item3, item4, item5, item6, item7, rest);
+ }
+
+ public static Tuple<T1, T2, T3, T4, T5, T6, T7, TRest> CreateLongRef<T1, T2, T3, T4, T5, T6, T7, TRest>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest)
+ {
+ return new Tuple<T1, T2, T3, T4, T5, T6, T7, TRest>(item1, item2, item3, item4, item5, item6, item7, rest);
+ }
+
+ [Fact]
+ public static void EightTuples()
+ {
+ var x = new Tuple<int, int, int, int, int, int, int, Tuple<string, string>>(1, 2, 3, 4, 5, 6, 7, new Tuple<string, string>("alice", "bob"));
+ var y = new ValueTuple<int, int, int, int, int, int, int, ValueTuple<string, string>>(1, 2, 3, 4, 5, 6, 7, new ValueTuple<string, string>("alice", "bob"));
+ Assert.Equal(x.ToString(), y.ToString());
+
+ var t = CreateLong(1, 1, 1, 1, 1, 1, 1, ValueTuple.Create(1));
+
+ IStructuralEquatable se = t;
+ Assert.False(se.Equals(null, TestEqualityComparer.Instance));
+ Assert.False(se.Equals("string", TestEqualityComparer.Instance));
+ Assert.False(se.Equals(new ValueTuple(), TestEqualityComparer.Instance));
+
+ IComparable c = t;
+ Assert.Equal(-1, c.CompareTo(CreateLong(3, 1, 1, 1, 1, 1, 1, ValueTuple.Create(1))));
+ Assert.Equal(-1, c.CompareTo(CreateLong(1, 3, 1, 1, 1, 1, 1, ValueTuple.Create(1))));
+ Assert.Equal(-1, c.CompareTo(CreateLong(1, 1, 3, 1, 1, 1, 1, ValueTuple.Create(1))));
+ Assert.Equal(-1, c.CompareTo(CreateLong(1, 1, 1, 3, 1, 1, 1, ValueTuple.Create(1))));
+ Assert.Equal(-1, c.CompareTo(CreateLong(1, 1, 1, 1, 3, 1, 1, ValueTuple.Create(1))));
+ Assert.Equal(-1, c.CompareTo(CreateLong(1, 1, 1, 1, 1, 3, 1, ValueTuple.Create(1))));
+ Assert.Equal(-1, c.CompareTo(CreateLong(1, 1, 1, 1, 1, 1, 3, ValueTuple.Create(1))));
+
+ IStructuralComparable sc = t;
+ Assert.Equal(1, sc.CompareTo(null, DummyTestComparer.Instance));
+ Assert.Throws<ArgumentException>(() => sc.CompareTo("string", DummyTestComparer.Instance));
+
+ Assert.Equal(1, sc.CompareTo(CreateLong(3, 1, 1, 1, 1, 1, 1, ValueTuple.Create(1)), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(CreateLong(1, 3, 1, 1, 1, 1, 1, ValueTuple.Create(1)), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(CreateLong(1, 1, 3, 1, 1, 1, 1, ValueTuple.Create(1)), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(CreateLong(1, 1, 1, 3, 1, 1, 1, ValueTuple.Create(1)), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(CreateLong(1, 1, 1, 1, 3, 1, 1, ValueTuple.Create(1)), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(CreateLong(1, 1, 1, 1, 1, 3, 1, ValueTuple.Create(1)), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(CreateLong(1, 1, 1, 1, 1, 1, 3, ValueTuple.Create(1)), TestComparer.Instance));
+ Assert.Equal(1, sc.CompareTo(CreateLong(1, 1, 1, 1, 1, 1, 1, ValueTuple.Create(3)), TestComparer.Instance));
+
+ Assert.Equal(2138941962, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create()).GetHashCode());
+ Assert.Equal(2138941954, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8)).GetHashCode());
+ Assert.Equal(-1746596640, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9)).GetHashCode());
+ Assert.Equal(121964360, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10)).GetHashCode());
+ Assert.Equal(4363008, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11)).GetHashCode());
+ Assert.Equal(9413384, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12)).GetHashCode());
+ Assert.Equal(305131744, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12, 13)).GetHashCode());
+ Assert.Equal(1479338186, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12, 13, 14)).GetHashCode());
+ Assert.Equal(1573514559, CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create())).GetHashCode());
+ Assert.Equal(1573514711, CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15))).GetHashCode());
+
+ Assert.Equal(2138941962, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create())).GetHashCode(TestEqualityComparer.Instance));
+ Assert.Equal(2138941954, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8))).GetHashCode(TestEqualityComparer.Instance));
+ Assert.Equal(-1746596640, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9))).GetHashCode(TestEqualityComparer.Instance));
+ Assert.Equal(121964360, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10))).GetHashCode(TestEqualityComparer.Instance));
+ Assert.Equal(4363008, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11))).GetHashCode(TestEqualityComparer.Instance));
+ Assert.Equal(9413384, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12))).GetHashCode(TestEqualityComparer.Instance));
+ Assert.Equal(305131744, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12, 13))).GetHashCode(TestEqualityComparer.Instance));
+ Assert.Equal(1479338186, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8, 9, 10, 11, 12, 13, 14))).GetHashCode(TestEqualityComparer.Instance));
+ Assert.Equal(1573514559, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create()))).GetHashCode(TestEqualityComparer.Instance));
+ Assert.Equal(1573514711, ((IStructuralEquatable)CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(8, 9, 10, 11, 12, 13, 14, ValueTuple.Create(15)))).GetHashCode(TestEqualityComparer.Instance));
+
+ Assert.False(se.Equals(t, DummyTestEqualityComparer.Instance));
+
+ // Notice that 0-tuple prints as empty position
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, )", CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create())).ToString());
+
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 1)", CreateLong(1, 2, 3, 4, 5, 6, 7, CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(1))).ToString());
+
+ var vtWithNull = new ValueTuple<string, string, string, string, string, string, string, ValueTuple<string>>(null, null, null, null, null, null, null, new ValueTuple<string>(null));
+ var tupleWithNull = new Tuple<string, string, string, string, string, string, string, Tuple<string>>(null, null, null, null, null, null, null, new Tuple<string>(null));
+ Assert.Equal("(, , , , , , , )", vtWithNull.ToString());
+ Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
+ }
+
+ [Fact]
+ public static void LongTuplesWithNull()
+ {
+ {
+ var vtWithNull = CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple<string>(null));
+ var tupleWithNull = CreateLongRef(1, 2, 3, 4, 5, 6, 7, new Tuple<string>(null));
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, )", vtWithNull.ToString());
+ Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
+ }
+
+ {
+ var vtWithNull = CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple<string>(null));
+ var tupleWithNull = CreateLongRef(1, 2, 3, 4, 5, 6, 7, new Tuple<string>(null));
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, )", vtWithNull.ToString());
+ Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
+ }
+
+ {
+ var vtWithNull = CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple<string, string>(null, null));
+ var tupleWithNull = CreateLongRef(1, 2, 3, 4, 5, 6, 7, new Tuple<string, string>(null, null));
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, , )", vtWithNull.ToString());
+ Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
+ }
+
+ {
+ var vtWithNull = CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple<string, string, string>(null, null, null));
+ var tupleWithNull = CreateLongRef(1, 2, 3, 4, 5, 6, 7, new Tuple<string, string, string>(null, null, null));
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, , , )", vtWithNull.ToString());
+ Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
+ }
+
+ {
+ var vtWithNull = CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple<string, string, string, string>(null, null, null, null));
+ var tupleWithNull = CreateLongRef(1, 2, 3, 4, 5, 6, 7, new Tuple<string, string, string, string>(null, null, null, null));
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, , , , )", vtWithNull.ToString());
+ Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
+ }
+
+ {
+ var vtWithNull = CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple<string, string, string, string, string>(null, null, null, null, null));
+ var tupleWithNull = CreateLongRef(1, 2, 3, 4, 5, 6, 7, new Tuple<string, string, string, string, string>(null, null, null, null, null));
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, , , , , )", vtWithNull.ToString());
+ Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
+ }
+
+ {
+ var vtWithNull = CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple<string, string, string, string, string, string>(null, null, null, null, null, null));
+ var tupleWithNull = CreateLongRef(1, 2, 3, 4, 5, 6, 7, new Tuple<string, string, string, string, string, string>(null, null, null, null, null, null));
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, , , , , , )", vtWithNull.ToString());
+ Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
+ }
+
+ {
+ var vtWithNull = CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple<string, string, string, string, string, string, string>(null, null, null, null, null, null, null));
+ var tupleWithNull = CreateLongRef(1, 2, 3, 4, 5, 6, 7, new Tuple<string, string, string, string, string, string, string>(null, null, null, null, null, null, null));
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, , , , , , , )", vtWithNull.ToString());
+ Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
+ }
+ }
+
+ [Fact]
+ public static void EightTuplesWithBadRest()
+ {
+ // Change as necessary if in the future
+ // the hash algorithm is modified again.
+ const int ExpectedHash = 1291467969;
+
+ var d = default(ValueTuple<int, int, int, int, int, int, int, int>);
+ d.Item1 = 1;
+ d.Rest = 42;
+ Assert.Equal(ExpectedHash, d.GetHashCode());
+ Assert.Equal(ExpectedHash, ((IStructuralEquatable)d).GetHashCode());
+ Assert.Equal("(1, 0, 0, 0, 0, 0, 0, 42)", d.ToString());
+
+ Assert.Equal(ExpectedHash, CreateLong(1, 2, 3, 4, 5, 6, 7, d).GetHashCode());
+
+ // GetHashCode only tries to hash the first 7 elements when rest is not ITupleInternal
+ Assert.Equal(ValueTuple.Create(1, 0, 0, 0, 0, 0, 0).GetHashCode(), d.GetHashCode());
+ Assert.Equal(((IStructuralEquatable)ValueTuple.Create(1, 0, 0, 0, 0, 0, 0)).GetHashCode(TestEqualityComparer.Instance), ((IStructuralEquatable)d).GetHashCode(TestEqualityComparer.Instance));
+
+ Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 0, 0, 0, 0, 0, 0, 42)", CreateLong(1, 2, 3, 4, 5, 6, 7, d).ToString());
+ }
+
+ private class TestClass : IComparable
+ {
+ private readonly int _value;
+
+ internal TestClass()
+ : this(0)
+ { }
+
+ internal TestClass(int value)
+ {
+ this._value = value;
+ }
+
+ public override string ToString()
+ {
+ return "{" + _value.ToString() + "}";
+ }
+
+ public int CompareTo(object x)
+ {
+ TestClass tmp = x as TestClass;
+ if (tmp != null)
+ return this._value.CompareTo(tmp._value);
+ else
+ return 1;
+ }
+ }
+
+ private class TestClass2
+ {
+ private readonly int _value;
+
+ internal TestClass2()
+ : this(0)
+ { }
+
+ internal TestClass2(int value)
+ {
+ this._value = value;
+ }
+
+ public override string ToString()
+ {
+ return "[" + _value.ToString() + "]";
+ }
+
+ public override bool Equals(object x)
+ {
+ TestClass2 tmp = x as TestClass2;
+ if (tmp != null)
+ return _value.Equals(tmp._value);
+ else
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return _value.GetHashCode();
+ }
+ }
+
+ private class DummyTestComparer : IComparer
+ {
+ public static readonly DummyTestComparer Instance = new DummyTestComparer();
+
+ public int Compare(object x, object y)
+ {
+ return 5;
+ }
+ }
+
+ private class TestComparer : IComparer
+ {
+ public static readonly TestComparer Instance = new TestComparer();
+
+ public int Compare(object x, object y)
+ {
+ return x.Equals(y) ? 0 : 1;
+ }
+ }
+
+ private class DummyTestEqualityComparer : IEqualityComparer
+ {
+ public static readonly DummyTestEqualityComparer Instance = new DummyTestEqualityComparer();
+
+ public new bool Equals(object x, object y)
+ {
+ return false;
+ }
+
+ public int GetHashCode(object x)
+ {
+ return x.GetHashCode();
+ }
+ }
+
+ private class TestEqualityComparer : IEqualityComparer
+ {
+ public static readonly TestEqualityComparer Instance = new TestEqualityComparer();
+
+ public new bool Equals(object x, object y)
+ {
+ return x.Equals(y);
+ }
+
+ public int GetHashCode(object x)
+ {
+ return x.GetHashCode();
+ }
+ }
+ }
+}
diff --git a/src/System.Xml.ReaderWriter/dir.props b/src/System.Xml.ReaderWriter/dir.props
new file mode 100644
index 0000000000..0769c12aaa
--- /dev/null
+++ b/src/System.Xml.ReaderWriter/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.1.0.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Xml.ReaderWriter/pkg/ValidationSuppression.txt b/src/System.Xml.ReaderWriter/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Xml.ReaderWriter/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Xml.ReaderWriter/ref/4.0.0/System.Xml.ReaderWriter.depproj b/src/System.Xml.ReaderWriter/ref/4.0.0/System.Xml.ReaderWriter.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Xml.ReaderWriter/ref/4.0.0/System.Xml.ReaderWriter.depproj
+++ b/src/System.Xml.ReaderWriter/ref/4.0.0/System.Xml.ReaderWriter.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Xml.ReaderWriter/ref/System.Xml.ReaderWriter.csproj b/src/System.Xml.ReaderWriter/ref/System.Xml.ReaderWriter.csproj
index ad31c9b652..35131d7a4f 100644
--- a/src/System.Xml.ReaderWriter/ref/System.Xml.ReaderWriter.csproj
+++ b/src/System.Xml.ReaderWriter/ref/System.Xml.ReaderWriter.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.1.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Xml.ReaderWriter/src/System.Xml.ReaderWriter.csproj b/src/System.Xml.ReaderWriter/src/System.Xml.ReaderWriter.csproj
index 134749a7ae..6e097ca39c 100644
--- a/src/System.Xml.ReaderWriter/src/System.Xml.ReaderWriter.csproj
+++ b/src/System.Xml.ReaderWriter/src/System.Xml.ReaderWriter.csproj
@@ -1,14 +1,12 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<ProjectGuid>{C559743A-762E-4D9D-B986-E77BDB97652E}</ProjectGuid>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
- <AssemblyVersion>4.1.0.0</AssemblyVersion>
<RootNamespace>System.Xml</RootNamespace>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory>None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Xml.XDocument/dir.props b/src/System.Xml.XDocument/dir.props
new file mode 100644
index 0000000000..d16ef39bdb
--- /dev/null
+++ b/src/System.Xml.XDocument/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.12.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Xml.XDocument/pkg/System.Xml.XDocument.pkgproj b/src/System.Xml.XDocument/pkg/System.Xml.XDocument.pkgproj
index 6ab882f42b..5d35ad1253 100644
--- a/src/System.Xml.XDocument/pkg/System.Xml.XDocument.pkgproj
+++ b/src/System.Xml.XDocument/pkg/System.Xml.XDocument.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.12.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\4.0.0\System.Xml.XDocument.depproj">
diff --git a/src/System.Xml.XDocument/pkg/ValidationSuppression.txt b/src/System.Xml.XDocument/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Xml.XDocument/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Xml.XDocument/ref/4.0.0/System.Xml.XDocument.depproj b/src/System.Xml.XDocument/ref/4.0.0/System.Xml.XDocument.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Xml.XDocument/ref/4.0.0/System.Xml.XDocument.depproj
+++ b/src/System.Xml.XDocument/ref/4.0.0/System.Xml.XDocument.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Xml.XDocument/ref/System.Xml.XDocument.csproj b/src/System.Xml.XDocument/ref/System.Xml.XDocument.csproj
index 939623b0a9..e5ad24ca89 100644
--- a/src/System.Xml.XDocument/ref/System.Xml.XDocument.csproj
+++ b/src/System.Xml.XDocument/ref/System.Xml.XDocument.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Xml.XDocument/src/System.Xml.XDocument.csproj b/src/System.Xml.XDocument/src/System.Xml.XDocument.csproj
index dbea5ca28a..7ece42bafd 100644
--- a/src/System.Xml.XDocument/src/System.Xml.XDocument.csproj
+++ b/src/System.Xml.XDocument/src/System.Xml.XDocument.csproj
@@ -4,11 +4,9 @@
<PropertyGroup>
<ProjectGuid>{442C5A88-29C2-4B00-B1DF-730D646D3861}</ProjectGuid>
<AssemblyName>System.Xml.XDocument</AssemblyName>
- <AssemblyVersion>4.0.12.0</AssemblyVersion>
<RootNamespace>System.Xml</RootNamespace>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory>None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Xml.XPath.XDocument/dir.props b/src/System.Xml.XPath.XDocument/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Xml.XPath.XDocument/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Xml.XPath.XDocument/ref/System.Xml.XPath.XDocument.csproj b/src/System.Xml.XPath.XDocument/ref/System.Xml.XPath.XDocument.csproj
index ac7af7745f..2be556b24b 100644
--- a/src/System.Xml.XPath.XDocument/ref/System.Xml.XPath.XDocument.csproj
+++ b/src/System.Xml.XPath.XDocument/ref/System.Xml.XPath.XDocument.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Xml.XPath.XDocument/src/System.Xml.XPath.XDocument.csproj b/src/System.Xml.XPath.XDocument/src/System.Xml.XPath.XDocument.csproj
index 7a0c080042..270b5841c1 100644
--- a/src/System.Xml.XPath.XDocument/src/System.Xml.XPath.XDocument.csproj
+++ b/src/System.Xml.XPath.XDocument/src/System.Xml.XPath.XDocument.csproj
@@ -4,9 +4,7 @@
<PropertyGroup>
<ProjectGuid>{DAA1EA56-C318-4D2E-AB8D-1AB87D9F98F5}</ProjectGuid>
<AssemblyName>System.Xml.XPath.XDocument</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)'==''">netstandard1.3</PackageTargetFramework>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
diff --git a/src/System.Xml.XPath.XmlDocument/dir.props b/src/System.Xml.XPath.XmlDocument/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Xml.XPath.XmlDocument/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Xml.XPath.XmlDocument/ref/System.Xml.XPath.XmlDocument.csproj b/src/System.Xml.XPath.XmlDocument/ref/System.Xml.XPath.XmlDocument.csproj
index 1b1b5027ae..aab32358a3 100644
--- a/src/System.Xml.XPath.XmlDocument/ref/System.Xml.XPath.XmlDocument.csproj
+++ b/src/System.Xml.XPath.XmlDocument/ref/System.Xml.XPath.XmlDocument.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Xml.XPath.XmlDocument/src/System.Xml.XPath.XmlDocument.csproj b/src/System.Xml.XPath.XmlDocument/src/System.Xml.XPath.XmlDocument.csproj
index 0133455eb1..71fc74be78 100644
--- a/src/System.Xml.XPath.XmlDocument/src/System.Xml.XPath.XmlDocument.csproj
+++ b/src/System.Xml.XPath.XmlDocument/src/System.Xml.XPath.XmlDocument.csproj
@@ -4,9 +4,7 @@
<PropertyGroup>
<ProjectGuid>{17CB2E3C-2904-4241-94DB-3894D24F35DA}</ProjectGuid>
<AssemblyName>System.Xml.XPath.XmlDocument</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Xml.XPath/dir.props b/src/System.Xml.XPath/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Xml.XPath/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Xml.XPath/ref/System.Xml.XPath.csproj b/src/System.Xml.XPath/ref/System.Xml.XPath.csproj
index a4d1b2111c..3b32757f2c 100644
--- a/src/System.Xml.XPath/ref/System.Xml.XPath.csproj
+++ b/src/System.Xml.XPath/ref/System.Xml.XPath.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Xml.XPath/src/System.Xml.XPath.csproj b/src/System.Xml.XPath/src/System.Xml.XPath.csproj
index cbffacc774..22fa5379d3 100644
--- a/src/System.Xml.XPath/src/System.Xml.XPath.csproj
+++ b/src/System.Xml.XPath/src/System.Xml.XPath.csproj
@@ -4,10 +4,8 @@
<PropertyGroup>
<ProjectGuid>{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}</ProjectGuid>
<AssemblyName>System.Xml.XPath</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory>None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Xml.XmlDocument/dir.props b/src/System.Xml.XmlDocument/dir.props
new file mode 100644
index 0000000000..3a45f88c15
--- /dev/null
+++ b/src/System.Xml.XmlDocument/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.2.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Xml.XmlDocument/ref/System.Xml.XmlDocument.csproj b/src/System.Xml.XmlDocument/ref/System.Xml.XmlDocument.csproj
index 65c05ad77e..8de16d66d0 100644
--- a/src/System.Xml.XmlDocument/ref/System.Xml.XmlDocument.csproj
+++ b/src/System.Xml.XmlDocument/ref/System.Xml.XmlDocument.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Xml.XmlDocument/src/System.Xml.XmlDocument.csproj b/src/System.Xml.XmlDocument/src/System.Xml.XmlDocument.csproj
index 061ff38c4f..36fff3a83f 100644
--- a/src/System.Xml.XmlDocument/src/System.Xml.XmlDocument.csproj
+++ b/src/System.Xml.XmlDocument/src/System.Xml.XmlDocument.csproj
@@ -4,12 +4,10 @@
<PropertyGroup>
<ProjectGuid>{16EE5522-F387-4C9E-9EF2-B5134B043F37}</ProjectGuid>
<AssemblyName>System.Xml.XmlDocument</AssemblyName>
- <AssemblyVersion>4.0.2.0</AssemblyVersion>
<RootNamespace>System.Xml.XmlDocument</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory>None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
diff --git a/src/System.Xml.XmlSerializer/dir.props b/src/System.Xml.XmlSerializer/dir.props
new file mode 100644
index 0000000000..d16ef39bdb
--- /dev/null
+++ b/src/System.Xml.XmlSerializer/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.12.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Xml.XmlSerializer/pkg/System.Xml.XmlSerializer.pkgproj b/src/System.Xml.XmlSerializer/pkg/System.Xml.XmlSerializer.pkgproj
index b34599c4cc..a8abaca5e0 100644
--- a/src/System.Xml.XmlSerializer/pkg/System.Xml.XmlSerializer.pkgproj
+++ b/src/System.Xml.XmlSerializer/pkg/System.Xml.XmlSerializer.pkgproj
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Version>4.0.12.0</Version>
- </PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\4.0.0\System.Xml.XmlSerializer.depproj">
diff --git a/src/System.Xml.XmlSerializer/pkg/ValidationSuppression.txt b/src/System.Xml.XmlSerializer/pkg/ValidationSuppression.txt
deleted file mode 100644
index 8cb05cc624..0000000000
--- a/src/System.Xml.XmlSerializer/pkg/ValidationSuppression.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Suppress exact match reference https://github.com/dotnet/corefx/issues/7114
-PermitHigherCompatibleImplementationVersion \ No newline at end of file
diff --git a/src/System.Xml.XmlSerializer/ref/4.0.0/System.Xml.XmlSerializer.depproj b/src/System.Xml.XmlSerializer/ref/4.0.0/System.Xml.XmlSerializer.depproj
index f1c59486ed..67482df301 100644
--- a/src/System.Xml.XmlSerializer/ref/4.0.0/System.Xml.XmlSerializer.depproj
+++ b/src/System.Xml.XmlSerializer/ref/4.0.0/System.Xml.XmlSerializer.depproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.0</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Xml.XmlSerializer/ref/System.Xml.XmlSerializer.csproj b/src/System.Xml.XmlSerializer/ref/System.Xml.XmlSerializer.csproj
index 78b5bf655b..b1fe954121 100644
--- a/src/System.Xml.XmlSerializer/ref/System.Xml.XmlSerializer.csproj
+++ b/src/System.Xml.XmlSerializer/ref/System.Xml.XmlSerializer.csproj
@@ -4,7 +4,6 @@
<PropertyGroup>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
diff --git a/src/System.Xml.XmlSerializer/src/System.Xml.XmlSerializer.csproj b/src/System.Xml.XmlSerializer/src/System.Xml.XmlSerializer.csproj
index bc598204e1..2eb4c9e959 100644
--- a/src/System.Xml.XmlSerializer/src/System.Xml.XmlSerializer.csproj
+++ b/src/System.Xml.XmlSerializer/src/System.Xml.XmlSerializer.csproj
@@ -4,11 +4,9 @@
<PropertyGroup>
<AssemblyName>System.Xml.XmlSerializer</AssemblyName>
<RootNamespace>System.Xml.XmlSerializer</RootNamespace>
- <AssemblyVersion>4.0.12.0</AssemblyVersion>
<ProjectGuid>{D62A6082-5229-4845-8BE9-75753E08C65A}</ProjectGuid>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory>None</ResourcesSourceOutputDirectory>
- <PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<!-- netcore50 project.json fork is shared for both netcore50 and netcore50aot. This redirects netcore50aot. -->
diff --git a/src/System.Xml.Xsl.Primitives/dir.props b/src/System.Xml.Xsl.Primitives/dir.props
new file mode 100644
index 0000000000..e58893f6ab
--- /dev/null
+++ b/src/System.Xml.Xsl.Primitives/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\dir.props" />
+ <PropertyGroup>
+ <AssemblyVersion>4.0.0.0</AssemblyVersion>
+ </PropertyGroup>
+</Project>
+
diff --git a/src/System.Xml.Xsl.Primitives/ref/System.Xml.Xsl.Primitives.csproj b/src/System.Xml.Xsl.Primitives/ref/System.Xml.Xsl.Primitives.csproj
index 737c102293..64888db444 100644
--- a/src/System.Xml.Xsl.Primitives/ref/System.Xml.Xsl.Primitives.csproj
+++ b/src/System.Xml.Xsl.Primitives/ref/System.Xml.Xsl.Primitives.csproj
@@ -2,9 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
- <PackageTargetFramework>netstandard1.3</PackageTargetFramework>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>