How to resolve System.Reflection.TargetInvocationException: Exception? [closed]

-1

My application (using Xamarin Forms) was working ok, most of all when I click the login button it is being interrupted by launching the following error:

  

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

How to solve this?

To make it clear, there is no error in the script, everything is ok, even because I was running everything ok and nothing gave it. I do not know what to do, but I do not know what to do.

My loginPage xaml:

<ContentPage Title="Login">
    <ScrollView>
    <StackLayout Spacing="20" Padding="20"
                 VerticalOptions="Center">
        <Image 
        VerticalOptions="Center"
         HorizontalOptions="Center"
        Source="logo.png"/>

        <Entry x:Name="emailEntry" Placeholder="Usuário"
               Text="{Binding Usuario}"/>
        <Entry x:Name="senhaEntry" Placeholder="Senha"
               Text="{Binding Senha}"
               IsPassword="true"/>

        <ActivityIndicator x:Name="waitActivityIndicator"
                               HorizontalOptions="CenterAndExpand"
                               VerticalOptions="CenterAndExpand">
        </ActivityIndicator>
        <Button x:Name="loginButton"
                Text="Login" TextColor="White"
                BackgroundColor="#800000"
                Clicked="BtnLogin_Clicked"/>

    </StackLayout>
    </ScrollView>
</ContentPage>

And here's CodeBehind:

public LoginPage()
{
    InitializeComponent();
    NavigationPage.SetHasNavigationBar(this, false);    
}

protected async void BtnLogin_Clicked(object sender, EventArgs e)
{
    App.Current.MainPage = new MainPageRoot();
}

Here is the MainPagel 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="EbsHelpDesk.Views.MainPage"
             Title="Home">
    <ContentPage.Content>
        <ScrollView>
        <StackLayout Padding="20">
            <Label Text="Atendimentos em Aberto"
                   HorizontalOptions="Center"
                   VerticalOptions="Center"
                   FontAttributes="Bold"
                   FontSize="25"/>
                <Grid  ColumnSpacing="2">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions/>
                    <Label Text="#" Grid.Row="0" Grid.Column="0" FontAttributes="Bold"/>
                    <ListView x:Name="coluna0" Grid.Column="0" Grid.Row="1"  SeparatorColor="White"
                SeparatorVisibility="Default"/>
                    <Label Text="Colaborador" Grid.Row="0" Grid.Column="1" FontAttributes="Bold"/>
                    <ListView x:Name="coluna1" Grid.Column="1" Grid.Row="1"  SeparatorColor="White"
                SeparatorVisibility="Default"/>
                    <Label Text="Cliente" Grid.Row="0" Grid.Column="2" FontAttributes="Bold" />
                    <ListView x:Name="coluna2" Grid.Column="2" Grid.Row="1"  SeparatorColor="White"
                SeparatorVisibility="Default"/>
                    <Label Text="Duração" Grid.Row="0" Grid.Column="3" FontAttributes="Bold"/>
                    <ListView x:Name="coluna3" Grid.Column="3" Grid.Row="1"  SeparatorColor="White"
                SeparatorVisibility="Default"/>
                </Grid>

                <Label Text="Minhas Tarefas"
                   HorizontalOptions="Center"
                   VerticalOptions="Center"
                   FontAttributes="Bold"
                   FontSize="25"/>
                <Label Text="Sistema:"
                   HorizontalOptions="Center"
                   VerticalOptions="Center"
                   FontSize="12"/>
                <Picker x:Name="pckSistema" Title="Selecione o sistema:">
                    <Picker.Items>
                        <x:String>CORREÇÃO DE ERRO</x:String>
                        <x:String>MELHORIA DE SISTEMA</x:String>
                        <x:String>NOVA FUNCIONALIDADE</x:String>
                        <x:String>NOVO RELATÓRIO/ETIQUETA</x:String>
                        <x:String>OBRIGAÇÕES FISCAIS</x:String>
                        <x:String>MIGRAÇÃO DE SISTEMA</x:String>
                    </Picker.Items>
                </Picker>
                <Button Text="Criar Chamado"
                    TextColor="White"
                    BackgroundColor="#008000"
                    Image="tarefa24.png"
                    />
        </StackLayout>
        </ScrollView>
    </ContentPage.Content>
</ContentPage>
    
asked by anonymous 16.02.2018 / 16:20

1 answer

1

Then, I discovered that the error was in XAML of mainpage, just remove the tag <Grid.RowDefinitions/> , then it returned to normal operation.

    
19.02.2018 / 16:43