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

HasUnevenRows=True and Image in ItemTemplate causes InvalidOperationException #7964

Closed
ThuCommix opened this issue Jun 12, 2022 · 8 comments
Closed
Labels
area-controls-listview ListView and TableView p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/iOS 🍎 s/needs-info Issue needs more info from the author s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@ThuCommix
Copy link

ThuCommix commented Jun 12, 2022

Description

If I enable HasUnevenRows, and my ItemTemplate contains an Image the app crashes with a invalid operation exception.

Minimal repro:
MauiApp1.zip

If you disable HasUnevenRows the ListView works again.

Steps to Reproduce

  1. Debug the attached project.

Version with bug

6.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 15

Did you find any workaround?

  • Disabling HasUnevenRows

Relevant log output

System.InvalidOperationException: PlatformView cannot be null here
   at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IImage, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[UIKit.UIImageView, Microsoft.iOS, Version=15.4.300.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]].get_PlatformView()
   at Microsoft.Maui.Handlers.ImageHandler.DisconnectHandler(UIImageView platformView)
   at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IImage, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[UIKit.UIImageView, Microsoft.iOS, Version=15.4.300.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]].OnDisconnectHandler(UIView platformView)
   at Microsoft.Maui.Handlers.ViewHandler.OnDisconnectHandler(Object platformView)
   at Microsoft.Maui.Handlers.ElementHandler.DisconnectHandler(Object platformView)
   at Microsoft.Maui.Handlers.ElementHandler.Microsoft.Maui.IElementHandler.DisconnectHandler()
   at Microsoft.Maui.Controls.Handlers.Compatibility.ListViewRenderer.UnevenListViewDataSource.CalculateHeightForCell(UITableView tableView, Cell cell)
   at Microsoft.Maui.Controls.Handlers.Compatibility.ListViewRenderer.UnevenListViewDataSource.GetEstimatedRowHeight(UITableView table)
   at Microsoft.Maui.Controls.Handlers.Compatibility.ListViewRenderer.UnevenListViewDataSource.UpdateEstimatedRowHeight(UITableView tableView)
   at Microsoft.Maui.Controls.Handlers.Compatibility.ListViewRenderer.ListViewDataSource.DetermineEstimatedRowHeight()
   at Microsoft.Maui.Controls.Handlers.Compatibility.FormsUITableViewController.ViewWillLayoutSubviews()
   at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)
   at MauiApp1.Program.Main(String[] args) in /Users/kevin/Projects/MauiApp1/MauiApp1/Platforms/iOS/Program.cs:line 12
@ThuCommix ThuCommix added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Jun 12, 2022
@ThuCommix ThuCommix changed the title HasUnevenRows=True and Image in ItemTemplate causes NullRef HasUnevenRows=True and Image in ItemTemplate causes InvalidOperationException Jun 12, 2022
@MattSullivanRio
Copy link

MattSullivanRio commented Jun 13, 2022

I can confirm I am having the same issues. It's worth noting however that it's not isolated to images. I've had a listview containing nothing but labels encounter this issue. I believe it occurs for all uneven rows, but I may be wrong there. Disabling HasUnevenRows fixes the issue.

@jfversluis jfversluis added platform/iOS 🍎 area-controls-listview ListView and TableView and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Jun 13, 2022
@hartez hartez added this to the 6.0-servicing milestone Jun 13, 2022
@kristinx0211 kristinx0211 added the s/verified Verified / Reproducible Issue ready for Engineering Triage label Jun 15, 2022
@kristinx0211
Copy link

confirm this on IOS as describe above.

@samhouts samhouts added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Jul 12, 2022
@gavinb80
Copy link

gavinb80 commented Jul 12, 2022

Can confirm I have the same issue with builds for Mac, iPhone and Android.

The following works as expected:

            <ListView
                ItemsSource="{Binding IncidentCategories}"
                VerticalOptions="FillAndExpand">

The following causes a crash:

            <ListView
                ItemsSource="{Binding IncidentCategories}"
                HasUnevenRows="True"
                VerticalOptions="FillAndExpand">

Crash log:

System.InvalidOperationException: PlatformView cannot be null here
  at at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IImage, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[UIKit.UIImageView, Microsoft.MacCatalyst, Version=15.4.300.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]].get_PlatformView()
  at at Microsoft.Maui.Handlers.ImageHandler.DisconnectHandler(UIImageView platformView)
  at at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IImage, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[UIKit.UIImageView, Microsoft.MacCatalyst, Version=15.4.300.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]].OnDisconnectHandler(UIView platformView)
  at at Microsoft.Maui.Handlers.ViewHandler.OnDisconnectHandler(Object platformView)
  at at Microsoft.Maui.Handlers.ElementHandler.DisconnectHandler(Object platformView)
  at at Microsoft.Maui.Handlers.ElementHandler.Microsoft.Maui.IElementHandler.DisconnectHandler()
  at at Microsoft.Maui.Controls.Handlers.Compatibility.ListViewRenderer.UnevenListViewDataSource.CalculateHeightForCell(UITableView tableView, Cell cell)
  at at Microsoft.Maui.Controls.Handlers.Compatibility.ListViewRenderer.UnevenListViewDataSource.GetEstimatedRowHeight(UITableView table)
  at at Microsoft.Maui.Controls.Handlers.Compatibility.ListViewRenderer.UnevenListViewDataSource.UpdateEstimatedRowHeight(UITableView tableView)
  at at Microsoft.Maui.Controls.Handlers.Compatibility.ListViewRenderer.ListViewDataSource.DetermineEstimatedRowHeight()
  at at Microsoft.Maui.Controls.Handlers.Compatibility.FormsUITableViewController.ViewWillLayoutSubviews()
  at at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)
  at DsfrsApp.Program.Main(String[] args) in /Users/xxx/Projects/DsfrsApp/DsfrsApp/Platforms/MacCatalyst/Program.cs:13

If I remove the image from the stack, it works just fine as well

@hartez hartez removed the fatal label Aug 1, 2022
@techresidential
Copy link

techresidential commented Aug 3, 2022

Just in case anyone else is stumbling across this error with ListView+HasUnevenRows+iOS: using the CollectionView is a better way to go.

@Redth Redth modified the milestones: 6.0-servicing, Backlog Aug 30, 2022
@ghost
Copy link

ghost commented Aug 30, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@jsuarezruiz
Copy link
Contributor

Cannot reproduce the issue using the current main branch or 6.0.525 workloads.

Captura de Pantalla 2022-09-08 a las 12 21 49

Could you try again with latest version?

@jsuarezruiz jsuarezruiz added the s/needs-info Issue needs more info from the author label Sep 8, 2022
@ghost
Copy link

ghost commented Sep 8, 2022

Hi @ThuCommix. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@ThuCommix
Copy link
Author

Hi @jsuarezruiz, I've checked again on it and it works on the latest workload. Thanks.

@ghost ghost locked as resolved and limited conversation to collaborators Oct 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-listview ListView and TableView p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/iOS 🍎 s/needs-info Issue needs more info from the author s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants