These are chat archives for AvaloniaUI/Avalonia

2nd
May 2016
Steven Kirk
@grokys
May 02 2016 01:00
@jkoritzinsky ok i've finally had chance to investigate the issue - and yeah your diagnosis is correct
This message was deleted
I think the best solution would be to add a ContentControl.ContentTemplate property to set a data template that applies only to the content control
what do you think?
although we should probably try to avoid the stackoverflow anyway - any idea if it happens in WPF ?
Darnell WIlliams
@ImaBrokeDude_twitter
May 02 2016 03:04
Yeah ContentTemplate would really help
Oh sorry out of context, but some of what I am doing would need something like a cotenttemplate
Steven Kirk
@grokys
May 02 2016 03:08
interesting - what do you need it for that can't be done with the existing data templates?
Jeremy Koritzinsky
@jkoritzinsky
May 02 2016 04:03
This bug doesn't happen in wpf because it doesn't automatically search for data templates that don't have a target type. Templates without a target type need to be referenced by key in WPF.
Steven Kirk
@grokys
May 02 2016 04:13
yeah, but if you do this:
    <Window.Resources>
        <DataTemplate DataType="{x:Type sys:String}">
            <Button>Foo</Button>
        </DataTemplate>
    </Window.Resources>
    <ContentPresenter Content="Bar"/>
that is equivalent, and I've tested it and it causes a StackOverflowException
so maybe we should just not allow DataTemplates without a data type in Control.DataTemplates and add a ContentControl.ContentTemplate property
Steven Kirk
@grokys
May 02 2016 04:23
btw what is the state of the property validation PR? have you made the changes we discussed? it appears so, just wanted to check
Jeremy Koritzinsky
@jkoritzinsky
May 02 2016 05:23
Yep. All changes that we talked about should be implemented.
Wiesław Šoltés
@wieslawsoltes
May 02 2016 14:40

i think that ToggleButton.OnClick just needs to call its base

@grokys That works!

Steven Kirk
@grokys
May 02 2016 14:41
great, PR welcome, even with such a small change ;)
Wiesław Šoltés
@wieslawsoltes
May 02 2016 14:41
yeah working on it
will also add sample to BindingTest project
Steven Kirk
@grokys
May 02 2016 14:51
:+1:
Wiesław Šoltés
@wieslawsoltes
May 02 2016 15:08
CI build failed, some RPC error @grokys could you re-run my PR in CI
Steven Kirk
@grokys
May 02 2016 15:09
Sure, give me 10 mins
Wiesław Šoltés
@wieslawsoltes
May 02 2016 18:21
@grokys I had to submit new PR with ToggleButton fix, see #528. The base.OnClick(e); has to be called after Toggle(); otherwise using binding and commands causes invalid behavior.
Steven Kirk
@grokys
May 02 2016 19:32
merged
Wiesław Šoltés
@wieslawsoltes
May 02 2016 19:33
Thanks!
Jeremy Koritzinsky
@jkoritzinsky
May 02 2016 20:36
@grokys I'm going to prototype a possible solution for the StackOverflowException so that we don't crash in that situation, but have a (well documented) non-crashy default behavior. Are you ok if I do that?
Steven Kirk
@grokys
May 02 2016 20:37
sure, though i've thought about it and i couldn't think of an easy way to do it that might not affect a valid use-case
it's easy to detect if it's just a stack overflow of 1 level, i.e. string -> string -> string
but if it's something like string -> int -> string -> int it'd be harder to detect
(if that notation makes sense)
Jeremy Koritzinsky
@jkoritzinsky
May 02 2016 20:40
The StackOverflow that we see eventually ends up as Measure->MeasureCore->MeasureOverride-> (repeat) -> different frames depending on the call stack depth at the start (for example DynamicInvoke or something within ApplyTemplate).
And the this object changes after each MeasureOverride
I'm planning at coming at this from a non "checking the call stack" angle to avoid that problem.
Jeremy Koritzinsky
@jkoritzinsky
May 02 2016 22:51
My fix is in #487.