Skip to content
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

App.Current.Resources.MergedDictionaries.Add Unavailable switch the second time #11334

Open
fanhai opened this issue Nov 14, 2022 · 7 comments
Open
Labels
area-xaml XAML, CSS, Triggers, Behaviors platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@fanhai
Copy link

fanhai commented Nov 14, 2022

Description

image
image

Steps to Reproduce

  1. click switch
  2. click switch

Link to public reproduction project repository

null

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

net7.0-windows10.0.19041.0

Did you find any workaround?

No response

Relevant log output

No response

@fanhai fanhai added the t/bug Something isn't working label Nov 14, 2022
@fanhai
Copy link
Author

fanhai commented Nov 14, 2022

at Microsoft.Maui.Controls.VisualElement.OnParentResourcesChanged(IEnumerable1 values) in D:\a\_work\1\s\src\Controls\src\Core\VisualElement.cs:line 1051 at Microsoft.Maui.Controls.Element.OnParentResourcesChanged(Object sender, ResourcesChangedEventArgs e) in D:\a\_work\1\s\src\Controls\src\Core\Element.cs:line 437 at Microsoft.Maui.Controls.Element.OnResourcesChanged(IEnumerable1 values) in D:\a_work\1\s\src\Controls\src\Core\Element.cs:line 500
at Microsoft.Maui.Controls.Element.OnParentResourcesChanged(IEnumerable1 values) in D:\a\_work\1\s\src\Controls\src\Core\Element.cs:line 442 at Microsoft.Maui.Controls.VisualElement.OnParentResourcesChanged(IEnumerable1 values) in D:\a_work\1\s\src\Controls\src\Core\VisualElement.cs:line 1039
at Microsoft.Maui.Controls.Element.OnParentResourcesChanged(Object sender, ResourcesChangedEventArgs e) in D:\a_work\1\s\src\Controls\src\Core\Element.cs:line 437
at Microsoft.Maui.Controls.Element.OnResourcesChanged(IEnumerable1 values) in D:\a\_work\1\s\src\Controls\src\Core\Element.cs:line 500 at Microsoft.Maui.Controls.Element.OnParentResourcesChanged(IEnumerable1 values) in D:\a_work\1\s\src\Controls\src\Core\Element.cs:line 442
at Microsoft.Maui.Controls.Element.OnParentResourcesChanged(Object sender, ResourcesChangedEventArgs e) in D:\a_work\1\s\src\Controls\src\Core\Element.cs:line 437
at Microsoft.Maui.Controls.Element.OnResourcesChanged(IEnumerable1 values) in D:\a\_work\1\s\src\Controls\src\Core\Element.cs:line 500 at Microsoft.Maui.Controls.Element.OnResourcesChanged(Object sender, ResourcesChangedEventArgs e) in D:\a\_work\1\s\src\Controls\src\Core\Element.cs:line 459 at Microsoft.Maui.Controls.ResourceDictionary.OnValuesChanged(KeyValuePair2[] values) in D:\a_work\1\s\src\Controls\src\Core\ResourceDictionary.cs:line 342
at Microsoft.Maui.Controls.ResourceDictionary.MergedDictionaries_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in D:\a_work\1\s\src\Controls\src\Core\ResourceDictionary.cs:line 109
at System.Collections.ObjectModel.ObservableCollection1[[Microsoft.Maui.Controls.ResourceDictionary, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].OnCollectionChanged(NotifyCollectionChangedEventArgs e) at System.Collections.ObjectModel.ObservableCollection1[[Microsoft.Maui.Controls.ResourceDictionary, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].OnCollectionChanged(NotifyCollectionChangedAction action, Object item, Int32 index)
at System.Collections.ObjectModel.ObservableCollection1[[Microsoft.Maui.Controls.ResourceDictionary, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].InsertItem(Int32 index, ResourceDictionary item) at System.Collections.ObjectModel.Collection1[[Microsoft.Maui.Controls.ResourceDictionary, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Add(ResourceDictionary item)
at Maons.Languages.SwitchLan(String lang) in C:\Users\fanhai\go\src\github.com\asmbio\Maons\MauiApp3\Languages.cs:line 50
at Maons.my.Mysetup.Picker_SelectedIndexChanged(Object sender, EventArgs e) in C:\Users\fanhai\go\src\github.com\asmbio\Maons\MauiApp3\my\Mysetup.xaml.cs:line 30
at Microsoft.Maui.Controls.Picker.OnSelectedIndexChanged(Object bindable, Object oldValue, Object newValue) in D:\a_work\1\s\src\Controls\src\Core\Picker.cs:line 327
at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent) in D:\a_work\1\s\src\Controls\src\Core\BindableObject.cs:line 535
at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes) in D:\a_work\1\s\src\Controls\src\Core\BindableObject.cs:line 469
at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value, Boolean fromStyle, Boolean checkAccess) in D:\a_work\1\s\src\Controls\src\Core\BindableObject.cs:line 391
at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value) in D:\a_work\1\s\src\Controls\src\Core\BindableObject.cs:line 365
at Microsoft.Maui.Controls.Picker.set_SelectedIndex(Int32 value) in D:\a_work\1\s\src\Controls\src\Core\Picker.cs:line 146
at Microsoft.Maui.Handlers.PickerHandler.b__16_1(Object s, DialogClickEventArgs e) in D:\a_work\1\s\src\Core\src\Handlers\Picker\PickerHandler.Android.cs:line 138
at Android.Content.IDialogInterfaceOnClickListenerImplementor.OnClick(IDialogInterface dialog, Int32 which) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net7.0/android-33/mcw/Android.Content.IDialogInterface.cs:line 251
at Android.Content.IDialogInterfaceOnClickListenerInvoker.n_OnClick_Landroid_content_DialogInterface_I(IntPtr jnienv, IntPtr native__this, IntPtr native_dialog, Int32 which) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net7.0/android-33/mcw/Android.Content.IDialogInterface.cs:line 203
at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLI_V(_JniMarshal_PPLI_V callback, IntPtr jnienv, IntPtr klazz, IntPtr p0, Int32 p1) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:line 165

@jsuarezruiz jsuarezruiz added platform/windows 🪟 area-xaml XAML, CSS, Triggers, Behaviors s/needs-repro Attach a solution or code which reproduces the issue labels Nov 14, 2022
@ghost
Copy link

ghost commented Nov 14, 2022

Hi @fanhai. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@fanhai
Copy link
Author

fanhai commented Nov 15, 2022

https://github.com/asmbio/Maons.git

MauiApp1 and MauiApp3 are used for testing. You can uninstall others

image

MauiApp3: Error will be reported when switching
MauiApp1: No error will be reported when switching, but the switching is invalid
Key code location: Title="{StaticResource switchlan}"

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Nov 15, 2022
@fanhai
Copy link
Author

fanhai commented Nov 15, 2022

MauiApp3: Step

image

@jsuarezruiz jsuarezruiz removed the s/needs-attention Issue has more information and needs another look label Nov 15, 2022
@jsuarezruiz jsuarezruiz added this to the Backlog milestone Nov 15, 2022
@ghost
Copy link

ghost commented Nov 15, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@Zhanglirong-Winnie Zhanglirong-Winnie added s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage labels May 31, 2023
@Zhanglirong-Winnie
Copy link

Verified this issue with Visual Studio 17.7.0 Preview 1.0. Can repro on windows platform with sample project.
Maons-main.zip
MauiApp1:
Mauiapp1
MauiApp3:
Mauiapp3

@Neo-CP
Copy link

Neo-CP commented Nov 25, 2023

I have the same error on Android in .Net 8 and VS 17.8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-xaml XAML, CSS, Triggers, Behaviors platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants