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

TabView crashed on second Loaded event #1245

Closed
eugenegff opened this issue Aug 30, 2019 · 2 comments · Fixed by #1482
Closed

TabView crashed on second Loaded event #1245

eugenegff opened this issue Aug 30, 2019 · 2 comments · Fixed by #1482
Assignees
Labels
area-TabView bug Something isn't working team-Controls Issue for the Controls team

Comments

@eugenegff
Copy link
Contributor

eugenegff commented Aug 30, 2019

Describe the bug
TabView crashed on second Loaded event if databound, duplicates count of tab items if not databound.

Steps to reproduce the bug

TabViewCrash.zip

  1. Unzip, build and run attached TabViewCrash project
  2. Click on 'Navigate Forward from MainPage to TestPage' button.
    There would be databound TabView with "Tab 1" and "Tab 2" tabs,
    and another not databound one with "Tab 11" and "Tab 12" tabs.
    Note that width of tabs is not equal - separate issue.
  3. Click on 'Navigate Backward from TestPage to MainPage' button.
  4. Click on 'Navigate Forward from MainPage to TestPage' button again
    Crash in TabView::OnListViewLoaded for databound TabView.
    If first databound TabView would be commented out - there would be no crash, but tab count of second TabView would be duplicated.

Expected behavior
Results of second navigation to TestPage results should be the same as results of first navigation, i.e.
there should be databound TabView with "Tab 1" and "Tab 2" tabs,
and another not databound one with "Tab 11" and "Tab 12" tabs.

Screenshots
TabViewCrashScreenshot

Version Info

NuGet package version:
Microsoft.UI.Xaml 2.2.190822001-prerelease

Windows 10 version Saw the problem?
Insider Build (xxxxx)
May 2019 Update (18362) Yes
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Mobile
Xbox
Surface Hub
IoT

Additional context
Note, that page with TabView had NavigationCacheMode=Required, that caused unloading and reloading without destruction.

@eugenegff
Copy link
Contributor Author

Note, that Loaded event could occur several times. I suspect, that OnApplyTemplate could occur several times too.

@mdmozibur
Copy link
Contributor

Faced the same problem. The TabItems Collection seems to behave weirdly. TabItems.Clear() generates error : Attempted to read or write protected memory. Any update on this issue?

StephenLPeters pushed a commit that referenced this issue Oct 30, 2019
#1482)

* fixes #1245

* incorporated suggestions from reviewers

* removed unnecessary codes

* more suggestion incorporated

* reverting a previous commit

* added const

* added TeaP's suggestion
@jevansaks jevansaks added the team-Controls Issue for the Controls team label Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-TabView bug Something isn't working team-Controls Issue for the Controls team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants