-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An item with the same key has already been added. Key: Mopups.PreBaked.PopupPages.Loader.LoaderPopupPage #145
Comments
Same issue. Switched back to version 1.3.1 to see if it was present and it still crashes, same error. |
oh this issue was very commun in Rg.Popups. i remember creating another nuget just solved this issue :D |
@meopoc This is because you tried to open 2 popups with the same type, in this case "Mopups.PreBaked.PopupPages.Loader.LoaderPopupPage". This used to work a while ago, but now it fails in AndroidMopups.cs: public Task AddAsync(PopupPage page) accessibilityStates is a Dictionary, and uses the popup type as its key, hence we can't add more than 1 popup of the same type. I had to ditch mopups for those cases when I needed to display multiple popups of the same type, for example during async loading of several tasks when I want to close each popup when its task is done, not in the order they were opened. It would be nice if this was improved in a future release. |
@mf-noirsoft Thanks for the update. Did you manage to find a solution that looks the same as LoaderPopupPage? Of course I don;t want to use 2 visually different loading functionality in the same app? Thanks I've added a small delay between, which works, but this isn't ideal. |
@meopoc not really, I don't use LoaderPopupPage or any other PreBaked popups, I use my own popup page. What I did was switch my loader page to be shown using the community toolkit popups, which also allows to close specific modal pages, so visually nothing changed in my project. I'm yet to decide if I will be using mopups for the other popups, or just use the community toolkit. Good luck and hope you get the results you want! |
Hi,
I'm intermittently getting the following exception. I think it's when 2 LoaderPopupPages are loaded in quick succession.
System.ArgumentException: An item with the same key has already been added. Key: Mopups.PreBaked.PopupPages.Loader.LoaderPopupPage
File "AndroidMopups.cs", line 129, in void AndroidMopups.HandleAccessibility(bool showPopup, bool disableAccessibilityHandling, PopupPage popup)
accessibilityStates.Add(popup.GetType(), views);
File "AndroidMopups.cs", line 39, in Task AndroidMopups.AddAsync(PopupPage page)
HandleAccessibility(true, page.DisableAndroidAccessibilityHandling, page);
File "PopupNavigation.cs", line 73, in async Task PopupNavigation.PushAsync(PopupPage page, bool animate)+PushPage(?)
await PopupPlatform.AddAsync(page);
File "PreBakedMopupService.cs", line 260, in async void d__32.MoveNext()
await MainThread.InvokeOnMainThreadAsync(() => s_popupNavigation.PushAsync(popupModal));
File "SafeFireAndForgetExtensions.shared.cs", line 96, in async void d__16.MoveNext()
await task.ConfigureAwait(continueOnCapturedContext);
...
(7 additional frame(s) were not displayed)
Any ideas?
TIA
The text was updated successfully, but these errors were encountered: