When the application starts, I download the list from the local storage, if it is disconnected, or if there is a network connection, it will download this list from the web service (and then write to the local storage.
My problem is that in order to debug this, I have to completely close the application and then restart it (therefore terminating the visual studio debugging session)
The application will load, but when I call a specific method, as soon as the application starts, it will work. I can’t understand where his fall. and since the debugging session is no longer tied, this also does not help.
It’s strange. I even tried wrapping the method call and the contents of the method in a catch try block (trying to figure out what was wrong) and it still crashes.
Here is a snippet.
class MyCouncilsFragment:Fragment { public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
And this is a method called
public static void loadLists() { try { // // _| _|_| _|_| _|_|_| // // _| _| _| _| _| _| _| // // _| _| _| _|_|_|_| _| _| // // _| _| _| _| _| _| _| // // _|_|_|_| _|_| _| _| _|_|_| if (MyGlobals.sessionCouncil != null) { var connectivityManager = (ConnectivityManager)context.GetSystemService(ConnectivityService); var activeConnection = connectivityManager.ActiveNetworkInfo; if (activeConnection != null && activeConnection.IsConnected) { loadConsentsFromWeb(); Console.WriteLine("getting inspectiontypes online"); loadInspectionTypesOnline(); } else { try { loadConsentsFromFile(); loadInspectionTypesOffline(); } catch { Toast.MakeText(context, "Unable to load consents from file", ToastLength.Long).Show(); } } try { loadBookings(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } else { //inspection types failed to load from file or from web. propmt user to reaload app? or something? Toast.MakeText(context, "Definition Elements failed to load, please restart the app", ToastLength.Short).Show(); System.Environment.Exit(0); } } catch { } }
Note: I tried putting the whole method in a try block, and the application still crashes
source share