Quantcast
Channel: Active questions tagged crash - Stack Overflow
Viewing all articles
Browse latest Browse all 7199

Xamarin app crashes suddenly while using a poor connection

$
0
0

When my app suffers connection issues, it crashes suddenly and throws no exceptions. I have putted microsoft app center plugin and this is the crash report:

Xamarin Exception Stack:System.NullReferenceException: Object reference not set to an instance of an object  at Project.XAML.AtendimentosUser.GetData (System.Collections.Specialized.NameValueCollection data) [0x000f3] in <8ee15104665a463180bbffb742ed9570>:0  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in <0db975f2d36842718f4da4da36d2fcb7>:0  at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <c2957c7ec1ac46f688b7f30f24232572>:0  at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <c2957c7ec1ac46f688b7f30f24232572>:0  at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <c2957c7ec1ac46f688b7f30f24232572>:0  at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.35(intptr,intptr)

Code of method AtendimentosUser.GetData:

async void GetData(NameValueCollection data){    /* try {  */        StackListagem.IsVisible = false;        SemResultados.IsVisible = false;        LoadingItems.IsRunning = true;        LoadingContainer.IsVisible = true;        WebService client = new WebService();        agendamentos = await Task.Run(() => client.PostData<List<Agendamento>>(url, data, debug: true));        LoadingContainer.IsVisible = false;        LoadingItems.IsRunning = false;        if (agendamentos.Count > 0)        {            LabelListagem.Text = "Você tem " + agendamentos.Count +" agendamento(s) para " + ((Mes)PickerMes.SelectedItem).label +" de " + PickerAno.SelectedItem;            ListagemAgendamento.ItemsSource = agendamentos;            StackListagem.IsVisible = true;        }        else        {            CaptionTxt.Text = "Você não possui agendamentos" + Environment.NewLine +" para " + ((Mes)PickerMes.SelectedItem).label +" de " + PickerAno.SelectedItem;            SemResultados.IsVisible = true;        }    /* } catch  { GetData(data); } */}

I just added the try/catch but I don't know if this will correctly handle the problem.

Do you guys see what can be causing this issue?


Viewing all articles
Browse latest Browse all 7199

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>