Hello,
we switched our application from .NET 4.8 to .NET 6 and your GoWPF from 2.2.2 to Version 3.0.4.
Since this change, one of our tests failes with the following exception:
Must disconnect specified child from current parent Visual before attaching to new parent Visual.
StackTrace
at System.Windows.Media.Visual.AddVisualChild(Visual child)
at Northwoods.GoXam.LinkLayer.InternalAdd(Link part)
at Northwoods.GoXam.DiagramPanel.UpdateVisuals(Rect viewb, Boolean remove)
at Northwoods.GoXam.DiagramPanel.UpdateScrollTransform(Point pos, Double scale, Size panelsize, Boolean clipandscroll)
at Northwoods.GoXam.DiagramPanel.UpdateScrollTransform()
at Northwoods.GoXam.DiagramPanel.OnSizeChanged(Size oldsize, Size newsize)
at Northwoods.GoXam.DiagramPanel.DiagramPanel_SizeChanged(Object sender, SizeChangedEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.FrameworkElement.OnRenderSizeChanged(SizeChangedInfo sizeInfo)
at System.Windows.ContextLayoutManager.fireSizeChangedEvents()
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
— End of stack trace from previous location —
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run()
at <OurApplication.Main()>
I can not give you an exact function that we call and end up in the problem, but somewere after we do the following stuff:
LayeredDigraphLayout layoutEngine = new LayeredDigraphLayout
{
SetsPortSpots = false,
AggressiveOption = LayeredDigraphAggressive.None,
PackOption = LayeredDigraphPack.None,
LayeringOption = LayeredDigraphLayering.OptimalLinkLength,
LayerSpacing = 150
};
this.compositionDiagramView.Layout = layoutEngine;
this.compositionDiagramView.LayoutManager.LayoutDiagram(LayoutInitial.InvalidateAll, true);
this.compositionDiagramView.Layout = new DiagramLayout();
this.compositionDiagramView.LayoutCompleted += this.OnAutolayoutCompleted;
The “compositionDiagramView” is the WPF View which drives from your class “Diagram”.
We would be happy if you have any ideas for this problem.
Thanks and regards,
Sven