View Issue Details

IDProjectCategoryView StatusLast Update
0002047NoesisGUIUnrealpublic2021-06-18 19:59
Reportersergey_sitnikov_ninjatheory Assigned Tosfernandez  
PrioritynormalSeveritycrash 
Status resolvedResolutionfixed 
Product Version3.0.12 
Summary0002047: Crash when using DataTrigger bound to DataContext
Description

There is a crash in Noesis in some specific cases when xaml uses DataTrigger bound to a DataContext property. It is not crashing if it is bound to some other property of the element.

Here is an example:
<Grid x:Name="HintPCParent">
<Grid x:Name="ButtonHint_Pc" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,5,0" Visibility="{TemplateBinding PCHintVisibility}">
<TextBlock x:Name="ButtonHint_Pc_Key" Style="{StaticResource Bold_XXS}" Text="{TemplateBinding PCHint}" Foreground="{DynamicResource Col_4}" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="0" Margin="0,0,0,-3"/>
</Grid>
<Grid.Style>
<Style TargetType="Grid">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Settings.ControllerType }" Value="MouseAndKeyboard">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
</Grid>

I have also tried using DataTrigger in ControlTemplate.Triggers instead with the same result.

I other places DataTriggers work absolutely fine, but when used in that specific file it causes crash.
Crash dump is attached.

Steps To Reproduce

Not every DataTrigger causes that crash so there are not real steps to reproduce. It is just in that specific case it will always crash.

Attached Files
PlatformAny

Activities

sergey_sitnikov_ninjatheory

sergey_sitnikov_ninjatheory

2021-06-16 09:47

reporter   ~0007296

Added a new crash dump file.

sergey_sitnikov_ninjatheory

sergey_sitnikov_ninjatheory

2021-06-16 14:26

reporter   ~0007298

I have investigate it a bit further and it seems that the crash is likely related to the fact that Binding to the DataContext is used INSIDE the ControlTemplate.
So as a simple example, I have created a style that sets a Template and inside it uses a Binding to the ViewModel property.
I found out that if that Binding is never used anywhere else but only inside the ControlTemplate, then Noesis will crash on the first usage of that control template/style.
But if that Binding to the property is used directly in some control then there is no crash!

<Style TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<TextBlock x:Name="ButtonText" Text="{Binding TestObject.TestProperty}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

It will crash if used in the ContentControl like that:

<ContentControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Width="Auto" Height="Auto">
<StackPanel>
<Button/>
</StackPanel>
</ContentControl>

But it will not crash anymore if used this way:

<ContentControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Width="Auto" Height="Auto">
<StackPanel>
<Button Content="{Binding TestObject.TestProperty}"/>
<Button/>
</StackPanel>
</ContentControl>

I hope it makes sense. Please let me know if you need any additional information.

sfernandez

sfernandez

2021-06-16 16:05

manager   ~0007299

Thanks for the detailed info, the crash dumps point me to a problem initializing an element when applying the template on the control.
It seems that the binding is modifying a value that invalidates some data that is being iterated, I'll try to reproduce and fix it as soon as possible.

sfernandez

sfernandez

2021-06-17 12:37

manager   ~0007302

I've been trying to reproduce the crash using both examples without success, it worked for me in Unreal and using our XamlPlayer.

Would it be possible for you to generate new crash dumps with the following debug library of Noesis?
https://drive.google.com/file/d/1QUtlPTYGkpeX77EoW83VBhivPU6v4Q-9/view?usp=sharing

Or if you can attach a small Unreal project that reproduces the crash that will be even better.

I need some more information to confirm what I think is the source of the problem.
Thanks for your feedback.

sergey_sitnikov_ninjatheory

sergey_sitnikov_ninjatheory

2021-06-17 13:50

reporter   ~0007303

Hey Sergio,

Should I just take Noesis.dll from that library?

Cheers,
Sergey

sfernandez

sfernandez

2021-06-17 14:57

manager   ~0007304

Yes, place that Noesis.dll inside the Binaries folder of your project.

sergey_sitnikov_ninjatheory

sergey_sitnikov_ninjatheory

2021-06-17 15:20

reporter   ~0007305

Hi Sergio,

Unfortunately, that zip is recognised by googledrive as infected for some reason and it doesn't let me to download it. Can you please just zip the dll file and send it to me by the email instead?

Cheers,
Sergey

sfernandez

sfernandez

2021-06-17 15:28

manager   ~0007306

Sure, mail sent.

sergey_sitnikov_ninjatheory

sergey_sitnikov_ninjatheory

2021-06-17 15:43

reporter   ~0007307

Hi Sergio,

The crash now looks different. I haven't been able to reproduce it yet with the simple example but I will spend some time tying to simplify it as much as possible,

