From a201fbe955d90511dc17e7a2ec8d44362a326679 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 12 Jun 2018 09:23:11 -0700 Subject: [PATCH] [xharness] Check the right (unpaired) device when determining whether a new watch device must be created or not. (#4222) This fixes a NullReferenceException when there are already paired watch devices: [0x700009ad7000:] EXCEPTION handling: System.NullReferenceException: Object reference not set to an instance of an object "" tid=0x0x700009ad7000 this=0x0x10b903ad8 , thread handle : 0x7f9ad49109a0, state : not waiting at xharness.Simulators/d__18.MoveNext () [0x001ae] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/xharness/Simulators.cs:169 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Startd__18> (xharness.Simulators/d__18&) [0x0002c] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:471 at xharness.Simulators.CreateDevicePair (xharness.Log,xharness.SimDevice,xharness.SimDevice,string,string,bool) [0x00057] in <7c5e77efeb3146c095a26043fb517189>:0 at xharness.Simulators/d__19.MoveNext () [0x000fc] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/xharness/Simulators.cs:206 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start (TStateMachine_REF&) [0x0002c] in <0f9df4881040473f9da7cf6c2e2cb8c3>:0 at xharness.Simulators.FindOrCreateDevicePairAsync (xharness.Log,System.Collections.Generic.IEnumerable`1,System.Collections.Generic.IEnumerable`1) [0x0003f] in <7c5e77efeb3146c095a26043fb517189>:0 at xharness.Simulators/d__20.MoveNext () [0x00364] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/xharness/Simulators.cs:275 --- tests/xharness/Simulators.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/xharness/Simulators.cs b/tests/xharness/Simulators.cs index d30871c85a..9c877e5111 100644 --- a/tests/xharness/Simulators.cs +++ b/tests/xharness/Simulators.cs @@ -203,7 +203,7 @@ namespace xharness var unpairedDevice = unPairedDevices.FirstOrDefault (); var companion_device = companion_devices.First (); var device = devices.First (); - if (!await CreateDevicePair (log, unpairedDevice, companion_device, device.SimRuntime, device.SimDeviceType, device == null)) + if (!await CreateDevicePair (log, unpairedDevice, companion_device, device.SimRuntime, device.SimDeviceType, unpairedDevice == null)) return null; await LoadAsync (log, force: true);