GoToAsync Failed With Java.Lang.IllegalStateException

Fan Yang 0 Reputation points
2024-06-21T19:12:56.94+00:00

In my ViewModel, I had a relaycommand to navigation another page:

[RelayCommand]
public async Task ReviewIt () {
   ...
   await Shell.Current.GoToAsync(nameof(ReviewItView), new Dictionary<string, object>{
       ["key1"] = value1,
       ["key2"] = value2
   });
}

but it ends with exception:
Java.Lang.IllegalStateException: 'The specified child already has a parent. You must call removeView() on the child's parent first.'

how to fix this?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,141 questions
{count} votes