These are chat archives for AvaloniaUI/Avalonia

27th
Jun 2018
Wiesław Šoltés
@wieslawsoltes
Jun 27 2018 05:10
wow nice work @grokys
Maksim Kislyakov
@Gradi
Jun 27 2018 13:48

Hello everyone. I am playing with avalonia and i got some problem with xaml previewer.
The following code throws exception:

<Window x:Class="TestApp.MainWindow"
        xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="TestApp" >

  <Button Click="ButtonClick">Press me</Button>

</Window>

Exception:

Portable.Xaml.XamlObjectWriterException: Could not convert object 'ButtonClick' (of type System.String) to {clr-namespace:System;assembly=mscorlib}EventHandler({clr-namespace:Avalonia.Interactivity;assembly=Avalonia.Interactivity}RoutedEventArgs): Referenced value method ButtonClick in type Avalonia.Controls.Window indicated by event System.EventHandler`1[[Avalonia.Interactivity.RoutedEventArgs, Avalonia.Interactivity, Version=0.6.2.0, Culture=neutral, PublicKeyToken=null]] was not found ---> Portable.Xaml.XamlObjectWriterException: Referenced value method ButtonClick in type

But project successfully compiles and runs. When i press button ButtonClick gets called.
I am using avalonia version 0.6.2-build5555-beta from nightly builds and visual studio avalonia extension version is 0.6.0.1.

Jeremy Koritzinsky
@jkoritzinsky
Jun 27 2018 14:05
We dont support the x:Class directive currently. So the previewer is constructing an instance of Window instead of your window subclass. It's a known issue.
Maksim Kislyakov
@Gradi
Jun 27 2018 14:09
But on this page AvaloniaUI/Avalonia#1282 you have checkbox selected for x:Class or there is something i don't understand?
Jeremy Koritzinsky
@jkoritzinsky
Jun 27 2018 14:29
It's recognized by the parser and outside of the Previewer it generally works. Currently the Previewer uses a different code path.
Benedikt Schroeder
@Gillibald
Jun 27 2018 15:06
Looks like there is some work needed to support LayeredWindow and DirectComposion. But in the end we shouldn't need more. Everything can be done with DXGI.
Benedikt Schroeder
@Gillibald
Jun 27 2018 15:13
For Windows 7 we are limited to DirectX 10 and LayeredWindow. For Windows 8 and above we can use DirectComposion. Still thinking about the changes that are needed for the render backend. LayeredWindow still needs a DC so we have to call UpdateLayeredWindow until drawing has finished. There is a callback for that but that is currently not used. I ask myself if we really need all these fallbacks for the RenderTarget. In my opinion there should just be one registered environment and that's it.
Nelson Carrillo
@nc4rrillo
Jun 27 2018 15:44
So we need to for the win7 path create a DC and route drawing to it and then provide that as the source for UpdateLayeredWibdow
Nelson Carrillo
@nc4rrillo
Jun 27 2018 15:55
You can like you said use DXGI to create a GDI compatible render target that D2d can draw to
And get the DC to pass to ULW from that
Or we can just not support transparent windows on win7 :P
DComp makes all of this a cake walk
Wiesław Šoltés
@wieslawsoltes
Jun 27 2018 16:04
@grokys AvaloniaUI/Avalonia#1703
before
after
Benedikt Schroeder
@Gillibald
Jun 27 2018 16:17
We can just register a specific render target for these scenarios.
Steven Kirk
@grokys
Jun 27 2018 16:31
@wieslawsoltes do those videos show a problem? or just the reduced memory usage?
i'm hoping the latter ;)
Wiesław Šoltés
@wieslawsoltes
Jun 27 2018 16:36
Memory usage only
Steven Kirk
@grokys
Jun 27 2018 16:42
excellent :)
danwalmsley
@danwalmsley
Jun 27 2018 16:54
btw @grokys avalonia give stackoverflow exception when any animation is running constantly and window gets minimized for a while, then restored
I have to check if some of latest fixes resolve it
Steven Kirk
@grokys
Jun 27 2018 16:54
ah yeah @jmacato mentioned that to me
danwalmsley
@danwalmsley
Jun 27 2018 16:54
ok
Steven Kirk
@grokys
Jun 27 2018 16:55
don't think any of the recent PRs will fix that
danwalmsley
@danwalmsley
Jun 27 2018 16:55
did you or @jmacato manage to identify the problem or repro?
Steven Kirk
@grokys
Jun 27 2018 16:55
best thing would be to tie the animation timer to the render timer to fix that i think
i've not had chance to look
Nelson Carrillo
@nc4rrillo
Jun 27 2018 16:56
Noticed it too with indefinite animations and stackoverflow
Jeremy Koritzinsky
@jkoritzinsky
Jun 27 2018 16:57
Someone want to file an issue with at least a snippet of the stack trace?
Nelson Carrillo
@nc4rrillo
Jun 27 2018 16:57
Can’t get a stack trace last I tried because it was an overflow :( may need to break out windbg
I can file a bug when I get home with a sample project
Steven Kirk
@grokys
Jun 27 2018 17:11
trying to repro now by minimizing renderdemo with the animations page open
@danwalmsley said it can take like 10 mins or so
i've seen something similar when pausing in the debugger with an animation running and the animation gets kinda backed up
not sure if it's the same thing though
danwalmsley
@danwalmsley
Jun 27 2018 17:16
image.png
just managed to trigger it @jkoritzinsky here is end of stacktrace
Steven Kirk
@grokys
Jun 27 2018 17:16
thanks, that's really useful
how did you trigger it?
danwalmsley
@danwalmsley
Jun 27 2018 17:17
its the same all the way to the bottom and just says maximum number of frames triggered
i had some other exception in my application which brought vs to front
Steven Kirk
@grokys
Jun 27 2018 17:17
and could you open an issue with that screenshot so i can find it later if necessary?
danwalmsley
@danwalmsley
Jun 27 2018 17:17
then i started running it again
and when I alt-tabbed back to it
it immediately did this
Steven Kirk
@grokys
Jun 27 2018 17:17
ok, so the debugger paused execution?
danwalmsley
@danwalmsley
Jun 27 2018 17:18
btw none of my animations are visible so they shouldn't get processed but animations are being processed regardless
it paused it
Steven Kirk
@grokys
Jun 27 2018 17:18
but this happens even if the debugger doesn't pause execution at times?
danwalmsley
@danwalmsley
Jun 27 2018 17:18
so its like the program sees a jump in time because the debugger paused
Steven Kirk
@grokys
Jun 27 2018 17:18
yeah, like i say i've seen that one
just never seen it happen because the window is minimized
danwalmsley
@danwalmsley
Jun 27 2018 17:19
ah let me ask the other guys here if they only saw it when debugger paused
hmm they didn't remember if they were or not
i guess it sees a jump in time and tries to schedule 1000s or animation frames or something like that?
causing overflow when debugger resumes?
Steven Kirk
@grokys
Jun 27 2018 17:22
i can't remember quite what caused it, but something like that
like i say, we need to use the same timer for animations as we use for rendering
danwalmsley
@danwalmsley
Jun 27 2018 17:23
ok so basically its only triggered during development
Steven Kirk
@grokys
Jun 27 2018 17:23
ah ok
that's good to know
danwalmsley
@danwalmsley
Jun 27 2018 17:23
shouldn't happen in normal runtime
that's good to know
Steven Kirk
@grokys
Jun 27 2018 17:23
ok cool. i was worried there were two separate issues
danwalmsley
@danwalmsley
Jun 27 2018 17:24
ok
i only realised just now it was caused by debugger pausing execution
from what you were saying
Steven Kirk
@grokys
Jun 27 2018 17:25
yeah so it's still a problem but not such a big problem
also easy to repro!
danwalmsley
@danwalmsley
Jun 27 2018 17:26
ok
Jeremy Koritzinsky
@jkoritzinsky
Jun 27 2018 17:35
I think I know the problem. I think the fast-path in AvaloniaScheduler is causing the SO.
danwalmsley
@danwalmsley
Jun 27 2018 18:33
@grokys I should be able to set ToolTip on Grid?
im getting
Portable.Xaml.XamlObjectWriterException: 'Cannot set unknown member '{clr-namespace:Avalonia.Controls;assembly=Avalonia.Controls}Grid.ToolTip''
<DataTemplate>
                <Grid ColumnDefinitions="50,50,200,200,100,150,Auto">
                    <Grid.ToolTip>
                        <StackPanel Gap="4" MaxWidth="800">
is this a bug or did I get something wrong?
ahopper
@ahopper
Jun 27 2018 19:06
when I did something similar I used ToolTip.Tip
ahopper
@ahopper
Jun 27 2018 19:16
 <DataTemplate>

                        <Button Classes="LinkButton" Command="{Binding $parent[4].DataContext.SpotSelectedCommand}"
                          CommandParameter="{Binding}" Width="120" >

                        <TextBlock FontSize="11"  Text="{Binding msg}" Foreground="{Binding color, Converter={x:Static r:Converters.SpotToColor}}"></TextBlock>
                        <ToolTip.Tip>
                          <StackPanel Orientation="Vertical">
                            <TextBlock Text="{Binding mode}"></TextBlock>
                            <TextBlock Text="{Binding frequency}"></TextBlock>
                            <TextBlock Text="{Binding snr}"></TextBlock>
                            <TextBlock Text="{Binding dt}"></TextBlock>
                            <TextBlock Text="{Binding distance}"></TextBlock>
                          </StackPanel>
                        </ToolTip.Tip>
                      </Button>

                     </DataTemplate>
ToolTip.Tip is an attached property
danwalmsley
@danwalmsley
Jun 27 2018 19:21
Ahh of course
I had been coding all day 😀
Wiesław Šoltés
@wieslawsoltes
Jun 27 2018 19:22
:smile:
ahopper
@ahopper
Jun 27 2018 19:23
:smile:
danwalmsley
@danwalmsley
Jun 27 2018 19:33
Thanks guys :)
Wiesław Šoltés
@wieslawsoltes
Jun 27 2018 19:38
@grokys Tested AvaloniaUI/Avalonia#1694, AvaloniaUI/Avalonia#1695 and AvaloniaUI/Avalonia#1703 with Core2D everything works :smile:
danwalmsley
@danwalmsley
Jun 27 2018 19:57
@grokys #1706