Cheers,
Sergey

sergey_sitnikov_ninjatheory

sergey_sitnikov_ninjatheory

2021-06-17 16:01

reporter   ~0007308

Last edited: 2021-06-17 16:01

I have skipped two exceptions and got the same crash as before. However this one has crashed in the situation when the original library would not.

sergey_sitnikov_ninjatheory

sergey_sitnikov_ninjatheory

2021-06-17 16:13

reporter   ~0007309

This crash is on file import when I try to import the Window xaml with that problematic control as a child.

sergey_sitnikov_ninjatheory

sergey_sitnikov_ninjatheory

2021-06-17 17:58

reporter   ~0007310

Hello Sergio,

It looks like the problem is likely deeper than it seemed at the beginning and in my case is related to the fact that I stream level instance right after the initialisation of the Noesis view and its viewmodel. I will keep investigating further and also will try the new dll you sent earlier.

Cheers,
Sergey

sergey_sitnikov_ninjatheory

sergey_sitnikov_ninjatheory

2021-06-17 20:27

reporter   ~0007311

Hey Sergio,

I managed to reproduce the issue and sent you more details by the email. Here is the latest crash dump using debug Noesis.dll.

Cheers,
Sergey

Issue History

Date Modified Username Field Change
2021-06-15 15:56 sergey_sitnikov_ninjatheory New Issue
2021-06-15 15:56 sergey_sitnikov_ninjatheory Tag Attached: C++
2021-06-15 15:56 sergey_sitnikov_ninjatheory Tag Attached: UE4
2021-06-15 15:56 sergey_sitnikov_ninjatheory Tag Attached: xaml
2021-06-15 15:56 sergey_sitnikov_ninjatheory File Added: UE4CC-Windows-0AAC39604FF526D6D02B4B96473383D9_0000.zip
2021-06-15 20:07 sfernandez Assigned To => sfernandez
2021-06-15 20:07 sfernandez Status new => assigned
2021-06-15 20:07 sfernandez Target Version => 3.0.13
2021-06-15 20:07 sfernandez Description Updated
2021-06-16 09:47 sergey_sitnikov_ninjatheory File Added: UE4CC-Windows-72213015497A202C274847AFC5DE8CE7_0000.zip
2021-06-16 09:47 sergey_sitnikov_ninjatheory Note Added: 0007296
2021-06-16 14:26 sergey_sitnikov_ninjatheory Note Added: 0007298
2021-06-16 16:05 sfernandez Note Added: 0007299
2021-06-17 12:37 sfernandez Status assigned => feedback
2021-06-17 12:37 sfernandez Note Added: 0007302
2021-06-17 13:50 sergey_sitnikov_ninjatheory Note Added: 0007303
2021-06-17 13:50 sergey_sitnikov_ninjatheory Status feedback => assigned
2021-06-17 14:57 sfernandez Status assigned => feedback
2021-06-17 14:57 sfernandez Note Added: 0007304
2021-06-17 15:20 sergey_sitnikov_ninjatheory Note Added: 0007305
2021-06-17 15:20 sergey_sitnikov_ninjatheory Status feedback => assigned
2021-06-17 15:28 sfernandez Note Added: 0007306
2021-06-17 15:43 sergey_sitnikov_ninjatheory File Added: UE4CC-Windows-EA9C8C9E49C72BB548B0CFA9584A2F64_0000.zip
2021-06-17 15:43 sergey_sitnikov_ninjatheory Note Added: 0007307
2021-06-17 16:01 sergey_sitnikov_ninjatheory File Added: UE4CC-Windows-83B4716D4014A57545BC7AA489B6EAB9_0000.zip
2021-06-17 16:01 sergey_sitnikov_ninjatheory Note Added: 0007308
2021-06-17 16:01 sergey_sitnikov_ninjatheory Note Edited: 0007308
2021-06-17 16:13 sergey_sitnikov_ninjatheory File Added: UE4CC-Windows-BBD83AB0438347D7BEF1D998F74646DE_0000.zip
2021-06-17 16:13 sergey_sitnikov_ninjatheory Note Added: 0007309
2021-06-17 17:58 sergey_sitnikov_ninjatheory Note Added: 0007310
2021-06-17 20:27 sergey_sitnikov_ninjatheory File Added: UE4CC-Windows-342A90954289735B6C8DDC809D91EEAD_0000.zip
2021-06-17 20:27 sergey_sitnikov_ninjatheory Note Added: 0007311
2021-06-18 19:59 sfernandez Status assigned => resolved
2021-06-18 19:59 sfernandez Resolution open => fixed
2021-06-18 19:59 sfernandez Fixed in Version => 3.0.13