Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Avalonia TabControl causes MainSceneView to be disposed
#1
I am having an unexpected behaviour with the Avalonia TabControl.

The Scene is initialized when the control is first shown, but if you tab to another control and come back the Scene is disposed. When you try to move the camera, the following exception is thrown:

Code:
  at Ab4d.SharpEngine.SceneNodes.SceneNode.Update()
  at Ab4d.SharpEngine.Scene.Update(Boolean forceUpdateAll)
  at Ab4d.SharpEngine.Scene.GetClosestHitObject(Ray ray, SceneNode rootSceneNode, HitTestOptions customHitTestOptions)
  at Ab4d.SharpEngine.SceneView.GetClosestHitObject(Ray ray, HitTestOptions customHitTestOptions)
  at Ab4d.SharpEngine.Utilities.CameraController.GetRotationCenterPositionFromPointerPosition(Vector2 pointerPosition, Boolean calculatePositionWhenNoObjectIsHit)
  at Ab4d.SharpEngine.Utilities.CameraController.UpdateRotationCenterPosition(Vector2 pointerPosition, Boolean calculatePositionWhenNoObjectIsHit)
  at Ab4d.SharpEngine.Utilities.CameraController.StartCameraRotation(Vector2 pointerPosition)
  at Ab4d.SharpEngine.Utilities.ManualPointerCameraController.StartPointerProcessing(Vector2 pointerPosition, PointerButtons pressedButtons, KeyboardModifiers keyboardModifiers)
  at Ab4d.SharpEngine.Utilities.ManualPointerCameraController.ProcessPointerMoved(Vector2 pointerPosition, PointerButtons pressedPointerButtons, KeyboardModifiers keyboardModifiers)
  at Ab4d.SharpEngine.AvaloniaUI.PointerCameraController.♔(Object ♔, PointerEventArgs ♔)
  at Avalonia.Interactivity.Interactive.<AddHandler>g__InvokeAdapter|8_0[TEventArgs](Delegate baseHandler, Object sender, RoutedEventArgs args)
  at Avalonia.Interactivity.Interactive.<>c__8`1.<AddHandler>b__8_1(Delegate baseHandler, Object sender, RoutedEventArgs args)
  at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e)
  at Avalonia.Interactivity.EventRoute.RaiseEvent(Interactive source, RoutedEventArgs e)
  at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e)
  at Avalonia.Input.MouseDevice.ProcessRawEvent(RawPointerEventArgs e)
  at Avalonia.Controls.TopLevel.<>c.<HandleInput>b__150_0(Object state)
  at Avalonia.Threading.Dispatcher.Send(SendOrPostCallback action, Object arg, Nullable`1 priority)
  at Avalonia.Controls.TopLevel.HandleInput(RawInputEventArgs e)
  at Avalonia.Win32.WindowImpl.AppWndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam)
  at Avalonia.Win32.WindowImpl.WndProcMessageHandler(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam)
  at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
  at Avalonia.Win32.Win32DispatcherImpl.RunLoop(CancellationToken cancellationToken)
  at Avalonia.Threading.DispatcherFrame.Run(IControlledDispatcherImpl impl)
  at Avalonia.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
  at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
  at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.StartCore(String[] args)
  at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args)
  at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, Action`1 lifetimeBuilder)
  at AB4D.TabControlIssue.Program.Main(String[] args) in D:\Development\Ab4d.SharpEngine.Samples-main\TabControlSample\Program.cs:line 12

I created a project at GitHub to illustrate the issue

https://github.com/MichaelFCoyle/AB4D.TabControlIssue

In the main application I am working with a different exception is thrown because I am adding points to the root node but basically the MainSceneView, Scene, SceneView and RootNode are all disposed.

Is there guidance where I can re-create the scene in code every time the TabControl is shown?
  


Messages In This Thread
Avalonia TabControl causes MainSceneView to be disposed - by Oplopanax - 02-07-2026, 07:56 AM

Forum Jump:


Users browsing this thread:
1 Guest(s)