These are chat archives for AvaloniaUI/Avalonia

28th
Jun 2018
danwalmsley
@danwalmsley
Jun 28 2018 07:36
@grokys i think we have seem stack overflow without debugger pausing
Steven Kirk
@grokys
Jun 28 2018 07:38
any idea of a repro?
is it the same stacktrace as with the debugger pause?
danwalmsley
@danwalmsley
Jun 28 2018 07:40
Unfortunately the developer who saw this didn't capture anymore info
Im assuming its highly likely its the same
Steven Kirk
@grokys
Jun 28 2018 07:41
ok, i well i hope to have a fix soon
danwalmsley
@danwalmsley
Jun 28 2018 07:41
Since this only started happening since we added animations
Jumar Macato
@jmacato
Jun 28 2018 07:45
there might be some flaw on the state machine
im currently combing through it
danwalmsley
@danwalmsley
Jun 28 2018 07:52
@jmacato i think a couple of improvments that would also greatly reduce the chancea of encountering this bug are...
1) use the render timer instead of its own timer.
2) dont process animations that are inside controls with isvisible false
Steven Kirk
@grokys
Jun 28 2018 07:53
i'm working on 1
Jumar Macato
@jmacato
Jun 28 2018 08:22
my problem with 2 is that i can't access IsEffectivelyVisible property from SM
since i'm only handling the objects as Animatable rather than a Control
perhaps i can make an internal property that is bound to IEV prop to a prop within Animatable
Benedikt Schroeder
@Gillibald
Jun 28 2018 09:15
I need a handle to the window in my DrawingContextImpl any idea how to achieve that? The swapchain isn't always used.
danwalmsley
@danwalmsley
Jun 28 2018 09:23
window.PlatformImpl.Handle
danwalmsley
@danwalmsley
Jun 28 2018 09:39
I managed to create a very slow layout !
@grokys does your recent PRs for memory reduction also happen to improve layout performance
I seem to rememeber someone saying something about lots of checkboxes causing an issue?
ahopper
@ahopper
Jun 28 2018 09:50
@danwalmsley it does help with my checkbox issue AvaloniaUI/Avalonia#1529
danwalmsley
@danwalmsley
Jun 28 2018 09:51
I have a layout like this...
<Grid RowDefinitions="*,200,*">
        <controls:GroupBox Title="" TextBlock.FontSize="30" Padding="20" Margin="10">
         Listbox with lots of items and checkboxes
        </controls:GroupBox>

        <controls:GroupBox Title="Status" TextBlock.FontSize="30" Padding="20" Margin="10" Grid.Row="1">
            <Grid Classes="content">
            </Grid>
        </controls:GroupBox>

        <controls:GroupBox Title="{Binding Title}" TextBlock.FontSize="30" Padding="20" Margin="10" Grid.Row="2">
         Listbox with lots of items and checkboxes
        </controls:GroupBox>
    </Grid>
