diff --git a/src/Core/src/Handlers/View/ViewHandler.cs b/src/Core/src/Handlers/View/ViewHandler.cs
index 43b76c1f695c..9abf57a8133b 100644
--- a/src/Core/src/Handlers/View/ViewHandler.cs
+++ b/src/Core/src/Handlers/View/ViewHandler.cs
@@ -1,4 +1,5 @@
using Microsoft.Maui.Graphics;
+using System.Diagnostics;
#if __IOS__ || MACCATALYST
using PlatformView = UIKit.UIView;
#elif __ANDROID__
@@ -18,6 +19,7 @@ namespace Microsoft.Maui.Handlers
///
/// Handlers map virtual views (.NET MAUI layer) to controls on each platform (iOS, Android, Windows, macOS, etc.), which are known as platform views.
/// Handlers are also responsible for instantiating the underlying platform view, and mapping the cross-platform control API to the platform view API.
+ [DebuggerDisplay("{GetDebuggerDisplay(), nq}")]
public abstract partial class ViewHandler : ElementHandler, IViewHandler
{
///
@@ -536,5 +538,20 @@ public static void MapToolTip(IViewHandler handler, IView view)
handler.ToPlatform().UpdateToolTip(tooltipContainer.ToolTip);
#endif
}
+
+ ///
+ /// Provides a string representation of the current object for debugging purposes.
+ ///
+ ///
+ /// This method is used by the to display
+ /// a concise and informative string representation of the instance
+ /// during debugging sessions.
+ ///
+ /// A string containing the type name and key properties of the object.
+ private protected virtual string GetDebuggerDisplay()
+ {
+ var debugText = DebuggerDisplayHelpers.GetDebugText(nameof(VirtualView), VirtualView, nameof(PlatformView), PlatformView);
+ return $"{GetType().FullName}: {debugText}";
+ }
}
}