You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
@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)
{
HandleAccessibility(true, page.DisableAndroidAccessibilityHandling, page);
...
//! important keeps reference to pages that accessibility has applied to. This is so accessibility can be removed properly when popup is removed. ##93
readonly Dictionary<Type, List<Android.Views.View>> accessibilityStates = new();
void HandleAccessibility(bool showPopup, bool disableAccessibilityHandling, PopupPage popup)
{
...
accessibilityStates.Add(popup.GetType(), views);
...
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.
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: