View Issue Details

IDProjectCategoryView StatusLast Update
0002727NoesisGUIUnitypublic2024-07-05 20:26
Reporterstonstad Assigned Tosfernandez  
PrioritynormalSeveritycrash 
Status resolvedResolutionfixed 
Product Version3.2.2 
Target Version3.2.5 
Summary0002727: Stack Overflow and Crash from Player and Unity Editor When Button Clicked
Description

Clicking certain buttons causes both the Unity Editor and built Player to crash due to a stack overflow. The only change is that we upgraded to 3.2.2.

I am not seeing a crash dump or error logs. When attached to the Editor process, I am getting this error:

(Filename: D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisUnity.cs Line: 363)
Exception thrown at 0x00007FFD65EEE96B (Noesis.dll) in Unity.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x00000066168D3FF0).
Unhandled exception at 0x00007FFD65EEE96B (Noesis.dll) in Unity.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x00000066168D3FF0).

I am enclosing a minidump w/ heap from Visual Studio (when attached to Unity editor).

Please let me know what else I can do to assist.

Attached Files
Unity.dmp (1,154,452 bytes)
PlatformAny

Relationships

related to 0002791 resolvedsfernandez [NOESIS/E] Visuals don't have a common ancestor after domain reload. 
related to 0002793 resolvedsfernandez Noesis Unloading UserControls 

Activities

stonstad

stonstad

2023-10-13 18:30

reporter   ~0008817

Top of stack trace.

image.png (64,173 bytes)   
image.png (64,173 bytes)   
stonstad

stonstad

2023-10-13 18:32

reporter   ~0008818

If I hit continue in the debugger, it starts reading invalid memory....

nhandled exception at 0x00007FFD65FAC121 (Noesis.dll) in Unity.exe: 0xC0000005: Access violation writing location 0x00000066168D0FF0.

Exception thrown at 0x00007FFD65FAC121 (Noesis.dll) in Unity.exe: 0xC0000005: Access violation writing location 0x00000066168D0FF0.

Unhandled exception at 0x00007FFD65FAC121 (Noesis.dll) in Unity.exe: 0xC0000005: Access violation writing location 0x00000066168D0FF0.

Exception thrown at 0x00007FFD65FAC121 (Noesis.dll) in Unity.exe: 0xC0000005: Access violation writing location 0x00000066168D0FF0.

Unhandled exception at 0x00007FFD65FAC121 (Noesis.dll) in Unity.exe: 0xC0000005: Access violation writing location 0x00000066168D0FF0.

Exception thrown at 0x00007FFD65FAC121 (Noesis.dll) in Unity.exe: 0xC0000005: Access violation writing location 0x00000066168D0FF0.

Unhandled exception at 0x00007FFD65FAC121 (Noesis.dll) in Unity.exe: 0xC0000005: Access violation writing location 0x00000066168D0FF0.

Exception thrown at 0x00007FFD65FAC121 (Noesis.dll) in Unity.exe: 0xC0000005: Access violation writing location 0x00000066168D0FF0.

Unhandled exception at 0x00007FFD65FAC121 (Noesis.dll) in Unity.exe: 0xC0000005: Access violation writing location 0x00000066168D0FF0.

Exception thrown at 0x00007FFD65FAC121 (Noesis.dll) in Unity.exe: 0xC0000005: Access violation writing location 0x00000066168D0FF0.

Unhandled exception at 0x00007FFD65FAC121 (Noesis.dll) in Unity.exe: 0xC0000005: Access violation writing location 0x00000066168D0FF0.

Exception thrown at 0x00007FFD65FAC121 (Noesis.dll) in Unity.exe: 0xC0000005: Access violation writing location 0x00000066168D0FF0.

Unhandled exception at 0x00007FFD65FAC121 (Noesis.dll) in Unity.exe: 0xC0000005: Access violation writing location 0x00000066168D0FF0.

Exception thrown at 0x00007FFD65FAC121 (Noesis.dll) in Unity.exe: 0xC0000005: Access violation writing location 0x00000066168D0FF0.

Unhandled exception at 0x00007FFD65FAC121 (Noesis.dll) in Unity.exe: 0xC0000005: Access violation writing location 0x00000066168D0FF0.

Unity2.dmp (1,154,688 bytes)
stonstad

stonstad

2023-10-13 18:49

reporter   ~0008820

I can't reliably reproduce it. Clicking on buttons may cause the stack overflow. Because it is not consistent and I'm having trouble isolating it to a single line of code. This is high priority for me because if I can't get the PC version to run OK, I have to roll back to 3.2.1, and that impacts XBOX work, which has the corrupt texture issue in 3.2.1.

sfernandez

sfernandez

2023-10-16 18:27

manager   ~0008828

I'm not able to open the attached crash dumps. Could you open them fine in your Visual? Which version?

stonstad

stonstad

2023-10-16 18:33

reporter   ~0008829

They came from VS 2022 17.5.2. I tried opening them and they don't work for me either. :( I kept getting VS errors when I tried to save dump. Assuming that is still broken, when retesting with PDBs help?

jsantos

jsantos

2023-10-16 20:58

manager   ~0008835

I don't think PDBs will help. Let's try again to generate dumps. because without them we are unable to get enough information.

I also assume you are not able to reproduce this in our Buttons example right?

stonstad

stonstad

2023-10-18 17:04

reporter   ~0008843

Understood. I'm working to understand why VS isn't properly exporting dumps. That's correct -- the button sample does not reproduce this behavior.

jsantos

jsantos

2023-10-18 17:16

manager   ~0008844

Thanks!

stonstad

stonstad

2023-10-18 17:58

reporter   ~0008845

Last edited: 2023-10-18 17:58

Still working on getting a dump exported. I keep getting an error message. I receive this error when I export from Unity and the built binary.... I'll try changing VS versions.

image-2.png (176,865 bytes)   
image-2.png (176,865 bytes)   
jsantos

jsantos

2023-10-19 11:07

manager   ~0008850

Last edited: 2023-10-27 21:11

Thanks for the dump!

@Sergio This is seems to be related to an infinite loop generating offscreen nodes for visual brushes


Noesis.dll!Noesis::RenderTreeHelper::AccumNode() Line 1541 C++

Noesis.dll!Noesis::RenderTreeHelper::GenerateOffscreenNodes() Line 482 C++
Noesis.dll!Noesis::RenderTreeHelper::GenerateOffscreenNodes() Line 523 C++
Noesis.dll!Noesis::RenderTreeHelper::GenerateOffscreenNodes() Line 523 C++
Noesis.dll!Noesis::RenderTreeHelper::GenerateOffscreenNodes() Line 523 C++
Noesis.dll!Noesis::RenderTreeHelper::GenerateOffscreenNodes() Line 523 C++
Noesis.dll!Noesis::RenderTreeHelper::GenerateOffscreenNodes() Line 523 C++
Noesis.dll!Noesis::RenderTreeHelper::GenerateOffscreenNodes() Line 523 C++
Noesis.dll!Noesis::RenderTreeHelper::GenerateVisualBrush() Line 800 C++
Noesis.dll!Noesis::RenderTreeHelper::GenerateVisualBrushes() Line 668 C++
Noesis.dll!Noesis::RenderTreeHelper::GenerateOffscreenNodes() Line 518 C++
Noesis.dll!Noesis::RenderTreeHelper::GenerateVisualBrush() Line 800 C++
Noesis.dll!Noesis::RenderTreeHelper::GenerateVisualBrushes() Line 668 C++

stonstad

stonstad

2023-10-20 21:07

reporter   ~0008860

If you have any test assemblies you would like us to try, we are ready and available. Or if there is a proposed work-around, thank you!

stonstad

stonstad

2023-10-20 21:18

reporter   ~0008861

Separately, we're seeing a hang when the game launches on Xbox and the build is release/master. We're thinking it could be related to the above behavior.

Thanks,
Shaun

stonstad

stonstad

2023-10-23 14:30

reporter   ~0008864

Good afternoon. I'm just reaching out to see if there are any updates? Thank you.

jsantos

jsantos

2023-10-23 14:53

manager   ~0008865

Hello, we haven't had time to work on this

stonstad

stonstad

2023-10-24 20:14

reporter   ~0008877

How can I help to provide the diagnostic data needed to resolve this behavior? This bug prevents us from upgrading to 3.2.2. 3.2.1 is showing texture issues on Xbox and we are stuck between two worlds. Thanks, Shaun.

jsantos

jsantos

2023-10-25 11:48

manager   ~0008881

Right now, we have all the needed information, we will come back as soon as possible.

By the way, 3.2.1 should work in Xbox is you disable "Linear" rendering.

stonstad

stonstad

2023-10-26 16:17

reporter   ~0008884

Understood. Switching to gamma rendering creates a different set of problems for us. If the issue is related to visual brushes, perhaps I can arrange my XAML resourced dictionaries differently?

sfernandez

sfernandez

2023-10-27 21:23

manager   ~0008891

Hi,

The crash is definitely related to VisualBrushes.
What is happening is that there is an element A with a VisualBrush that targets an element B with another VisualBrush that targets an ancestor of element A.
We should detect that circularity, show an error message and avoid any stack overflow.

In the meantime could you please check your usage of VisualBrushes and maybe disable them?

stonstad

stonstad

2023-10-28 00:43

reporter   ~0008892

Your feedback as helpful. OK, the cause is the use of BackgroundEffectBehavior (shown in style below) in combination with a pop-up window. Usage is shown below the style.

<Style x:Key="BorderControlHero" TargetType="local:BorderControlHero">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:BorderControlHero">
<Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height=""/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="
"/>
</Grid.ColumnDefinitions>

                <!-- Bottom Shape -->
                <Grid Grid.Row="1">
                    <Path x:Name="_BottomPanelBlur">

