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

[MAUI] Crashes on .NET 9 #116

Open
daltzctr opened this issue Sep 11, 2024 · 0 comments · May be fixed by #118
Open

[MAUI] Crashes on .NET 9 #116

daltzctr opened this issue Sep 11, 2024 · 0 comments · May be fixed by #118

Comments

@daltzctr
Copy link

daltzctr commented Sep 11, 2024

Platform (please complete the following information):

  • OS: Android and iOS

Describe the bug
Whenever an instance of Sharpnado tabs is initialized and connected to a view, it crashes the application with XAML issues.

To Reproduce

  1. Create a MAUI .NET 9 project
  2. Add the Sharpnado nuget
  3. Initialize tabs, no item source is necessary
    4
    Exceptions (if applicable)
Unhandled managed exception: Exception has been thrown by the target of an invocation. (System.Reflection.TargetInvocationException)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
   at System.RuntimeType.CreateInstanceMono(Boolean nonPublic, Boolean wrapExceptions)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Microsoft.Maui.Controls.Xaml.CreateValuesVisitor.Visit(ElementNode node, INode parentNode)
   at Microsoft.Maui.Controls.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode)
   at Microsoft.Maui.Controls.Xaml.ApplyPropertiesVisitor.<>c__DisplayClass43_0.<SetTemplate>b__0()
   at Microsoft.Maui.Controls.ElementTemplate.CreateContent()
at Sharpnado.Tabs.TabHostView.CreateTabItem(Object item)
   at Sharpnado.Tabs.TabHostView.InitializeItems()
   at Sharpnado.Tabs.TabHostView.UpdateItemsSource()
   at Sharpnado.Tabs.TabHostView.OnPropertyChanged(String propertyName)
   at Microsoft.Maui.Controls.BindableObject.OnBindablePropertySet(BindableProperty property, Object original, Object value, Boolean didChange, Boolean willFirePropertyChanged)

This is likely due to the use of reflection based bindings in Sharpnado. This is no longer allowed in .NET 9 and all bindings must be compiled (or explicitly opted out with x:DataType={x:Null}.

This is due to references to obsolete code

@daltzctr daltzctr linked a pull request Sep 11, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant