Xamarin Forms: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation

In general, I've noticed that any syntax errors in XAML may show up as this exception.


You have mistake in your Carousel page

<?xml version="1.0" encoding="utf-8" ?>
<CarouselPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="ForTesting.TestPage">
  <Label Text="{Binding MainText}" VerticalOptions="Center" HorizontalOptions="Center" />
  <ContentPage>
    <ContentPage.Padding>
      <OnPlatform x:TypeArguments="Thickness" iOS="0,40,0,0" Android="0,40,0,0" />
    </ContentPage.Padding>
  </ContentPage>
</CarouselPage>

Carousel page should have only one child, and it should be a ContentPage, you won't be able to add both label and content page. Remove this line

 <Label Text="{Binding MainText}" VerticalOptions="Center" HorizontalOptions="Center" />

If you want to have both label and content in a Carousel, I would suggest using something like CarouselView.

EDIT 1

I've create a sample Carousel project with latest Xamarin.Forms (2.2.0.31), I've tested it on iOS and Android and it works. You can use it as a starter to implement your version. I use this control in production app.