// </copyright>
//------------------------------------------------------------------------------
+#if CONFIGURATION_DEP
using System.Configuration;
namespace System.Diagnostics {
}
}
+#endif
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
private void InitializeSettings() {
// don't use the property setters here to avoid infinite recursion.
+#if CONFIGURATION_DEP
assertUIEnabled = DiagnosticsConfiguration.AssertUIEnabled;
logFileName = DiagnosticsConfiguration.LogFileName;
+#endif
settingsInitialized = true;
}
// </copyright>
//------------------------------------------------------------------------------
+#if CONFIGURATION_DEP
namespace System.Diagnostics {
using System;
using System.Reflection;
}
}
+#endif
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
+#if CONFIGURATION_DEP
using System.Configuration;
using System;
}
}
-
+#endif
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
+#if CONFIGURATION_DEP
using System.Configuration;
using System;
using System.Reflection;
}
}
+#endif
// </copyright>
//------------------------------------------------------------------------------
+#if CONFIGURATION_DEP
using System.Configuration;
namespace System.Diagnostics {
}
}
+#endif
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
+
+#if CONFIGURATION_DEP
using System.Configuration;
using System.Collections;
using System.Collections.Specialized;
}
+#endif
/*
*/
+#if !CONFIGURATION_DEP
+using SwitchElementsCollection = System.Object;
+#endif
namespace System.Diagnostics {
using System;
using System.Collections.Specialized;
using System.Globalization;
using System.Configuration;
+#if XML_DEP
using System.Xml.Serialization;
+#endif
using System.Diagnostics.CodeAnalysis;
/// <devdoc>
}
}
+#if XML_DEP
[XmlIgnore]
+#endif
public StringDictionary Attributes {
get {
Initialize();
set {
Initialize();
switchValueString = value;
+#if CONFIGURATION_DEP
try {
OnValueChanged();
}
catch (OverflowException e) {
throw new ConfigurationErrorsException(SR.GetString(SR.BadConfigSwitchValue, DisplayName), e);
}
+#else
+ OnValueChanged();
+#endif
}
}
}
}
+#if CONFIGURATION_DEP
if (switchSettings != null) {
SwitchElement mySettings = switchSettings[displayName];
if (mySettings != null) {
OnValueChanged();
}
} else {
+#endif
// We don't use the property here because we don't want to catch exceptions
// and rethrow them as ConfigurationException. In this case there's no config.
switchValueString = defaultValue;
OnValueChanged();
+#if CONFIGURATION_DEP
}
+#endif
initialized = true;
initializing = false;
if (switchSettings != null)
return true;
+#if CONFIGURATION_DEP
if (!DiagnosticsConfiguration.CanInitialize())
return false;
// This hashtable is case-insensitive.
switchSettings = DiagnosticsConfiguration.SwitchSettings;
+#endif
return true;
}
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
+
+#if CONFIGURATION_DEP
using System.Configuration;
using System.Collections;
using System.Collections.Specialized;
}
}
+#endif
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
+#if CONFIGURATION_DEP
using System.Configuration;
namespace System.Diagnostics {
}
}
+#endif
}
public static void Refresh() {
+#if CONFIGURATION_DEP
DiagnosticsConfiguration.Refresh();
+#endif
Switch.RefreshAll();
TraceSource.RefreshAll();
TraceInternal.Refresh();
if (listeners == null) {
// We only need to check that the main section exists. Everything else will get
// created for us if it doesn't exist already.
+#if CONFIGURATION_DEP
SystemDiagnosticsSection configSectionSav = DiagnosticsConfiguration.SystemDiagnosticsSection;
if (configSectionSav != null) {
listeners = configSectionSav.Trace.Listeners.GetRuntimeObject();
}
else {
+#endif
// If machine.config was deleted the code will get to here
// supply at least something to prevent the world from coming to
// an abrupt end.
defaultListener.IndentLevel = indentLevel;
defaultListener.IndentSize = indentSize;
listeners.Add(defaultListener);
+#if CONFIGURATION_DEP
}
+#endif
}
}
}
}
private static void InitializeSettings() {
+#if CONFIGURATION_DEP
// we want to redo this logic exactly once if the last time we entered the config
// system was still initializing. (ASURT 111941, VSWhidbey 149552)
if (!settingsInitialized || (defaultInitialized && DiagnosticsConfiguration.IsInitialized())) {
}
}
}
+#endif
}
// This method refreshes all the data from the configuration file, so that updated to the configuration file are mirrored
// </copyright>
//------------------------------------------------------------------------------
+#if CONFIGURATION_DEP
using System.Configuration;
namespace System.Diagnostics {
}
}
+#endif
if (_initCalled)
return;
+#if CONFIGURATION_DEP
SourceElementsCollection sourceElements = DiagnosticsConfiguration.Sources;
if (sourceElements != null) {
NoConfigInit();
}
else
+#endif
NoConfigInit();
_initCalled = true;
return;
}
+#if CONFIGURATION_DEP
SourceElementsCollection sources = DiagnosticsConfiguration.Sources;
if (sources != null) {
attributes = null;
}
}
+#endif
}
[Conditional("TRACE")]
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
+#if CONFIGURATION_DEP
using System.Configuration;
using System;
using System.Reflection;
}
}
+#endif
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
-
+#if XML_DEP
using System;
using System.Text;
using System.Xml;
}
}
}
+#endif
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
internal static object GetRuntimeObject(string className, Type baseType, string initializeData) {
Object newObject = null;
+#if CONFIGURATION_DEP
Type objectType = null;
if (className.Length == 0) {
else
throw new ConfigurationErrorsException(SR.GetString(SR.Could_not_create_type_instance, className));
}
+#endif
return newObject;
}
+#if !MOBILE
// Our own tracelisteners that needs extra config validation
internal static bool IsOwnedTL(Type type) {
return (typeof(EventLogTraceListener) == type
|| IsOwnedTextWriterTL(type));
}
internal static bool IsOwnedTextWriterTL(Type type) {
+#if XML_DEP
return (typeof(XmlWriterTraceListener) == type)
|| (typeof(DelimitedListTraceListener) == type)
|| (typeof(TextWriterTraceListener) == type);
+#else
+ return false;
+#endif
}
+#endif
private static object ConvertToBaseTypeOrEnum(string value, Type type) {
if (type.IsEnum)
}
internal static void VerifyAttributes(IDictionary attributes, String[] supportedAttributes, object parent) {
+#if CONFIGURATION_DEP
foreach (string key in attributes.Keys) {
bool found = false;
if (supportedAttributes != null) {
if (!found)
throw new ConfigurationErrorsException(SR.GetString(SR.AttributeNotSupported, key, parent.GetType().FullName));
}
+#endif
}
}
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
-
+#if CONFIGURATION_DEP
namespace System.Configuration {
}
}
}
+#endif