Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] Invalid TabBar.Items access in iOS ShellItemRenderer #6184

Closed
Dresel opened this issue May 13, 2019 · 4 comments · Fixed by #9781
Closed

[Bug] Invalid TabBar.Items access in iOS ShellItemRenderer #6184

Dresel opened this issue May 13, 2019 · 4 comments · Fixed by #9781
Labels
4.0.0 regression on 4.0.0 a/shell 🐚 blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. e/2 🕑 2 help wanted We welcome community contributions to any issue, but these might be a good place to start! i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often in-progress This issue has an associated pull request that may resolve it! p/iOS 🍎 t/bug 🐛 up-for-grabs We welcome community contributions to any issue, but these might be a good place to start!
Milestone

Comments

@Dresel
Copy link
Contributor

Dresel commented May 13, 2019

Description

iOS ShellItemRenderer accesses TabBar.Items to enable / disable items. If there are more shell sections than maxTabs, it could lead to an index out of range exception because they are aggregated in a single "show more" item.

Steps to Reproduce

  1. Create shell project
  2. Create additional shell sections
  3. Set shell section to IsEnabled false to trigger array access
  4. Start app
<!-- Your Pages -->
<ShellItem>
    <ShellSection Title="Browse" Icon="tab_feed.png">
        <ShellContent ContentTemplate="{DataTemplate local:ItemsPage}" />
    </ShellSection>
    <ShellSection Title="About" Icon="tab_about.png">
        <ShellContent ContentTemplate="{DataTemplate local:AboutPage}" />
    </ShellSection>
    <ShellSection Title="Browse" Icon="tab_feed.png">
        <ShellContent ContentTemplate="{DataTemplate local:ItemsPage}" />
    </ShellSection>
    <ShellSection Title="About" Icon="tab_about.png">
        <ShellContent ContentTemplate="{DataTemplate local:AboutPage}" />
    </ShellSection>
    <ShellSection Title="Browse" Icon="tab_feed.png">
        <ShellContent ContentTemplate="{DataTemplate local:ItemsPage}" />
    </ShellSection>
    <ShellSection Title="About" Icon="tab_about.png">
        <ShellContent ContentTemplate="{DataTemplate local:AboutPage}" />
    </ShellSection>
    <ShellSection Title="Browse" Icon="tab_feed.png">
        <ShellContent ContentTemplate="{DataTemplate local:ItemsPage}" />
    </ShellSection>
    <ShellSection Title="About" Icon="tab_about.png" IsEnabled="False">
        <ShellContent ContentTemplate="{DataTemplate local:AboutPage}" />
    </ShellSection>
</ShellItem>

Expected Behavior

No exception. You might also have to fiddle with the UIMoreNavigationController to disable particular items there.

Actual Behavior

Exception.

@Dresel Dresel added s/unverified New report that has yet to be verified t/bug 🐛 labels May 13, 2019
@samhouts
Copy link
Member

@Dresel Can you please attach a small project that demonstrates this issue? Thanks!

@samhouts samhouts added s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one. labels May 14, 2019
@Dresel
Copy link
Contributor Author

Dresel commented May 20, 2019

Repo6184.zip

As mentioned, crashes here.

@samhouts samhouts added i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often and removed s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one. labels May 30, 2019
@samhouts samhouts added this to the 4.0.0 milestone May 30, 2019
@samhouts samhouts added e/2 🕑 2 and removed s/unverified New report that has yet to be verified labels Jun 1, 2019
@samhouts samhouts added the 4.0.0 regression on 4.0.0 label Sep 12, 2019
@samhouts samhouts removed this from the 4.0.0 milestone Sep 12, 2019
@samhouts samhouts added inactive Issue is older than 6 months and needs to be retested help wanted We welcome community contributions to any issue, but these might be a good place to start! labels Nov 16, 2019
@pictos
Copy link
Contributor

pictos commented Feb 27, 2020

This still happens, so @samhouts can I work on this issue?

@PureWeen
Copy link
Contributor

@pictos Yes!!

@samhouts samhouts removed the inactive Issue is older than 6 months and needs to be retested label Feb 27, 2020
pictos added a commit to pictos/Xamarin.Forms that referenced this issue Feb 29, 2020
@samhouts samhouts added the in-progress This issue has an associated pull request that may resolve it! label Feb 29, 2020
pictos added a commit to pictos/Xamarin.Forms that referenced this issue Mar 4, 2020
 into xamaringh-6184

# Conflicts:
#	Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
pictos added a commit to pictos/Xamarin.Forms that referenced this issue Apr 4, 2020
@samhouts samhouts added this to the 5.0.0 milestone Aug 13, 2020
@samhouts samhouts added inactive Issue is older than 6 months and needs to be retested up-for-grabs We welcome community contributions to any issue, but these might be a good place to start! and removed inactive Issue is older than 6 months and needs to be retested labels Sep 18, 2020
@PureWeen PureWeen added the blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. label Nov 2, 2020
PureWeen added a commit to pictos/Xamarin.Forms that referenced this issue Nov 6, 2020
rmarinho pushed a commit that referenced this issue Nov 16, 2020
…iOS] (#9781)

* Fixed the mess-up

* Fix merge conflict and UITest

* Update Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue6184.xaml.cs

Co-authored-by: Shane Neuville <shneuvil@microsoft.com>

* Added information on how to run the test

* Improviments in the code and prevent crash on iOS14 or newer

* make sure that Forms is into the commit

* code style fix

* - fix for iOS14

* - change pages

* - fix delegate

* - fix cast exception

* - retain default text color

* - add page numbers

* - fix

* - reduce number of more

Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4.0.0 regression on 4.0.0 a/shell 🐚 blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. e/2 🕑 2 help wanted We welcome community contributions to any issue, but these might be a good place to start! i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often in-progress This issue has an associated pull request that may resolve it! p/iOS 🍎 t/bug 🐛 up-for-grabs We welcome community contributions to any issue, but these might be a good place to start!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants