digimezzo / WPFControls

WPF Controls (deprecated by Foundation project)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VirtualizingWrapPanel crash

julesx opened this issue · comments

First off really great work.

I have a sorted collection of items, and trying to change how the list is sorted in real time throws the following:

"{"Specified argument was out of the range of valid values.\r\nParameter name: index"} at System.Windows.Media.VisualCollection.get_Item(Int32 index)\r\n at System.Windows.Controls.UIElementCollection.RemoveRangeInternal(Int32 index, Int32 count)\r\n at System.Windows.Controls.VirtualizingPanel.RemoveInternalChildRange(Int32 index, Int32 range)\r\n at ...VirtualizingWrapPanel.OnItemsChanged(Object sender, ItemsChangedEventArgs args) in C:\\..\\VirtualizingWrapPanel.cs:line 196"

i am able to filter and un-filter without any issues, but it seems like the NotifyCollectionChangedAction.Move case has some issues

here is a repo of the crash:
https://github.com/julesx/VWPTest/tree/master/WpfApplication1
i found that it does not happen when binding against a regular ObservableCollection, so the issue is probably (?) not in your code.

Thanks for the reproduction! Could you keep it available for some weeks? I'm leaving on holiday soon, and I'd like to have a look at it end of July. Thanks!

I contacted the author of Dynamic Data with the issue, he states that it is occurring because the problem is the virtualizing panel does not account for observable collection reset event which is a perfectly legitimate event.

have you had a chance to look at this?

i've also found that the panel crashes if you place it in a grid with no defined height.

@julesx I tried your sample and cannot reproduce the crash. Which specific step should I perform to reproduce it?

check the comment in the MainWindow xaml

you have to change the binding from RegItems to DdItems

any luck with this?

After changed the binding from RegItems to DdItems, nothing happens.

Did you run the sort ...?

really not sure how you are managing that. i downloaded the project i linked here after not looking at it since then and immediately triggered the crash after clicking the sort button.

here is a video:
https://gfycat.com/gifs/detail/amusingcloudygerenuk

  1. change RegItems to DdItems in the xaml
  2. run program
  3. click sort button

2017-09-12_00-47-20
Nothing happens.

i'm at a loss to explain how that could be possible

can you put a breakpoint on RemoveInternalChildRange(args.Position.Index, args.ItemUICount); line 189 VirtualizingWrapPanel.cs? that is where the error is thrown in my case.

Maybe you have ArgumentOutOfRange exceptions disabled, or perhaps exceptions in general?

Since nothing is happening, I'm pretty sure the exception is still happening, your IDE just isn't catching it for some reason.

When it hits at line 189, visual studio suddenly crashes even though the data source binds to RegItems. I have never encountered this situation.

if i change the xaml back to the original RegItems bindings, the program runs and sorts without any issues.

Yes, the programs runs properly, but I cannot debug it.

i don't have that issue, I am able to breakpoint line 189 and step through it without any problems

Sorry, I'm afraid I cannot give you any help.

seems like your dev environment is broken

@digimezzo could i bug you to take another look

I'll be investigating the VirtualWrapPanel issues (including this one) in the coming days. Stay tuned.

Edit: I can reproduce the crash at RemoveInternalChildRange. I'll further investigate.

I fixed the issue. Please have a look. Sorry for taking so long to resolve this.

awesome!