static ResourceDictionaryDiagnostics() { IsEnabled = VisualDiagnostics.IsEnabled && VisualDiagnostics.IsEnvironmentVariableSet(null, "ENABLE_XAML_DIAGNOSTICS_SOURCE_INFO"); // internal property, not visible to user IgnorableProperties.Add(typeof(ResourceDictionary).GetProperty("DeferrableContent")); }
// Calls critical method IsEnvironmentVariableSet, but doesn't expose data static ResourceDictionaryDiagnostics() { IsEnabled = VisualDiagnostics.IsEnabled && VisualDiagnostics.IsEnvironmentVariableSet(null, XamlSourceInfoHelper.XamlSourceInfoEnvironmentVariable); // internal property, not visible to user IgnorableProperties.Add(typeof(ResourceDictionary).GetProperty("DeferrableContent")); }
// this method is (also) called via private reflection from test code private static void InitializeEnableXamlSourceInfo(string value) { if (VisualDiagnostics.IsEnabled && VisualDiagnostics.IsEnvironmentVariableSet(value, "ENABLE_XAML_DIAGNOSTICS_SOURCE_INFO") && InitializeXamlObjectEventArgs()) { s_sourceInfoTable = new ConditionalWeakTable <object, XamlSourceInfo>(); } else { s_sourceInfoTable = null; } }
// this method is (also) called via private reflection from test code private static void InitializeEnableXamlSourceInfo(string value) { if (VisualDiagnostics.IsEnabled && VisualDiagnostics.IsEnvironmentVariableSet(value, XamlSourceInfoHelper.XamlSourceInfoEnvironmentVariable) && InitializeXamlObjectEventArgs()) { s_sourceInfoTable = new ConditionalWeakTable <object, XamlSourceInfo>(); } else { s_sourceInfoTable = null; } }
static BindingDiagnostics() { IsEnabled = VisualDiagnostics.IsEnabled && VisualDiagnostics.IsEnvironmentVariableSet(null, XamlSourceInfoHelper.XamlSourceInfoEnvironmentVariable); if (IsEnabled) { // Listeners may miss the initial set of binding failures, so cache events until the first listener attaches. // Normally there will only be one listener added soon after the process starts, // and it will want to know about any binding failures that already happened. s_pendingEvents = new List <BindingFailedEventArgs>(); s_pendingEventsLock = new object(); } }