Posted 17 years ago
by Simon Deguire
Version: 3.0.0405
Platform: .NET 3.0
Environment: Windows XP (32-bit)

The exception is "'System.Windows.Documents.Run' is not a Visual or Visual3D."
I get this on a particular occasion, I cannot easily reproduce it.
Anyway, it seems that you let a DependencyObject go through System.Windows.Media.VisualTreeHelper.GetParent(DependencyObject reference)
but the doc of getparent specifies that "The value of reference can represent either a Visual or Visual3D object."
Maybe you should wrap this call with a try catch or check if the object is a visual or a visual3d before calling the method.
Here's the stacktrace
I get this on a particular occasion, I cannot easily reproduce it.
Anyway, it seems that you let a DependencyObject go through System.Windows.Media.VisualTreeHelper.GetParent(DependencyObject reference)
but the doc of getparent specifies that "The value of reference can represent either a Visual or Visual3D object."
Maybe you should wrap this call with a try catch or check if the object is a visual or a visual3d before calling the method.
Here's the stacktrace
Quote:
at MS.Internal.Media.VisualTreeUtils.AsVisual(DependencyObject element, Visual& visual, Visual3D& visual3D)
at System.Windows.Media.VisualTreeHelper.GetParent(DependencyObject reference)
at ActiproSoftware.Windows.Media.VisualTreeHelperExtended.GetAncestor(DependencyObject source, Type desiredType)
at ActiproSoftware.Windows.Media.VisualTreeHelperExtended.GetCurrentOrAncestor(DependencyObject source, Type desiredType)
at ActiproSoftware.Windows.Controls.Ribbon.RibbonWindow.a(Point A_0)
at ActiproSoftware.Windows.Controls.Ribbon.RibbonWindow.OnPreviewMouseMove(MouseEventArgs e)
at System.Windows.UIElement.OnPreviewMouseMoveThunk(Object sender, MouseEventArgs e)
at System.Windows.Input.MouseEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.ContentElement.RaiseEventImpl(RoutedEventArgs args)
at System.Windows.ContentElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
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, Int32 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, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
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.Window.ShowHelper(Object booleanBox)
at System.Windows.Window.Show()
at System.Windows.Window.ShowDialog()