xamarin 表单应用程序在发布和调试模式下的不同行为
Different behavior in release and debug mode in xamarin forms app
我创建了一个跨平台应用程序。
当 运行 项目处于调试模式并单击登录按钮时,它 正常工作
,但是当我设置为 释放模式 并单击登录按钮时,我收到了错误消息
这是我的登录名 xaml
<ContentPage.Content>
<StackLayout Orientation="Vertical" Padding="30" Spacing="40">
<BoxView HeightRequest="10"/>
<Image HorizontalOptions="Center" WidthRequest="300" Source="maco.jpg"/>
<Frame BackgroundColor="#BF043055" HasShadow="False">
<StackLayout Orientation="Vertical" Spacing="10">
<Entry x:Name="Email" Text="{Binding Email}" Placeholder="پست الکترونیک"
PlaceholderColor="White" HeightRequest="40"
Keyboard="Email"
TextColor="White"/>
<Entry x:Name="Password" Text="{Binding Password}" Placeholder="کلمه عبور"
PlaceholderColor="White" HeightRequest="40"
IsPassword="True"
TextColor="White"/>
</StackLayout>
</Frame>
<Button Command="{Binding SubmitCommand}" Text="login" TextColor="White"
FontAttributes="Bold" FontSize="Large" HorizontalOptions="FillAndExpand"
BackgroundColor="#088da5" />
</StackLayout>
</ContentPage.Content>
这是我的login.xaml.cs
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LoginPage : ContentPage
{
public LoginPage()
{
var vm = new LoginViewModel( Navigation);
this.BindingContext = vm;
vm.DisplayInvalidLoginPrompt += () => DisplayAlert("Error", "Invalid Login, try again", "OK");
InitializeComponent();
Email.Completed += (object sender, EventArgs e) =>
{
Password.Focus();
};
Password.Completed += (object sender, EventArgs e) =>
{
vm.SubmitCommand.Execute(null);
};
}
}
我使用 mvvm 模式,这是我的 mvvm
public class LoginViewModel : INotifyPropertyChanged
{
public Action DisplayInvalidLoginPrompt;
public event PropertyChangedEventHandler PropertyChanged = delegate { };
public INavigation Navigation { get; set; }
private string email;
public string Email
{
get { return email; }
set
{
email = value;
PropertyChanged(this, new PropertyChangedEventArgs("Email"));
}
}
private string password;
public string Password
{
get { return password; }
set
{
password = value;
PropertyChanged(this, new PropertyChangedEventArgs("Password"));
}
}
public ICommand SubmitCommand { protected set; get; }
//public LoginViewModel(INavigation navigation)
//{
// SubmitCommand = new Command(OnSubmit);
//}
public LoginViewModel(INavigation navigation)
{
this.Navigation = navigation;
SubmitCommand = new Command(async ()=>await OnSubmitAsync());
}
public async Task OnSubmitAsync()
{
if (email != "s" || password != "s")
{
DisplayInvalidLoginPrompt();
}
else
{
await Navigation.PushAsync(new HomePage());
}
}
在发布模式下或在实际安装后 phone,当我输入“s”和“s”(不带引号)时,它会显示我的错误消息(“无效登录,请重试”)但是在调试模式下它工作正常。
我该如何解决?
更新
这是发布
中的“调试日志 logcat”
Time Device Name Type PID Tag Message
07-19 13:35:20.891 pixel_2_pie_9_0_-_api_28 Info 25264 GoogleInputMethod onFinishInput() : Dummy InputConnection bound
07-19 13:35:20.914 pixel_2_pie_9_0_-_api_28 Warning 25264 Conv2QueryExtension Conv2Query not enabled due to current app [ir.sunn.emsbase] not in whitelist
07-19 13:35:20.913 pixel_2_pie_9_0_-_api_28 Info 25264 Conv2QueryExtension Current locale: en_US, config allows these locales: de,en,fr,it,es,pt
07-19 13:35:20.912 pixel_2_pie_9_0_-_api_28 Info 25264 Conv2QueryExtension isEnabled() : true
07-19 13:35:20.912 pixel_2_pie_9_0_-_api_28 Info 25264 EmojiSuperpacksFeature Emoji superpacks enabled
07-19 13:35:20.912 pixel_2_pie_9_0_-_api_28 Info 25264 EmojiDataExtension onActivate() : Locale = en_US
07-19 13:35:20.912 pixel_2_pie_9_0_-_api_28 Info 25264 DevFeatureConfig Gif candidate disabled by Phenotype
07-19 13:35:20.912 pixel_2_pie_9_0_-_api_28 Info 25264 GifEntryExtension onActivate()
07-19 13:35:20.905 pixel_2_pie_9_0_-_api_28 Debug 17925 EGL_emulation eglMakeCurrent: 0xebc853c0: ver 2 0 (tinfo 0xebc836f0)
07-19 13:35:20.900 pixel_2_pie_9_0_-_api_28 Warning 25264 VoiceImeTranscriptor UIME feature enabled: false
07-19 13:35:20.893 pixel_2_pie_9_0_-_api_28 Info 25264 GoogleInputMethod onStartInputView() : Dummy InputConnection bound
07-19 13:35:20.891 pixel_2_pie_9_0_-_api_28 Info 25264 GoogleInputMethod onStartInput() : Dummy InputConnection bound
07-19 13:35:20.889 pixel_2_pie_9_0_-_api_28 Info 25264 PhenotypeExpConfig refreshConfiguration() : Force = false : UpdateAvailable = false : Age = 62 minutes : MaxAge = 720 minutes
07-19 13:35:20.889 pixel_2_pie_9_0_-_api_28 Info 25264 GoogleInputMethod onFinishInputView() : Dummy InputConnection bound
07-19 13:35:20.888 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:20.869 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@bf31831)
07-19 13:35:20.868 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@bf31831)
07-19 13:35:20.865 pixel_2_pie_9_0_-_api_28 Debug 17925 OpenGLRenderer endAllActiveAnimators on 0xcd2ec200 (RippleDrawable) with handle 0xebc83770
07-19 13:35:20.860 pixel_2_pie_9_0_-_api_28 Debug 17925 EGL_emulation eglMakeCurrent: 0xebc853c0: ver 2 0 (tinfo 0xebc836f0)
07-19 13:35:20.823 pixel_2_pie_9_0_-_api_28 Debug 17925 EGL_emulation eglMakeCurrent: 0xebc853c0: ver 2 0 (tinfo 0xebc836f0)
07-19 13:35:19.919 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:19.892 pixel_2_pie_9_0_-_api_28 Debug 17925 EGL_emulation eglMakeCurrent: 0xebc853c0: ver 2 0 (tinfo 0xebc836f0)
07-19 13:35:19.874 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@dc71dec)
07-19 13:35:19.870 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:19.868 pixel_2_pie_9_0_-_api_28 Debug 17925 EGL_emulation eglMakeCurrent: 0xebc853c0: ver 2 0 (tinfo 0xebc836f0)
07-19 13:35:19.867 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@dc71dec)
07-19 13:35:19.841 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:19.838 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:19.818 pixel_2_pie_9_0_-_api_28 Debug 17925 EGL_emulation eglMakeCurrent: 0xebc853c0: ver 2 0 (tinfo 0xebc836f0)
07-19 13:35:19.793 pixel_2_pie_9_0_-_api_28 Debug 17925 EGL_emulation eglMakeCurrent: 0xebc853c0: ver 2 0 (tinfo 0xebc836f0)
07-19 13:35:19.663 pixel_2_pie_9_0_-_api_28 Debug 1652 gralloc_ranchu gralloc_alloc: Creating ashmem region of size 3174400
07-19 13:35:19.655 pixel_2_pie_9_0_-_api_28 Debug 1652 gralloc_ranchu gralloc_alloc: Creating ashmem region of size 3174400
07-19 13:35:19.643 pixel_2_pie_9_0_-_api_28 Debug 1652 gralloc_ranchu gralloc_alloc: Creating ashmem region of size 3174400
07-19 13:35:19.583 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:19.580 pixel_2_pie_9_0_-_api_28 Info 17925 chatty uid=10097(ir.sunn.emsbase) identical 7 lines
07-19 13:35:19.455 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:18.870 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@46923fd)
07-19 13:35:18.868 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@46923fd)
07-19 13:35:18.255 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:18.190 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:18.187 pixel_2_pie_9_0_-_api_28 Info 25264 FeaturePermissions onSharedPreferenceChanged() : Key = latest_activation_time : Feature = null
07-19 13:35:18.171 pixel_2_pie_9_0_-_api_28 Info 25264 PrimesMetrics Ignore memory metric of com.google.android.apps.inputmethod.libs.pill.PillExtension.
07-19 13:35:18.171 pixel_2_pie_9_0_-_api_28 Info 25264 PrimesMetrics Ignore memory metric of com.google.android.apps.inputmethod.libs.search.nativecard.FeatureCardNoticeExtension.
07-19 13:35:18.171 pixel_2_pie_9_0_-_api_28 Info 25264 VoiceImeExtension Voice Extension onStartInputView() Mic status = [MicIconAvailable]
07-19 13:35:18.171 pixel_2_pie_9_0_-_api_28 Warning 25264 VoiceImeTranscriptor UIME feature enabled: false
07-19 13:35:18.171 pixel_2_pie_9_0_-_api_28 Info 25264 FeatureCardNotice Feature card notice not shown: no cards to display
07-19 13:35:18.171 pixel_2_pie_9_0_-_api_28 Info 25264 FeatureCardGenerator Autospace card not added
07-19 13:35:18.168 pixel_2_pie_9_0_-_api_28 Info 25264 PrimesMetrics Ignore memory metric of com.google.android.apps.inputmethod.libs.search.gif.GifEntryPointCandidateExtension.
07-19 13:35:18.168 pixel_2_pie_9_0_-_api_28 Info 25264 FeatureCardGenerator Make a GIF card not added
07-19 13:35:18.168 pixel_2_pie_9_0_-_api_28 Warning 25264 Conv2QueryExtension onActivate() : Disabled by unsupported host app
07-19 13:35:18.167 pixel_2_pie_9_0_-_api_28 Warning 25264 Conv2QueryExtension Conv2Query not enabled due to current app [ir.sunn.emsbase] not in whitelist
07-19 13:35:18.167 pixel_2_pie_9_0_-_api_28 Info 25264 Conv2QueryExtension Current locale: en_US, config allows these locales: de,en,fr,it,es,pt
07-19 13:35:18.167 pixel_2_pie_9_0_-_api_28 Info 25264 Conv2QueryExtension isEnabled() : true
07-19 13:35:18.167 pixel_2_pie_9_0_-_api_28 Info 25264 EmojiSuperpacksFeature Emoji superpacks enabled
07-19 13:35:18.167 pixel_2_pie_9_0_-_api_28 Info 25264 EmojiDataExtension onActivate() : Locale = en_US
07-19 13:35:18.167 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:18.167 pixel_2_pie_9_0_-_api_28 Info 25264 DevFeatureConfig Gif candidate disabled by Phenotype
07-19 13:35:18.167 pixel_2_pie_9_0_-_api_28 Info 25264 GifEntryExtension onActivate()
07-19 13:35:18.158 pixel_2_pie_9_0_-_api_28 Warning 25264 VoiceImeTranscriptor UIME feature enabled: false
07-19 13:35:18.155 pixel_2_pie_9_0_-_api_28 Info 25264 GoogleInputMethod onStartInputView() : Dummy InputConnection bound
07-19 13:35:18.154 pixel_2_pie_9_0_-_api_28 Info 25264 GoogleInputMethod onStartInput() : Dummy InputConnection bound
07-19 13:35:18.154 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:18.153 pixel_2_pie_9_0_-_api_28 Info 25264 PhenotypeExpConfig refreshConfiguration() : Force = false : UpdateAvailable = false : Age = 62 minutes : MaxAge = 720 minutes
07-19 13:35:18.134 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:18.048 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:18.030 pixel_2_pie_9_0_-_api_28 Info 17925 mono-stdout Binding: 'Password' property not found on 'EmsBase.ViewModels.LoginViewModel', target property: 'Xamarin.Forms.Entry.Text'
07-19 13:35:17.871 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@5ff5ba7)
07-19 13:35:17.869 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@5ff5ba7)
07-19 13:35:17.626 pixel_2_pie_9_0_-_api_28 Info 25264 FeaturePermissions onSharedPreferenceChanged() : Key = latest_activation_time : Feature = null
07-19 13:35:17.612 pixel_2_pie_9_0_-_api_28 Info 25264 VoiceImeExtension Voice Extension onStartInputView() Mic status = [MicIconHidden-PasswordOrNumberOrDateInputType, ]
07-19 13:35:17.540 pixel_2_pie_9_0_-_api_28 Warning 25264 VoiceImeTranscriptor UIME feature enabled: false
07-19 13:35:17.540 pixel_2_pie_9_0_-_api_28 Info 25264 PrimesMetrics Ignore memory metric of com.google.android.apps.inputmethod.libs.pill.PillExtension.
07-19 13:35:17.539 pixel_2_pie_9_0_-_api_28 Info 25264 PrimesMetrics Ignore memory metric of com.google.android.apps.inputmethod.libs.search.nativecard.FeatureCardNoticeExtension.
07-19 13:35:17.539 pixel_2_pie_9_0_-_api_28 Info 25264 FeatureCardNotice Feature card notice not shown: no cards to display
07-19 13:35:17.539 pixel_2_pie_9_0_-_api_28 Info 25264 FeatureCardGenerator Autospace card not added
07-19 13:35:17.539 pixel_2_pie_9_0_-_api_28 Info 25264 FeatureCardGenerator Make a GIF card not added
07-19 13:35:17.538 pixel_2_pie_9_0_-_api_28 Warning 25264 Conv2QueryExtension onActivate() : Disabled by unsupported host app
07-19 13:35:17.538 pixel_2_pie_9_0_-_api_28 Warning 25264 Conv2QueryExtension Conv2Query not enabled due to current app [ir.sunn.emsbase] not in whitelist
07-19 13:35:17.537 pixel_2_pie_9_0_-_api_28 Info 25264 Conv2QueryExtension Current locale: en_US, config allows these locales: de,en,fr,it,es,pt
07-19 13:35:17.537 pixel_2_pie_9_0_-_api_28 Info 25264 Conv2QueryExtension isEnabled() : true
07-19 13:35:17.535 pixel_2_pie_9_0_-_api_28 Info 25264 EmojiSuperpacksFeature Emoji superpacks enabled
07-19 13:35:17.535 pixel_2_pie_9_0_-_api_28 Info 25264 EmojiDataExtension onActivate() : Locale = en_US
07-19 13:35:17.532 pixel_2_pie_9_0_-_api_28 Info 25264 PrimesMetrics Ignore memory metric of com.google.android.apps.inputmethod.libs.search.gif.GifEntryPointCandidateExtension.
07-19 13:35:17.531 pixel_2_pie_9_0_-_api_28 Info 25264 DevFeatureConfig Gif candidate disabled by Phenotype
07-19 13:35:17.531 pixel_2_pie_9_0_-_api_28 Info 25264 GifEntryExtension onActivate()
07-19 13:35:17.527 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:17.519 pixel_2_pie_9_0_-_api_28 Info 25264 DlamWrapper close(): Successfully wrote DLAM properties file.
07-19 13:35:17.514 pixel_2_pie_9_0_-_api_28 Info 25264 LatinIme onDeactivate()
07-19 13:35:17.514 pixel_2_pie_9_0_-_api_28 Info 25264 Delight5Decoder abortComposing() : input state id = 401
07-19 13:35:17.513 pixel_2_pie_9_0_-_api_28 Info 25264 LatinIme abortComposing()
07-19 13:35:17.512 pixel_2_pie_9_0_-_api_28 Info 25264 PhenotypeExpConfig refreshConfiguration() : Force = false : UpdateAvailable = false : Age = 62 minutes : MaxAge = 720 minutes
07-19 13:35:17.509 pixel_2_pie_9_0_-_api_28 Warning 25085 audio_hw_generic Not supplying enough data to HAL, expected position 33246355 , only wrote 33246000
07-19 13:35:17.366 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:17.331 pixel_2_pie_9_0_-_api_28 Info 17925 mono-stdout Binding: 'Email' property not found on 'EmsBase.ViewModels.LoginViewModel', target property: 'Xamarin.Forms.Entry.Text'
07-19 13:35:16.868 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@d45adcb)
07-19 13:35:16.867 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@d45adcb)
07-19 13:35:15.870 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@131909a)
07-19 13:35:15.868 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@131909a)
07-19 13:35:14.869 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@d1145)
07-19 13:35:14.868 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@d1145)
07-19 13:35:13.867 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@156cdbc)
07-19 13:35:13.866 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@156cdbc)
07-19 13:35:12.867 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@76e65af)
07-19 13:35:12.865 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@76e65af)
好的,4 天后,我的解析器将我的程序集名称从混合的小写和大写更改为小写,并且每次都认为这次工作正常。
我创建了一个跨平台应用程序。 当 运行 项目处于调试模式并单击登录按钮时,它 正常工作 ,但是当我设置为 释放模式 并单击登录按钮时,我收到了错误消息 这是我的登录名 xaml
<ContentPage.Content>
<StackLayout Orientation="Vertical" Padding="30" Spacing="40">
<BoxView HeightRequest="10"/>
<Image HorizontalOptions="Center" WidthRequest="300" Source="maco.jpg"/>
<Frame BackgroundColor="#BF043055" HasShadow="False">
<StackLayout Orientation="Vertical" Spacing="10">
<Entry x:Name="Email" Text="{Binding Email}" Placeholder="پست الکترونیک"
PlaceholderColor="White" HeightRequest="40"
Keyboard="Email"
TextColor="White"/>
<Entry x:Name="Password" Text="{Binding Password}" Placeholder="کلمه عبور"
PlaceholderColor="White" HeightRequest="40"
IsPassword="True"
TextColor="White"/>
</StackLayout>
</Frame>
<Button Command="{Binding SubmitCommand}" Text="login" TextColor="White"
FontAttributes="Bold" FontSize="Large" HorizontalOptions="FillAndExpand"
BackgroundColor="#088da5" />
</StackLayout>
</ContentPage.Content>
这是我的login.xaml.cs
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LoginPage : ContentPage
{
public LoginPage()
{
var vm = new LoginViewModel( Navigation);
this.BindingContext = vm;
vm.DisplayInvalidLoginPrompt += () => DisplayAlert("Error", "Invalid Login, try again", "OK");
InitializeComponent();
Email.Completed += (object sender, EventArgs e) =>
{
Password.Focus();
};
Password.Completed += (object sender, EventArgs e) =>
{
vm.SubmitCommand.Execute(null);
};
}
}
我使用 mvvm 模式,这是我的 mvvm
public class LoginViewModel : INotifyPropertyChanged
{
public Action DisplayInvalidLoginPrompt;
public event PropertyChangedEventHandler PropertyChanged = delegate { };
public INavigation Navigation { get; set; }
private string email;
public string Email
{
get { return email; }
set
{
email = value;
PropertyChanged(this, new PropertyChangedEventArgs("Email"));
}
}
private string password;
public string Password
{
get { return password; }
set
{
password = value;
PropertyChanged(this, new PropertyChangedEventArgs("Password"));
}
}
public ICommand SubmitCommand { protected set; get; }
//public LoginViewModel(INavigation navigation)
//{
// SubmitCommand = new Command(OnSubmit);
//}
public LoginViewModel(INavigation navigation)
{
this.Navigation = navigation;
SubmitCommand = new Command(async ()=>await OnSubmitAsync());
}
public async Task OnSubmitAsync()
{
if (email != "s" || password != "s")
{
DisplayInvalidLoginPrompt();
}
else
{
await Navigation.PushAsync(new HomePage());
}
}
在发布模式下或在实际安装后 phone,当我输入“s”和“s”(不带引号)时,它会显示我的错误消息(“无效登录,请重试”)但是在调试模式下它工作正常。
我该如何解决?
更新 这是发布
中的“调试日志 logcat”Time Device Name Type PID Tag Message
07-19 13:35:20.891 pixel_2_pie_9_0_-_api_28 Info 25264 GoogleInputMethod onFinishInput() : Dummy InputConnection bound
07-19 13:35:20.914 pixel_2_pie_9_0_-_api_28 Warning 25264 Conv2QueryExtension Conv2Query not enabled due to current app [ir.sunn.emsbase] not in whitelist
07-19 13:35:20.913 pixel_2_pie_9_0_-_api_28 Info 25264 Conv2QueryExtension Current locale: en_US, config allows these locales: de,en,fr,it,es,pt
07-19 13:35:20.912 pixel_2_pie_9_0_-_api_28 Info 25264 Conv2QueryExtension isEnabled() : true
07-19 13:35:20.912 pixel_2_pie_9_0_-_api_28 Info 25264 EmojiSuperpacksFeature Emoji superpacks enabled
07-19 13:35:20.912 pixel_2_pie_9_0_-_api_28 Info 25264 EmojiDataExtension onActivate() : Locale = en_US
07-19 13:35:20.912 pixel_2_pie_9_0_-_api_28 Info 25264 DevFeatureConfig Gif candidate disabled by Phenotype
07-19 13:35:20.912 pixel_2_pie_9_0_-_api_28 Info 25264 GifEntryExtension onActivate()
07-19 13:35:20.905 pixel_2_pie_9_0_-_api_28 Debug 17925 EGL_emulation eglMakeCurrent: 0xebc853c0: ver 2 0 (tinfo 0xebc836f0)
07-19 13:35:20.900 pixel_2_pie_9_0_-_api_28 Warning 25264 VoiceImeTranscriptor UIME feature enabled: false
07-19 13:35:20.893 pixel_2_pie_9_0_-_api_28 Info 25264 GoogleInputMethod onStartInputView() : Dummy InputConnection bound
07-19 13:35:20.891 pixel_2_pie_9_0_-_api_28 Info 25264 GoogleInputMethod onStartInput() : Dummy InputConnection bound
07-19 13:35:20.889 pixel_2_pie_9_0_-_api_28 Info 25264 PhenotypeExpConfig refreshConfiguration() : Force = false : UpdateAvailable = false : Age = 62 minutes : MaxAge = 720 minutes
07-19 13:35:20.889 pixel_2_pie_9_0_-_api_28 Info 25264 GoogleInputMethod onFinishInputView() : Dummy InputConnection bound
07-19 13:35:20.888 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:20.869 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@bf31831)
07-19 13:35:20.868 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@bf31831)
07-19 13:35:20.865 pixel_2_pie_9_0_-_api_28 Debug 17925 OpenGLRenderer endAllActiveAnimators on 0xcd2ec200 (RippleDrawable) with handle 0xebc83770
07-19 13:35:20.860 pixel_2_pie_9_0_-_api_28 Debug 17925 EGL_emulation eglMakeCurrent: 0xebc853c0: ver 2 0 (tinfo 0xebc836f0)
07-19 13:35:20.823 pixel_2_pie_9_0_-_api_28 Debug 17925 EGL_emulation eglMakeCurrent: 0xebc853c0: ver 2 0 (tinfo 0xebc836f0)
07-19 13:35:19.919 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:19.892 pixel_2_pie_9_0_-_api_28 Debug 17925 EGL_emulation eglMakeCurrent: 0xebc853c0: ver 2 0 (tinfo 0xebc836f0)
07-19 13:35:19.874 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@dc71dec)
07-19 13:35:19.870 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:19.868 pixel_2_pie_9_0_-_api_28 Debug 17925 EGL_emulation eglMakeCurrent: 0xebc853c0: ver 2 0 (tinfo 0xebc836f0)
07-19 13:35:19.867 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@dc71dec)
07-19 13:35:19.841 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:19.838 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:19.818 pixel_2_pie_9_0_-_api_28 Debug 17925 EGL_emulation eglMakeCurrent: 0xebc853c0: ver 2 0 (tinfo 0xebc836f0)
07-19 13:35:19.793 pixel_2_pie_9_0_-_api_28 Debug 17925 EGL_emulation eglMakeCurrent: 0xebc853c0: ver 2 0 (tinfo 0xebc836f0)
07-19 13:35:19.663 pixel_2_pie_9_0_-_api_28 Debug 1652 gralloc_ranchu gralloc_alloc: Creating ashmem region of size 3174400
07-19 13:35:19.655 pixel_2_pie_9_0_-_api_28 Debug 1652 gralloc_ranchu gralloc_alloc: Creating ashmem region of size 3174400
07-19 13:35:19.643 pixel_2_pie_9_0_-_api_28 Debug 1652 gralloc_ranchu gralloc_alloc: Creating ashmem region of size 3174400
07-19 13:35:19.583 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:19.580 pixel_2_pie_9_0_-_api_28 Info 17925 chatty uid=10097(ir.sunn.emsbase) identical 7 lines
07-19 13:35:19.455 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:18.870 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@46923fd)
07-19 13:35:18.868 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@46923fd)
07-19 13:35:18.255 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:18.190 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:18.187 pixel_2_pie_9_0_-_api_28 Info 25264 FeaturePermissions onSharedPreferenceChanged() : Key = latest_activation_time : Feature = null
07-19 13:35:18.171 pixel_2_pie_9_0_-_api_28 Info 25264 PrimesMetrics Ignore memory metric of com.google.android.apps.inputmethod.libs.pill.PillExtension.
07-19 13:35:18.171 pixel_2_pie_9_0_-_api_28 Info 25264 PrimesMetrics Ignore memory metric of com.google.android.apps.inputmethod.libs.search.nativecard.FeatureCardNoticeExtension.
07-19 13:35:18.171 pixel_2_pie_9_0_-_api_28 Info 25264 VoiceImeExtension Voice Extension onStartInputView() Mic status = [MicIconAvailable]
07-19 13:35:18.171 pixel_2_pie_9_0_-_api_28 Warning 25264 VoiceImeTranscriptor UIME feature enabled: false
07-19 13:35:18.171 pixel_2_pie_9_0_-_api_28 Info 25264 FeatureCardNotice Feature card notice not shown: no cards to display
07-19 13:35:18.171 pixel_2_pie_9_0_-_api_28 Info 25264 FeatureCardGenerator Autospace card not added
07-19 13:35:18.168 pixel_2_pie_9_0_-_api_28 Info 25264 PrimesMetrics Ignore memory metric of com.google.android.apps.inputmethod.libs.search.gif.GifEntryPointCandidateExtension.
07-19 13:35:18.168 pixel_2_pie_9_0_-_api_28 Info 25264 FeatureCardGenerator Make a GIF card not added
07-19 13:35:18.168 pixel_2_pie_9_0_-_api_28 Warning 25264 Conv2QueryExtension onActivate() : Disabled by unsupported host app
07-19 13:35:18.167 pixel_2_pie_9_0_-_api_28 Warning 25264 Conv2QueryExtension Conv2Query not enabled due to current app [ir.sunn.emsbase] not in whitelist
07-19 13:35:18.167 pixel_2_pie_9_0_-_api_28 Info 25264 Conv2QueryExtension Current locale: en_US, config allows these locales: de,en,fr,it,es,pt
07-19 13:35:18.167 pixel_2_pie_9_0_-_api_28 Info 25264 Conv2QueryExtension isEnabled() : true
07-19 13:35:18.167 pixel_2_pie_9_0_-_api_28 Info 25264 EmojiSuperpacksFeature Emoji superpacks enabled
07-19 13:35:18.167 pixel_2_pie_9_0_-_api_28 Info 25264 EmojiDataExtension onActivate() : Locale = en_US
07-19 13:35:18.167 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:18.167 pixel_2_pie_9_0_-_api_28 Info 25264 DevFeatureConfig Gif candidate disabled by Phenotype
07-19 13:35:18.167 pixel_2_pie_9_0_-_api_28 Info 25264 GifEntryExtension onActivate()
07-19 13:35:18.158 pixel_2_pie_9_0_-_api_28 Warning 25264 VoiceImeTranscriptor UIME feature enabled: false
07-19 13:35:18.155 pixel_2_pie_9_0_-_api_28 Info 25264 GoogleInputMethod onStartInputView() : Dummy InputConnection bound
07-19 13:35:18.154 pixel_2_pie_9_0_-_api_28 Info 25264 GoogleInputMethod onStartInput() : Dummy InputConnection bound
07-19 13:35:18.154 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:18.153 pixel_2_pie_9_0_-_api_28 Info 25264 PhenotypeExpConfig refreshConfiguration() : Force = false : UpdateAvailable = false : Age = 62 minutes : MaxAge = 720 minutes
07-19 13:35:18.134 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:18.048 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:18.030 pixel_2_pie_9_0_-_api_28 Info 17925 mono-stdout Binding: 'Password' property not found on 'EmsBase.ViewModels.LoginViewModel', target property: 'Xamarin.Forms.Entry.Text'
07-19 13:35:17.871 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@5ff5ba7)
07-19 13:35:17.869 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@5ff5ba7)
07-19 13:35:17.626 pixel_2_pie_9_0_-_api_28 Info 25264 FeaturePermissions onSharedPreferenceChanged() : Key = latest_activation_time : Feature = null
07-19 13:35:17.612 pixel_2_pie_9_0_-_api_28 Info 25264 VoiceImeExtension Voice Extension onStartInputView() Mic status = [MicIconHidden-PasswordOrNumberOrDateInputType, ]
07-19 13:35:17.540 pixel_2_pie_9_0_-_api_28 Warning 25264 VoiceImeTranscriptor UIME feature enabled: false
07-19 13:35:17.540 pixel_2_pie_9_0_-_api_28 Info 25264 PrimesMetrics Ignore memory metric of com.google.android.apps.inputmethod.libs.pill.PillExtension.
07-19 13:35:17.539 pixel_2_pie_9_0_-_api_28 Info 25264 PrimesMetrics Ignore memory metric of com.google.android.apps.inputmethod.libs.search.nativecard.FeatureCardNoticeExtension.
07-19 13:35:17.539 pixel_2_pie_9_0_-_api_28 Info 25264 FeatureCardNotice Feature card notice not shown: no cards to display
07-19 13:35:17.539 pixel_2_pie_9_0_-_api_28 Info 25264 FeatureCardGenerator Autospace card not added
07-19 13:35:17.539 pixel_2_pie_9_0_-_api_28 Info 25264 FeatureCardGenerator Make a GIF card not added
07-19 13:35:17.538 pixel_2_pie_9_0_-_api_28 Warning 25264 Conv2QueryExtension onActivate() : Disabled by unsupported host app
07-19 13:35:17.538 pixel_2_pie_9_0_-_api_28 Warning 25264 Conv2QueryExtension Conv2Query not enabled due to current app [ir.sunn.emsbase] not in whitelist
07-19 13:35:17.537 pixel_2_pie_9_0_-_api_28 Info 25264 Conv2QueryExtension Current locale: en_US, config allows these locales: de,en,fr,it,es,pt
07-19 13:35:17.537 pixel_2_pie_9_0_-_api_28 Info 25264 Conv2QueryExtension isEnabled() : true
07-19 13:35:17.535 pixel_2_pie_9_0_-_api_28 Info 25264 EmojiSuperpacksFeature Emoji superpacks enabled
07-19 13:35:17.535 pixel_2_pie_9_0_-_api_28 Info 25264 EmojiDataExtension onActivate() : Locale = en_US
07-19 13:35:17.532 pixel_2_pie_9_0_-_api_28 Info 25264 PrimesMetrics Ignore memory metric of com.google.android.apps.inputmethod.libs.search.gif.GifEntryPointCandidateExtension.
07-19 13:35:17.531 pixel_2_pie_9_0_-_api_28 Info 25264 DevFeatureConfig Gif candidate disabled by Phenotype
07-19 13:35:17.531 pixel_2_pie_9_0_-_api_28 Info 25264 GifEntryExtension onActivate()
07-19 13:35:17.527 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:17.519 pixel_2_pie_9_0_-_api_28 Info 25264 DlamWrapper close(): Successfully wrote DLAM properties file.
07-19 13:35:17.514 pixel_2_pie_9_0_-_api_28 Info 25264 LatinIme onDeactivate()
07-19 13:35:17.514 pixel_2_pie_9_0_-_api_28 Info 25264 Delight5Decoder abortComposing() : input state id = 401
07-19 13:35:17.513 pixel_2_pie_9_0_-_api_28 Info 25264 LatinIme abortComposing()
07-19 13:35:17.512 pixel_2_pie_9_0_-_api_28 Info 25264 PhenotypeExpConfig refreshConfiguration() : Force = false : UpdateAvailable = false : Age = 62 minutes : MaxAge = 720 minutes
07-19 13:35:17.509 pixel_2_pie_9_0_-_api_28 Warning 25085 audio_hw_generic Not supplying enough data to HAL, expected position 33246355 , only wrote 33246000
07-19 13:35:17.366 pixel_2_pie_9_0_-_api_28 Warning 17925 monodroid-assembly typemap: module matching MVID [CAD0FB41-A72A-4345-B6B8-DAF8486E8A76] not found.
07-19 13:35:17.331 pixel_2_pie_9_0_-_api_28 Info 17925 mono-stdout Binding: 'Email' property not found on 'EmsBase.ViewModels.LoginViewModel', target property: 'Xamarin.Forms.Entry.Text'
07-19 13:35:16.868 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@d45adcb)
07-19 13:35:16.867 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@d45adcb)
07-19 13:35:15.870 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@131909a)
07-19 13:35:15.868 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@131909a)
07-19 13:35:14.869 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@d1145)
07-19 13:35:14.868 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@d1145)
07-19 13:35:13.867 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@156cdbc)
07-19 13:35:13.866 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@156cdbc)
07-19 13:35:12.867 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@76e65af)
07-19 13:35:12.865 pixel_2_pie_9_0_-_api_28 Info 25132 GnssLocationProvider WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@76e65af)
好的,4 天后,我的解析器将我的程序集名称从混合的小写和大写更改为小写,并且每次都认为这次工作正常。