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

Exception thrown when new item is added to ObservableCollection ItemsSource of TreeView #631

Closed
dpaulino opened this issue Apr 30, 2019 · 7 comments · Fixed by #865
Closed
Assignees
Labels
area-TreeView bug Something isn't working team-Controls Issue for the Controls team

Comments

@dpaulino
Copy link
Contributor

dpaulino commented Apr 30, 2019

Describe the bug
System.Exception. The operation attempted to access data outside the valid range error is thrown when adding item to ObservableCollection ItemsSource of TreeView. This error only occurs after the existing items in the TreeView have been reordered in a specific way.

Steps to reproduce the bug

Steps to reproduce the behavior:

  1. Download this sample UWP solution: https://github.com/dpaulino/treeviewtest
  2. Run in Local Machine. The TreeView will be populated by two items named first and second.
  3. Drag and drop second into first
  4. Press the "Add" button above the TreeView control.
  5. Exception thrown.

Expected behavior
No exception thrown.

Screenshots
image

Version Info

NuGet package version:
Microsoft.Ui.Xaml 2.1.190405004.2 and 2.2.190425001-prerelease

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

Additional context

@jevansaks
Copy link
Member

This sounds like a dupe of #556. Without that fix the drag&drop operation is leaving the TreeView internal list out of sync with the data source, so then moving items in the data source will cause further inconsistencies.

Can you try one of the latest CI builds as Kai was showing in #556?

@msft-github-bot msft-github-bot added the needs-assignee-attention Assignee needs to follow-up or investigate this issue label Apr 30, 2019
@dpaulino
Copy link
Contributor Author

I performed the same repro steps as I detailed above but with 2.2.190425001-prerelease and the same error occurs.
image

@jevansaks
Copy link
Member

Thanks. @RBrid can you take a look?

@jevansaks jevansaks added area-TreeView bug Something isn't working labels May 1, 2019
@msft-github-bot msft-github-bot removed the needs-assignee-attention Assignee needs to follow-up or investigate this issue label May 1, 2019
@dpaulino
Copy link
Contributor Author

dpaulino commented May 1, 2019

Thanks @jevansaks.

@RBrid Let me know if there's anything else I can help with.

@dpaulino
Copy link
Contributor Author

Hi all, just checking in about this exception. Any updates? Thanks in advance!

@dpaulino
Copy link
Contributor Author

Hi all, checking in again. Is there a workaround I could do on my end? This bug is blocking one of my features in my application, and my customers are complaining

@jevansaks jevansaks assigned kaiguo and unassigned RBrid Jun 12, 2019
kaiguo pushed a commit that referenced this issue Jun 14, 2019
* TreeView test page updates for repro'ing Issue #631.

* Set ItemsSource on root node and remove duplicated code

* Delete commented code

* Extra fixes

* Add tests

* Skip test on lower os version
@msft-github-bot
Copy link
Collaborator

🎉This issue was addressed in #865, which has now been successfully released as Microsoft.UI.Xaml v2.2.190702001-prerelease.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-TreeView 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