View Issue Details

IDProjectCategoryView StatusLast Update
0002793NoesisGUIUnitypublic2024-04-26 14:00
Reporterstonstad Assigned Tosfernandez  
PrioritynormalSeveritymajor 
Status resolvedResolutionno change required 
Product Version3.2.2 
Target Version3.2.4 
Summary0002793: Noesis Unloading UserControls
Description

Noesis "holds onto" an instance of a user control during Unity Editor play, stop, and play cycles. On a subsequent play, "Unloaded" is called during playback. See details below, which stores the time the user control was made. You'll notice that an old instance is unloaded, noted by the following log line: UIStateMachine Unloaded 10/29/2023 11:56:13 PM. This is an instance from a previous playback run within the editor.

This user control is stored to a static singleton get accessor. However, it is released via UserControl.Instance = null during script OnDestroy.

Calling dispose on the instance within MonoBeahvior.OnDestroy causes a crash, documented here: https://www.noesisengine.com/bugs/view.php?id=2792

On subsequent runs (without an app domain unload), these errors occur: https://www.noesisengine.com/bugs/view.php?id=2791

It appears to be related.

Steps To Reproduce

Noesis appears to be holding onto user control instances across AppDomain unload boundaries. Eventually, the control is released but it happens during subsequent playback.

  1. App Domain Unload.
  2. First Run

UIStateMachine CTOR 10/29/2023 11:56:13 PM
UnityEngine.Debug:LogWarning (object)
StellarConquest.Presentation.Unity.UI.UIStateMachine:.ctor () (at Assets/User Interface/UIStateMachine.cs:53)
(wrapper dynamic-method) object:lambda_method (System.Runtime.CompilerServices.Closure)
Noesis.Extend:CreateInstance (intptr,intptr) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/Extend.cs:5711)
Noesis.GUI:LoadXaml (System.IO.Stream,string) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/NoesisGUI.cs:292)
NoesisXaml:Load () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisXaml.cs:17)
NoesisView:LoadXaml (bool) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisView.cs:535)
NoesisView:OnEnable () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisView.cs:723)

UIStateMachine InitializeComponent 10/29/2023 11:56:13 PM
UnityEngine.Debug:LogWarning (object)
StellarConquest.Presentation.Unity.UI.UIStateMachine:InitializeComponent () (at Assets/User Interface/UIStateMachine.cs:130)
StellarConquest.Presentation.Unity.UI.UIStateMachine:.ctor () (at Assets/User Interface/UIStateMachine.cs:57)
(wrapper dynamic-method) object:lambda_method (System.Runtime.CompilerServices.Closure)
Noesis.Extend:CreateInstance (intptr,intptr) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/Extend.cs:5711)
Noesis.GUI:LoadXaml (System.IO.Stream,string) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/NoesisGUI.cs:292)
NoesisXaml:Load () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisXaml.cs:17)
NoesisView:LoadXaml (bool) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisView.cs:535)
NoesisView:OnEnable () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisView.cs:723)

UIStateMachine OnInitialized10/29/2023 11:56:13 PM
UnityEngine.Debug:LogWarning (object)
StellarConquest.Presentation.Unity.UI.UIStateMachine:OnInitialized (object,Noesis.EventArgs) (at Assets/User Interface/UIStateMachine.cs:71)
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:CreateCPtr (System.Type,bool&) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/View.cs:562)
Noesis.BaseComponent:.ctor () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Proxies/BaseComponentExtend.cs:16)
Noesis.DispatcherObject:.ctor () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Proxies/DispatcherObject.cs:30)
Noesis.View:.ctor (System.Runtime.InteropServices.HandleRef) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/View.cs:546)
Noesis.View:.ctor (Noesis.FrameworkElement) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/View.cs:519)
NoesisView:CreateView (Noesis.FrameworkElement) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisView.cs:1850)
NoesisView:LoadXaml (bool) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisView.cs:543)
NoesisView:OnEnable () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisView.cs:723)

  1. No App Domain Unload.
  2. Second Run

UIStateMachine CTOR 10/29/2023 11:56:54 PM
UnityEngine.Debug:LogWarning (object)
StellarConquest.Presentation.Unity.UI.UIStateMachine:.ctor () (at Assets/User Interface/UIStateMachine.cs:53)
(wrapper dynamic-method) object:lambda_method (System.Runtime.CompilerServices.Closure)
Noesis.Extend:CreateInstance (intptr,intptr) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/Extend.cs:5711)
Noesis.GUI:LoadXaml (System.IO.Stream,string) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/NoesisGUI.cs:292)
NoesisXaml:Load () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisXaml.cs:17)
NoesisView:LoadXaml (bool) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisView.cs:535)
NoesisView:OnEnable () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisView.cs:723)

UIStateMachine InitializeComponent 10/29/2023 11:56:54 PM
UnityEngine.Debug:LogWarning (object)
StellarConquest.Presentation.Unity.UI.UIStateMachine:InitializeComponent () (at Assets/User Interface/UIStateMachine.cs:130)
StellarConquest.Presentation.Unity.UI.UIStateMachine:.ctor () (at Assets/User Interface/UIStateMachine.cs:57)
(wrapper dynamic-method) object:lambda_method (System.Runtime.CompilerServices.Closure)
Noesis.Extend:CreateInstance (intptr,intptr) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/Extend.cs:5711)
Noesis.GUI:LoadXaml (System.IO.Stream,string) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/NoesisGUI.cs:292)
NoesisXaml:Load () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisXaml.cs:17)
NoesisView:LoadXaml (bool) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisView.cs:535)
NoesisView:OnEnable () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisView.cs:723)