<!-- disabled to prevent stackoverflow behavior in 3.2.2 -->
<!--<b:Interaction.Behaviors>
<noesis:BackgroundEffectBehavior x:Name="_BottomPanelBackgroundEffect" Source="{Binding ElementName=_BackgroundBlurSource}">
<BlurEffect Radius="{Binding Radius, Source={StaticResource BottomBlurRadius}}"/>
</noesis:BackgroundEffectBehavior>
</b:Interaction.Behaviors>-->
</Path>
<Path x:Name="_BottomPanelColor" Fill="{StaticResource DefaultUI.Brush.Bottom.Gradient}" Stroke="{StaticResource DefaultUI.Brush.Border}" Margin="0,-1,0,0" Opacity="0.5">
<Path.Effect>
<DropShadowEffect Direction="270" Opacity="0.365" BlurRadius="20" ShadowDepth="18"/>
</Path.Effect>
</Path>
<Path x:Name="_DecorLeft" Fill="{StaticResource DefaultUI.Brush.Decor.BottomLeft.Gradient}" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="-1,0,0,0" Opacity="0.7"/>
<Path x:Name="_DecorRight" Fill="{StaticResource DefaultUI.Brush.Decor.BottomRight.Gradient}" VerticalAlignment="Bottom" HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Opacity="0.7">
<Path.RenderTransform>
<ScaleTransform ScaleX="-1"/>
</Path.RenderTransform>
</Path>
</Grid>

                <!-- Content -->
                <ContentPresenter Grid.Row="1" ContentSource="Content" />

                <!-- Top Shape -->
                <Grid Grid.Row="0">
                    <Path x:Name="_TopPanelBlur" >
                        <!--<b:Interaction.Behaviors>
                            <noesis:BackgroundEffectBehavior x:Name="_TopPanelBackgroundEffect" Source="{Binding ElementName=_BackgroundBlurSource}">
                                <BlurEffect Radius="{Binding Radius, Source={StaticResource TopBlurRadius}}"/>
                            </noesis:BackgroundEffectBehavior>
                        </b:Interaction.Behaviors>-->
                    </Path>
                    <Path x:Name="_TopPanelColor" Fill="{StaticResource DefaultUI.Brush.Top.Gradient}" Stroke="{StaticResource DefaultUI.Brush.Border}" Opacity="0.7">
                        <Path.Effect>
                            <DropShadowEffect Direction="270" Opacity="0.35" ShadowDepth="8" BlurRadius="20"/>
                        </Path.Effect>
                    </Path>
                    <Path x:Name="_DecorTop" Fill="{StaticResource DefaultUI.Brush.Decor.Gradient}" VerticalAlignment="Top"/>

                    <Ellipse x:Name="_LineHighlight" Fill="{StaticResource DefaultUI.Brush.Decor.Gradient}" Height="1" VerticalAlignment="Bottom" Width="500"/>
                </Grid>

                <!-- Top Content -->
                <Grid Grid.Row="0" HorizontalAlignment="Center" Effect="{StaticResource DefaultUI.Effect.TextShadow}">
                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0, 0, 0, -12">
                        <ContentControl Template="{StaticResource logo_template}" Background="{StaticResource DefaultUI.Brush.LogoBlueBg}" Width="45" Height="45"
                              Visibility="{Binding LogoVisibility, RelativeSource={RelativeSource AncestorType={x:Type local:BorderControlHero}}}" />
                        <TextBlock x:Name="_LogoText" HorizontalAlignment="Center" FontFamily="{StaticResource TekoMedium}" FontSize="40" 
                                           VerticalAlignment="Center" Foreground="White" noesis:Text.CharacterSpacing="90" 
                                           Margin="18, 0, 0, 0" 
                                           Text="{Binding TitleText, RelativeSource={RelativeSource AncestorType={x:Type local:BorderControlHero}}}"
                                           Visibility="{Binding TitleVisibility, RelativeSource={RelativeSource AncestorType={x:Type local:BorderControlHero}}}"
                                           />
                    </StackPanel>
                </Grid>
            </Grid>
        </ControlTemplate>
    </Setter.Value>
</Setter>

</Style>

_BackgroundBlurSource is created as a top-level element within the game's visual tree:

<!-- game's top level visual tree -->

<Grid>
<Grid x:Name="_BaseLayerBlurSource">
<Grid x:Name="_BackgroundBlurSourceContainer" Opacity="0">
<Border x:Name="_BackgroundBlurSource" Background="{DynamicResource DefaultUI.Brush.Background}"/>
</Grid>
<Grid x:Name="_BaseLayer"/>
</Grid>
<local:OverlayLayer x:Name="_OverlayLayer"/>
</Grid>

_BackgroundBlurSource and OverlayLayer exist within separate trees to prevent a stackoverflow. This works successfully in 3.2.1.

stonstad

stonstad

2023-10-28 17:43

reporter   ~0008893

Last edited: 2023-10-28 17:44

It works in 3.2.1 all the time. And in 3.2.2 it works most of the time. When it fails, I am not seeing my code in the call stack. I am thinking this is a Noesis race condition.

stonstad

stonstad

2023-10-28 18:13

reporter   ~0008894

  • The camera renders to a texture which is saved in Resources["DefaultUI.Brush.Background"]
  • This texture is then used as a background for _BackgroundBlurSource.
  • The style shown uses _BackbroundBlurSource as a background for BackgroundEffectBehavior
  • BaseLayerBlurSource is saved in Resource["BaseLayerBlurSource"]. This resource contains _BackgroundBlurSource and base layer U layers (_BaseLayer).
  • Pop-up layers use BaseLayerBlurSource for their BackgroundEffectBehavior.

The visual result is as follows:

  • Base Layer Blur.png. BackgroundEffectBehavior uses _BackgroundBlurSource.
  • Base Layer Blur with Secondary Blur.png BackgroundEffectBehavior uses _BackgroundBlurSource _BaseLayerBlurSource.

