View Issue Details

IDProjectCategoryView StatusLast Update
0001992NoesisGUIUnity3Dpublic2021-05-03 17:22
ReporterKeldorKatarnAssigned Tosfernandez 
PrioritynormalSeveritycrashReproducibilityalways
Status assignedResolutionopen 
Product Version3.0.11 
Target VersionFixed in Version 
Summary0001992: Unity 2019.4.9f1 (64-bit) crashes when using asynchronous event handler for Noesis RoutedEvent
DescriptionDoing 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();
        }
}
TagsNo tags attached.
PlatformAny

Activities

KeldorKatarn

KeldorKatarn

2021-04-30 09:58

reporter  

crash.dmp (1,589,471 bytes)
Editor.log (194,068 bytes)
error.log (134,758 bytes)
sfernandez

sfernandez

2021-05-03 11:15

manager   ~0007205

I found that args object (the native part) is already destroyed after the delay, we need to think about how to deal with this issue.
In the meantime a workaround is to extract the information from the args before doing the wait:
private async void OnTreeViewItemSelected(object sender, RoutedEventArgs e)
{
  TreeViewItem tvi = e.Source as TreeViewItem;
  await Task.Delay(500);
  tvi?.BringIntoView();
}
KeldorKatarn

KeldorKatarn

2021-05-03 14:03

reporter   ~0007209

Ah, that makes sense. It shouldn't crash the editor though.

Issue History

Date Modified Username Field Change
2021-04-30 09:58 KeldorKatarn New Issue
2021-04-30 09:58 KeldorKatarn File Added: crash.dmp
2021-04-30 09:58 KeldorKatarn File Added: Editor.log
2021-04-30 09:58 KeldorKatarn File Added: error.log
2021-04-30 11:44 jsantos Assigned To => sfernandez
2021-04-30 11:44 jsantos Status new => assigned
2021-04-30 11:44 jsantos Target Version => 3.0.12
2021-04-30 11:44 jsantos Description Updated View Revisions
2021-05-03 11:15 sfernandez Status assigned => feedback
2021-05-03 11:15 sfernandez Note Added: 0007205
2021-05-03 14:03 KeldorKatarn Note Added: 0007209
2021-05-03 14:03 KeldorKatarn Status feedback => assigned
2021-05-03 17:22 jsantos Target Version 3.0.12 =>