These are chat archives for AvaloniaUI/Avalonia

19th
Jul 2016
danwalmsley
@danwalmsley
Jul 19 2016 10:04
@grokys I know your away at the moment, if you get a minute could you advise me how to fix this bug:
private void CreateAndRemoveContainers()
        {
            var generator = Owner.ItemContainerGenerator;
            var panel = VirtualizingPanel;

            if (!panel.IsFull && Items != null && panel.IsAttachedToVisualTree)
            {
                var memberSelector = Owner.MemberSelector;
                var index = NextIndex;
                var step = 1;

                while (!panel.IsFull)
                {
                    if (index >= ItemCount)
                    {
                        // We can fit more containers in the panel, but we're at the end of the
                        // items. If we're scrolled to the top (FirstIndex == 0), then there are
                        // no more items to create. Otherwise, go backwards adding containers to
                        // the beginning of the panel.
                        if (FirstIndex == 0)
                        {
                            break;
                        }
                        else
                        {
                            index = FirstIndex - 1;
                            step = -1;
                        }
                    }

                    var materialized = generator.Materialize(index, Items.ElementAt(index), memberSelector);

                    if (step == 1)
                    {
                        panel.Children.Add(materialized.ContainerControl);
                    }
                    else
                    {
                        panel.Children.Insert(0, materialized.ContainerControl);
                    }

                    index += step;
                }

                if (step == 1)
                {
                    NextIndex = index;
                }
                else
                {
                    NextIndex = ItemCount;
                    FirstIndex = index + 1;
                }
            }

            if (panel.OverflowCount > 0)
            {
                RemoveContainers(panel.OverflowCount);
            }
        }
if you see step = -1
when that happens, it passes -1 to generator.Materialize
causing an exception on:
IEnumerableUtils line 75.
I'm wondering if step is -1 should we just break?
or just skip the materialized section?
sorry I'm getting index = -1 (not step) sorry for misleading.
danwalmsley
@danwalmsley
Jul 19 2016 10:13
( I didn't manage to find a unit test to produce this...)
I had a quick go though
Ivan Kochurkin
@KvanTTT
Jul 19 2016 10:21
This message was deleted
Ivan Kochurkin
@KvanTTT
Jul 19 2016 10:31
Hi! I want to fix AvaloniaUI/Avalonia#502 issue. Could somebody help me where I should start?
Wiesław Šoltés
@wieslawsoltes
Jul 19 2016 10:50
Ivan Kochurkin
@KvanTTT
Jul 19 2016 10:53
Thank you! I'll try to fix it.
Darnell Williams
@Seeker1437
Jul 19 2016 15:31
Very, very interesting. This is a few cases, but some of the people I know say they love it at MS and have no issues.
Jeremy Koritzinsky
@jkoritzinsky
Jul 19 2016 16:00
It entirely depends on what team you're on
Sounds like this guy was in WDG
Darnell Williams
@Seeker1437
Jul 19 2016 16:08
I know hwo stuff can get really frayed though, I recently had to wipe my computer because I accidentally changed permissions in the wrong folder, and not even the installer had permissions to correct it... I was lost for words.