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
To migrate our Xamarin Forms apps over, we need to be able to change the app shell at runtime. We have different layout structures that are very complex and divide them according to appshells.
Currently, when switching the AppShell, we get the following error attached to the log
app shells
Steps to Reproduce
Application.Current.MainPage = new AppShell();
then change it to another app shell.
Error:
No service for type 'Microsoft.Maui.Controls.Hosting.EffectsFactory' has been registered.
We can change the MainPage to another ContentPage after an AppShell was previously set, but but an AppShell
{System.InvalidOperationException: No service fortype'Microsoft.Maui.Controls.Hosting.EffectsFactory' has been registered.
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[EffectsFactory](IServiceProvider provider)
at Microsoft.Maui.Controls.Element.get_EffectsFactory() in D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:line 854
at Microsoft.Maui.Controls.Element.Microsoft.Maui.Controls.IEffectControlProvider.RegisterEffect(Effect effect) in D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:line 940
at Microsoft.Maui.Controls.Element.AttachEffect(Effect effect) in D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:line 728
at Microsoft.Maui.Controls.Element.set_EffectControlProvider(IEffectControlProvider value) in D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:line 407
at Microsoft.Maui.Controls.Element.OnHandlerChangedCore() in D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:line 883
at Microsoft.Maui.Controls.VisualElement.OnHandlerChangedCore() in D:\a\_work\1\s\src\Controls\src\Core\VisualElement\VisualElement.cs:line 1714
at Microsoft.Maui.Controls.View.OnHandlerChangedCore() in D:\a\_work\1\s\src\Controls\src\Core\View\View.cs:line 279
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) in D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:line 923
at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:line 863
at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\VisualElement\VisualElement.cs:line 2031
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:line 96
at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:line 127
at Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView(IView view) in D:\a\_work\1\s\src\Core\src\Handlers\Layout\LayoutHandler.Android.cs:line 41
at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.ILayout, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.LayoutViewGroup, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 56 at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) in D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:line 921 at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:line 863 at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\VisualElement\VisualElement.cs:line 2031 at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:line 96 at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:line 127 at Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView(IView view) in D:\a\_work\1\s\src\Core\src\Handlers\Layout\LayoutHandler.Android.cs:line 41 at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.ILayout, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.LayoutViewGroup, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 56
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) in D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:line 921
at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:line 863
at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\VisualElement\VisualElement.cs:line 2031
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:line 96
at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:line 127
at Microsoft.Maui.Handlers.ContentViewHandler.UpdateContent(IContentViewHandler handler) in D:\a\_work\1\s\src\Core\src\Handlers\ContentView\ContentViewHandler.Android.cs:line 42
at Microsoft.Maui.Handlers.ContentViewHandler.MapContent(IContentViewHandler handler, IContentView page) in D:\a\_work\1\s\src\Core\src\Handlers\ContentView\ContentViewHandler.Android.cs:line 47
at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Handlers.IContentViewHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<Add>b__0(IElementHandler h, IElement v) in D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:line 172 at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView) in D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:line 47 at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView) in D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:line 82 at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view) in D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:line 79 at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.ContentViewGroup, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IView view) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 53
at Microsoft.Maui.Handlers.ContentViewHandler.SetVirtualView(IView view) in D:\a\_work\1\s\src\Core\src\Handlers\ContentView\ContentViewHandler.Android.cs:line 26
at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.ContentViewGroup, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 56 at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) in D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:line 921 at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\Element\Element.cs:line 863 at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\VisualElement\VisualElement.cs:line 2031 at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:line 96 at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:line 127 at Microsoft.Maui.Controls.Platform.Compatibility.ShellViewRenderer.OnViewSet(IView view) in D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\Android\ShellContentView.cs:line 118 at Microsoft.Maui.Controls.Platform.Compatibility.ShellViewRenderer.set_View(IView value) in D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\Android\ShellContentView.cs:line 48 at Microsoft.Maui.Controls.Platform.Compatibility.ShellViewRenderer..ctor(Context context, View view, IMauiContext mauiContext) in D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\Android\ShellContentView.cs:line 40 at Microsoft.Maui.Controls.Platform.Compatibility.ContainerView.OnViewSet(View view) in D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\Android\ContainerView.cs:line 181 at Microsoft.Maui.Controls.Platform.Compatibility.ContainerView.set_View(View value) in D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\Android\ContainerView.cs:line 43 at Microsoft.Maui.Controls.Platform.Compatibility.ContainerView..ctor(Context context, View view, IMauiContext mauiContext) in D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\Android\ContainerView.cs:line 25 at Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutTemplatedContentRenderer.HeaderContainer..ctor(Context context, View view, IMauiContext mauiContext) in D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\Android\ShellFlyoutTemplatedContentRenderer.cs:line 683 at Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutTemplatedContentRenderer.UpdateFlyoutHeader() in D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\Android\ShellFlyoutTemplatedContentRenderer.cs:line 272 at Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutTemplatedContentRenderer.LoadView(IShellContext shellContext) in D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\Android\ShellFlyoutTemplatedContentRenderer.cs:line 92 at Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutTemplatedContentRenderer..ctor(IShellContext shellContext) in D:\a\_work\1\s\src\Controls\src\Core\
The text was updated successfully, but these errors were encountered:
Description
To migrate our Xamarin Forms apps over, we need to be able to change the app shell at runtime. We have different layout structures that are very complex and divide them according to appshells.
Currently, when switching the AppShell, we get the following error attached to the log
app shells
Steps to Reproduce
Application.Current.MainPage = new AppShell();
then change it to another app shell.
Error:
No service for type 'Microsoft.Maui.Controls.Hosting.EffectsFactory' has been registered.
We can change the MainPage to another ContentPage after an AppShell was previously set, but but an AppShell
#16067
The issue above outlines the same issue, unsure why it was closed.
Link to public reproduction project repository
#16067 (comment)
Version with bug
8.0.7 SR2
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
iOS, Android
Affected platform versions
Android 13, iOS 16
Did you find any workaround?
No workaround yet
Relevant log output
The text was updated successfully, but these errors were encountered: