Page 1 of 1

Crash with InlineUIContainer inside a style

Posted: 04 Dec 2019, 11:22
by Joren
Hi,

We have encountered a crash within Noesis while using InlineUIContainers inside of a style. We tested this in our engine and using the xaml player that comes with Noesis. We are running on 2.2.5.

Below is a snippet that crashes (Note: This is a watered down version of our xaml), look for the comments in the xaml for more information on where it crashes.
<Window x:Class="Buttons.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
        xmlns:local="clr-namespace:Buttons"
        xmlns:noesis="clr-namespace:NoesisGUIExtensions;assembly=Noesis.GUI.Extensions"
        Title="NoesisGUI - Buttons"
        d:DesignWidth="1468" d:DesignHeight="1015.5">
  <Window.Resources>
    <Style x:Key="MovementButton" TargetType="{x:Type ToggleButton}">
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type ToggleButton}">
            <Grid>
              <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="#Another" FontSize="21" Foreground="#FFFFFF">
                <Run Text="Hello"/><Run Text="/"/><Run Text="World"/>
                <InlineUIContainer>
                  <InlineUIContainer.Child>
                    <Rectangle Fill="#FF00FFFF" Width="12" Height="12"/>
                  </InlineUIContainer.Child>
                </InlineUIContainer>
              </TextBlock>
            </Grid>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
  </Window.Resources>
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="80*"/>
      <RowDefinition Height="800*"/>
      <RowDefinition Height="120*"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="40*"/>
      <ColumnDefinition Width="900*"/>
      <ColumnDefinition Width="60*"/>
    </Grid.ColumnDefinitions>
	
	<!-- This inline container works -->
    <TextBlock Grid.Column="1" Foreground="#EEEEEE" HorizontalAlignment="Center"  VerticalAlignment="Center" FontFamily="#Another" FontSize="21">
       <Run Text="Hello"/><Run Text="/"/><Run Text="World"/>
       <InlineUIContainer>
         <InlineUIContainer.Child>
          <Rectangle Fill="#FFFF00FF" Width="12" Height="12"/>
         </InlineUIContainer.Child>
       </InlineUIContainer>
    </TextBlock>
	
	<!-- This inline container DOESNT work -->
    <ToggleButton Grid.Column="1" Grid.Row="1" Style="{StaticResource MovementButton}" IsEnabled="False"/>
  </Grid>
</Window>
Is this a known issue?

Re: Crash with InlineUIContainer inside a style

Posted: 05 Dec 2019, 13:51
by sfernandez
Hi Joren,

This is not a known issue, and I was able to reproduce it here with the XamlPlayer thanks to your test xaml.
Could you please report it in our bugtracker and we will fix it for the upcoming release?

Unfortunately there is no workaround for this, sorry for the inconvenience.

Re: Crash with InlineUIContainer inside a style

Posted: 05 Dec 2019, 14:21
by Joren
Reported under #1594

Re: Crash with InlineUIContainer inside a style

Posted: 11 Dec 2019, 17:15
by sfernandez
Thanks, we fixed it for the upcoming version.

Re: Crash with InlineUIContainer inside a style

Posted: 09 Jan 2020, 10:36
by Joren
Thank you for the fix. We updated to 2.2.6 and enabled all the instances where we want to use the InlineUIContainers. It works for most, except in 1 situation where it will just hang the application. We managed to simplify our code and reproduce this in the Sample projects. Reported the bug and repro under #1615.

To be a bit more specific, this time the issue is because of a InlineUIContainer inside a style, which is then used inside an itemscontrol.

Please let me know if you need additional information to solve this issue.

Re: Crash with InlineUIContainer inside a style

Posted: 16 Jan 2020, 10:59
by sfernandez
Thanks for the report, we were able to reproduce it and will fix it for the next release.