From: Viktor Hofer Date: Mon, 4 Feb 2019 23:52:11 +0000 (+0100) Subject: Fix uapaot binaryformatter tests (dotnet/corefx#35079) X-Git-Tag: submit/tizen/20210909.063632~11031^2~2536 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e9bae8f28c6decdd854f424347762d2815b09348;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fix uapaot binaryformatter tests (dotnet/corefx#35079) Commit migrated from https://github.com/dotnet/corefx/commit/61a8b5b02aa88772d2a73d643cfeb20bf3715458 --- diff --git a/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.rd.xml b/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.rd.xml index 52f9ed3..61eb52e 100644 --- a/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.rd.xml +++ b/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.rd.xml @@ -3,6 +3,7 @@ + diff --git a/src/libraries/System.Runtime.Serialization.Formatters/tests/PlatformExtensions.cs b/src/libraries/System.Runtime.Serialization.Formatters/tests/PlatformExtensions.cs index c087c21..19a11f1 100644 --- a/src/libraries/System.Runtime.Serialization.Formatters/tests/PlatformExtensions.cs +++ b/src/libraries/System.Runtime.Serialization.Formatters/tests/PlatformExtensions.cs @@ -42,6 +42,7 @@ namespace System.Runtime.Serialization.Formatters.Tests } List blobList = blobs.ToList(); + int index; // .NET Framework if (PlatformDetection.IsFullFramework) @@ -49,7 +50,7 @@ namespace System.Runtime.Serialization.Formatters.Tests // Check if a specialized blob for >=netfx472 is present and return if found. if (IsNetfx472PatchedOrNewer()) { - int index = blobList.FindIndex(b => b.Platform == TargetFrameworkMoniker.netfx472); + index = blobList.FindIndex(b => b.Platform == TargetFrameworkMoniker.netfx472); if (index >= 0) return index; @@ -58,7 +59,7 @@ namespace System.Runtime.Serialization.Formatters.Tests // Check if a specialized blob for >=netfx471 is present and return if found. if (PlatformDetection.IsNetfx471OrNewer) { - int index = blobList.FindIndex(b => b.Platform == TargetFrameworkMoniker.netfx471); + index = blobList.FindIndex(b => b.Platform == TargetFrameworkMoniker.netfx471); if (index >= 0) return index; @@ -69,25 +70,19 @@ namespace System.Runtime.Serialization.Formatters.Tests return blobList.FindIndex(b => b.Platform == TargetFrameworkMoniker.netfx461); } - // .NET Core - if (PlatformDetection.IsNetCore) - { - // Check if a specialized blob for >=netcoreapp3.0 is present and return if found. - int index = blobList.FindIndex(b => b.Platform == TargetFrameworkMoniker.netcoreapp30); - if (index >= 0) - return index; - - // Check if a specialized blob for netcoreapp2.1 is present and return if found. - index = blobList.FindIndex(b => b.Platform == TargetFrameworkMoniker.netcoreapp21); - if (index >= 0) - return index; - - // If no newer blob for >=netcoreapp2.1 is present use existing one. - // If no netcoreapp blob is present then -1 will be returned. - return blobList.FindIndex((b => b.Platform == TargetFrameworkMoniker.netcoreapp20)); - } + // Check if a specialized blob for >=netcoreapp3.0 is present and return if found. + index = blobList.FindIndex(b => b.Platform == TargetFrameworkMoniker.netcoreapp30); + if (index >= 0) + return index; + + // Check if a specialized blob for netcoreapp2.1 is present and return if found. + index = blobList.FindIndex(b => b.Platform == TargetFrameworkMoniker.netcoreapp21); + if (index >= 0) + return index; - return -1; + // If no newer blob for >=netcoreapp2.1 is present use existing one. + // If no netcoreapp blob is present then -1 will be returned. + return blobList.FindIndex((b => b.Platform == TargetFrameworkMoniker.netcoreapp20)); } } }