System.ArgumentException: <Timeout exceeded the number of exception details> Xamarin.Forms

I'm new to this awesome platform, I made a very simple example, it contains only one XAML page. Yesterday it worked flawlessly, but when he launched it today, it threw this exception out of nowhere

This is an exception:

An exception

HelloPage.xaml:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="SAP.HelloPage">

<!--  la configuration personalisé pour chaque system d'éxploitation   -->
   <ContentPage.Padding>
       <OnPlatform x:TypeArguments="Thickness"
             iOS="0,10,0,0"
             Android="0,40,0,0">
      </OnPlatform>
   </ContentPage.Padding>  


  <StackLayout HorizontalOptions="Center" BindingContext="{x:Reference sliderID}">

     <Button Clicked="Button_Clicked" Text="Suivant"/>

     <Label x:Name="lb_font"  Text="Font is :"/>


     <Slider Minimum="16" Maximum="45"  x:Name="sliderID"  ValueChanged="sliderID_ValueChanged"/>

     <Label x:Name="lb_quote"/>

  </StackLayout> 
<ContentPage>

HelloPage.xaml.cs:

public partial class HelloPage : ContentPage
{

   // quotes
   List<string> quotes = new List<string>()
   {
       "Bienvenu, la première paragraphe",
       "une autre quote, cella j'adore",
       "La troisième est magnifique"
   };

   int pos = 0;

   public HelloPage()
   {
        InitializeComponent();

        // settings initialisation
         lb_quote.Text = quotes.ElementAt(0);
  }


private void Button_Clicked(object sender, EventArgs e)
{
    if(pos == quotes.Count)
    {
        pos = 0;
    }

    lb_quote.Text = quotes.ElementAt(pos);
    pos += 1;

 }

private void sliderID_ValueChanged(object sender, ValueChangedEventArgs e)
{
    lb_font.Text ="Font Size : " + sliderID.Value.ToString();
    lb_quote.FontSize = sliderID.Value;
  }
}
+9
source share
2 answers

It's hard to catch (well, actually not, just put it try/catcharound InitializeComponentand you can examine this exception) and pretty subtle.

XAML , , . - - XAML - , .

, Slider .

var slider = new Slider();
slider.Minimum = 16;
slider.Maximum = 45;
...

Slider.Minimum Slider.Maximum, , , . Maximum 0. Minimum 16, Minimum Maximum , , ArgumentOutOfRangeException.

, Maximum Minimum, .

+16

@Paul. try-catch, . , ,

0

All Articles