diff --git a/scripts/Build.ps1 b/scripts/Build.ps1 index 232642828b..80a1b4f3b1 100644 --- a/scripts/Build.ps1 +++ b/scripts/Build.ps1 @@ -120,6 +120,25 @@ function Print-Help { Exit 0 } +function Install-WindowsSDK { + Push-Location + $temp = [System.IO.Path]::GetTempFileName(); + Remove-Item $temp + New-Item $temp -Type Directory | Out-Null + Set-Location $temp + + try { + Invoke-WebRequest -Method Get -Uri https://go.microsoft.com/fwlink/p/?LinkId=838916 -OutFile sdksetup.exe -UseBasicParsing + Start-Process -Wait sdksetup.exe -ArgumentList "/q", "/norestart", "/ceip off", "/features OptionId.WindowsSoftwareDevelopmentKit" -Wait -PassThru + } + finally { + Pop-Location + + Remove-Item $temp -Force -Recurse | Out-Null + } + +} + # # Restores packages for the solutions. # @@ -285,6 +304,10 @@ if (ShouldRunStep @("UpdateTPVersion")) { Sync-PackageVersions } +if (ShouldRunStep @("Install-WindowsSDK")) { + Install-WindowsSDK +} + if (ShouldRunStep @("UpdateTPVersion", "Restore")) { Perform-Restore } diff --git a/src/Adapter/MSTest.CoreAdapter/Helpers/DataSerializationHelper.cs b/src/Adapter/MSTest.CoreAdapter/Helpers/DataSerializationHelper.cs index eeb01f8ab7..cd6937e806 100644 --- a/src/Adapter/MSTest.CoreAdapter/Helpers/DataSerializationHelper.cs +++ b/src/Adapter/MSTest.CoreAdapter/Helpers/DataSerializationHelper.cs @@ -85,18 +85,18 @@ public static object[] Deserialize(string[] serializedData, params Assembly[] as for (int i = 0; i < length; i++) { var typeIndex = i * 2; - var dataIndex = typeIndex + 1; + var typeName = serializedData[typeIndex]; + var serializedValue = serializedData[typeIndex + 1]; - if (serializedData[i] == null) + if (serializedValue == null || typeName == null) { data[i] = null; continue; } - var typeName = serializedData[typeIndex]; var serializer = GetSerializer(typeName, assemblies); - var serialzedDataBytes = Encoding.UTF8.GetBytes(serializedData[dataIndex]); + var serialzedDataBytes = Encoding.UTF8.GetBytes(serializedValue); using (var memoryStream = new MemoryStream(serialzedDataBytes)) { data[i] = serializer.ReadObject(memoryStream);