Add #if CONFIGURATION_DEP and #if XML_DEP in Trace class and co.
authorAtsushi Eno <atsushieno@gmail.com>
Tue, 24 Feb 2015 14:48:37 +0000 (22:48 +0800)
committerMarek Safar <marek.safar@gmail.com>
Mon, 2 May 2016 22:07:58 +0000 (00:07 +0200)
18 files changed:
mcs/class/referencesource/System/compmod/system/diagnostics/AssertSection.cs
mcs/class/referencesource/System/compmod/system/diagnostics/DefaultTraceListener.cs
mcs/class/referencesource/System/compmod/system/diagnostics/DiagnosticsConfiguration.cs
mcs/class/referencesource/System/compmod/system/diagnostics/FilterElement.cs
mcs/class/referencesource/System/compmod/system/diagnostics/ListenerElementsCollection.cs
mcs/class/referencesource/System/compmod/system/diagnostics/PerfCounterSection.cs
mcs/class/referencesource/System/compmod/system/diagnostics/SourceElementsCollection.cs
mcs/class/referencesource/System/compmod/system/diagnostics/Switch.cs
mcs/class/referencesource/System/compmod/system/diagnostics/SwitchElementsCollection.cs
mcs/class/referencesource/System/compmod/system/diagnostics/SystemDiagnosticsSection.cs
mcs/class/referencesource/System/compmod/system/diagnostics/Trace.cs
mcs/class/referencesource/System/compmod/system/diagnostics/TraceInternal.cs
mcs/class/referencesource/System/compmod/system/diagnostics/TraceSection.cs
mcs/class/referencesource/System/compmod/system/diagnostics/TraceSource.cs
mcs/class/referencesource/System/compmod/system/diagnostics/TypedElement.cs
mcs/class/referencesource/System/compmod/system/diagnostics/XmlWriterTraceListener.cs
mcs/class/referencesource/System/compmod/system/diagnostics/traceutils.cs
mcs/class/referencesource/System/misc/PrivilegedConfigurationManager.cs

index a98f6d4e5536dd32d532b350f1aecdb5d812663b..8efde6f9ab3c1b4ca9b3088efe60fc6b7f276236 100644 (file)
@@ -4,6 +4,7 @@
 // </copyright>
 //------------------------------------------------------------------------------
 
+#if CONFIGURATION_DEP
 using System.Configuration;
 
 namespace System.Diagnostics {
@@ -41,3 +42,4 @@ namespace System.Diagnostics {
     }
 }
 
+#endif
index 25daba9c59138fec31bab76b4c2fc48d15681432..cd1a421dd9f2ec97cacc116e7ad4ba60f8c37c3d 100644 (file)
@@ -111,8 +111,10 @@ namespace System.Diagnostics {
         [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;
         }
 
index 43b34530b29d7998776de22d8923cb0e8681350a..5b5c81384b82dcfa80e4ec7bb98e5be76c078439 100644 (file)
@@ -4,6 +4,7 @@
 // </copyright>
 //------------------------------------------------------------------------------
 
+#if CONFIGURATION_DEP
 namespace System.Diagnostics {
     using System;
     using System.Reflection;
@@ -255,3 +256,4 @@ namespace System.Diagnostics {
     }
 }
 
+#endif
index 6b01e8a7f3815370069046f5c5b93de95a3ac02b..2e1696938331eb12ad6c3d1bd7f2886085c6d6e8 100644 (file)
@@ -3,6 +3,7 @@
 //     Copyright (c) Microsoft Corporation.  All rights reserved.
 // </copyright>
 //------------------------------------------------------------------------------
+#if CONFIGURATION_DEP
 using System.Configuration;
 using System;
 
@@ -29,4 +30,4 @@ namespace System.Diagnostics {
     }
 }
 
-
+#endif
index 810c3c2c4bc05222792da90e7edc0772e89e38d7..37dc9b8e1a04955d24ce2726190fd98850b9ec57 100644 (file)
@@ -3,6 +3,7 @@
 //     Copyright (c) Microsoft Corporation.  All rights reserved.
 // </copyright>
 //------------------------------------------------------------------------------ 
+#if CONFIGURATION_DEP
 using System.Configuration;
 using System;
 using System.Reflection;
@@ -372,3 +373,4 @@ namespace System.Diagnostics {
     }
 }
 
+#endif
index 7a4ae062ba28462237c9da28c96a8cab8003e674..8d75870edc3d521a249be995ca64b137495d4de6 100644 (file)
@@ -4,6 +4,7 @@
 // </copyright>
 //------------------------------------------------------------------------------
 
