View Issue Details

IDProjectCategoryView StatusLast Update
0002791NoesisGUIUnitypublic2024-07-08 11:06
Reporterstonstad Assigned Tosfernandez  
PrioritynormalSeverityminor 
Status resolvedResolutionfixed 
Product Version3.2.2 
Target Version3.2.4Fixed in Version3.2.4 
Summary0002791: [NOESIS/E] Visuals don't have a common ancestor after domain reload.
Description

After a domain reload, I get the following error when user controls are created.

[NOESIS/E] Visuals don't have a common ancestor
UnityEngine.Debug:LogError (object,UnityEngine.Object)
NoesisUnity:UnityLog (int,string) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisUnity.cs:363)
Noesis.Visual:TransformToVisual (Noesis.Visual) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Proxies/Visual.cs:137)
NoesisGUIExtensions.BackgroundEffectBehavior:OnElementUpdated (object,Noesis.EventArgs) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Interactivity/BackgroundEffectBehavior.cs:125)
Noesis.EventArgs:InvokeHandler (System.Delegate,intptr,intptr) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Proxies/EventArgs.cs:51)
Noesis.EventManager:InvokeHandler (string,System.Delegate,intptr,intptr) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/Events.cs:660)
Noesis.EventHandlerStore:RaiseEvent (intptr,intptr,string,intptr,intptr) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/Events.cs:407)
Noesis.View:Update (double) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/View.cs:368)
NoesisView:UpdateInternal () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisView.cs:1461)
NoesisView:LateUpdate () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisView.cs:1362)

Steps To Reproduce

This is new to 3.2.2.

1) Open Unity
2) Run game. No errors are shown. Stop game.
3) Run game. Now user controls throw the above error.

I'm sure you'll need a reproduction project. This is one of three different kinds of errors I am seeing with 3.2.2. I'm trying to resolve the bug with the stack overflow, and I'm running into this behavior. I am also running into Unity Editor crashes on domain reload after editing XAML. I'll file a separate report for the crashes -- but perhaps it is all related.

PlatformAny

Relationships

related to 0002727 resolvedsfernandez Stack Overflow and Crash from Player and Unity Editor When Button Clicked 

Activities

stonstad

stonstad

2023-10-30 05:38

reporter   ~0008897

Last edited: 2023-10-30 05:38

*edit, removed.

sfernandez

sfernandez

2023-10-30 11:11

manager   ~0008900

I was not able to reproduce it with our BackgroundBlur sample included in the plugin.
Is this only happening in your game or are you able to reproduce it in a separate simple project?

I could add a check before calling TransformToVisual to avoid the error message, but I want to understand why this is happening.

stonstad

stonstad

2023-10-30 16:23

reporter   ~0008904

I think the error message is telling us that something is wrong, but I can't seem to figure out what the precise side-effect is to having a static singleton instance of my top-level UI, and how it is contributing to the behaviors I am seeing.

I have a very complex use-case for background blur effect, which involves two separate effects, and binding logic to tell a template which blur layer to use (to avoid cyclic dependencies).

[UIStateMachine]
<Controls>

[Root] (this is a static singleton)
[OverlayBlurSource]
[BackgroundBlurSource (Camera)]
[BaseLayer]
<BackgroundControlTitle>
-> BackgroundBlurSource

[OverlayLayer]
<TitleMenuControl>
<BackgroundEffect1>
-> OverlayBlurSource

  • The first background blur source uses a 2D texture from the Unity camera. This is "Background Blur Source". Controls in the BaseLayer or OverlayLayer may reference this brush.
  • The second background blur source combines everything in the "base" layer visual tree, including the original blur source. This is called "OverlayBlurSource". This is the blur source used by overlays.

I can see how referencing an incorrect layer causes a cyclic dependency. But what isn't clear is why it sometimes works, and sometimes doesn't, and always works in 3.2.1. As you suggest, it may be related to a different behavior / issue.

stonstad

stonstad

2023-10-30 17:41

reporter   ~0008907

The warning message, " [NOESIS/E] Visuals don't have a common ancestor after domain reload." is now resolved by changing my 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.

jsantos

jsantos

2024-07-05 20:26

manager   ~0009750

Can this be closed then?

stonstad

stonstad

2024-07-06 18:48

reporter   ~0009751

Yes. Thank you!

Issue History

Date Modified Username Field Change
2023-10-29 21:39 stonstad New Issue
2023-10-30 05:13 stonstad Steps to Reproduce Updated
2023-10-30 05:38 stonstad Note Added: 0008897
2023-10-30 05:38 stonstad Note Edited: 0008897
2023-10-30 11:11 sfernandez Assigned To => sfernandez
2023-10-30 11:11 sfernandez Status new => feedback
2023-10-30 11:11 sfernandez Note Added: 0008900
2023-10-30 11:42 jsantos Relationship added related to 0002727
2023-10-30 16:23 stonstad Note Added: 0008904
2023-10-30 16:23 stonstad Status feedback => assigned
2023-10-30 17:41 stonstad Note Added: 0008907
2023-11-01 15:12 stonstad Steps to Reproduce Updated
2024-07-05 20:26 jsantos Note Added: 0009750
2024-07-05 20:27 jsantos Status assigned => feedback
2024-07-05 20:27 jsantos Target Version => 3.2.5
2024-07-06 18:48 stonstad Note Added: 0009751
2024-07-06 18:48 stonstad Status feedback => assigned
2024-07-08 11:06 sfernandez Status assigned => resolved
2024-07-08 11:06 sfernandez Resolution open => fixed
2024-07-08 11:06 sfernandez Fixed in Version => 3.2.4
2024-07-08 11:06 sfernandez Target Version 3.2.5 => 3.2.4
2025-10-10 13:29 jsantos Category Unity3D => Unity