Open Az6bcn opened 9 months ago
Hi, can you share the exception with stacktrace?
This is the stacktrace,
" at Microsoft.Maui.Controls.Xaml.ApplyPropertiesVisitor.SetPropertyValue(Object xamlelement, XmlName propertyName, Object value, Object rootElement, INode node, HydrationContext context, IXmlLineInfo lineInfo)\n at Microsoft.Maui.Controls.Xaml.ApplyPropertiesVisitor.Visit(ValueNode node, INode parentNode)\n at Microsoft.Maui.Controls.Xaml.ValueNode.Accept(IXamlNodeVisitor visitor, INode parentNode)\n at Microsoft.Maui.Controls.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode)\n at Microsoft.Maui.Controls.Xaml.RootNode.Accept(IXamlNodeVisitor visitor, INode parentNode)\n at Microsoft.Maui.Controls.Xaml.XamlLoader.Visit(RootNode rootnode, HydrationContext visitorContext, Boolean useDesignProperties)\n at Microsoft.Maui.Controls.Xaml.XamlLoader.Load(Object view, String xaml, Assembly rootAssembly, Boolean useDesignProperties)\n at Microsoft.Maui.Controls.Xaml.XamlLoader.Load(Object view, String xaml, Boolean useDesignProperties)\n at Microsoft.Maui.Controls.Xaml.XamlLoader.Load(Object view, Type callingType)\n at Microsoft.Maui.Controls.Xaml.Extensions.LoadFromXaml[MyPage](MyPage view, Type callingType)\n at MyApp.Views.MyPage.InitializeComponent() in /Users/Documents/Projects/Maui/MyApp/MyApp/Microsoft.Maui.Controls.SourceGen/Microsoft.Maui.Controls.SourceGen.CodeBehindGenerator/Views_MyPage.xaml.sg.cs:line 22\n at MyApp.Views.MyPage..ctor(MyViewModel viewModel) in /Users/Documents/Projects/Maui/MyApp/MyApp/Views/MyPage.xaml.cs:line 15\n at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags , Binder , Object[] , CultureInfo )\n at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite , RuntimeResolverContext )\n at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite , RuntimeResolverContext )\n at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite , RuntimeResolverContext )\n at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite , RuntimeResolverContext )\n at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite , ServiceProviderEngineScope )\n at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type )\n at System.Collections.Concurrent.ConcurrentDictionary`2[[System.Type, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Func`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope, Microsoft.Extensions.DependencyInjection, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetOrAdd(Type , Func`2 )\n at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type , ServiceProviderEngineScope )\n at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type )\n at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)\n at Microsoft.Maui.Controls.ShellContent.<>c__DisplayClass19_0.<Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent>b__0()\n at Microsoft.Maui.Controls.ElementTemplate.CreateContent()\n at Microsoft.Maui.Controls.Internals.DataTemplateExtensions.CreateContent(DataTemplate self, Object item, BindableObject container)\n at Microsoft.Maui.Controls.ShellContent.Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent()\n at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.LoadRenderers()\n at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.ViewDidLoad()\n at UIKit.UIApplication.UIApplicationMain(Int32 , String[] , IntPtr , IntPtr )\n at UIKit.UIApplication.Main(String[] , Type , Type )\n at MyApp.Program.Main(String[] args) in /Users/Documents/Projects/Maui/MyApp/MyApp/Platforms/iOS/Program.cs:line 13"
Both my Page and viewModel are registered
builder.Services.AddSingleton<MyViewModel>();
builder.Services.AddSingleton<MyPage>();
And this is the source generated code from the line its failing on when InitializeComponent() is called:
private void InitializeComponent()
{
global::Microsoft.Maui.Controls.Xaml.Extensions.LoadFromXaml(this, typeof(MyPage));
}
And am on .NET 7
I couldn't reproduce the same problem currently.
Are you using UranuimUI v2.5.6 on .NET 7?
This could be a duplicate of #540
I have not tested though
I have my Page inheriting from UraniumContentPage and I have done same in the xlml to use the bottom sheet in the attachment but it keeps throwing null reference exception (Object reference not set to an instance of an object) when InitializeComponent method is called.