+#if CONFIGURATION_DEP
 using System.Configuration;
 
 namespace System.Diagnostics {
@@ -31,3 +32,4 @@ namespace System.Diagnostics {
     }
 }
 
+#endif
index a8a606a0ea98314cec8c986f93ff79d615b0a8af..834430a775934985564bf823cd77391545bca431 100644 (file)
@@ -3,6 +3,8 @@
 //     Copyright (c) Microsoft Corporation.  All rights reserved.
 // </copyright>
 //------------------------------------------------------------------------------
+
+#if CONFIGURATION_DEP
 using System.Configuration;
 using System.Collections;
 using System.Collections.Specialized;
@@ -185,3 +187,4 @@ namespace System.Diagnostics {
         
 }
 
+#endif
index 471abb488c9e4aa5148a4d656723257049cd82e0..f019ee54f5b9b735be116f1650a12679b9c5faa5 100644 (file)
@@ -6,6 +6,9 @@
 
 /*
  */
+#if !CONFIGURATION_DEP
+using SwitchElementsCollection = System.Object;
+#endif
 
 namespace System.Diagnostics {
     using System;
@@ -19,7 +22,9 @@ namespace System.Diagnostics {
     using System.Collections.Specialized;
     using System.Globalization;
     using System.Configuration;
+#if XML_DEP
     using System.Xml.Serialization;
+#endif
     using System.Diagnostics.CodeAnalysis;
     
     /// <devdoc>
@@ -97,7 +102,9 @@ namespace System.Diagnostics {
             }
         }
 
+#if XML_DEP
         [XmlIgnore]
+#endif
         public StringDictionary Attributes {
             get {
                 Initialize();
@@ -164,6 +171,7 @@ namespace System.Diagnostics {
             set {
                 Initialize();
                 switchValueString = value;
+#if CONFIGURATION_DEP
                 try {
                     OnValueChanged();
                 }
@@ -176,6 +184,9 @@ namespace System.Diagnostics {
                 catch (OverflowException e) {
                     throw new ConfigurationErrorsException(SR.GetString(SR.BadConfigSwitchValue, DisplayName), e);
                 }
+#else
+                OnValueChanged();
+#endif
             }
         }
 
@@ -204,6 +215,7 @@ namespace System.Diagnostics {
                         }
                     }
 
+#if CONFIGURATION_DEP
                     if (switchSettings != null) {
                         SwitchElement mySettings = switchSettings[displayName];
                         if (mySettings != null) {
@@ -231,11 +243,14 @@ namespace System.Diagnostics {
                             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;
@@ -249,11 +264,13 @@ namespace System.Diagnostics {
             if (switchSettings != null)
                 return true;
 
+#if CONFIGURATION_DEP
             if (!DiagnosticsConfiguration.CanInitialize())
                 return false;
 
             // This hashtable is case-insensitive.
             switchSettings = DiagnosticsConfiguration.SwitchSettings;
+#endif
             return true;
         }
 
index 414b03e338c5001f934cb253e76e32938bb390e1..cbe85945bb8f65a079bf6ec5f7172d7e3e20e082 100644 (file)
@@ -3,6 +3,8 @@
 //     Copyright (c) Microsoft Corporation.  All rights reserved.
 // </copyright>
 //------------------------------------------------------------------------------
+
+#if CONFIGURATION_DEP
 using System.Configuration;
 using System.Collections;
 using System.Collections.Specialized;
@@ -136,3 +138,4 @@ namespace System.Diagnostics {
     }
 }
 
+#endif
index 29c47a8d2e6ff6eaa767b42f08658a9912d0c7a1..48e4d775c0609a7923e635b98957336d283aecac 100644 (file)
@@ -3,6 +3,7 @@
 //     Copyright (c) Microsoft Corporation.  All rights reserved.
 // </copyright>
 //------------------------------------------------------------------------------
+#if CONFIGURATION_DEP
 using System.Configuration;
 
 namespace System.Diagnostics {
@@ -79,3 +80,4 @@ namespace System.Diagnostics {
     }
 }
     
+#endif
index 3e09ae8a392f4d0f7ad01bdb54287a912d767ba4..9d9a20aac1cbcc292856348d74e8cd868e59f233 100644 (file)
@@ -163,7 +163,9 @@ namespace System.Diagnostics {
         }
 
         public static void Refresh() {
+#if CONFIGURATION_DEP
             DiagnosticsConfiguration.Refresh();
+#endif
             Switch.RefreshAll();
             TraceSource.RefreshAll();
             TraceInternal.Refresh();
index 12e6571063635e716f6a4a4efb9b8ff41d75560f..6890780312993d035f3523352751a6227bb17c4b 100644 (file)
@@ -34,11 +34,13 @@ namespace System.Diagnostics {
                         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. 
@@ -47,7 +49,9 @@ namespace System.Diagnostics {
                                 defaultListener.IndentLevel = indentLevel;
                                 defaultListener.IndentSize = indentSize;
                                 listeners.Add(defaultListener);
+#if CONFIGURATION_DEP
                             }
+#endif
                         }
                     }
                 }
@@ -269,6 +273,7 @@ namespace System.Diagnostics {
         }        
 
         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())) {
@@ -289,6 +294,7 @@ namespace System.Diagnostics {
                     }
                 }
             }
+#endif
         }
 
         // This method refreshes all the data from the configuration file, so that updated to the configuration file are mirrored