and resizing that view is very very slow
even without checkboxes
if I remove the listboxes
its fast again
removing checkboxes improves things, but its still terribly slow
ill try with the branches with the performance fixes
hmm turning off virtualization actually makes it quite a lot faster
after its displayed the first time
it must be recreating all the containers on resize
ahopper
@ahopper
Jun 28 2018 09:55
I've noticed large memory use on resize
danwalmsley
@danwalmsley
Jun 28 2018 09:56
hmm I bet the listbox is thinking it has unlimited size as its resizing
and listboxes are iterating through all the data
anyone know of any recent changes to listbox virtualization?
Wiesław Šoltés
@wieslawsoltes
Jun 28 2018 10:04
It works last time I checked few days ago
Do you have any external sroll viewer's in the layout
ahopper
@ahopper
Jun 28 2018 10:06
I have a number of slow layouts, they are particularly visible in my app as they pause the live graph/waterfall display I have. The memory improvements have helped a lot but there is some way to go. I'll see if the listsboxes I'm using are behaving.
danwalmsley
@danwalmsley
Jun 28 2018 10:09
@wieslawsoltes I have put them inside some special groupbox control, perhaps this is interfering... I will remove it and see
but there are no scrollviewers above them in the visual tree that I know of
hmm even removing that I still get the problem
its inside the Dock control
do you think that could be an issue?
danwalmsley
@danwalmsley
Jun 28 2018 10:14
just profiling now
ahopper
@ahopper
Jun 28 2018 10:16
just tried to run my iconpack project with the current build to see if the virtualizing was working and it appears some of the path stuff is broken @Gillibald
Could not convert object 'F1M9.0771,11C9.1161,10.701,9.1801,10.352,9.3031,10L9.0001,10 9.0001,6.166 3.0001,9.767 3.0001,10 9.99999999997669E-05,10 9.99999999997669E-05,0 3.0001,0 3.0001,0.234 9.0001,3.834 9.0001,0 12.0001,0 12.0001,8.062C12.1861,8.043 12.3821,8.031 12.5941,8.031 15.3481,8.031 15.7961,9.826 15.9201,11L16.0001,16 9.0001,16 9.0001,12.562 9.0001,11z' (of type System.String) to {clr-namespace:Avalonia.Media;assembly=Avalonia.Visuals}Geometry: Invalid double value
danwalmsley
@danwalmsley
Jun 28 2018 10:16
ah it could have been when the layout helper stuff got merged?
image.png
Steven Kirk
@grokys
Jun 28 2018 10:26
@danwalmsley what's the Grid above contained within?
i assume it only happens when you resize vertically, not horizontally?
danwalmsley
@danwalmsley
Jun 28 2018 10:42
yes only vertically
the Grid is inside a usercontrol
apart from that its contained within border, contentcontrol
etc
i'll make my app only have the listbox and take out all the other stuff
perhaps somewhere measure is not implemented correctly
weird thing is the listbox gets scrollbars and scrolls correctly
so I dont see why this is happening
Steven Kirk
@grokys
Jun 28 2018 10:55
might be worth debugging it by adding Debug.WriteLine statements to ItemVirtualizerSimple.CreateAndRemoveContainers
in particular the lines that add controls
danwalmsley
@danwalmsley
Jun 28 2018 10:57
ok
Rayyan Tahir
@RayyanTahir
Jun 28 2018 11:20
Is there an Avalonia way of getting IControl in an IControl's ControlTemplate?
In WPF it was something like FrameworkElement.Template.FindName("Nameofelement"....)
Steven Kirk
@grokys
Jun 28 2018 11:54
there not simple way to do it currently. something like NameScope.GetNameScope(control.GetVisualChildren().Single()).Find("Nameofelement") should do it though
(untested)
basically you need to get the child visual of the control
get the namescope from that
and look up the control name in that namescope
Rayyan Tahir
@RayyanTahir
Jun 28 2018 11:56
@grokys I managed to do something very similar to what you are suggesting like below:
ListBox.TemplateApplied += (s, e) =>{
TextBlock tb = e.NameScope.Get<TextBlock>("NameofControl");
}
Jumar Macato
@jmacato
Jun 28 2018 11:57
image.png
finally repro'd it
Steven Kirk
@grokys
Jun 28 2018 11:57
how did you trigger it?
Jumar Macato
@jmacato
Jun 28 2018 11:58
paused the debugger then waited for at least 3+ mins
then ran
it seems like it is catching up from all the "lost" frames
which it shouldn't be doing
replace RenderDemo/Pages/AnimationsPage.xaml with that
to make the bug a bit more obvious
Rayyan Tahir
@RayyanTahir
Jun 28 2018 12:14

I'm getting an exception everytime an item is added to an empty ReactiveList which Listbox is bound to. The exception is:

System.ArgumentException: An item with the same key has already been added. Key: 0

