View Issue Details

IDProjectCategoryView StatusLast Update
0002417NoesisGUIUnitypublic2022-09-13 12:28
ReporterFeldruebe Assigned Tosfernandez  
PrioritynormalSeverityminor 
Status resolvedResolutionfixed 
Product Version3.1.5 
Target Version3.1.6Fixed in Version3.1.6 
Summary0002417: FlowDirection of WrapPanel crashed Unity
Description

Use the following Control:

xaml:

<UserControl x:Class="Testing.TestControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib"
x:Name="Root">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<ItemsControl Grid.Row="0" Grid.Column="0" ItemsSource="{Binding Texts, ElementName=Root}" Width="300">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel VerticalAlignment="Bottom" FlowDirection="RightToLeft" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding }"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button Content="Click me" Click="Button_Click" />
<TextBlock Text="{Binding Counter, ElementName=Root, StringFormat='Button clicked {0} time(s)'}" Margin="5,0,0,0" VerticalAlignment="Center" />
</StackPanel>
</UserControl>

CodeBehind:

#if UNITY_5_3_OR_NEWER
#define NOESIS
using Noesis;
#else
using System.Windows;
using System.Windows.Controls;
#endif

namespace Testing
{
using System.Collections.ObjectModel;

public partial class TestControl: UserControl
{
    public TestControl()
    {
        InitializeComponent();
    }

    public int Counter
    {
        get { return (int)GetValue(CounterProperty); }
        set { SetValue(CounterProperty, value); }
    }

    public static readonly DependencyProperty CounterProperty =  DependencyProperty.Register(
        "Counter", typeof(int), typeof(TestControl), new PropertyMetadata(0));

    public ObservableCollection<string> Texts
    {
        get { return (ObservableCollection<string>)GetValue(TextsProperty); }
        set { SetValue(TextsProperty, value); }
    }

    public static readonly DependencyProperty TextsProperty =  DependencyProperty.Register(
        "Texts", typeof(ObservableCollection<string>), typeof(TestControl), new PropertyMetadata(new ObservableCollection<string>()));

#if NOESIS
    protected override bool ConnectEvent(object source, string eventName, string handlerName)
    {
        if (eventName == "Click" && handlerName == "Button_Click")
        {
            ((Button)source).Click += this.Button_Click;
            return true;
        }

        return false;
    }

    private void InitializeComponent()
    {
        NoesisUnity.LoadComponent(this);
    }
#endif

    private void Button_Click(object sender, RoutedEventArgs args)
    {
        Counter++;
        this.Texts.Add("qwe");
    }
};

}

Steps To Reproduce

Click 12 times on the button.
Unity crashes

PlatformAny

Activities

sfernandez

sfernandez

2022-09-13 12:22

manager   ~0008064

Thanks for the report, I was able to reproduce it.
We'll fix it for the next release.

sfernandez

sfernandez

2022-09-13 12:28

manager   ~0008065

Fixed in r11477.

Issue History

Date Modified Username Field Change
2022-09-12 23:25 Feldruebe New Issue
2022-09-13 12:22 sfernandez Assigned To => sfernandez
2022-09-13 12:22 sfernandez Status new => assigned
2022-09-13 12:22 sfernandez Target Version => 3.1.6
2022-09-13 12:22 sfernandez Note Added: 0008064
2022-09-13 12:28 sfernandez Status assigned => resolved
2022-09-13 12:28 sfernandez Resolution open => fixed
2022-09-13 12:28 sfernandez Fixed in Version => 3.1.6
2022-09-13 12:28 sfernandez Note Added: 0008065
2025-10-10 13:29 jsantos Category Unity3D => Unity