2017-04-24 42 views
0

當我開始我的應用程序時,我顯示以下錯誤,並調查了有關錯誤,但我沒有在任何論壇上找到答案xamarin,當我做斷點時,在MainActivity.cs中停止附加我的代碼,謝謝您的幫助 發生未處理的異常。在Xamarin Visual Studio

using System; 
using Android.App; 
using Android.Content.PM; 
using Android.Runtime; 
using Android.Views; 
using Android.Widget; 
using Android.OS; 

namespace SITMovil.Droid 
{ 
    [Activity(Label = "SITMovil", 
Icon = "@drawable/icon", 
Theme = "@style/MainTheme", 
MainLauncher = true, 
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 

    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity 
    { 
     protected override void OnCreate(Bundle bundle) 
     { 
       TabLayoutResource = Resource.Layout.Tabbar; 
      ToolbarResource = Resource.Layout.Toolbar; 

      base.OnCreate(bundle); 

      global::Xamarin.Forms.Forms.Init(this, bundle); 
      LoadApplication(new App()); 
     } 
    } 
} 
+1

你可以在你的OnCreate(Bundle bundle)方法中添加一個try catch,並捕獲那裏有什麼異常。您也可以嘗試將事件處理程序設置爲AppDomain.CurrentDomain.UnhandledException + = CurrentDomain_UnhandledException;有關詳細信息,請參閱https://forums.xamarin.com/discussion/58002/what-is-the-preferred-way-to-catch-all-unhandled-exceptions-on-xamarin-forms –

+0

錯誤圖像的鏈接是破碎。另外,請將錯誤作爲文本添加到您的問題中,因爲圖像更難以使用。 – mhawke

回答

0

雖然它可能不是在給定的情景,但在我而言,當我試圖加載,這不是項目的一部分圖標的幫助,我得到的例外。 確保您沒有使用項目中不再存在的資源。

相關問題