diff --git a/tests/xharness/Jenkins/TestTasks/AggregatedRunSimulatorTask.cs b/tests/xharness/Jenkins/TestTasks/AggregatedRunSimulatorTask.cs index 6c805cd958ab..1b42f64d6f04 100644 --- a/tests/xharness/Jenkins/TestTasks/AggregatedRunSimulatorTask.cs +++ b/tests/xharness/Jenkins/TestTasks/AggregatedRunSimulatorTask.cs @@ -63,7 +63,11 @@ protected override async Task ExecuteAsync () await task.SelectSimulatorAsync (); } - var devices = executingTasks.First ().Simulators; + var devices = executingTasks.FirstOrDefault ()?.Simulators; + if (devices == null) { + ExecutionResult = TestExecutingResult.DeviceNotFound; + return; + } Jenkins.MainLog.WriteLine ("Selected simulator: {0}", devices.Length > 0 ? devices [0].Name : "none"); foreach (var dev in devices)