It works well except in 3.2.2 sometimes.

Base Layer Blur.png (1,661,300 bytes)
stonstad

stonstad

2023-10-28 18:54

reporter   ~0008895

Last edited: 2023-10-28 19:14

I don't really understand what is happening or why. I may not share more detail for a while until I can understand what is happening.

stonstad

stonstad

2023-10-30 06:11

reporter   ~0008899

I can stop the crashes by disabling the visual brush used by BackgroundEffectBehavior.

After careful analysis I do not believe there is a cyclic dependency with visual brushes. With the functionality disabled, I'm now seeing other behaviors during subsequent rounds of editor playback. The strange behaviors are resolved by an app domain reload.

Some of these behaviors are documented in https://www.noesisengine.com/bugs/view.php?id=2791 and https://www.noesisengine.com/bugs/view.php?id=2793 Other behaviors are visual, such as UIs appearing differently based on the order of invocation within the visual tree.

If there truly was a cyclic dependency in visual brushes, wouldn't 3.2.1, by necessity, also experience a stack overflow?

I think the process for reloading app domains in Noesis changed.

sfernandez

sfernandez

2023-10-30 11:40

manager   ~0008901

If this error was not happening always it might be related to your other posts 0002791 and 0002793.
It seems that some elements in the UI tree are not correctly released from play to play and are somehow mixed or misused in subsequent plays.

stonstad

stonstad

2023-10-30 17:41

reporter   ~0008908

The previously described crash behavior is now resolved by changing the binding approach.

Previously, binding BackgroundEffectBehavior.Source was accomplished as follows:

// code-behind:

public static readonly DependencyProperty BlurLayerProperty = DependencyProperty.Register("BlurLayer", typeof(FrameworkElement), typeof(BorderControlTitle), new PropertyMetadata(null));

public FrameworkElement BlurLayer
{
get { return (FrameworkElement)GetValue(BlurLayerProperty); }
set { SetValue(BlurLayerProperty, value); }
}

public override void OnApplyTemplate()
{
base.OnApplyTemplate();
if (Template != null && BlurLayer != null)
{
BackgroundEffectBehavior _BottomPanelBackgroundEffect = GetTemplateChild("_BottomPanelBackgroundEffect") as BackgroundEffectBehavior;
BackgroundEffectBehavior _TopPanelBackgroundEffect = GetTemplateChild("_TopPanelBackgroundEffect") as BackgroundEffectBehavior;

  if (_BottomPanelBackgroundEffect != null)
     _BottomPanelBackgroundEffect.Source = BlurLayer;
  if (_TopPanelBackgroundEffect != null)
     _TopPanelBackgroundEffect.Source = BlurLayer;

}
}

Binding is now accomplished as follows:

public static readonly DependencyProperty BlurLayerProperty = DependencyProperty.Register("BlurLayer", typeof(FrameworkElement), typeof(BorderControlTitle), new PropertyMetadata(null));

public FrameworkElement BlurLayer
{
get { return (FrameworkElement)GetValue(BlurLayerProperty); }
set { SetValue(BlurLayerProperty, value); }
}

// XAML:
<b:Interaction.Behaviors>
<noesis:BackgroundEffectBehavior Source="{Binding RelativeSource={RelativeSource AncestorType=local:BorderControlHero}, Path=BlurLayer}">
<BlurEffect Radius="{Binding Radius, Source={StaticResource BottomBlurRadius}}"/>
</noesis:BackgroundEffectBehavior>
</b:Interaction.Behaviors>

All error messages and crashes are now resolved.

sfernandez

sfernandez

2024-06-03 19:59

manager   ~0009620

Can we close this issue?

stonstad

stonstad

2024-07-05 19:36

reporter   ~0009746

Yes, please feel free to close. Thank you for the assistance in resolving this behavior.

Issue History

