我的Android应用程序在生产环境中崩溃,我们的崩溃报告工具是XamarinInsights,它转储了以下堆栈
at(wrapper castclass)System.Object:__ castclass_with_cache(object,intptr,intptr)
在MvvmCross.Droid.Support.V7.AppCompat.MvxAppCompatActivity 1[TViewModel].get_ViewModel () [0x00006] in <76c7f3cdfddd459898d814608e83832e>:0
at AnyNameSpace.BaseActivity
1 [TViewModel] .get_Context()[0x00000] in&lt; 5d7ceda804ca4cbe89e187bc8a206872&gt ;:0
在AnyNameSpace.BaseActivity`1 [TViewModel] .OnCreate(Android.OS.Bundle bundle)[0x00015] in&lt; 5d7ceda804ca4cbe89e187bc8a206872&gt ;:0
位于&lt; 03e2d64cacc54ebebbfb6133dd9c33ae&gt;中的AnyNameSpace.ProfileView.OnCreate(Android.OS.Bundle包)[0x00000]:0
在Android.Support.V4.App.FragmentActivity.n_OnCreate_Landroid_os_Bundle_(System.IntPtr jnienv,System.IntPtr native__this,System.IntPtr native_savedInstanceState)[0x00011] in&lt; 6296d3d76c5d4378959a1d9bf7205023&gt ;:0
at(wrapper dynamic-method)System.Object:dd3ad951-7481-46d2-860d-a9601d351cd2(intptr,intptr,intptr)
这是抛出异常的位置
public class ProfileView : BaseAppActivity<ProfileViewModel>
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.ProfileView);
Title = string.Format("{0} | {1}", Title, Context.Version);
}
}
BaseAppActivity:BaseActivity
protected override void OnCreate(Bundle bundle)
{
SupportRequestWindowFeature((int)WindowFeatures.IndeterminateProgress);
base.OnCreate(bundle);
RegisterBaseViewReceiver();
if (Context != null)
{
Context.OnLoaded();
}
和BaseActivity
public class BaseActivity<TViewModel> : MvxAppCompatActivity<TViewModel>
where TViewModel : BaseViewModel
{
public TViewModel Context
{
get
{
return (TViewModel)base.ViewModel;
}
}
}
引发了异常
return (TViewModel)base.ViewModel;
但是我无法在发布和调试配置中重现此崩溃,我只能在崩溃报告系统中看到此错误。有什么想法吗?