index 3641201e78d3d774415e3d54727d6ea5506d187a..722470c434e990ec0dae77f8e6a41a925e4c3d53 100644 (file)
@@ -4,6 +4,7 @@
 // </copyright>
 //------------------------------------------------------------------------------
 
+#if CONFIGURATION_DEP
 using System.Configuration;
 
 namespace System.Diagnostics {
@@ -58,3 +59,4 @@ namespace System.Diagnostics {
     }
 }
 
+#endif
index a9abcaf3e297b2e975f55d91fd04910f579d2fd7..f5fae9ab41f099c45befd2e4da488bd7fbad2f18 100644 (file)
@@ -74,6 +74,7 @@ namespace System.Diagnostics {
                     if (_initCalled)
                         return;
                     
+#if CONFIGURATION_DEP
                     SourceElementsCollection sourceElements = DiagnosticsConfiguration.Sources;
     
                     if (sourceElements != null) {
@@ -99,6 +100,7 @@ namespace System.Diagnostics {
                             NoConfigInit();
                     }
                     else
+#endif
                         NoConfigInit();
     
                     _initCalled = true;
@@ -173,6 +175,7 @@ namespace System.Diagnostics {
                 return;
             }
 
+#if CONFIGURATION_DEP
             SourceElementsCollection sources = DiagnosticsConfiguration.Sources;
 
             if (sources != null) {
@@ -233,6 +236,7 @@ namespace System.Diagnostics {
                     attributes = null;
                 }
             }
+#endif
         }
         
         [Conditional("TRACE")]
index 1128db6a9db5de2536755c68c718765bccf5577f..5c6850e845cfa955cfb47e83e24aeb809a73b1a8 100644 (file)
@@ -3,6 +3,7 @@
 //     Copyright (c) Microsoft Corporation.  All rights reserved.
 // </copyright>
 //------------------------------------------------------------------------------
+#if CONFIGURATION_DEP
 using System.Configuration;
 using System;
 using System.Reflection;
@@ -62,3 +63,4 @@ namespace System.Diagnostics {
 
     }
 }
+#endif
index 93a2e710249334b336721c62105ace9cb1902cff..535d839ea2ccde9873a153f803897b3b4bb9c088 100644 (file)
@@ -3,7 +3,7 @@
 //     Copyright (c) Microsoft Corporation.  All rights reserved.
 // </copyright>
 //------------------------------------------------------------------------------
-
+#if XML_DEP
 using System;
 using System.Text;
 using System.Xml;
@@ -335,3 +335,4 @@ namespace System.Diagnostics {
         }
     }
 }
+#endif
index d7a641a219e3786c522683b596607c9cf3de3f5c..ee765e8dc4b3fbf030e48d326bf7d70692c01374 100644 (file)
@@ -19,6 +19,7 @@ namespace System.Diagnostics {
         [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) {
@@ -106,20 +107,27 @@ namespace System.Diagnostics {
                 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)
@@ -129,6 +137,7 @@ namespace System.Diagnostics {
         }
 
         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) {
@@ -140,6 +149,7 @@ namespace System.Diagnostics {
                 if (!found)
                     throw new ConfigurationErrorsException(SR.GetString(SR.AttributeNotSupported, key, parent.GetType().FullName));
             }
+#endif
         }
         
     }
index 63e04f244b54519df5e1b288bfbcd87fa3d51731..ec8920a6ac1ae4f06c8da18b88853a277e816365 100644 (file)
@@ -3,7 +3,7 @@
 //     Copyright (c) Microsoft Corporation.  All rights reserved.
 // </copyright>
 //------------------------------------------------------------------------------
-
+#if CONFIGURATION_DEP
 
 namespace System.Configuration {
 
@@ -25,3 +25,4 @@ namespace System.Configuration {
         }
     }
 }
+#endif