diff --git a/source/Components/AvalonDock/DockingManager.cs b/source/Components/AvalonDock/DockingManager.cs
index 65c06576..bbae5fec 100644
--- a/source/Components/AvalonDock/DockingManager.cs
+++ b/source/Components/AvalonDock/DockingManager.cs
@@ -1349,8 +1349,17 @@ public bool AllowMixedOrientation
///
bool IOverlayWindowHost.HitTest(Point dragPoint)
{
- var detectionRect = new Rect(this.PointToScreenDPIWithoutFlowDirection(new Point()), this.TransformActualSizeToAncestor());
- return detectionRect.Contains(dragPoint);
+ try
+ {
+ var detectionRect = new Rect(this.PointToScreenDPIWithoutFlowDirection(new Point()), this.TransformActualSizeToAncestor());
+ return detectionRect.Contains(dragPoint);
+ }
+ catch
+ {
+ // Silently swallow exception that may occur if DockingManager is not visible (because its hidden by a tab)
+ }
+
+ return false;
}
///