-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not solely make Visual Diagnostics available on debugger being attached #23490
Conversation
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
@@ -13,16 +13,19 @@ namespace Microsoft.Maui | |||
public static class VisualDiagnostics | |||
{ | |||
static ConditionalWeakTable<object, SourceInfo> sourceInfos = new ConditionalWeakTable<object, SourceInfo>(); | |||
static Lazy<bool> isVisualDiagnosticsEnvVarSet = new Lazy<bool>(() => Environment.GetEnvironmentVariable("ENABLE_XAML_DIAGNOSTICS_SOURCE_INFO") is { } value && value == "1"); | |||
|
|||
static public bool IsEnabled => DebuggerHelper.DebuggerIsAttached || isVisualDiagnosticsEnvVarSet.Value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be a public variable? Since it's not settable and not used outside of this repo I'm not sure if it's needed to be accessible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! It should be internalvisible to Microsoft.Maui.Controls
db21032
to
5eaf90a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't guarantee all the information will be available. some diagnostics are generated by the runtime XAML parser, and not by XAMLC
@StephaneDelcroix Indeed, I'm attempting to discern whether there's a difference from how things were prior to this PR. Are there still Debugger checks in the runtime XAML Parser that I might have overlooked or need to modify? |
Description of Change
This changes ensure that Visual Diagnostics doesn't rely on the debugger being attached, like the rest of the supported platforms (WPF, UWP, WinUI). Other platform relies on ENABLE_XAML_DIAGNOSTICS_SOURCE_INFO to be set by the Launch Provider in VS to enable Full Visual Diagnostics with Source Information. For backward compatibility, MAUI will still continue to check for the debugger being attached, but will also check the presence of the environment.
Issues Fixed
Task 2078603: Remove MAUI's VisualDiagnostics coupling on the Debugger