Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Microsoft.TestPlatform.Build/Tasks/VSTestTask2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private bool TryGetMessage(string singleLine, out string name, out string?[] dat
{
var parts = singleLine.Split(_messageSplitterArray, StringSplitOptions.None);
name = parts[1];
data = parts.Skip(2).Take(parts.Length).Select(p => p == null ? null : p.Replace("~~~~", "\r").Replace("!!!!", "\n")).ToArray();
data = parts.Skip(2).Take(parts.Length).Select(p => p?.Replace("~~~~", "\r").Replace("!!!!", "\n")).ToArray();
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public int ExecuteAsync()
_executionStartTime = DateTime.UtcNow;

// Collecting Number of sources Sent For Execution
var numberOfSources = (uint)(TestRunCriteria.Sources != null ? TestRunCriteria.Sources.Count() : 0);
var numberOfSources = (uint)(TestRunCriteria.Sources?.Count() ?? 0);
_requestData.MetricsCollection.Add(TelemetryDataConstants.NumberOfSourcesSentForRun, numberOfSources);

EqtTrace.Info("TestRunRequest.ExecuteAsync: Starting run with settings:{0}", TestRunCriteria);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ internal class TestSourcesUtility
internal static string? GetDefaultCodebasePath(Dictionary<string, IEnumerable<string>?> adapterSourceMap)
{
var source = GetSources(adapterSourceMap)?.FirstOrDefault();
return source != null ? Path.GetDirectoryName(source) : null;
return Path.GetDirectoryName(source);
}

/// <summary>
Expand All @@ -56,6 +56,6 @@ internal class TestSourcesUtility
internal static string? GetDefaultCodebasePath(IEnumerable<TestCase> tests)
{
var source = GetSources(tests)?.FirstOrDefault();
return source != null ? Path.GetDirectoryName(source) : null;
return Path.GetDirectoryName(source);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public override bool Equals(object? obj)

return other != null
&& SessionId.Equals(other.SessionId)
&& (TestExecId == null ? other.TestExecId == null : TestExecId.Equals(other.TestExecId));
&& (TestExecId?.Equals(other.TestExecId) ?? other.TestExecId == null);
}

public override int GetHashCode()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1428,9 +1428,7 @@ private void HandleCustomHostLaunch(ITestHostLauncher? customHostLauncher, Messa
{
var testProcessStartInfo = _dataSerializer.DeserializePayload<TestProcessStartInfo>(message);

ackPayload.HostProcessId = customHostLauncher != null
? customHostLauncher.LaunchTestHost(testProcessStartInfo!)
: -1;
ackPayload.HostProcessId = customHostLauncher?.LaunchTestHost(testProcessStartInfo!) ?? -1;
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public override string ToString()
$"Runner = {RunnerFramework}",
$"TargetFramework = {TargetFramework}",
string.IsNullOrEmpty(InIsolationValue) ? "InProcess" : "InIsolation",
VSTestConsoleInfo == null ? null : VSTestConsoleInfo.ToString(),
VSTestConsoleInfo?.ToString(),
TestHostInfo == null ? null : string.Join(",", TestHostInfo),
AdapterInfo == null ? null : string.Join(",", AdapterInfo)
}.Where(s => s != null));
Expand Down