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

iOS: App is crashing when using a CarouselView/CollectionView with AISettingsView #25

Closed
1 task
rdelrosario opened this issue Mar 23, 2024 · 2 comments
Closed
1 task

Comments

@rdelrosario
Copy link

rdelrosario commented Mar 23, 2024

Description

When using a CarouselView or a CollectionView it crashes because of this exception:

System.NullReferenceException: Object reference not set to an instance of an object.
at AiForms.Settings.Handlers.SettingsViewHandler.CreatePlatformView()
at Microsoft.Maui.Handlers.ViewHandler`2[[AiForms.Settings.SettingsView, SettingsView, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[AiForms.Settings.Platforms.iOS.AiTableView, SettingsView, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].OnCreatePlatformView()
at Microsoft.Maui.Handlers.ViewHandler.OnCreatePlatformElement()

The issue is happening because when calling the CreatePlatformView() the Parent is null (for this scenario it gets set later), this specific code is causing the crash:
_parentPage.Appearing += ParentPageAppearing

Steps to Reproduce

  1. Create an app with a CarouselView or CollectionView and add the AISettingsView in the content

Actual Behavior

The app is crashing

Platforms

  • Android
  • [x ] iOS

Basic Information

  • AiForms.SettingsView 1.0.8
  • MAUI 8.0.14
  • Affected Devices: All iOS devices

Reproduction Link

https://drive.google.com/file/d/15qU2K2TQsK20s-t10FoPRyLFVwnLM-_r/view?usp=sharing

Workaround

If you manually set the Parent in the xaml, it won't crash.
For example:

 <CarouselView x:Name="CarouselView">
        <CarouselView.ItemTemplate>
            <DataTemplate>
              <sv:SettingsView HasUnevenRows="true"
                               Parent="CarouselView">
              </sv:SettingsView>
            </DataTemplate>
          </CarouselView.ItemTemplate>
    </CarouselView>
Char0394 added a commit to CrossGeeks/AiForms.Maui.SettingsView that referenced this issue Apr 9, 2024
Fixing issue muak#25 iOS: App is crashing when using a CarouselView/CollectionView with AISettingsView
muak added a commit that referenced this issue Apr 9, 2024
Fix for issue #25

Thank you for your Pull Request!
@peterblazejewicz
Copy link

Looks like fixed with #26

@muak
Copy link
Owner

muak commented Jun 2, 2024

Thanks for @Char0394 @peterblazejewicz
This issue was fixed.

@muak muak closed this as completed Jun 2, 2024
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

No branches or pull requests

3 participants