Date Modified Username Field Change
2023-10-13 18:25 stonstad New Issue
2023-10-13 18:25 stonstad File Added: Unity.dmp
2023-10-13 18:30 stonstad Note Added: 0008817
2023-10-13 18:30 stonstad File Added: image.png
2023-10-13 18:32 stonstad Note Added: 0008818
2023-10-13 18:32 stonstad File Added: Unity2.dmp
2023-10-13 18:49 stonstad Note Added: 0008820
2023-10-16 17:52 sfernandez Assigned To => sfernandez
2023-10-16 17:52 sfernandez Status new => assigned
2023-10-16 17:52 sfernandez Target Version => 3.2.3
2023-10-16 18:27 sfernandez Status assigned => feedback
2023-10-16 18:27 sfernandez Note Added: 0008828
2023-10-16 18:33 stonstad Note Added: 0008829
2023-10-16 18:33 stonstad Status feedback => assigned
2023-10-16 20:58 jsantos Note Added: 0008835
2023-10-16 20:59 jsantos Status assigned => feedback
2023-10-18 17:04 stonstad Note Added: 0008843
2023-10-18 17:04 stonstad Status feedback => assigned
2023-10-18 17:16 jsantos Status assigned => feedback
2023-10-18 17:16 jsantos Note Added: 0008844
2023-10-18 17:58 stonstad Note Added: 0008845
2023-10-18 17:58 stonstad File Added: image-2.png
2023-10-18 17:58 stonstad Status feedback => assigned
2023-10-18 17:58 stonstad Note Edited: 0008845
2023-10-19 11:07 jsantos Note Added: 0008850
2023-10-19 11:08 jsantos Note Edited: 0008850
2023-10-20 21:07 stonstad Note Added: 0008860
2023-10-20 21:18 stonstad Note Added: 0008861
2023-10-23 14:30 stonstad Note Added: 0008864
2023-10-23 14:53 jsantos Note Added: 0008865
2023-10-24 20:14 stonstad Note Added: 0008877
2023-10-25 11:48 jsantos Note Added: 0008881
2023-10-26 16:17 stonstad Note Added: 0008884
2023-10-27 21:11 sfernandez Note Edited: 0008850
2023-10-27 21:23 sfernandez Status assigned => feedback
2023-10-27 21:23 sfernandez Note Added: 0008891
2023-10-28 00:43 stonstad Note Added: 0008892
2023-10-28 00:43 stonstad Status feedback => assigned
2023-10-28 17:43 stonstad Note Added: 0008893
2023-10-28 17:44 stonstad Note Edited: 0008893
2023-10-28 18:13 stonstad Note Added: 0008894
2023-10-28 18:13 stonstad File Added: Base Layer Blur With Secondary Blur-.png
2023-10-28 18:13 stonstad File Added: Base Layer Blur.png
2023-10-28 18:54 stonstad Note Added: 0008895
2023-10-28 19:14 stonstad Note Edited: 0008895
2023-10-30 06:11 stonstad Note Added: 0008899
2023-10-30 11:40 sfernandez Status assigned => feedback
2023-10-30 11:40 sfernandez Note Added: 0008901
2023-10-30 11:42 jsantos Relationship added related to 0002791
2023-10-30 11:42 jsantos Relationship added related to 0002793
2023-10-30 17:41 stonstad Note Added: 0008908
2023-10-30 17:41 stonstad Status feedback => assigned
2024-01-22 11:47 sfernandez Target Version 3.2.3 => 3.2.4
2024-06-03 19:59 sfernandez Status assigned => feedback
2024-06-03 19:59 sfernandez Note Added: 0009620
2024-06-13 18:01 sfernandez Target Version 3.2.4 => 3.2.5
2024-07-05 19:36 stonstad Note Added: 0009746
2024-07-05 19:36 stonstad Status feedback => assigned
2024-07-05 20:26 jsantos Status assigned => resolved
2024-07-05 20:26 jsantos Resolution open => fixed
2025-10-10 13:29 jsantos Category Unity3D => Unity