Add most of the Debug class (with related tracing types) to the mobile build. Fixes...
authorRolf Bjarne Kvinge <rolf@xamarin.com>
Thu, 29 Mar 2012 15:30:02 +0000 (17:30 +0200)
committerRolf Bjarne Kvinge <rolf@xamarin.com>
Thu, 29 Mar 2012 15:53:04 +0000 (17:53 +0200)
mcs/class/System/System.Diagnostics/DefaultTraceListener.cs
mcs/class/System/System.Diagnostics/TraceImpl.cs
mcs/class/System/System.Diagnostics/TraceListener.cs
mcs/class/System/System.Diagnostics/TraceListenerCollection.cs
mcs/class/System/mobile_System.dll.sources

index 2ee3a8ee2da09ca0d8eb4755f67f87edbe96ca23..42dce1ffe26e3ddf5a83246e4060c5b34f027c12 100644 (file)
@@ -77,6 +77,11 @@ namespace System.Diagnostics {
                                String trace = Environment.GetEnvironmentVariable("MONO_TRACE_LISTENER");
 #endif
 
+#if MOBILE
+                               if (trace == null)
+                                       trace = ConsoleOutTrace;
+#endif
+
                                if (trace != null) {
                                        string file = null;
                                        string prefix = null;
index 265cd6eb60d4c3b456999502657f930dbf367e11..167045711178e4572ebb9eb009c25089764d0277 100644 (file)
@@ -37,6 +37,7 @@ using System.Threading;
 
 namespace System.Diagnostics {
 
+#if !MOBILE
        internal class TraceImplSettings {
                public const string Key = ".__TraceInfoSettingsKey__.";
 
@@ -49,10 +50,13 @@ namespace System.Diagnostics {
                        Listeners.Add (new DefaultTraceListener (), this);
                }
        }
+#endif
 
        internal class TraceImpl {
 
+#if !MOBILE
                private static object initLock = new object ();
+#endif
 
                private static bool autoFlush;
 
@@ -91,6 +95,13 @@ namespace System.Diagnostics {
                {
                }
 
+#if MOBILE
+               static TraceImpl ()
+               {
+                       listeners = new TraceListenerCollection (true);
+               }
+#endif
+
                public static bool AutoFlush {
                        get {
                                InitOnce ();
@@ -151,7 +162,7 @@ namespace System.Diagnostics {
                }
 
                static bool use_global_lock;
-#if NET_2_0
+#if NET_2_0 && !MOBILE
                static CorrelationManager correlation_manager = new CorrelationManager ();
 
                public static CorrelationManager CorrelationManager {
@@ -193,6 +204,7 @@ namespace System.Diagnostics {
                // in the IDictionary returned).
                private static void InitOnce ()
                {
+#if !MOBILE
                        if (initLock != null) {
                                lock (initLock) {
                                        if (listeners == null) {
@@ -209,6 +221,7 @@ namespace System.Diagnostics {
                                }
                                initLock = null;
                        }
+#endif
                }
 
                // FIXME: According to MSDN, this method should display a dialog box
index 873a62343c63dd7e6c17524706b06f0ee1166874..6ce37000c10bc7614089c66d93e7ab0115499d43 100644 (file)
@@ -76,10 +76,12 @@ namespace System.Diagnostics {
                        set { System.Threading.Thread.SetData (_attributesStore, value); }
                }
 
+#if !MOBILE
                private TraceFilter filter {
                        get { return (TraceFilter) System.Threading.Thread.GetData (_filterStore); }
                        set { System.Threading.Thread.SetData (_filterStore, value); }
                }
+#endif
 
                private TraceOptions options {
                        get {
@@ -101,8 +103,10 @@ namespace System.Diagnostics {
 #if NET_2_0
                [ThreadStatic]
                private StringDictionary attributes = new StringDictionary ();
+#if !MOBILE
                [ThreadStatic]
                private TraceFilter filter;
+#endif
                [ThreadStatic]
                private TraceOptions options;
 #endif
@@ -234,6 +238,7 @@ namespace System.Diagnostics {
                        return String.Join (joiner, arr);
                }
 
+#if !MOBILE
                [ComVisible (false)]
                public virtual void TraceData (TraceEventCache eventCache, string source,
                        TraceEventType eventType, int id, object data)
@@ -298,6 +303,7 @@ namespace System.Diagnostics {
                {
                        TraceEvent (eventCache, source, TraceEventType.Transfer, id, String.Format ("{0}, relatedActivityId={1}", message, relatedActivityId));
                }
+#endif
 
                protected internal virtual string [] GetSupportedAttributes ()
                {
@@ -308,11 +314,13 @@ namespace System.Diagnostics {
                        get { return attributes; }
                }
 
+#if !MOBILE
                [ComVisibleAttribute (false)]
                public TraceFilter Filter {
                        get { return filter; }
                        set { filter = value; }
                }
+#endif
 
                [ComVisibleAttribute (false)]
                public TraceOptions TraceOutputOptions {
index d01064be91c0548043f8d1384ce904e2cd85cc82..f2c36d87f9aef9d87ce796f9f40bd7fa1f5710e6 100644 (file)
@@ -109,12 +109,14 @@ namespace System.Diagnostics {
                        return listeners.Add (listener);
                }
 
+#if !MOBILE
                internal void Add (TraceListener listener, TraceImplSettings settings)
                {
                        listener.IndentLevel = settings.IndentLevel;
                        listener.IndentSize  = settings.IndentSize;
                        listeners.Add (listener);
                }
+#endif
 
                private void InitializeListener (TraceListener listener)
                {
index 6656ee67febaf08d209718fd97832722eda3c52c..b36696dbb6948b7cedae925f9fdb94b26cbe8232 100644 (file)
@@ -191,7 +191,8 @@ System.ComponentModel/WeakObjectWrapperComparer.cs
 System.ComponentModel/Win32Exception.cs
 System.Diagnostics/DataReceivedEventArgs.cs
 System.Diagnostics/DataReceivedEventHandler.cs
-System.Diagnostics/Debug_2_1.cs
+System.Diagnostics/Debug.cs
+System.Diagnostics/DefaultTraceListener.cs
 System.Diagnostics/FileVersionInfo.cs
 System.Diagnostics/MonitoringDescriptionAttribute.cs
 System.Diagnostics/Process.cs
@@ -203,6 +204,10 @@ System.Diagnostics/ProcessThread.cs
 System.Diagnostics/ProcessThreadCollection.cs
 System.Diagnostics/ProcessWindowStyle.cs
 System.Diagnostics/Stopwatch.cs
+System.Diagnostics/TraceImpl.cs
+System.Diagnostics/TraceListener.cs
+System.Diagnostics/TraceListenerCollection.cs
+System.Diagnostics/TraceOptions.cs
 System.Diagnostics/ThreadPriorityLevel.cs
 System.Diagnostics/ThreadState.cs
 System.Diagnostics/ThreadWaitReason.cs