Stacktrace:

 at System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException(Object key)
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at Avalonia.Controls.Generators.ItemContainerGenerator.Materialize(Int32 index, Object item, IMemberSelector selector) in C:\projects\Avalonia\src\Avalonia.Controls\Generators\ItemContainerGenerator.cs:line 65
   at Avalonia.Controls.Presenters.ItemVirtualizerSimple.CreateAndRemoveContainers() in C:\projects\Avalonia\src\Avalonia.Controls\Presenters\ItemVirtualizerSimple.cs:line 320
   at Avalonia.Controls.Presenters.ItemVirtualizerSimple.UpdateControls() in C:\projects\Avalonia\src\Avalonia.Controls\Presenters\ItemVirtualizerSimple.cs:line 148
   at Avalonia.Controls.VirtualizingStackPanel.MeasureOverride(Size availableSize) in C:\projects\Avalonia\src\Avalonia.Controls\VirtualizingStackPanel.cs:line 89
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize) in C:\projects\Avalonia\src\Avalonia.Layout\Layoutable.cs:line 479
   at Avalonia.Layout.Layoutable.Measure(Size availableSize) in C:\projects\Avalonia\src\Avalonia.Layout\Layoutable.cs:line 318
   at Avalonia.Controls.Presenters.ItemVirtualizerSimple.MeasureOverride(Size availableSize) in C:\projects\Avalonia\src\Avalonia.Controls\Presenters\ItemVirtualizerSimple.cs:line 137
   at Avalonia.Controls.Presenters.ItemsPresenter.MeasureOverride(Size availableSize) in C:\projects\Avalonia\src\Avalonia.Controls\Presenters\ItemsPresenter.cs:line 124
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize) in C:\projects\Avalonia\src\Avalonia.Layout\Layoutable.cs:line 479
   at Avalonia.Layout.Layoutable.Measure(Size availableSize) in C:\projects\Avalonia\src\Avalonia.Layout\Layoutable.cs:line 318
   at Avalonia.Controls.Presenters.ScrollContentPresenter.MeasureOverride(Size availableSize) in C:\projects\Avalonia\src\Avalonia.Controls\Presenters\ScrollContentPresenter.cs:line 211
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize) in C:\projects\Avalonia\src\Avalonia.Layout\Layoutable.cs:line 479
   at Avalonia.Layout.Layoutable.Measure(Size availableSize) in C:\projects\Avalonia\src\Avalonia.Layout\Layoutable.cs:line 318
   at Avalonia.Controls.Grid.<>c__DisplayClass22_0.<MeasureOverride>g__MeasureOnce|2(Control child, Size size) in C:\projects\Avalonia\src\Avalonia.Controls\Grid.cs:line 267
   at Avalonia.Controls.Grid.<>c__DisplayClass22_0.<MeasureOverride>b__0(Control child) in C:\projects\Avalonia\src\Avalonia.Controls\Grid.cs:line 235
   at Avalonia.Controls.Utils.GridLayout.AppendMeasureConventions[T](IDictionary`2 source, Func`2 getDesiredLength) in C:\projects\Avalonia\src\Avalonia.Controls\Utils\GridLayout.cs:line 132
   at Avalonia.Controls.Grid.MeasureOverride(Size constraint) in C:\projects\Avalonia\src\Avalonia.Controls\Grid.cs:line 235
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize) in C:\projects\Avalonia\src\Avalonia.Layout\Layoutable.cs:line 479
   at Avalonia.Layout.Layoutable.Measure(Size availableSize) in C:\projects\Avalonia\src\Avalonia.Layout\Layoutable.cs:line 318
   at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize) in C:\projects\Avalonia\src\Avalonia.Layout\Layoutable.cs:line 527
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize) in C:\projects\Avalonia\src\Avalonia.Layout\Layoutable.cs:line 479
   at Avalonia.Layout.Layoutable.Measure(Size availableSize) in C:\projects\Avalonia\src\Avalonia.Layout\Layoutable.cs:line 318
   at Avalonia.Layout.LayoutHelper.MeasureChild(ILayoutable control, Size availableSize, Thickness padding) in C:\projects\Avalonia\src\Avalonia.Layout\LayoutHelper.cs:line 41
   at Avalonia.Controls.Border.MeasureOverride(Size availableSize) in C:\projects\Avalonia\src\Avalonia.Controls\Border.cs:line 103
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSiz
The ListBox was previously empty but bound to a ReactiveList. an item was then added to that ReactiveList, and then this crash occurs
Benedikt Schroeder
@Gillibald
Jun 28 2018 12:30
@ahopper Ty for letting me know. Could fix the issue. Will create a PR later this day.
danwalmsley
@danwalmsley
Jun 28 2018 12:36
@grokys anyway to have a listbox, where the user cant select items by clicking on them
just by checking a checkbox or something
iv done it so far by binding ListBoxItem.IsSelected property
but cant disable mouse selection on listbox itself
Steven Kirk
@grokys
Jun 28 2018 12:42
i think the best way to do that currently is to use an ItemsControl with a VirtualizingStackPanel and override the ItemsPresenter in the template to set its VirtualizationMode
we need a better way of doing that
either by adding VirtualizationMode to ItemsControl or having a SelectionMode.None for ListBox
Rayyan Tahir
@RayyanTahir
Jun 28 2018 13:33
Can someone please take a quick look at AvaloniaUI/Avalonia#1709 ?
Steven Kirk
@grokys
Jun 28 2018 14:36
sorry @RayyanTahir a bit busy at the moment, will look into it when i can. could you remind me tomorrow if nobody's looked at it?
Rayyan Tahir
@RayyanTahir
Jun 28 2018 14:36
Sure @grokys , Appreciate it :)
ahopper
@ahopper
Jun 28 2018 15:14
@danwalmsley I got a non selecting listbox in iconpacks by binding SelectedItem to a property that returned null from get
Wiesław Šoltés
@wieslawsoltes
Jun 28 2018 15:39
Can you just set to {x:Null}
ahopper
@ahopper
Jun 28 2018 15:46
that makes sense, I wanted the set method to capture the click without the overhead of a button
Steven Kirk
@grokys
Jun 28 2018 17:32
wow @RayyanTahir that's a tricky one. it doesn't even repro when i put the exact same code in ControlCatalog!
just tying to work out what's going on!
thanks for the minimal repro though, that helps enormously!
Benedikt Schroeder
@Gillibald
Jun 28 2018 17:48
Any idea how to avoid throwing an exception on non valid path data and still give the user a warning what failed? By avoiding exceptions and just parse as much as possible you still get some part of the path. Or do you think it should just fail?
Nelson Carrillo
@nc4rrillo
Jun 28 2018 17:57
Can you just make a path with an empty number of commands
So it just doesn’t render
Or maybe have a built in broken path Path 😄
Benedikt Schroeder
@Gillibald
Jun 28 2018 18:01
You can always construct a partial path geometry. My implementation followed the svg spec and returned a geometry containing all the valid parts. But don't know if we should do that.
Jeremy Koritzinsky
@jkoritzinsky
Jun 28 2018 18:03
I think as long as we log the invalid path warning we can try to fallback
Benedikt Schroeder
@Gillibald
Jun 28 2018 18:17
Does anyone know how a resize of the backbuffer is handled? I always see that you have to explicitly have to resize the buffer but with avalonia this doesn't seem to happen.
Nelson Carrillo
@nc4rrillo
Jun 28 2018 18:19
Might just be recreated, I’m not sure
Benedikt Schroeder
@Gillibald
Jun 28 2018 18:21
Y thats what I though is happening. Thats probably the reason why you see some black area on resize.
I find it strange that everything is drawn to a Bitmap isn't that system memory or am i mistaken? In the end it would be nice to have everything processed by the GPU Maybe DComp makes that possible.
ahopper
@ahopper
Jun 28 2018 18:33
@Gillibald thanks for the path fix, I think the bug broke all my apps :smile:
Benedikt Schroeder
@Gillibald
Jun 28 2018 19:52
No problem. Was easy to fix.
ahopper
@ahopper
Jun 28 2018 20:37
I think it needs to support lowercase e
Could not convert object 'M 10.9041,8.42781L 11,8C 11,7.44772 10.5523,7 10,7L 4.92592,7.00001L 5.84748,3.56073L 5.85238,3.54243C 5.94159,3.20888 5.85526,2.83821 5.59356,2.57652L 1.585,6.58508L 1.58577,6.58585C 1.22384,6.94778 0.999981,7.44778 0.999981,8.00007L 0.999996,12C 0.999996,13.1046 1.89543,14 3,14L 7,14C 7.79733,14 8.48568,13.5334 8.80693,12.8584L 8.80481,12.8574L 10.9041,8.42781 Z M 7,15L 3,15C 1.34315,15 0,13.6569 0,12L -1.01725e-005,8.00006C -1.01725e-005,7.17257 0.335012,6.42333 0.87682,5.88058L 5.59355,1.16233L 6.30065,1.86943C 6.83373,2.40249 7.00298,3.16158 6.80841,3.83818L 6.22915,6.00002L 10,6.00001C 11.1046,6.00001 12,6.89544 12,8C 12,8.34024 11.915,8.66063 11.7652,8.94112L 9.76384,13.1687C 9.30819,14.2449 8.24227,15 7,15 Z M 12.0959,16.5722L 12,17C 12,17.5523 12.4477,18 13,18L 18.0741,18L 17.1525,21.4393L 17.1476,21.4576C 17.0584,21.7911 17.1447,22.1618 17.4064,22.4235L 21.415,18.4149L 21.4142,18.4142C 21.7762,18.0522 22,17.5522 22,16.9999L 22,13C 22,11.8954 21.1046,11 20,11L 16,11C 15.2027,11 14.5143,11.4666 14.1931,12.1416L 14.1952,12.1426L 12.0959,16.5722 Z M 16,10L 20,10C 21.6568,10 23,11.3431 23,13L 23,16.9999C 23,17.8274 22.665,18.5767 22.1232,19.1194L 17.4064,23.8377L 16.6993,23.1306C 16.1663,22.5975 15.997,21.8384 16.1916,21.1618L 16.7708,19L 13,19C 11.8954,19 11,18.1046 11,17C 11,16.6598 11.085,16.3394 11.2348,16.0589L 13.2362,11.8313C 13.6918,10.7551 14.7577,10 16,10 Z ' (of type System.String) to {clr-namespace:Avalonia.Media;assembly=Avalonia.Visuals}Geometry: Invalid double value
from the materialLight mahapps import
Steven Kirk
@grokys
Jun 28 2018 21:20
@Gillibald Bitmap is backed by a GPU bitmap on platforms that support it
Jumar Macato
@jmacato
Jun 28 2018 21:34
@Gillibald perhaps we can make PathParser case insensitive? I dont recall any Case-specific commands in the SVG spec and it'll make it more robust.
An uppercase M indicates that startPoint is an absolute value; a lowercase m indicates that startPoint is an offset to the previous point
Many (but not all of them) come in a pair. There is an UPPERCASE and a lowercase version. The UPPERCASE version is the absolute version and the lowercase is the relative version.
so it's the same in SVG
Jumar Macato
@jmacato
Jun 28 2018 22:10
@grokys i stand corrected sir
danwalmsley
@danwalmsley
Jun 28 2018 22:56
@grokys I think im hitting that virtualization binding bug that @RayyanTahir is hitting
Steven Kirk
@grokys
Jun 28 2018 22:56
ah really?
danwalmsley
@danwalmsley
Jun 28 2018 22:56
going to try and debug into avalonia and also test his repro to see whats going on
Steven Kirk
@grokys
Jun 28 2018 22:56
one sec
danwalmsley
@danwalmsley
Jun 28 2018 22:56
I basically setup 2 listboxs
and add items to 1
and transfer selected items to the other
danwalmsley
@danwalmsley
Jun 28 2018 22:56
i.e. remove from one and add to other
Steven Kirk
@grokys
Jun 28 2018 22:57
that fixes @RayyanTahir's problem
danwalmsley
@danwalmsley
Jun 28 2018 22:57
straight away I get that exception
ok
ill try now
btw I didn't change template in my case though
Steven Kirk
@grokys
Jun 28 2018 22:57
i don't think it'll be the same problem then
got to go to bed soon however
danwalmsley
@danwalmsley
Jun 28 2018 22:58
well I mean I didn't override template though
i have an itemtemplate for stuff in list if that's what it means
Steven Kirk
@grokys
Jun 28 2018 22:58
yeah i don't think it'll be the same problem then
danwalmsley
@danwalmsley
Jun 28 2018 22:58
'll try anyway
Jumar Macato
@jmacato
Jun 28 2018 22:59
@danwalmsley @nc4rrillo can you all try unify-render-animation-timers branch later? seems to have fixed #1706
danwalmsley
@danwalmsley
Jun 28 2018 23:03
ok sure
i will also try it now we still keep hitting that
is it ready for review yet?
Jumar Macato
@jmacato
Jun 28 2018 23:04
hmm yeah perhaps? still a WIP though
danwalmsley
@danwalmsley
Jun 28 2018 23:04
ok
Jumar Macato
@jmacato
Jun 28 2018 23:06
i am not happy at the perf. of the animations backend right now :/ 300 simultaneously looping animations should be a cakewalk, but it's crawling to single-digit FPS
danwalmsley
@danwalmsley
Jun 28 2018 23:08
@grokys that does fix my issue
i have no idea how :)
Steven Kirk
@grokys
Jun 28 2018 23:08
oh wow
well that's good news :)
danwalmsley
@danwalmsley
Jun 28 2018 23:08
is it ready for review?
Steven Kirk
@grokys
Jun 28 2018 23:09
i just need to write up the PR, but i also really want to go to bed!
i'll do it now
danwalmsley
@danwalmsley
Jun 28 2018 23:10
no no
no rush
i dont want to pressure you I can wait
Steven Kirk
@grokys
Jun 28 2018 23:10
no problem i've started now
here you go: AvaloniaUI/Avalonia#1711
danwalmsley
@danwalmsley
Jun 28 2018 23:20
ah damn, that bug was triggering every single time
with #1711 its less
but..
image.png
gonna see if there is a simple repro