View Revisions: Issue #1992

Summary 0001992: Unity 2019.4.9f1 (64-bit) crashes when using asynchronous event handler for Noesis RoutedEvent
Revision 2021-04-30 11:44 by jsantos
Description Doing this reliably crashes the editor

    public partial class FileDialogView : UserControl
    {
        public FileDialogView()
        {
            InitializeComponent();
            Initialized += OnInitialized;
        }

        private void OnInitialized(object sender, EventArgs args)
        {
            var treeView = (TreeView)FindName("TreeView");
            treeView.AddHandler(TreeViewItem.SelectedEvent, new RoutedEventHandler((s, e) => OnTreeViewItemSelected(s, e)));
        }


        private async void OnTreeViewItemSelected(object sender, RoutedEventArgs e)
        {
            await Task.Delay(500);
            (e.Source as TreeViewItem)?.BringIntoView();
        }
}
Revision 2021-04-30 09:58 by KeldorKatarn
Description Doing this reliably crashes the editor

    public partial class FileDialogView : UserControl
    {
        public FileDialogView()
        {
            InitializeComponent();
            Initialized += OnInitialized;
        }

        private void OnInitialized(object sender, EventArgs args)
        {
            var treeView = (TreeView)FindName("TreeView");
            treeView.AddHandler(TreeViewItem.SelectedEvent, new RoutedEventHandler((s, e) => OnTreeViewItemSelected(s, e)));
        }


        private async void OnTreeViewItemSelected(object sender, RoutedEventArgs e)
        {
            await Task.Delay(500);
            (e.Source as TreeViewItem)?.BringIntoView();
        }
}