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
With version 10.0.0 CommunityToolkit there is some change for AppThemeResourceExtension that causes only release build to crash. Debug builds run fine.
Error
Exception has occurred: System.ArgumentException
Value does not fall within the expected range. (Parameter 'serviceProvider')
at CommunityToolkit.Maui.Extensions.AppThemeResourceExtension.ProvideValue(IServiceProvider serviceProvider)
at MauiAppXyz.MainPage.InitializeComponent()
at MauiAppXyz.MainPage..ctor()
at System.Reflection.ConstructorInvoker.InterpretedInvoke(Object obj, IntPtr* args)
at System.Reflection.ConstructorInvoker.InvokeDirectByRefWithFewArgs(Span`1 copyOfArgs)
at System.Reflection.ConstructorInvoker.InvokeImpl(Object arg1, Object arg2, Object arg3, Object arg4)
at System.Reflection.ConstructorInvoker.Invoke(Span`1 arguments)
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
at Microsoft.Maui.Controls.ShellContent.<>c__DisplayClass20_0.<Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent>b__0()
at Microsoft.Maui.Controls.ElementTemplate.CreateContent()
at Microsoft.Maui.Controls.Internals.DataTemplateExtensions.CreateContent(DataTemplate self, Object item, BindableObject container)
at Microsoft.Maui.Controls.ShellContent.Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent()
at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.LoadRenderers()
at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.ViewDidLoad()
at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.__Registrar_Callbacks__.callback_131_Microsoft_Maui_Controls_Platform_Compatibility_ShellSectionRootRenderer_ViewDidLoad(IntPtr pobj, IntPtr sel, IntPtr* exception_gchandle)
It is most likely due to recent change [ContentProperty(nameof(Key)), RequireService([typeof(IServiceProvider)])] in AppThemeResourceExtension. I have tried registering IServiceProvider with default ServiceProvider and tried registering and resolving AppShell as mentioned in dependency-injection/limitations-with-xaml-resources
Work-around
Reverted nuget to 9.1.1
Expected Behavior
AppThemeResourceExtension should run fine in both debug and release configurations.
Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
Current Behavior
With version 10.0.0 CommunityToolkit there is some change for
AppThemeResourceExtension
that causes only release build to crash. Debug builds run fine.Error
Here is the reproducible sample
pmahend1/maui-toolkit-appresource-issue
It is most likely due to recent change
[ContentProperty(nameof(Key)), RequireService([typeof(IServiceProvider)])]
inAppThemeResourceExtension
. I have tried registering IServiceProvider with default ServiceProvider and tried registering and resolving AppShell as mentioned in dependency-injection/limitations-with-xaml-resourcesWork-around
Reverted nuget to
9.1.1
Expected Behavior
AppThemeResourceExtension should run fine in both debug and release configurations.
Steps To Reproduce
main
branch.Link to public reproduction project repository
https://github.com/pmahend1/maui-toolkit-appresource-issue
Environment
Anything else?
Reverting to v9.1.1 throws tens of warnings for XAML compiled binding and not having required-service everywhere
The text was updated successfully, but these errors were encountered: