diff --git a/src/Core/tests/DeviceTests/Handlers/Button/ButtonHandlerTests.iOS.cs b/src/Core/tests/DeviceTests/Handlers/Button/ButtonHandlerTests.iOS.cs index 50892eb39f4c..8b716ac9b638 100644 --- a/src/Core/tests/DeviceTests/Handlers/Button/ButtonHandlerTests.iOS.cs +++ b/src/Core/tests/DeviceTests/Handlers/Button/ButtonHandlerTests.iOS.cs @@ -43,14 +43,17 @@ public async Task PaddingInitializesCorrectly() Padding = new Thickness(5, 10, 15, 20) }; - var handler = await CreateHandlerAsync(button); - var uiButton = (UIButton)handler.View; - var insets = uiButton.ContentEdgeInsets; + await InvokeOnMainThreadAsync(async () => + { + var handler = await CreateHandlerAsync(button); + var uiButton = (UIButton)handler.View; + var insets = uiButton.ContentEdgeInsets; - Assert.Equal(5, insets.Left); - Assert.Equal(10, insets.Top); - Assert.Equal(15, insets.Right); - Assert.Equal(20, insets.Bottom); + Assert.Equal(5, insets.Left); + Assert.Equal(10, insets.Top); + Assert.Equal(15, insets.Right); + Assert.Equal(20, insets.Bottom); + }); } UIButton GetNativeButton(ButtonHandler buttonHandler) =>