Xamarin формы: отображение DISABLE_XAML_GENERATED_BINDING_DEBUG_OUTPUT при загрузке страницы - PullRequest
0 голосов
/ 12 декабря 2018

Перенаправление на App.g.i.cs при загрузке страницы в xamarin UWP.Управление кодом сводится к следующему, если блок.

#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
        UnhandledException += (sender, e) =>
        {
            if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
        };
#endif

Если навести курсор мыши на e , показывая {Windows.UI.Xaml.UnhandledExceptionEventArgs}

Я не понимаю, в чем проблема?Это связано с какой-то ошибкой в ​​XAML?Эта проблема возникает только в приложениях Windows, части приложений Android и IOS работают нормально.

Код страницы 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="Myproject.Pages.CodeValidationPage"
             BackgroundColor="#00aff0">

<ScrollView>
    <StackLayout
        VerticalOptions="FillAndExpand">
        <StackLayout 
        VerticalOptions="CenterAndExpand"
        Orientation="Vertical">

            <Image 
            Source="splash.png"
            HeightRequest="120"
            WidthRequest="120"
            IsVisible="True"
            HorizontalOptions="Center"
            VerticalOptions="CenterAndExpand"/>

            <Label
            Text=" Please check your email for the verification code and activate your account. "
            HorizontalOptions="CenterAndExpand"
                x:Name="italic_test"
            HorizontalTextAlignment="Center"
            Margin="3"
            Font="Italic,15"
            TextColor="White"/>

            <Frame
                HorizontalOptions="FillAndExpand"
                CornerRadius="10"
                Margin="20"
                Padding="0">

                <StackLayout 
                    BackgroundColor="White" 
                    Orientation="Vertical"
                    VerticalOptions="CenterAndExpand" >

                    <Entry 
                        x:Name="codeentry" 
                        Margin="10,10,10,0"
                        Keyboard="Numeric"
                        Placeholder="Enter Verification Code"/>

                    <Entry 
                        x:Name="passwordentry" 
                        Placeholder="Password" 
                        IsVisible="False"
                        Margin="10,10,10,0"
                        IsPassword="True"/>

                    <Entry 
                        x:Name="confirmpasswordentry" 
                        Margin="10,0,10,-10"
                        IsVisible="False"
                        Placeholder="Confirm Password"
                        IsPassword="True"/>

                    <Button
                        Text="Verify Code" 
                        HeightRequest="40"
                        WidthRequest="150"
                        x:Name="validationButton"
                        TextColor="White"
                        HorizontalOptions="CenterAndExpand"
                        Font="Bold,15"
                        Margin="5,15,5,10"
                        BorderRadius="20"
                        BackgroundColor="#00aff0" 
                        Clicked="SaveNewPassword"/>
                </StackLayout>
            </Frame>
        </StackLayout>

        <Label
            VerticalOptions="EndAndExpand"
            HorizontalOptions="CenterAndExpand"
            Margin="0,0,0,15"
                x:Name="backto_label"
                TextColor="White"
                Font="Bold,16"
                Text=" Back to Sign Up "/>
    </StackLayout>
</ScrollView>
</ContentPage>

Ответы [ 2 ]

0 голосов
/ 03 января 2019

Реальная проблема с disaplayalert.

. Я использую следующий код для отображения предупреждения:

await DisplayAlert("Alert", "A verification code has been sent to your email.", "OK");

Если я изменил вышеуказанные строки, как показано ниже, никаких проблем не будетприезжай.

Device.BeginInvokeOnMainThread(async () => 
{
    await DisplayAlert("Alert", "A verification code has been sent to your email.", "OK");
});
0 голосов
/ 17 декабря 2018

С Xamarin.forms 3.x Microsoft перешла на .net стандарт 2.0 .

Я смог скомпилировать код и запустить приложение после преобразования PCL в стандарт .net 2.0 , обновления всех пакетов nuget до последней версии и изменения xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions" на xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin" как указано в документации в ваших файлах XAML.

enter image description here

При нажатии на ResetPassword отображается System.Collections.Generic.KeyNotFoundException в этой строке:

string initialLogin = Application.Current.Properties["initialLogin"].ToString();

Поэтому измените его на

Application.Current.Properties.TryGetValue("initialLogin", out var initialLogin);

, чтобы обработать случай, когда " initialLogin " не был добавлен в Application.Current.Properties коллекция.Затем проверьте, чтобы значение было != null, прежде чем использовать его.

Также в Mainpage.xaml.cs вы делаете ту же ошибку с username и password .

Также измените Тип PDB с полного на pdb-only, чтобы разрешить отладку.Это известная проблема.

Сброс работает:

enter image description here

...