Currently in the process of trying to build a simple app, I want to create an object using Sqlite and then navigate back to overview so I can see the created item in my listview.
Creating the objects and storing works fine, but I'm getting a System.ArgumentOutOfRangeException when trying to navigate back to the overview.
The weird thing is, that when I restart the app my model is correctly shown in the table. Meaning that it did in fact get created.
Code as follows:
// Code in viewModel
async Task Store()
{
// Do some db operations
await Shell.Current.GoToAsync($"/dashboard");
}
It works fine the first time I navigate but after the second time I will get the following error:
\*\*System.ArgumentOutOfRangeException:\*\* 'Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index'
I've tried to put the navigation part in a try/catch block but with no success.
I don't understand why it works the first time but not the second time around.