This project is read-only.

[Version 2.0] New bug with Anchorable Pin

Mar 16, 2012 at 8:07 PM

Ado,

I have found another bug.... Do you want me to start adding them to the issue tracker, put them here or just leave you alone for a while? :)

Anyway, this bug occurs if you have an Anchorable pinned to the AnchorablePane.

Un-pin it.

Pin it back.

Un-pin it again and I get an exception but it disappears too fast.

Cheers,

 

Steve

Mar 16, 2012 at 8:22 PM

Here's the exception:

System.InvalidOperationException was unhandled  Message=Operation is not valid due to the current state of the object.  Source=AvalonDock  StackTrace:       at AvalonDock.DockingManager.AvalonDock.Controls.ILogicalChildrenContainer.InternalAddLogicalChild(Object element) in E:\Users\Steve\Documents\Visual Studio 2010\Projects\Controls\AvalonDock\Version2.0\89300\Version2.0\AvalonDock\AvalonDock\DockingManager.cs:line 1158       at AvalonDock.Controls.LayoutAnchorControl.OnVisualParentChanged(DependencyObject oldParent) in E:\Users\Steve\Documents\Visual Studio 2010\Projects\Controls\AvalonDock\Version2.0\89300\Version2.0\AvalonDock\AvalonDock\Controls\LayoutAnchorControl.cs:line 57       at System.Windows.Media.Visual.FireOnVisualParentChanged(DependencyObject oldParent)       at System.Windows.Media.VisualCollection.Add(Visual visual)       at System.Windows.Controls.Panel.GenerateChildren()       at System.Windows.Controls.Panel.get_InternalChildren()       at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)       at System.Windows.UIElement.Measure(Size availableSize)       at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)       at System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)       at System.Windows.UIElement.Measure(Size availableSize)       at System.Windows.Controls.Border.MeasureOverride(Size constraint)       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)       at System.Windows.UIElement.Measure(Size availableSize)       at System.Windows.Controls.Control.MeasureOverride(Size constraint)       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)       at System.Windows.UIElement.Measure(Size availableSize)       at System.Windows.Controls.Control.MeasureOverride(Size constraint)       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)       at System.Windows.UIElement.Measure(Size availableSize)       at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)       at System.Windows.UIElement.Measure(Size availableSize)       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 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)       at System.Windows.Threading.DispatcherOperation.InvokeImpl()       at System.Threading.ExecutionContext.runTryCode(Object userData)       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)       at System.Threading.ExecutionContext.Run(ExecutionContext 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 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)       at System.Windows.Threading.Dispatcher.InvokeImpl(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.Application.RunInternal(Window window)       at System.Windows.Application.Run()       at BA.M8_Rating.App.Main() in Z:\My Binaries\Quest 2\Obj\Debug\App.g.cs:line 50       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)       at System.Threading.ThreadHelper.ThreadStart()  InnerException: 

Mar 17, 2012 at 3:16 PM

Could you please describe better how to reproduce the issue? You can create an issue ticket if you'd like,

Ado

Mar 19, 2012 at 3:24 AM

Ado,

I *Finally* tracked down the reason for this exception (after 6 hours debugging today!!).

All my ViewModels derive from Josh Smith's ViewModelBase which derives from DependencyObject so that DependencyProperties can be used to update the View.

I changed my ViewModels to derive from your ViewModelBase (just implements INotifyPropertyChanged, *DOESN'T* inherit DependencyObject) and it works.

Are you really not allowing us to derive from DependencyObject in the ViewModel as well as the LayoutElements in the View???

Not being able to use DependencyProperties in the ViewModel would be a huge limitation.

Steve

Mar 19, 2012 at 4:00 AM

Actually, I tell a lie! Josh's ViewModelBase doesn't inherit from DependencyObject... I may have added that myself sometime during my last project so I could use DP's :)

I guess I'll have to get used to not using them oing forward...

Steve