Delete duplicate files and fix build breaks
authorJan Kotas <jkotas@microsoft.com>
Fri, 7 Apr 2017 13:29:10 +0000 (06:29 -0700)
committerJan Kotas <jkotas@microsoft.com>
Fri, 7 Apr 2017 16:53:13 +0000 (09:53 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/8a06f89f97231f5675a9c737bb1ec12c79fbb51f

src/coreclr/src/mscorlib/System.Private.CoreLib.csproj
src/coreclr/src/mscorlib/shared/System/Diagnostics/Debug.cs
src/coreclr/src/mscorlib/src/Interop/Unix/System.Native/Interop.SysLog.cs [deleted file]
src/coreclr/src/mscorlib/src/Interop/Windows/kernel32/Interop.OutputDebugString.cs [deleted file]
src/coreclr/src/mscorlib/src/System/Diagnostics/Debug.cs [deleted file]

index d2e6dcb..d06643f 100644 (file)
     <Compile Include="$(BclSourcesRoot)\System\Diagnostics\AssertFilter.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Diagnostics\AssertFilters.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Diagnostics\ConditionalAttribute.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Diagnostics\Debug.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Diagnostics\Debug.Unix.cs" Condition="'$(TargetsUnix)' == 'true'" />
     <Compile Include="$(BclSourcesRoot)\System\Diagnostics\Debug.Windows.cs" Condition="'$(TargetsUnix)' != 'true'" />
-    <Compile Include="$(BclSourcesRoot)\Interop\Windows\kernel32\Interop.OutputDebugString.cs" Condition="'$(TargetsUnix)' != 'true'" />
     <Compile Include="$(BclSourcesRoot)\System\Diagnostics\Debugger.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Diagnostics\DebuggerAttributes.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Diagnostics\ICustomDebuggerNotification.cs" />
   <ItemGroup Condition="'$(TargetsUnix)' == 'true'">
     <Compile Include="$(BclSourcesRoot)\System\HResults.cs" />
     <Compile Include="$(BclSourcesRoot)\Interop\Unix\System.Native\Interop.GetRandomBytes.cs" />
-    <Compile Include="$(BclSourcesRoot)\Interop\Unix\System.Native\Interop.SysLog.cs" />
   </ItemGroup>
   <!-- Include additional sources shared files in the compilation -->
   <ItemGroup>
index 2dfde8d..59f3c37 100644 (file)
@@ -122,7 +122,7 @@ namespace System.Diagnostics
 
         private static string FormatAssert(string stackTrace, string message, string detailMessage)
         {
-            string newLine = GetIndentString() + NewLine;
+            string newLine = GetIndentString() + Environment.NewLine;
             return SR.DebugAssertBanner + newLine
                    + SR.DebugAssertShortMessage + newLine
                    + message + newLine
@@ -140,7 +140,7 @@ namespace System.Diagnostics
         [System.Diagnostics.Conditional("DEBUG")]
         public static void WriteLine(string message)
         {
-            Write(message + NewLine);
+            Write(message + Environment.NewLine);
         }
 
         [System.Diagnostics.Conditional("DEBUG")]
@@ -159,7 +159,7 @@ namespace System.Diagnostics
                     s_needIndent = false;
                 }
                 s_WriteCore(message);
-                if (message.EndsWith(NewLine))
+                if (message.EndsWith(Environment.NewLine))
                 {
                     s_needIndent = true;
                 }
@@ -311,7 +311,7 @@ namespace System.Diagnostics
         private sealed class DebugAssertException : Exception
         {
             internal DebugAssertException(string message, string detailMessage, string stackTrace) :
-                base(message + NewLine + detailMessage + NewLine + stackTrace)
+                base(message + Environment.NewLine + detailMessage + Environment.NewLine + stackTrace)
             {
             }
         }
diff --git a/src/coreclr/src/mscorlib/src/Interop/Unix/System.Native/Interop.SysLog.cs b/src/coreclr/src/mscorlib/src/Interop/Unix/System.Native/Interop.SysLog.cs
deleted file mode 100644 (file)
index 6b6a74b..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Runtime.InteropServices;
-
-internal static partial class Interop
-{
-    internal static partial class Sys
-    {
-        internal enum SysLogPriority : int
-        {
-            // Priorities
-            LOG_EMERG       = 0,        /* system is unusable */
-            LOG_ALERT       = 1,        /* action must be taken immediately */
-            LOG_CRIT        = 2,        /* critical conditions */
-            LOG_ERR         = 3,        /* error conditions */
-            LOG_WARNING     = 4,        /* warning conditions */
-            LOG_NOTICE      = 5,        /* normal but significant condition */
-            LOG_INFO        = 6,        /* informational */
-            LOG_DEBUG       = 7,        /* debug-level messages */
-            // Facilities
-            LOG_KERN        = (0<<3),   /* kernel messages */
-            LOG_USER        = (1<<3),   /* random user-level messages */
-            LOG_MAIL        = (2<<3),   /* mail system */
-            LOG_DAEMON      = (3<<3),   /* system daemons */
-            LOG_AUTH        = (4<<3),   /* authorization messages */
-            LOG_SYSLOG      = (5<<3),   /* messages generated internally by syslogd */
-            LOG_LPR         = (6<<3),   /* line printer subsystem */
-            LOG_NEWS        = (7<<3),   /* network news subsystem */
-            LOG_UUCP        = (8<<3),   /* UUCP subsystem */
-            LOG_CRON        = (9<<3),   /* clock daemon */
-            LOG_AUTHPRIV    = (10<<3),  /* authorization messages (private) */
-            LOG_FTP         = (11<<3),  /* ftp daemon */
-            // Between FTP and Local is reserved for system use
-            LOG_LOCAL0      = (16<<3),  /* reserved for local use */
-            LOG_LOCAL1      = (17<<3),  /* reserved for local use */
-            LOG_LOCAL2      = (18<<3),  /* reserved for local use */
-            LOG_LOCAL3      = (19<<3),  /* reserved for local use */
-            LOG_LOCAL4      = (20<<3),  /* reserved for local use */
-            LOG_LOCAL5      = (21<<3),  /* reserved for local use */
-            LOG_LOCAL6      = (22<<3),  /* reserved for local use */
-            LOG_LOCAL7      = (23<<3),  /* reserved for local use */
-        }
-
-        /// <summary>
-        /// Write a message to the system logger, which in turn writes the message to the system console, log files, etc. 
-        /// See man 3 syslog for more info
-        /// </summary>
-        /// <param name="priority">
-        /// The OR of a priority and facility in the SysLogPriority enum to declare the priority and facility of the log entry
-        /// </param>
-        /// <param name="message">The message to put in the log entry</param>
-        /// <param name="arg1">Like printf, the argument is passed to the variadic part of the C++ function to wildcards in the message</param>
-        [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SysLog")]
-        internal static extern void SysLog(SysLogPriority priority, string message, string arg1);
-    }
-}
diff --git a/src/coreclr/src/mscorlib/src/Interop/Windows/kernel32/Interop.OutputDebugString.cs b/src/coreclr/src/mscorlib/src/Interop/Windows/kernel32/Interop.OutputDebugString.cs
deleted file mode 100644 (file)
index 8da50ff..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
-    internal partial class Kernel32
-    {
-        [DllImport(Interop.Libraries.Kernel32, CharSet = CharSet.Unicode, EntryPoint = "OutputDebugStringW", ExactSpelling = true)]
-        internal static extern void OutputDebugString(string message);
-    }
-}
diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Debug.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Debug.cs
deleted file mode 100644 (file)
index 59f3c37..0000000
+++ /dev/null
@@ -1,323 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-// Do not remove this, it is needed to retain calls to these conditional methods in release builds
-#define DEBUG
-
-namespace System.Diagnostics
-{
-    /// <summary>
-    /// Provides a set of properties and methods for debugging code.
-    /// </summary>
-    public static partial class Debug
-    {
-        private static readonly object s_lock = new object();
-
-        public static bool AutoFlush { get { return true; } set { } }
-
-        [ThreadStatic]
-        private static int s_indentLevel;
-        public static int IndentLevel
-        {
-            get
-            {
-                return s_indentLevel;
-            }
-            set
-            {
-                s_indentLevel = value < 0 ? 0 : value;
-            }
-        }
-
-        private static int s_indentSize = 4;
-        public static int IndentSize
-        {
-            get
-            {
-                return s_indentSize;
-            }
-            set
-            {
-                s_indentSize = value < 0 ? 0 : value;
-            }
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void Close() { }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void Flush() { }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void Indent()
-        {
-            IndentLevel++;
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void Unindent()
-        {
-            IndentLevel--;
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void Print(string message)
-        {
-            Write(message);
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void Print(string format, params object[] args)
-        {
-            Write(string.Format(null, format, args));
-        }
-
-        private static readonly object s_ForLock = new Object();
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void Assert(bool condition)
-        {
-            Assert(condition, string.Empty, string.Empty);
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void Assert(bool condition, string message)
-        {
-            Assert(condition, message, string.Empty);
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void Assert(bool condition, string message, string detailMessage)
-        {
-            if (!condition)
-            {
-                string stackTrace;
-
-                try
-                {
-                    stackTrace = Internal.Runtime.Augments.EnvironmentAugments.StackTrace;
-                }
-                catch
-                {
-                    stackTrace = "";
-                }
-
-                WriteLine(FormatAssert(stackTrace, message, detailMessage));
-                s_ShowAssertDialog(stackTrace, message, detailMessage);
-            }
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void Fail(string message)
-        {
-            Assert(false, message, string.Empty);
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void Fail(string message, string detailMessage)
-        {
-            Assert(false, message, detailMessage);
-        }
-
-        private static string FormatAssert(string stackTrace, string message, string detailMessage)
-        {
-            string newLine = GetIndentString() + Environment.NewLine;
-            return SR.DebugAssertBanner + newLine
-                   + SR.DebugAssertShortMessage + newLine
-                   + message + newLine
-                   + SR.DebugAssertLongMessage + newLine
-                   + detailMessage + newLine
-                   + stackTrace;
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void Assert(bool condition, string message, string detailMessageFormat, params object[] args)
-        {
-            Assert(condition, message, string.Format(detailMessageFormat, args));
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void WriteLine(string message)
-        {
-            Write(message + Environment.NewLine);
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void Write(string message)
-        {
-            lock (s_lock)
-            {
-                if (message == null)
-                {
-                    s_WriteCore(string.Empty);
-                    return;
-                }
-                if (s_needIndent)
-                {
-                    message = GetIndentString() + message;
-                    s_needIndent = false;
-                }
-                s_WriteCore(message);
-                if (message.EndsWith(Environment.NewLine))
-                {
-                    s_needIndent = true;
-                }
-            }
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void WriteLine(object value)
-        {
-            WriteLine(value?.ToString());
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void WriteLine(object value, string category)
-        {
-            WriteLine(value?.ToString(), category);
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void WriteLine(string format, params object[] args)
-        {
-            WriteLine(string.Format(null, format, args));
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void WriteLine(string message, string category)
-        {
-            if (category == null)
-            {
-                WriteLine(message);
-            }
-            else
-            {
-                WriteLine(category + ":" + message);
-            }
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void Write(object value)
-        {
-            Write(value?.ToString());
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void Write(string message, string category)
-        {
-            if (category == null)
-            {
-                Write(message);
-            }
-            else
-            {
-                Write(category + ":" + message);
-            }
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void Write(object value, string category)
-        {
-            Write(value?.ToString(), category);
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void WriteIf(bool condition, string message)
-        {
-            if (condition)
-            {
-                Write(message);
-            }
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void WriteIf(bool condition, object value)
-        {
-            if (condition)
-            {
-                Write(value);
-            }
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void WriteIf(bool condition, string message, string category)
-        {
-            if (condition)
-            {
-                Write(message, category);
-            }
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void WriteIf(bool condition, object value, string category)
-        {
-            if (condition)
-            {
-                Write(value, category);
-            }
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void WriteLineIf(bool condition, object value)
-        {
-            if (condition)
-            {
-                WriteLine(value);
-            }
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void WriteLineIf(bool condition, object value, string category)
-        {
-            if (condition)
-            {
-                WriteLine(value, category);
-            }
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void WriteLineIf(bool condition, string message)
-        {
-            if (condition)
-            {
-                WriteLine(message);
-            }
-        }
-
-        [System.Diagnostics.Conditional("DEBUG")]
-        public static void WriteLineIf(bool condition, string message, string category)
-        {
-            if (condition)
-            {
-                WriteLine(message, category);
-            }
-        }
-
-        private static bool s_needIndent;
-
-        private static string s_indentString;
-
-        private static string GetIndentString()
-        {
-            int indentCount = IndentSize * IndentLevel;
-            if (s_indentString?.Length == indentCount)
-            {
-                return s_indentString;
-            }
-            return s_indentString = new string(' ', indentCount);
-        }
-
-        private sealed class DebugAssertException : Exception
-        {
-            internal DebugAssertException(string message, string detailMessage, string stackTrace) :
-                base(message + Environment.NewLine + detailMessage + Environment.NewLine + stackTrace)
-            {
-            }
-        }
-
-        // internal and not readonly so that the tests can swap this out.
-        internal static Action<string, string, string> s_ShowAssertDialog = ShowAssertDialog;
-        internal static Action<string> s_WriteCore = WriteCore;
-    }
-}