title: Getting an error in xamarin forms while inserting data: System.ArgumentNullException: 'Value cannot be null. Parameter name: cancel'
body: <p>Im trying a singUp page in xamarin for a project and in the method to insert the new user it appers to be an error. I tried to use addWithValue() command and Add(), and other methods but it always gives me this error "System.ArgumentNullException: 'Value cannot be null. Parameter name: cancel'". My SingUpPage.xaml.cscode look like this:</p>
  
  <pre><code>async private void Guardar_Clicked(object sender, EventArgs e)
  {
      if(!string.IsNullOrEmpty(txtUsuario.Text) &amp;&amp; !string.IsNullOrEmpty(txtContraseña.Text) &amp;&amp; !string.IsNullOrEmpty(txtCorreo.Text))
      {
          MySqlConnection con = new MySqlConnection(PaginaPrincipal.conexion);
          try
          {
  
              if (con.State == ConnectionState.Closed)
              {
                  con.Open();
                  string sql = "INSERT INTO users(Nombre_Usuario,Contra,Correo,Telefono) VALUES(@Nombre_Usuario,@Contra,@Correo,@Telefono)";
  
                  using (MySqlCommand cmd = new MySqlCommand(sql, con)) {
                      cmd.Parameters.Add("@Nombre_Usuario", MySqlDbType.VarChar, 30).Value = txtUsuario;
                      cmd.Parameters.Add("@Contra", MySqlDbType.VarChar, 45).Value = txtContraseña.Text;
                      cmd.Parameters.Add("@Correo", MySqlDbType.VarChar, 45).Value = txtCorreo.Text;
                      cmd.Parameters.Add("@Telefono", MySqlDbType.Int32, 10).Value = Convert.ToInt32(txtTelefono.Text);
                      cmd.CommandType = CommandType.Text;
  
                      int result = cmd.ExecuteNonQuery();
                      if (result &lt; 0) {
                          Console.WriteLine("Error inserting data to DB");
                      }
  
                      await DisplayAlert("Exito", "Se añadio tu usuario", "Ok");
                  }
              }
          }
          catch (MySqlException ex)
          {
              await DisplayAlert("Paso esto: ", Convert.ToString(ex), "");
          }
          finally
          {
              con.Close();
          }
      }
      else
      {
          await DisplayAlert("Required", "Los campos de Usuario, Contraseña y Correo son necesarios", "OK");
      }
  
  }
  </code></pre>
  
  <p>My SingUpPage.xaml: </p>
  
  <pre><code>&lt;ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
               xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
               xmlns:d="http://xamarin.com/schemas/2014/forms/design"
               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
               mc:Ignorable="d"
               x:Class="Saansa.Views.SingUpPage"&gt;
      &lt;ContentPage.Content&gt;
          &lt;StackLayout Padding="4"&gt;
              &lt;Entry x:Name="txtUsuario" Placeholder="Usuario" FontSize="Large" Margin="20,50,20,10"/&gt;
              &lt;Entry x:Name="txtContraseña" Placeholder="Contraseña" FontSize="Large" Margin="20,50,20,10"/&gt;
              &lt;Entry x:Name="txtCorreo" Placeholder="Correo"  FontSize="Large" Margin="20,50,20,10"/&gt;
              &lt;Entry x:Name="txtTelefono" Placeholder="Telefono" FontSize="Large" Margin="20,50,20,10"/&gt;
              &lt;Button x:Name="Guardar" Text="Registrar" FontSize="Large" Padding="4" Margin="20,50,20,10" Clicked="Guardar_Clicked"
                      BackgroundColor="White" BorderColor="Gray" BorderWidth="2" CornerRadius="20"/&gt;
          &lt;/StackLayout&gt;
      &lt;/ContentPage.Content&gt;
  &lt;/ContentPage&gt;
  </code></pre>
  
  <p>The database that i am using is Mysql and the columns of my table user are:</p>
  
  <pre><code>idUsers -&gt; Type: int(11) PK NotNull AutoIncrement.
  Nombre_Usuario -&gt; Type:varchar(45) NotNull.
  Contra -&gt; Type:varchar(45) NotNull.
  Correo -&gt; Type:varchar(45) NotNull.
  Telefono -&gt; Type:int(11) NotNull.
  </code></pre>