UIStateMachine OnInitialized10/29/2023 11:56:54 PM
UnityEngine.Debug:LogWarning (object)
StellarConquest.Presentation.Unity.UI.UIStateMachine:OnInitialized (object,Noesis.EventArgs) (at Assets/User Interface/UIStateMachine.cs:71)
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:CreateCPtr (System.Type,bool&) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/View.cs:562)
Noesis.BaseComponent:.ctor () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Proxies/BaseComponentExtend.cs:16)
Noesis.DispatcherObject:.ctor () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Proxies/DispatcherObject.cs:30)
Noesis.View:.ctor (System.Runtime.InteropServices.HandleRef) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/View.cs:546)
Noesis.View:.ctor (Noesis.FrameworkElement) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/View.cs:519)
NoesisView:CreateView (Noesis.FrameworkElement) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisView.cs:1850)
NoesisView:LoadXaml (bool) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisView.cs:543)
NoesisView:OnEnable () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/NoesisView.cs:723)

** HERE
UIStateMachine Unloaded 10/29/2023 11:56:13 PM
UnityEngine.Debug:LogWarning (object)
StellarConquest.Presentation.Unity.UI.UIStateMachine:UIStateMachine_Unloaded (object,Noesis.RoutedEventArgs) (at Assets/User Interface/UIStateMachine.cs:65)
Noesis.RoutedEventArgs:InvokeHandler (System.Delegate,intptr,intptr) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Proxies/RoutedEventArgs.cs:50)
Noesis.EventManager:InvokeHandler (intptr,System.Delegate,intptr,intptr) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/Events.cs:578)
Noesis.EventHandlerStore:RaiseRoutedEvent (intptr,intptr,intptr,intptr,intptr) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/Events.cs:267)
Noesis.BaseComponent:Release (intptr) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Proxies/BaseComponent.cs:62)
Noesis.Extend:ReleasePending () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/Extend.cs:6110)
Noesis.Extend:Update () (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/Extend.cs:6119)
Noesis.View:Update (double) (at D:/Source/StellarConquest/StellarConquest.Utilities/Noesis/3.2.2/Runtime/API/Core/View.cs:366)
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)

PlatformAny

Relationships

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

Activities

sfernandez

sfernandez

2023-10-30 11:47

manager   ~0008902

When you say that domain is not reloaded, is because you disabled "Reload Domain" in Project Settings > Editor > Enter Play Mode Settings?
I will do some experiments with those settings and come back to you.

Because Noesis does not have control over assembly reload, we are just hooked to DomainUnload to dispose all the native proxies corresponding to the managed objects.

stonstad

stonstad

2023-10-30 16:16

reporter   ~0008903

Yes, that's right. I can confirm Reload domain is disabled. If I have a static singleton instance to a Noesis user control and the editor stops, should I call Dispose on it, or set it to null, or just leave it alone? If I leave it, the instance will persist between play cycles in the editor.

stonstad

stonstad

2023-10-30 16:29

reporter   ~0008906

Given two Unity editor play cycles A, and B, if a user control created in A is disposed during playback of B, could this affect common XAML resources referenced by both A and B? Or is the memory isolated somehow?

stonstad

stonstad

2023-10-30 17:43

reporter   ~0008910

This may be a non-issue and it is a candidate for closure. If you could just confirm memory isolation, and what the desired approach is for freeing a static singleton instance. Thank you!

stonstad

stonstad

2024-04-26 12:09

reporter   ~0009419

Please feel free to clos this issue. I believe it was user error -- or at minimum it is not an issue now.

sfernandez

sfernandez

2024-04-26 14:00

manager   ~0009423

Thanks for the feedback, I'll close it then

Issue History

Date Modified Username Field Change
2023-10-30 06:02 stonstad New Issue
2023-10-30 11:14 sfernandez Assigned To => sfernandez
2023-10-30 11:14 sfernandez Status new => assigned
2023-10-30 11:14 sfernandez Target Version => 3.2.3
2023-10-30 11:42 jsantos Relationship added related to 0002727
2023-10-30 11:47 sfernandez Status assigned => feedback
2023-10-30 11:47 sfernandez Note Added: 0008902
2023-10-30 16:16 stonstad Note Added: 0008903
2023-10-30 16:16 stonstad Status feedback => assigned
2023-10-30 16:29 stonstad Note Added: 0008906
2023-10-30 17:43 stonstad Note Added: 0008910
2024-01-22 11:47 sfernandez Target Version 3.2.3 => 3.2.4
2024-04-26 12:09 stonstad Note Added: 0009419
2024-04-26 14:00 sfernandez Status assigned => resolved
2024-04-26 14:00 sfernandez Resolution open => no change required
2024-04-26 14:00 sfernandez Note Added: 0009423
2025-10-10 13:29 jsantos Category Unity3D => Unity