Skip to content

Commit 640372c

Browse files
authored
Fixed DataSource deserialization. (#859)
1 parent f6731ef commit 640372c

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

scripts/Build.ps1

+23
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,25 @@ function Print-Help {
120120
Exit 0
121121
}
122122

123+
function Install-WindowsSDK {
124+
Push-Location
125+
$temp = [System.IO.Path]::GetTempFileName();
126+
Remove-Item $temp
127+
New-Item $temp -Type Directory | Out-Null
128+
Set-Location $temp
129+
130+
try {
131+
Invoke-WebRequest -Method Get -Uri https://go.microsoft.com/fwlink/p/?LinkId=838916 -OutFile sdksetup.exe -UseBasicParsing
132+
Start-Process -Wait sdksetup.exe -ArgumentList "/q", "/norestart", "/ceip off", "/features OptionId.WindowsSoftwareDevelopmentKit" -Wait -PassThru
133+
}
134+
finally {
135+
Pop-Location
136+
137+
Remove-Item $temp -Force -Recurse | Out-Null
138+
}
139+
140+
}
141+
123142
#
124143
# Restores packages for the solutions.
125144
#
@@ -285,6 +304,10 @@ if (ShouldRunStep @("UpdateTPVersion")) {
285304
Sync-PackageVersions
286305
}
287306

307+
if (ShouldRunStep @("Install-WindowsSDK")) {
308+
Install-WindowsSDK
309+
}
310+
288311
if (ShouldRunStep @("UpdateTPVersion", "Restore")) {
289312
Perform-Restore
290313
}

src/Adapter/MSTest.CoreAdapter/Helpers/DataSerializationHelper.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,18 @@ public static object[] Deserialize(string[] serializedData, params Assembly[] as
8585
for (int i = 0; i < length; i++)
8686
{
8787
var typeIndex = i * 2;
88-
var dataIndex = typeIndex + 1;
88+
var typeName = serializedData[typeIndex];
89+
var serializedValue = serializedData[typeIndex + 1];
8990

90-
if (serializedData[i] == null)
91+
if (serializedValue == null || typeName == null)
9192
{
9293
data[i] = null;
9394
continue;
9495
}
9596

96-
var typeName = serializedData[typeIndex];
9797
var serializer = GetSerializer(typeName, assemblies);
9898

99-
var serialzedDataBytes = Encoding.UTF8.GetBytes(serializedData[dataIndex]);
99+
var serialzedDataBytes = Encoding.UTF8.GetBytes(serializedValue);
100100
using (var memoryStream = new MemoryStream(serialzedDataBytes))
101101
{
102102
data[i] = serializer.ReadObject(memoryStream);

0 commit comments

Comments
 (0)