From dc36545a905982a7395de425c8f12d78bd80c039 Mon Sep 17 00:00:00 2001 From: Pedro Jesus Date: Thu, 30 Jan 2025 00:58:21 -0300 Subject: [PATCH 1/6] refactor DebuggerDisplay --- .../ActivityIndicator/ActivityIndicator.cs | 4 +- src/Controls/src/Core/Button/Button.cs | 5 +- src/Controls/src/Core/CheckBox/CheckBox.cs | 2 +- .../src/Core/ContentPage/ContentPage.cs | 5 +- .../src/Core/ContentView/ContentView.cs | 4 +- .../src/Core/DatePicker/DatePicker.cs | 2 +- .../src/Core/FlyoutPage/FlyoutPage.cs | 6 +- src/Controls/src/Core/Image/Image.cs | 4 +- .../src/Core/IndicatorView/IndicatorView.cs | 5 +- src/Controls/src/Core/InputView/InputView.cs | 4 +- src/Controls/src/Core/Items/ItemsView.cs | 6 +- src/Controls/src/Core/Label/Label.cs | 4 +- src/Controls/src/Core/Layout/Layout.cs | 2 +- src/Controls/src/Core/Page/Page.cs | 4 +- src/Controls/src/Core/Picker/Picker.cs | 4 +- .../src/Core/ProgressBar/ProgressBar.cs | 2 +- .../src/Core/RadioButton/RadioButton.cs | 4 +- .../src/Core/RefreshView/RefreshView.cs | 4 +- .../src/Core/ScrollView/ScrollView.cs | 4 +- src/Controls/src/Core/SearchBar/SearchBar.cs | 4 +- src/Controls/src/Core/Slider/Slider.cs | 2 +- src/Controls/src/Core/Stepper/Stepper.cs | 2 +- src/Controls/src/Core/Switch/Switch.cs | 2 +- .../src/Core/TimePicker/TimePicker.cs | 2 +- .../src/Core/VisualElement/VisualElement.cs | 7 +- src/Controls/src/Core/WebView/WebView.cs | 4 +- .../src/Debugger/DebuggerDisplayHelpers.cs | 146 ++++++++++++++++++ 27 files changed, 215 insertions(+), 29 deletions(-) create mode 100644 src/Core/src/Debugger/DebuggerDisplayHelpers.cs diff --git a/src/Controls/src/Core/ActivityIndicator/ActivityIndicator.cs b/src/Controls/src/Core/ActivityIndicator/ActivityIndicator.cs index 0d59f419a08b..dec7964a7490 100644 --- a/src/Controls/src/Core/ActivityIndicator/ActivityIndicator.cs +++ b/src/Controls/src/Core/ActivityIndicator/ActivityIndicator.cs @@ -1,6 +1,7 @@ #nullable disable using System; using System.Diagnostics; +using Microsoft.Maui.Debugger; using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls @@ -45,7 +46,8 @@ public IPlatformElementConfiguration On() where T : ICo private protected override string GetDebuggerDisplay() { - return $"IsRunning = {IsRunning}, {base.GetDebuggerDisplay()}"; + var debugText = DebuggerDisplayHelpers.GetDebugText(nameof(IsRunning), IsRunning); + return $"{base.GetDebuggerDisplay()}, {debugText}"; } } } \ No newline at end of file diff --git a/src/Controls/src/Core/Button/Button.cs b/src/Controls/src/Core/Button/Button.cs index 071dedca2273..f04a1c398fd9 100644 --- a/src/Controls/src/Core/Button/Button.cs +++ b/src/Controls/src/Core/Button/Button.cs @@ -6,6 +6,7 @@ using System.Runtime.CompilerServices; using System.Windows.Input; using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Debugger; using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls @@ -611,7 +612,9 @@ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cul private protected override string GetDebuggerDisplay() { - return $"Text = {Text}, Command = {Command}, {base.GetDebuggerDisplay()}"; + var textString = DebuggerDisplayHelpers.GetDebugText(nameof(Text), Text); + var commandText = DebuggerDisplayHelpers.GetDebugText(nameof(Command), Command, false); + return $"{base.GetDebuggerDisplay()}, {textString}, {commandText}"; } } } diff --git a/src/Controls/src/Core/CheckBox/CheckBox.cs b/src/Controls/src/Core/CheckBox/CheckBox.cs index 1ffd379f5c84..e622647662b0 100644 --- a/src/Controls/src/Core/CheckBox/CheckBox.cs +++ b/src/Controls/src/Core/CheckBox/CheckBox.cs @@ -84,7 +84,7 @@ bool ICheckBox.IsChecked private protected override string GetDebuggerDisplay() { - return $"IsChecked = {IsChecked}, {base.GetDebuggerDisplay()}"; + return $"{base.GetDebuggerDisplay()}, IsChecked = {IsChecked}"; } } } \ No newline at end of file diff --git a/src/Controls/src/Core/ContentPage/ContentPage.cs b/src/Controls/src/Core/ContentPage/ContentPage.cs index f6cc3ecc59df..57f223177c52 100644 --- a/src/Controls/src/Core/ContentPage/ContentPage.cs +++ b/src/Controls/src/Core/ContentPage/ContentPage.cs @@ -2,6 +2,7 @@ using System; using System.Diagnostics; +using Microsoft.Maui.Debugger; using Microsoft.Maui.Graphics; using Microsoft.Maui.HotReload; using Microsoft.Maui.Layouts; @@ -11,6 +12,7 @@ namespace Microsoft.Maui.Controls /// [ContentProperty("Content")] [DebuggerDisplay("{GetDebuggerDisplay(), nq}")] + [DebuggerTypeProxy(typeof(ContentPageDebuggerView))] public partial class ContentPage : TemplatedPage, IContentView, HotReload.IHotReloadableView { /// Bindable property for . @@ -152,7 +154,8 @@ Size IContentView.CrossPlatformMeasure(double widthConstraint, double heightCons private protected override string GetDebuggerDisplay() { - return $"Content = {Content}, BindingContext = {BindingContext}"; + var contentText = DebuggerDisplayHelpers.GetDebugText(nameof(Content), Content); + return $"{base.GetDebuggerDisplay()}, {contentText}"; } } } \ No newline at end of file diff --git a/src/Controls/src/Core/ContentView/ContentView.cs b/src/Controls/src/Core/ContentView/ContentView.cs index 87f29f99efa6..46445d0b3143 100644 --- a/src/Controls/src/Core/ContentView/ContentView.cs +++ b/src/Controls/src/Core/ContentView/ContentView.cs @@ -1,5 +1,6 @@ #nullable disable using System.Diagnostics; +using Microsoft.Maui.Debugger; using Microsoft.Maui.Graphics; using Microsoft.Maui.Layouts; @@ -51,7 +52,8 @@ internal override void SetChildInheritedBindingContext(Element child, object con private protected override string GetDebuggerDisplay() { - return $"Content = {Content}, {base.GetDebuggerDisplay()}"; + var contentText = DebuggerDisplayHelpers.GetDebugText(nameof(Content), Content); + return $"{base.GetDebuggerDisplay()}, {contentText}"; } } } \ No newline at end of file diff --git a/src/Controls/src/Core/DatePicker/DatePicker.cs b/src/Controls/src/Core/DatePicker/DatePicker.cs index c7a51ed35dee..de39e32d2f54 100644 --- a/src/Controls/src/Core/DatePicker/DatePicker.cs +++ b/src/Controls/src/Core/DatePicker/DatePicker.cs @@ -244,7 +244,7 @@ string IDatePicker.Format private protected override string GetDebuggerDisplay() { - return $"Date = {Date}, {base.GetDebuggerDisplay()}"; + return $"{base.GetDebuggerDisplay()}, Date = {Date}"; } } } diff --git a/src/Controls/src/Core/FlyoutPage/FlyoutPage.cs b/src/Controls/src/Core/FlyoutPage/FlyoutPage.cs index 86f064c311f8..6d5006011123 100644 --- a/src/Controls/src/Core/FlyoutPage/FlyoutPage.cs +++ b/src/Controls/src/Core/FlyoutPage/FlyoutPage.cs @@ -2,8 +2,10 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Runtime.CompilerServices; using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Debugger; using Microsoft.Maui.Devices; using Microsoft.Maui.Graphics; @@ -11,6 +13,7 @@ namespace Microsoft.Maui.Controls { /// [ContentProperty(nameof(Detail))] + [DebuggerDisplay("{GetDebuggerDisplay(), nq}")] public partial class FlyoutPage : Page, IFlyoutPageController, IElementConfiguration, IFlyoutView { /// Bindable property for . @@ -383,7 +386,8 @@ double IFlyoutView.FlyoutWidth #endif private protected override string GetDebuggerDisplay() { - return $"DetailPage = {Detail}, FlyoutPage = {Flyout}, BindingContext = {BindingContext}"; + var debugText = DebuggerDisplayHelpers.GetDebugText(nameof(Detail), Detail, "FlyoutPage", Flyout, nameof(BindingContext), BindingContext); + return $"{GetType().FullName}: {debugText}"; } } } diff --git a/src/Controls/src/Core/Image/Image.cs b/src/Controls/src/Core/Image/Image.cs index 18f2649bfc70..dc3cf4764528 100644 --- a/src/Controls/src/Core/Image/Image.cs +++ b/src/Controls/src/Core/Image/Image.cs @@ -2,6 +2,7 @@ using System; using System.ComponentModel; using System.Diagnostics; +using Microsoft.Maui.Debugger; namespace Microsoft.Maui.Controls { @@ -108,7 +109,8 @@ void IImageSourcePart.UpdateIsLoading(bool isLoading) => private protected override string GetDebuggerDisplay() { - return $"Source = {Source}, {base.GetDebuggerDisplay()}"; + var sourceText = DebuggerDisplayHelpers.GetDebugText(nameof(Source), Source); + return $"{base.GetDebuggerDisplay()}, {sourceText}"; } } } \ No newline at end of file diff --git a/src/Controls/src/Core/IndicatorView/IndicatorView.cs b/src/Controls/src/Core/IndicatorView/IndicatorView.cs index e04c4d0bde2d..7968fca12375 100644 --- a/src/Controls/src/Core/IndicatorView/IndicatorView.cs +++ b/src/Controls/src/Core/IndicatorView/IndicatorView.cs @@ -4,6 +4,7 @@ using System.Collections.Specialized; using System.Diagnostics; using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Debugger; using Microsoft.Maui.Graphics; using Microsoft.Maui.Layouts; @@ -11,7 +12,6 @@ namespace Microsoft.Maui.Controls { /// [ContentProperty(nameof(IndicatorLayout))] - [DebuggerDisplay("{GetDebuggerDisplay(), nq}")] public partial class IndicatorView : TemplatedView, ITemplatedIndicatorView { @@ -199,7 +199,8 @@ int IIndicatorView.Position private protected override string GetDebuggerDisplay() { - return $"Position = {Position}, Count = {Count}, {base.GetDebuggerDisplay()}"; + var debugText = DebuggerDisplayHelpers.GetDebugText(nameof(Position), Position, nameof(Count), Count); + return $"{base.GetDebuggerDisplay()}, {debugText}"; } } } \ No newline at end of file diff --git a/src/Controls/src/Core/InputView/InputView.cs b/src/Controls/src/Core/InputView/InputView.cs index 57b85ccf0efc..20284d86a5da 100644 --- a/src/Controls/src/Core/InputView/InputView.cs +++ b/src/Controls/src/Core/InputView/InputView.cs @@ -2,6 +2,7 @@ using System; using System.Diagnostics; using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Debugger; using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls @@ -276,7 +277,8 @@ string ITextInput.Text private protected override string GetDebuggerDisplay() { - return $"Text = {Text}, {base.GetDebuggerDisplay()}"; + var debugText = DebuggerDisplayHelpers.GetDebugText(nameof(Text), Text); + return $"{base.GetDebuggerDisplay()}, Text = {debugText}"; } } } \ No newline at end of file diff --git a/src/Controls/src/Core/Items/ItemsView.cs b/src/Controls/src/Core/Items/ItemsView.cs index 3b165590eafe..0c989a4f0278 100644 --- a/src/Controls/src/Core/Items/ItemsView.cs +++ b/src/Controls/src/Core/Items/ItemsView.cs @@ -3,15 +3,18 @@ using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Diagnostics; using System.Windows.Input; using Microsoft.Maui.Controls.Internals; using Microsoft.Maui.Controls.Xaml.Diagnostics; +using Microsoft.Maui.Debugger; using Microsoft.Maui.Devices; using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls { /// + [DebuggerDisplay("{GetDebuggerDisplay(), nq}")] public abstract class ItemsView : View { @@ -228,7 +231,8 @@ protected override void OnBindingContextChanged() private protected override string GetDebuggerDisplay() { - return $"ItemsSource = {ItemsSource}, {base.GetDebuggerDisplay()}"; + var itemsSourceText = DebuggerDisplayHelpers.GetDebugText(nameof(ItemsSource), ItemsSource); + return $"{base.GetDebuggerDisplay()}, {itemsSourceText}"; } } } diff --git a/src/Controls/src/Core/Label/Label.cs b/src/Controls/src/Core/Label/Label.cs index 06d98ccd2bb9..3b7c7f1f0a4d 100644 --- a/src/Controls/src/Core/Label/Label.cs +++ b/src/Controls/src/Core/Label/Label.cs @@ -7,6 +7,7 @@ using System.Diagnostics; using System.Linq; using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Debugger; using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls @@ -482,7 +483,8 @@ internal static bool TextChangedShouldInvalidateMeasure(Label label) private protected override string GetDebuggerDisplay() { - return $"Text = {Text}, {base.GetDebuggerDisplay()}"; + var debugText = DebuggerDisplayHelpers.GetDebugText(nameof(Text), Text); + return $"{base.GetDebuggerDisplay()}, {debugText}"; } } } diff --git a/src/Controls/src/Core/Layout/Layout.cs b/src/Controls/src/Core/Layout/Layout.cs index da595b6dbccc..9f29c845569d 100644 --- a/src/Controls/src/Core/Layout/Layout.cs +++ b/src/Controls/src/Core/Layout/Layout.cs @@ -388,7 +388,7 @@ static void OnCascadeInputTransparentPropertyChanged(BindableObject bindable, ob private protected override string GetDebuggerDisplay() { - return $"ChildCount = {Count}, {base.GetDebuggerDisplay()}"; + return $"{base.GetDebuggerDisplay()}, ChildCount = {Count}"; } } } diff --git a/src/Controls/src/Core/Page/Page.cs b/src/Controls/src/Core/Page/Page.cs index 750eebe34c82..9915bded3b55 100644 --- a/src/Controls/src/Core/Page/Page.cs +++ b/src/Controls/src/Core/Page/Page.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using Microsoft.Maui.Controls.Internals; using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific; +using Microsoft.Maui.Debugger; using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls @@ -943,7 +944,8 @@ public virtual Window GetParentWindow() private protected override string GetDebuggerDisplay() { - return $"BindingContext = {BindingContext}, Title = {Title}"; + var debugText = DebuggerDisplayHelpers.GetDebugText(nameof(BindingContext), BindingContext, nameof(Title), Title); + return $"{this.GetType().FullName}: {debugText}"; } } } diff --git a/src/Controls/src/Core/Picker/Picker.cs b/src/Controls/src/Core/Picker/Picker.cs index 612d3a223bf9..0e650f703fa0 100644 --- a/src/Controls/src/Core/Picker/Picker.cs +++ b/src/Controls/src/Core/Picker/Picker.cs @@ -9,6 +9,7 @@ using System.Runtime.CompilerServices; using Microsoft.Maui.Controls.Internals; using Microsoft.Maui.Controls.Xaml; +using Microsoft.Maui.Debugger; using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls @@ -465,7 +466,8 @@ string GetItem(int index) private protected override string GetDebuggerDisplay() { - return $"Items = {ItemsSource?.Count ?? 0}, SelectedItem = {SelectedItem}, {base.GetDebuggerDisplay()}"; + var selectedItemText = DebuggerDisplayHelpers.GetDebugText(nameof(SelectedItem), SelectedItem); + return $"{base.GetDebuggerDisplay()}, Items = {ItemsSource?.Count ?? 0}, {selectedItemText}"; } } } diff --git a/src/Controls/src/Core/ProgressBar/ProgressBar.cs b/src/Controls/src/Core/ProgressBar/ProgressBar.cs index ebaba1231b05..f57a5817515e 100644 --- a/src/Controls/src/Core/ProgressBar/ProgressBar.cs +++ b/src/Controls/src/Core/ProgressBar/ProgressBar.cs @@ -58,7 +58,7 @@ public IPlatformElementConfiguration On() where T : IConfigPl private protected override string GetDebuggerDisplay() { - return $"Progress = {Progress}, {base.GetDebuggerDisplay()}"; + return $"{base.GetDebuggerDisplay()}, Progress = {Progress}"; } } } \ No newline at end of file diff --git a/src/Controls/src/Core/RadioButton/RadioButton.cs b/src/Controls/src/Core/RadioButton/RadioButton.cs index 9ab9a47a59e2..276d0f721370 100644 --- a/src/Controls/src/Core/RadioButton/RadioButton.cs +++ b/src/Controls/src/Core/RadioButton/RadioButton.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Maui.Controls.Internals; using Microsoft.Maui.Controls.Shapes; +using Microsoft.Maui.Debugger; using Microsoft.Maui.Devices; using Microsoft.Maui.Graphics; @@ -665,7 +666,8 @@ bool IRadioButton.IsChecked private protected override string GetDebuggerDisplay() { - return $"IsChecked = {IsChecked}, Value = {Value}, {base.GetDebuggerDisplay()}"; + var debugText = DebuggerDisplayHelpers.GetDebugText(nameof(Value), Value, nameof(IsChecked), IsChecked); + return $"{base.GetDebuggerDisplay()},{debugText}"; } private protected override Semantics UpdateSemantics() diff --git a/src/Controls/src/Core/RefreshView/RefreshView.cs b/src/Controls/src/Core/RefreshView/RefreshView.cs index 5d057762121c..4674eac31862 100644 --- a/src/Controls/src/Core/RefreshView/RefreshView.cs +++ b/src/Controls/src/Core/RefreshView/RefreshView.cs @@ -4,6 +4,7 @@ using System.Runtime.CompilerServices; using System.Windows.Input; using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Debugger; using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls @@ -152,7 +153,8 @@ bool IRefreshView.IsRefreshing private protected override string GetDebuggerDisplay() { - return $"Command = {Command}, IsRefreshing = {IsRefreshing}, {base.GetDebuggerDisplay()}"; + var debugText = DebuggerDisplayHelpers.GetDebugText(nameof(Command), Command, nameof(IsRefreshing), IsRefreshing, false); + return $"{base.GetDebuggerDisplay()}, {debugText}"; } } } diff --git a/src/Controls/src/Core/ScrollView/ScrollView.cs b/src/Controls/src/Core/ScrollView/ScrollView.cs index a9b961b05930..28e280ee3f70 100644 --- a/src/Controls/src/Core/ScrollView/ScrollView.cs +++ b/src/Controls/src/Core/ScrollView/ScrollView.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Threading.Tasks; using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Debugger; using Microsoft.Maui.Graphics; using Microsoft.Maui.Layouts; @@ -484,7 +485,8 @@ private protected override void InvalidateMeasureLegacy(InvalidationTrigger trig private protected override string GetDebuggerDisplay() { - return $"Content = {Content}, {base.GetDebuggerDisplay()}"; + var debugText = DebuggerDisplayHelpers.GetDebugText(nameof(Content), Content); + return $"{base.GetDebuggerDisplay()}, {debugText}"; } } } diff --git a/src/Controls/src/Core/SearchBar/SearchBar.cs b/src/Controls/src/Core/SearchBar/SearchBar.cs index 8bd390aa25de..a0cbc76999c5 100644 --- a/src/Controls/src/Core/SearchBar/SearchBar.cs +++ b/src/Controls/src/Core/SearchBar/SearchBar.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Windows.Input; using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Debugger; using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls @@ -167,7 +168,8 @@ void ISearchBar.SearchButtonPressed() private protected override string GetDebuggerDisplay() { - return $"SearchCommand = {SearchCommand}, {base.GetDebuggerDisplay()}"; + var debugText = DebuggerDisplayHelpers.GetDebugText(nameof(SearchCommand), SearchCommand); + return $"{base.GetDebuggerDisplay()}, {debugText}"; } } } diff --git a/src/Controls/src/Core/Slider/Slider.cs b/src/Controls/src/Core/Slider/Slider.cs index adb45da3c9ed..5575636cf511 100644 --- a/src/Controls/src/Core/Slider/Slider.cs +++ b/src/Controls/src/Core/Slider/Slider.cs @@ -187,7 +187,7 @@ void ISlider.DragStarted() private protected override string GetDebuggerDisplay() { - return $"Value = {Value}, Min-Max = {Minimum} - {Maximum}, {base.GetDebuggerDisplay()}"; + return $"{base.GetDebuggerDisplay()}, Value = {Value}, Min-Max = {Minimum} - {Maximum}"; } } } \ No newline at end of file diff --git a/src/Controls/src/Core/Stepper/Stepper.cs b/src/Controls/src/Core/Stepper/Stepper.cs index 8089134c20ec..f68bc03f2971 100644 --- a/src/Controls/src/Core/Stepper/Stepper.cs +++ b/src/Controls/src/Core/Stepper/Stepper.cs @@ -112,7 +112,7 @@ public double Value private protected override string GetDebuggerDisplay() { - return $"Value = {Value}, {base.GetDebuggerDisplay()}"; + return $"{base.GetDebuggerDisplay()}, Value = {Value}"; } } } \ No newline at end of file diff --git a/src/Controls/src/Core/Switch/Switch.cs b/src/Controls/src/Core/Switch/Switch.cs index b0dbafccfabb..739855f14738 100644 --- a/src/Controls/src/Core/Switch/Switch.cs +++ b/src/Controls/src/Core/Switch/Switch.cs @@ -112,7 +112,7 @@ bool ISwitch.IsOn private protected override string GetDebuggerDisplay() { - return $"IsToggled = {IsToggled}, {base.GetDebuggerDisplay()}"; + return $"{base.GetDebuggerDisplay()}, IsToggled = {IsToggled}"; } } } \ No newline at end of file diff --git a/src/Controls/src/Core/TimePicker/TimePicker.cs b/src/Controls/src/Core/TimePicker/TimePicker.cs index 896d2acb4eea..e91fc153d4b0 100644 --- a/src/Controls/src/Core/TimePicker/TimePicker.cs +++ b/src/Controls/src/Core/TimePicker/TimePicker.cs @@ -171,7 +171,7 @@ static void TimePropertyChanged(BindableObject bindable, object oldValue, object private protected override string GetDebuggerDisplay() { - return $"Time = {Time}, {base.GetDebuggerDisplay()}"; + return $"{base.GetDebuggerDisplay()}, Time = {Time}"; } } } diff --git a/src/Controls/src/Core/VisualElement/VisualElement.cs b/src/Controls/src/Core/VisualElement/VisualElement.cs index 02b03f2a4ce2..05c82b95aca8 100644 --- a/src/Controls/src/Core/VisualElement/VisualElement.cs +++ b/src/Controls/src/Core/VisualElement/VisualElement.cs @@ -6,6 +6,7 @@ using System.Globalization; using Microsoft.Maui.Controls.Internals; using Microsoft.Maui.Controls.Shapes; +using Microsoft.Maui.Debugger; using Microsoft.Maui.Graphics; using Microsoft.Maui.Layouts; using Geometry = Microsoft.Maui.Controls.Shapes.Geometry; @@ -19,7 +20,7 @@ namespace Microsoft.Maui.Controls /// /// The base class for most .NET MAUI on-screen elements. Provides most properties, events, and methods for presenting an item on screen. /// - + [DebuggerDisplay("{GetDebuggerDisplay(), nq}")] public partial class VisualElement : NavigableElement, IAnimatable, IVisualElementController, IResourcesProvider, IStyleElement, IFlowDirectionController, IPropertyPropagationController, IVisualController, IWindowController, IView, IControlsVisualElement { @@ -2402,10 +2403,10 @@ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cul } } - private protected virtual string GetDebuggerDisplay() { - return $"BindingContext = {BindingContext}, Bounds = {Bounds}"; + var debugText = DebuggerDisplayHelpers.GetDebugText(nameof(BindingContext), BindingContext, nameof(Bounds), Bounds); + return $"{GetType().FullName}: {debugText}"; } } } diff --git a/src/Controls/src/Core/WebView/WebView.cs b/src/Controls/src/Core/WebView/WebView.cs index d11daa6f9758..c24b31df331d 100644 --- a/src/Controls/src/Core/WebView/WebView.cs +++ b/src/Controls/src/Core/WebView/WebView.cs @@ -7,6 +7,7 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Debugger; using Microsoft.Maui.Devices; namespace Microsoft.Maui.Controls @@ -388,7 +389,8 @@ void IWebView.ProcessTerminated(WebProcessTerminatedEventArgs args) private protected override string GetDebuggerDisplay() { - return $"Source = {Source}, {base.GetDebuggerDisplay()}"; + var debugText = DebuggerDisplayHelpers.GetDebugText(nameof(Source), Source); + return $"{base.GetDebuggerDisplay()}, {debugText}"; } } } \ No newline at end of file diff --git a/src/Core/src/Debugger/DebuggerDisplayHelpers.cs b/src/Core/src/Debugger/DebuggerDisplayHelpers.cs new file mode 100644 index 000000000000..28b7600996ff --- /dev/null +++ b/src/Core/src/Debugger/DebuggerDisplayHelpers.cs @@ -0,0 +1,146 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.CompilerServices; +using System.Text; + +namespace Microsoft.Maui.Debugger; +/// +/// Inspired on https://github.com/dotnet/aspnetcore/blob/befc463e34b17edf8aee1fbf9dec44c75f13000b/src/Shared/Debugger/DebuggerHelpers.cs from Asp.NET +/// +static class DebuggerDisplayHelpers +{ + const string NullString = "(null)"; + + public static void Test() + { + _ = GetDebugString("batata", new LabelHandler()); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string GetDebugString(string name, object? value) + { + var valueString = GetDebugString(value); + return $"{name} = {valueString}"; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string GetDebugString(object? value) + { + var valueString = value is null ? NullString : value.ToString(); + Debug.Assert(valueString is not null); + return valueString!; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string GetDebugText(string key1, object? value1, bool includeNullValues = true) + { + return GetDebugText([Create(key1, value1)], includeNullValues); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string GetDebugText(string key1, object? value1, string key2, object? value2, bool includeNullValues = true) + { + return GetDebugText([Create(key1, value1), Create(key2, value2)], includeNullValues); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string GetDebugText(string key1, object? value1, string key2, object? value2, string key3, object? value3, bool includeNullValues = true) + { + return GetDebugText([Create(key1, value1), Create(key2, value2), Create(key3, value3)], includeNullValues); + } + + public static string GetDebugText(ReadOnlySpan> values, bool includeNullValues = true) + { + var size = values.Length; + if (size is 0) + { + return string.Empty; + } + + var sb = new StringBuilder(); + + var first = true; + for (var i = 0; i < size; i++) + { + var kvp = values[i]; + + if (HasValue(kvp.Value) || includeNullValues) + { + if (first) + { + first = false; + } + else + { + sb.Append(", "); + } + + sb.Append(kvp.Key); + sb.Append(" = "); + if (kvp.Value is null) + { + sb.Append(NullString); + } + else if (kvp.Value is string s) + { + sb.Append(s); + } + else if (kvp.Value is IEnumerable enumerable) + { + var firstItem = true; + foreach (var item in enumerable) + { + if (firstItem) + { + firstItem = false; + } + else + { + sb.Append(','); + } + sb.Append(item); + } + } + else + { + sb.Append(kvp.Value); + } + } + } + + return sb.ToString(); + } + + static bool HasValue([NotNullWhen(true)] object? value) + { + if (value is null) + { + return false; + } + + // Empty collections don't have a value. + if (value is not string && value is IEnumerable enumerable && !enumerable.GetEnumerator().MoveNext()) + { + return false; + } + + return true; + } + + + public static string GetDebugString(object? value, bool showIfNull) + { + if (value is null && !showIfNull) + { + return string.Empty; + } + + return GetDebugString(value); + } + + static KeyValuePair Create(string key, object? value) => new KeyValuePair(key, value); + +} From 9436ed9a089785af9c74a5c35062bd99243318a6 Mon Sep 17 00:00:00 2001 From: Pedro Jesus Date: Thu, 30 Jan 2025 01:14:23 -0300 Subject: [PATCH 2/6] fix build --- src/Core/src/HotReload/HotReloadHelper.cs | 2 +- src/Core/src/VisualDiagnostics/DebuggerHelper.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Core/src/HotReload/HotReloadHelper.cs b/src/Core/src/HotReload/HotReloadHelper.cs index 2049cea70441..f9d676f935af 100644 --- a/src/Core/src/HotReload/HotReloadHelper.cs +++ b/src/Core/src/HotReload/HotReloadHelper.cs @@ -23,7 +23,7 @@ public static void Reset() { replacedViews.Clear(); } - public static bool IsEnabled { get; set; } = Debugger.IsAttached; + public static bool IsEnabled { get; set; } = System.Diagnostics.Debugger.IsAttached; internal static bool IsSupported #if !NETSTANDARD diff --git a/src/Core/src/VisualDiagnostics/DebuggerHelper.cs b/src/Core/src/VisualDiagnostics/DebuggerHelper.cs index 6706093fd32c..372b3348cd62 100644 --- a/src/Core/src/VisualDiagnostics/DebuggerHelper.cs +++ b/src/Core/src/VisualDiagnostics/DebuggerHelper.cs @@ -11,6 +11,6 @@ internal static class DebuggerHelper #endif public static bool _mockDebuggerIsAttached; - public static bool DebuggerIsAttached => _mockDebuggerIsAttached || Debugger.IsAttached; + public static bool DebuggerIsAttached => _mockDebuggerIsAttached || System.Diagnostics.Debugger.IsAttached; } } From 5df8a82d132d890ffee5724aef4581f2ab70161f Mon Sep 17 00:00:00 2001 From: Pedro Jesus Date: Thu, 30 Jan 2025 23:11:56 -0300 Subject: [PATCH 3/6] removed unused method --- src/Core/src/Debugger/DebuggerDisplayHelpers.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Core/src/Debugger/DebuggerDisplayHelpers.cs b/src/Core/src/Debugger/DebuggerDisplayHelpers.cs index 28b7600996ff..3bcb350ecf97 100644 --- a/src/Core/src/Debugger/DebuggerDisplayHelpers.cs +++ b/src/Core/src/Debugger/DebuggerDisplayHelpers.cs @@ -14,11 +14,6 @@ static class DebuggerDisplayHelpers { const string NullString = "(null)"; - public static void Test() - { - _ = GetDebugString("batata", new LabelHandler()); - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static string GetDebugString(string name, object? value) { From ce72b726d0a52ebd473a39eff7ca44d1ef22d414 Mon Sep 17 00:00:00 2001 From: Pedro Jesus Date: Thu, 30 Jan 2025 23:23:54 -0300 Subject: [PATCH 4/6] improve Helper method --- .../src/Debugger/DebuggerDisplayHelpers.cs | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/src/Core/src/Debugger/DebuggerDisplayHelpers.cs b/src/Core/src/Debugger/DebuggerDisplayHelpers.cs index 3bcb350ecf97..4c3f65cc19d9 100644 --- a/src/Core/src/Debugger/DebuggerDisplayHelpers.cs +++ b/src/Core/src/Debugger/DebuggerDisplayHelpers.cs @@ -14,21 +14,6 @@ static class DebuggerDisplayHelpers { const string NullString = "(null)"; - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static string GetDebugString(string name, object? value) - { - var valueString = GetDebugString(value); - return $"{name} = {valueString}"; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static string GetDebugString(object? value) - { - var valueString = value is null ? NullString : value.ToString(); - Debug.Assert(valueString is not null); - return valueString!; - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static string GetDebugText(string key1, object? value1, bool includeNullValues = true) { @@ -125,17 +110,5 @@ static bool HasValue([NotNullWhen(true)] object? value) return true; } - - public static string GetDebugString(object? value, bool showIfNull) - { - if (value is null && !showIfNull) - { - return string.Empty; - } - - return GetDebugString(value); - } - static KeyValuePair Create(string key, object? value) => new KeyValuePair(key, value); - } From 651f6b7776199324f5b5214e7453f7468c5528f6 Mon Sep 17 00:00:00 2001 From: Pedro Jesus Date: Fri, 31 Jan 2025 12:20:03 -0300 Subject: [PATCH 5/6] remove wrong attribute --- src/Controls/src/Core/ContentPage/ContentPage.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Controls/src/Core/ContentPage/ContentPage.cs b/src/Controls/src/Core/ContentPage/ContentPage.cs index 57f223177c52..1dbceef8d5c5 100644 --- a/src/Controls/src/Core/ContentPage/ContentPage.cs +++ b/src/Controls/src/Core/ContentPage/ContentPage.cs @@ -12,7 +12,6 @@ namespace Microsoft.Maui.Controls /// [ContentProperty("Content")] [DebuggerDisplay("{GetDebuggerDisplay(), nq}")] - [DebuggerTypeProxy(typeof(ContentPageDebuggerView))] public partial class ContentPage : TemplatedPage, IContentView, HotReload.IHotReloadableView { /// Bindable property for . From fe2cd3fea246d4739271abe78b0205d7e30a0589 Mon Sep 17 00:00:00 2001 From: Pedro Jesus Date: Sat, 1 Feb 2025 16:18:27 -0300 Subject: [PATCH 6/6] changed namespace to avoid conflicts --- src/Controls/src/Core/ActivityIndicator/ActivityIndicator.cs | 2 +- src/Controls/src/Core/Button/Button.cs | 2 +- src/Controls/src/Core/ContentPage/ContentPage.cs | 2 +- src/Controls/src/Core/ContentView/ContentView.cs | 2 +- src/Controls/src/Core/FlyoutPage/FlyoutPage.cs | 2 +- src/Controls/src/Core/Image/Image.cs | 2 +- src/Controls/src/Core/IndicatorView/IndicatorView.cs | 2 +- src/Controls/src/Core/InputView/InputView.cs | 2 +- src/Controls/src/Core/Items/ItemsView.cs | 2 +- src/Controls/src/Core/Label/Label.cs | 2 +- src/Controls/src/Core/Page/Page.cs | 2 +- src/Controls/src/Core/Picker/Picker.cs | 2 +- src/Controls/src/Core/RadioButton/RadioButton.cs | 2 +- src/Controls/src/Core/RefreshView/RefreshView.cs | 2 +- src/Controls/src/Core/ScrollView/ScrollView.cs | 2 +- src/Controls/src/Core/SearchBar/SearchBar.cs | 2 +- src/Controls/src/Core/VisualElement/VisualElement.cs | 2 +- src/Controls/src/Core/WebView/WebView.cs | 2 +- src/Core/src/Debugger/DebuggerDisplayHelpers.cs | 2 +- src/Core/src/HotReload/HotReloadHelper.cs | 2 +- src/Core/src/VisualDiagnostics/DebuggerHelper.cs | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Controls/src/Core/ActivityIndicator/ActivityIndicator.cs b/src/Controls/src/Core/ActivityIndicator/ActivityIndicator.cs index dec7964a7490..306f27846196 100644 --- a/src/Controls/src/Core/ActivityIndicator/ActivityIndicator.cs +++ b/src/Controls/src/Core/ActivityIndicator/ActivityIndicator.cs @@ -1,7 +1,7 @@ #nullable disable using System; using System.Diagnostics; -using Microsoft.Maui.Debugger; + using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls diff --git a/src/Controls/src/Core/Button/Button.cs b/src/Controls/src/Core/Button/Button.cs index f04a1c398fd9..3ccba944ec54 100644 --- a/src/Controls/src/Core/Button/Button.cs +++ b/src/Controls/src/Core/Button/Button.cs @@ -6,7 +6,7 @@ using System.Runtime.CompilerServices; using System.Windows.Input; using Microsoft.Maui.Controls.Internals; -using Microsoft.Maui.Debugger; + using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls diff --git a/src/Controls/src/Core/ContentPage/ContentPage.cs b/src/Controls/src/Core/ContentPage/ContentPage.cs index 1dbceef8d5c5..e71bd13d22a0 100644 --- a/src/Controls/src/Core/ContentPage/ContentPage.cs +++ b/src/Controls/src/Core/ContentPage/ContentPage.cs @@ -2,7 +2,7 @@ using System; using System.Diagnostics; -using Microsoft.Maui.Debugger; + using Microsoft.Maui.Graphics; using Microsoft.Maui.HotReload; using Microsoft.Maui.Layouts; diff --git a/src/Controls/src/Core/ContentView/ContentView.cs b/src/Controls/src/Core/ContentView/ContentView.cs index 46445d0b3143..b56663e0012b 100644 --- a/src/Controls/src/Core/ContentView/ContentView.cs +++ b/src/Controls/src/Core/ContentView/ContentView.cs @@ -1,6 +1,6 @@ #nullable disable using System.Diagnostics; -using Microsoft.Maui.Debugger; + using Microsoft.Maui.Graphics; using Microsoft.Maui.Layouts; diff --git a/src/Controls/src/Core/FlyoutPage/FlyoutPage.cs b/src/Controls/src/Core/FlyoutPage/FlyoutPage.cs index 6d5006011123..366cb65df060 100644 --- a/src/Controls/src/Core/FlyoutPage/FlyoutPage.cs +++ b/src/Controls/src/Core/FlyoutPage/FlyoutPage.cs @@ -5,7 +5,7 @@ using System.Diagnostics; using System.Runtime.CompilerServices; using Microsoft.Maui.Controls.Internals; -using Microsoft.Maui.Debugger; + using Microsoft.Maui.Devices; using Microsoft.Maui.Graphics; diff --git a/src/Controls/src/Core/Image/Image.cs b/src/Controls/src/Core/Image/Image.cs index dc3cf4764528..5eb9e799f1fd 100644 --- a/src/Controls/src/Core/Image/Image.cs +++ b/src/Controls/src/Core/Image/Image.cs @@ -2,7 +2,7 @@ using System; using System.ComponentModel; using System.Diagnostics; -using Microsoft.Maui.Debugger; + namespace Microsoft.Maui.Controls { diff --git a/src/Controls/src/Core/IndicatorView/IndicatorView.cs b/src/Controls/src/Core/IndicatorView/IndicatorView.cs index 7968fca12375..b62fea1516a2 100644 --- a/src/Controls/src/Core/IndicatorView/IndicatorView.cs +++ b/src/Controls/src/Core/IndicatorView/IndicatorView.cs @@ -4,7 +4,7 @@ using System.Collections.Specialized; using System.Diagnostics; using Microsoft.Maui.Controls.Internals; -using Microsoft.Maui.Debugger; + using Microsoft.Maui.Graphics; using Microsoft.Maui.Layouts; diff --git a/src/Controls/src/Core/InputView/InputView.cs b/src/Controls/src/Core/InputView/InputView.cs index 20284d86a5da..d74ab5480e6f 100644 --- a/src/Controls/src/Core/InputView/InputView.cs +++ b/src/Controls/src/Core/InputView/InputView.cs @@ -2,7 +2,7 @@ using System; using System.Diagnostics; using Microsoft.Maui.Controls.Internals; -using Microsoft.Maui.Debugger; + using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls diff --git a/src/Controls/src/Core/Items/ItemsView.cs b/src/Controls/src/Core/Items/ItemsView.cs index 0c989a4f0278..cd0b0d820d7b 100644 --- a/src/Controls/src/Core/Items/ItemsView.cs +++ b/src/Controls/src/Core/Items/ItemsView.cs @@ -7,7 +7,7 @@ using System.Windows.Input; using Microsoft.Maui.Controls.Internals; using Microsoft.Maui.Controls.Xaml.Diagnostics; -using Microsoft.Maui.Debugger; + using Microsoft.Maui.Devices; using Microsoft.Maui.Graphics; diff --git a/src/Controls/src/Core/Label/Label.cs b/src/Controls/src/Core/Label/Label.cs index 3b7c7f1f0a4d..dc5fceea5721 100644 --- a/src/Controls/src/Core/Label/Label.cs +++ b/src/Controls/src/Core/Label/Label.cs @@ -7,7 +7,7 @@ using System.Diagnostics; using System.Linq; using Microsoft.Maui.Controls.Internals; -using Microsoft.Maui.Debugger; + using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls diff --git a/src/Controls/src/Core/Page/Page.cs b/src/Controls/src/Core/Page/Page.cs index 9915bded3b55..39ff6d2c2eaf 100644 --- a/src/Controls/src/Core/Page/Page.cs +++ b/src/Controls/src/Core/Page/Page.cs @@ -10,7 +10,7 @@ using System.Threading.Tasks; using Microsoft.Maui.Controls.Internals; using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific; -using Microsoft.Maui.Debugger; + using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls diff --git a/src/Controls/src/Core/Picker/Picker.cs b/src/Controls/src/Core/Picker/Picker.cs index 0e650f703fa0..399235196aa4 100644 --- a/src/Controls/src/Core/Picker/Picker.cs +++ b/src/Controls/src/Core/Picker/Picker.cs @@ -9,7 +9,7 @@ using System.Runtime.CompilerServices; using Microsoft.Maui.Controls.Internals; using Microsoft.Maui.Controls.Xaml; -using Microsoft.Maui.Debugger; + using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls diff --git a/src/Controls/src/Core/RadioButton/RadioButton.cs b/src/Controls/src/Core/RadioButton/RadioButton.cs index 276d0f721370..6a40dedf8119 100644 --- a/src/Controls/src/Core/RadioButton/RadioButton.cs +++ b/src/Controls/src/Core/RadioButton/RadioButton.cs @@ -4,7 +4,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Maui.Controls.Internals; using Microsoft.Maui.Controls.Shapes; -using Microsoft.Maui.Debugger; + using Microsoft.Maui.Devices; using Microsoft.Maui.Graphics; diff --git a/src/Controls/src/Core/RefreshView/RefreshView.cs b/src/Controls/src/Core/RefreshView/RefreshView.cs index 4674eac31862..1c5848377a3c 100644 --- a/src/Controls/src/Core/RefreshView/RefreshView.cs +++ b/src/Controls/src/Core/RefreshView/RefreshView.cs @@ -4,7 +4,7 @@ using System.Runtime.CompilerServices; using System.Windows.Input; using Microsoft.Maui.Controls.Internals; -using Microsoft.Maui.Debugger; + using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls diff --git a/src/Controls/src/Core/ScrollView/ScrollView.cs b/src/Controls/src/Core/ScrollView/ScrollView.cs index 28e280ee3f70..23489e87fb54 100644 --- a/src/Controls/src/Core/ScrollView/ScrollView.cs +++ b/src/Controls/src/Core/ScrollView/ScrollView.cs @@ -4,7 +4,7 @@ using System.Diagnostics; using System.Threading.Tasks; using Microsoft.Maui.Controls.Internals; -using Microsoft.Maui.Debugger; + using Microsoft.Maui.Graphics; using Microsoft.Maui.Layouts; diff --git a/src/Controls/src/Core/SearchBar/SearchBar.cs b/src/Controls/src/Core/SearchBar/SearchBar.cs index a0cbc76999c5..36c0be9e3e45 100644 --- a/src/Controls/src/Core/SearchBar/SearchBar.cs +++ b/src/Controls/src/Core/SearchBar/SearchBar.cs @@ -4,7 +4,7 @@ using System.Diagnostics; using System.Windows.Input; using Microsoft.Maui.Controls.Internals; -using Microsoft.Maui.Debugger; + using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls diff --git a/src/Controls/src/Core/VisualElement/VisualElement.cs b/src/Controls/src/Core/VisualElement/VisualElement.cs index 05c82b95aca8..b56b4ddbd672 100644 --- a/src/Controls/src/Core/VisualElement/VisualElement.cs +++ b/src/Controls/src/Core/VisualElement/VisualElement.cs @@ -6,7 +6,7 @@ using System.Globalization; using Microsoft.Maui.Controls.Internals; using Microsoft.Maui.Controls.Shapes; -using Microsoft.Maui.Debugger; + using Microsoft.Maui.Graphics; using Microsoft.Maui.Layouts; using Geometry = Microsoft.Maui.Controls.Shapes.Geometry; diff --git a/src/Controls/src/Core/WebView/WebView.cs b/src/Controls/src/Core/WebView/WebView.cs index c24b31df331d..48bbb4aedca9 100644 --- a/src/Controls/src/Core/WebView/WebView.cs +++ b/src/Controls/src/Core/WebView/WebView.cs @@ -7,7 +7,7 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; using Microsoft.Maui.Controls.Internals; -using Microsoft.Maui.Debugger; + using Microsoft.Maui.Devices; namespace Microsoft.Maui.Controls diff --git a/src/Core/src/Debugger/DebuggerDisplayHelpers.cs b/src/Core/src/Debugger/DebuggerDisplayHelpers.cs index 4c3f65cc19d9..b446707d5b12 100644 --- a/src/Core/src/Debugger/DebuggerDisplayHelpers.cs +++ b/src/Core/src/Debugger/DebuggerDisplayHelpers.cs @@ -6,7 +6,7 @@ using System.Runtime.CompilerServices; using System.Text; -namespace Microsoft.Maui.Debugger; +namespace Microsoft.Maui; /// /// Inspired on https://github.com/dotnet/aspnetcore/blob/befc463e34b17edf8aee1fbf9dec44c75f13000b/src/Shared/Debugger/DebuggerHelpers.cs from Asp.NET /// diff --git a/src/Core/src/HotReload/HotReloadHelper.cs b/src/Core/src/HotReload/HotReloadHelper.cs index f9d676f935af..2049cea70441 100644 --- a/src/Core/src/HotReload/HotReloadHelper.cs +++ b/src/Core/src/HotReload/HotReloadHelper.cs @@ -23,7 +23,7 @@ public static void Reset() { replacedViews.Clear(); } - public static bool IsEnabled { get; set; } = System.Diagnostics.Debugger.IsAttached; + public static bool IsEnabled { get; set; } = Debugger.IsAttached; internal static bool IsSupported #if !NETSTANDARD diff --git a/src/Core/src/VisualDiagnostics/DebuggerHelper.cs b/src/Core/src/VisualDiagnostics/DebuggerHelper.cs index 372b3348cd62..6706093fd32c 100644 --- a/src/Core/src/VisualDiagnostics/DebuggerHelper.cs +++ b/src/Core/src/VisualDiagnostics/DebuggerHelper.cs @@ -11,6 +11,6 @@ internal static class DebuggerHelper #endif public static bool _mockDebuggerIsAttached; - public static bool DebuggerIsAttached => _mockDebuggerIsAttached || System.Diagnostics.Debugger.IsAttached; + public static bool DebuggerIsAttached => _mockDebuggerIsAttached || Debugger.IsAttached; } }