Toolwindow Dock after autohide gives exception

Docking/MDI for WPF Forum

Posted 13 years ago by Martin - Blaise - Statistics Netherlands
Version: 10.2.0531
Avatar
Hi

I have a docksite on which is a toolwindowcontainer docked on the right side. When i click in the option menu on autohide and then click again on Dock, the application gives an exception " object reference not set to an nstance of an object". I enabled all exception trapping but that doesnt help.

This only fails when one of my DocumentWindow is shown. I have two subclasses from DocumentWindow of which only one triggers this behaviour:(
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Actipro = ActiproSoftware.Windows.Controls;
using StatNeth.Blaise.IDE.Base;
using StatNeth.Blaise.IDE.Base.Converters;
using StatNeth.Blaise.IDE.ProjectManagement;
using StatNeth.Blaise.IDE.ProjectManagement.Controls;
using System.Windows;

namespace StatNeth.Blaise.IDE.Internal {

    internal class DocumentWindow : Actipro.Docking.DocumentWindow, IDisposable {

        private File _file;

        public DocumentWindow(Actipro.Docking.DockSite docksite, File file, ViewTypeBase viewType)
            : base(docksite) {
                _file = file;
            _documentGuid = file.Guid;
            _viewType = viewType;
            Update(file);
            file.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(file_PropertyChanged);
        }

        private Guid _documentGuid;
        private ViewTypeBase _viewType;

        internal Guid DocumentGuid { get { return _documentGuid; } }

        internal ViewTypeBase ViewType {
            get { return _viewType; }
            set { _viewType = value; }
        }

        internal File File { get { return _file; } }

        private void file_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) {
            File f = sender as File;
            if (f != null) {
                Update(f);
            }
        }

        private void Update(File f) {
            IsDirtyConverter conv = new IsDirtyConverter();
            string s = (string) conv.Convert(f.IsDirty, typeof(string), null, null);
            this.Title = f.Label + s;
            this.FileName = f.Location.FullName;
        }

        public void Dispose() {
            _file.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(file_PropertyChanged);
        }
    }
}
Do you have an idea to solve this or at least to trap the exception in the debugger?

Thanks
Martin

[Modified at 03/31/2011 08:44 AM]

Comments (4)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Martin,

Sorry, we'd need a sample that we can debug. If you can please put together a small sample project that reproduces the issue, then we can take a closer look.


Actipro Software Support

Posted 13 years ago by Martin - Blaise - Statistics Netherlands
Avatar
Before we upgrade to the latest version, ill mention the trace. After upgarde ill try again;)

System.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.
Source=mscorlib
StackTrace:
at System.Object.GetType()
at ActiproSoftware.Windows.Controls.Docking.DockSite.a(DependencyObject A_0, DependencyObject A_1, Boolean A_2)
at ActiproSoftware.Windows.Controls.Docking.DockSite.a(DependencyObject A_0, DependencyObject A_1)
at ActiproSoftware.Windows.Controls.Docking.DockSite.a(DependencyObject A_0, EventNotifier A_1, Direction A_2, IList`1 A_3)
at ActiproSoftware.Windows.Controls.Docking.DockSite.a(DependencyObject A_0, EventNotifier A_1, Direction A_2)
at ActiproSoftware.Windows.Controls.Docking.DockSite.a(DependencyObject A_0, Direction A_1, Nullable`1 A_2)
at ActiproSoftware.Windows.Controls.Docking.ToolWindowContainer.OnToggleWindowAutoHideStateExecuted(Object A_0, ExecutedRoutedEventArgs A_1)
at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs 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.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
at System.Windows.Controls.Button.OnClick()
at ActiproSoftware.Windows.Controls.PopupButton.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs 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.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
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.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(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 StatNeth.Blaise.IDE.App.Main() in D:\Blaise\Blaise\obj\Debug\App.g.cs:line 0
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:
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Martin,

We've corrected the NullReferenceException you are experiencing. The problem is that the NullReferenceException occurs while we are in the process of throwing our own exception. It appears the ToolWindow is trying to dock back to a previously tracked location which has an invalid parent element.

This indicates that it's probably an issue with your layout, and not related to your customer docking windows.

Ideally, we'd need a small sample project that reproduces that issue to quickly resolve this issue. Alternatively, if you can reproduce the issue with our Sample Browser then please list detailed steps to show the issue.

If you cannot isolate the issue, then maybe send your XAML of how your DockSite is used/set up.


Actipro Software Support

Posted 13 years ago by Martin - Blaise - Statistics Netherlands
Avatar
Thank you.

In the meantime, i was trying to comment out the line which could cause the problem; and "hurray", i found the problem line(s). Autohiding the Toolwindow causes the activation of the DocumentWindow, which in my case sometimes activates and fills the same toolwindowcontainer/toolwindow. I removed the activation of those windows and i guess the problem is solved.

Thanks again for thinking with me.

Greetz Martin
The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.