Using sample Todo App and deleting last todo item causes Unhandled exception - Value cannot be null Parameter name: item
See original GitHub issueThe walkthrough for the Todo App references the sample in this repo.
https://docs.microsoft.com/en-gb/mobile-blazor-bindings/walkthroughs/todo-app
https://github.com/dotnet/MobileBlazorBindings/tree/main/samples/MobileBlazorBindingsTodoSample
If I delete the last item in the list I will get an Unhandled exception - Value cannot be null Parameter name: item on emulated Android Pixel 2 Q 10.0 - API 29.
It also occurs if I enter the last item in the list, press cancel, access any other value in the list and press delete.

Emulated device:

I Initially thought it was due to await contentPage.PopModalAsync(); in method OnDeleteClick in file TodoEntryDetails.razor but it happens if this code is commented out as well.
It does work If I place the delete button in TodoEntry.razor instead of TodoEntryDetails.razor. Then tried removing todoEntryDialog.FinishClosingDialog(); in OnDetailsClosed but that did not help. My guess is it has something to do with ModalContainer.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)

Top Related StackOverflow Question
@Eilon Perfect! Yes the
ModalContaineris a nice experiment but it needs some work. 😃 When I placed the delete button inTodoEntry.razorand accessed details for an item and then removed that item the same bug appears. Happens on iPhone simulator and local device as well.Hmm yes, the ModalContainer control is… hacky… at best! It was an experiment on how to go between Blazor and Xamarin.Forms and back again, and it works great… until it doesn’t 😄 We’ll have to take a look at this to see what’s going on.