Fix build breaks
authorJan Kotas <jkotas@microsoft.com>
Fri, 31 Mar 2017 18:45:17 +0000 (11:45 -0700)
committerJan Kotas <jkotas@microsoft.com>
Fri, 31 Mar 2017 18:45:17 +0000 (11:45 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/9b1504c1baccdebe5e3df9dba3d8faaf548a4b2e

21 files changed:
src/coreclr/src/mscorlib/Resources/Strings.resx
src/coreclr/src/mscorlib/System.Private.CoreLib.csproj
src/coreclr/src/mscorlib/src/Debug.cs [deleted file]
src/coreclr/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Collation.cs
src/coreclr/src/mscorlib/src/Interop/Unix/System.Native/Interop.SysLog.cs [new file with mode: 0644]
src/coreclr/src/mscorlib/src/System/ArraySegment.cs
src/coreclr/src/mscorlib/src/System/Diagnostics/Debug.Unix.cs
src/coreclr/src/mscorlib/src/System/Globalization/CalendarData.Windows.cs
src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.Unix.cs
src/coreclr/src/mscorlib/src/System/Globalization/CultureInfo.Windows.cs
src/coreclr/src/mscorlib/src/System/Globalization/IdnMapping.Unix.cs
src/coreclr/src/mscorlib/src/System/Globalization/IdnMapping.cs
src/coreclr/src/mscorlib/src/System/Globalization/JapaneseCalendar.Unix.cs
src/coreclr/src/mscorlib/src/System/Reflection/LocalVariableInfo.cs
src/coreclr/src/mscorlib/src/System/Reflection/RuntimeEventInfo.cs
src/coreclr/src/mscorlib/src/System/Reflection/RuntimeParameterInfo.cs
src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs
src/coreclr/src/mscorlib/src/System/ThrowHelper.cs
src/coreclr/src/mscorlib/src/System/TimeZone.cs
src/coreclr/src/mscorlib/src/System/TimeZoneInfo.Win32.cs
src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs

index 9769d5e..0ff4814 100644 (file)
   <data name="Word_At" xml:space="preserve">
     <value>at</value>
   </data>
-  </root>
+  <data name="DebugAssertBanner" xml:space="preserve">
+    <value>---- DEBUG ASSERTION FAILED ----</value>
+  </data>
+  <data name="DebugAssertLongMessage" xml:space="preserve">
+    <value>---- Assert Long Message ----</value>
+  </data>
+  <data name="DebugAssertShortMessage" xml:space="preserve">
+    <value>---- Assert Short Message ----</value>
+  </data>
+</root>
index 6f18a4f..3b6bfb6 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" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="$(BclSourcesRoot)\Debug.cs" />
+    <Compile Include="$(BclSourcesRoot)\Interop\Unix\System.Native\Interop.SysLog.cs" />
   </ItemGroup>
   <!-- Include additional sources shared files in the compilation -->
   <ItemGroup>
diff --git a/src/coreclr/src/mscorlib/src/Debug.cs b/src/coreclr/src/mscorlib/src/Debug.cs
deleted file mode 100644 (file)
index 35cb680..0000000
+++ /dev/null
@@ -1,29 +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.Diagnostics;
-
-namespace System
-{
-    internal static class Debug
-    {
-        [Conditional("_DEBUG")]
-        static public void Assert(bool condition)
-        {
-            BCLDebug.Assert(condition);
-        }
-
-        [Conditional("_DEBUG")]
-        static public void Assert(bool condition, string message)
-        {
-            BCLDebug.Assert(condition, message);
-        }
-
-        [Conditional("_DEBUG")]
-        static public void Fail(string message)
-        {
-            BCLDebug.Assert(false, message);
-        }
-    }
-}
index 5cd2ee5..fe14560 100644 (file)
@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 using System;
+using System.Diagnostics;
 using System.Globalization;
 using System.Runtime.InteropServices;
 using System.Security;
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
new file mode 100644 (file)
index 0000000..6b6a74b
--- /dev/null
@@ -0,0 +1,58 @@
+// 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);
+    }
+}
index 1e127e3..e0118c2 100644 (file)
@@ -15,6 +15,7 @@
 
 using System.Collections;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Diagnostics.Contracts;
 
 namespace System
index 6c9ec04..9584d75 100644 (file)
@@ -84,33 +84,30 @@ namespace System.Diagnostics
                     int bufCount;
                     int i = 0;
 
-                    using (SafeFileHandle fileHandle = SafeFileHandleHelper.Open(() => Interop.Sys.Dup(Interop.Sys.FileDescriptors.STDERR_FILENO)))
+                    while (i < message.Length)
                     {
-                        while (i < message.Length)
+                        for (bufCount = 0; bufCount < BufferLength && i < message.Length; i++)
                         {
-                            for (bufCount = 0; bufCount < BufferLength && i < message.Length; i++)
+                            if (message[i] <= 0x7F)
                             {
-                                if (message[i] <= 0x7F)
-                                {
-                                    buf[bufCount] = (byte)message[i];
-                                    bufCount++;
-                                }
+                                buf[bufCount] = (byte)message[i];
+                                bufCount++;
                             }
+                        }
 
-                            int totalBytesWritten = 0;
-                            while (bufCount > 0)
+                        int totalBytesWritten = 0;
+                        while (bufCount > 0)
+                        {
+                            int bytesWritten = Interop.Sys.Write(2 /* stderr */, buf + totalBytesWritten, bufCount);
+                            if (bytesWritten < 0)
                             {
-                                int bytesWritten = Interop.Sys.Write(fileHandle, buf + totalBytesWritten, bufCount);
-                                if (bytesWritten < 0)
-                                {
-                                    // On error, simply stop writing the debug output.  This could commonly happen if stderr
-                                    // was piped to a program that ended before this program did, resulting in EPIPE errors.
-                                    return;
-                                }
-
-                                bufCount -= bytesWritten;
-                                totalBytesWritten += bytesWritten;
+                                // On error, simply stop writing the debug output.  This could commonly happen if stderr
+                                // was piped to a program that ended before this program did, resulting in EPIPE errors.
+                                return;
                             }
+
+                            bufCount -= bytesWritten;
+                            totalBytesWritten += bytesWritten;
                         }
                     }
                 }
index 206d077..51a2727 100644 (file)
@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 using System;
+using System.Diagnostics;
 using System.Runtime.InteropServices;
 using System.Runtime.CompilerServices;
 using System.Diagnostics.Contracts;
index 4d98dd6..7a8a9fd 100644 (file)
@@ -2,6 +2,7 @@
 // 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.Diagnostics;
 using System.Threading;
 
 namespace System.Globalization
index 827330b..e33874e 100644 (file)
@@ -2,6 +2,8 @@
 // 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.Diagnostics;
+
 #if ENABLE_WINRT
 using Internal.Runtime.Augments;
 #endif
index aab957a..f1ad6f1 100644 (file)
@@ -2,6 +2,8 @@
 // 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.Diagnostics;
+
 namespace System.Globalization
 {
     sealed partial class IdnMapping
index 1f6bd9b..4320e3a 100644 (file)
@@ -24,6 +24,7 @@
 //  RFC 3491 - Nameprep: A Stringprep Profile for Internationalized Domain Names (IDN)
 //  RFC 3492 - Punycode: A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA)
 
+using System.Diagnostics;
 using System.Diagnostics.Contracts;
 using System.Text;
 
index 6f8e0ba..51ff809 100644 (file)
@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 using System.Collections.Generic;
+using System.Diagnostics;
 
 namespace System.Globalization
 {
index 41d7477..241a3c4 100644 (file)
@@ -2,6 +2,8 @@
 // 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.Diagnostics;
+
 namespace System.Reflection
 {
     public class LocalVariableInfo
index e2faf83..930e182 100644 (file)
@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Diagnostics.Contracts;
 using System.Runtime.Serialization;
 using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
index 77a56b4..a8d6240 100644 (file)
@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Diagnostics.Contracts;
 using System.Runtime.Serialization;
 using System.Runtime.CompilerServices;
index 445ea31..4dcf8d4 100644 (file)
@@ -38,6 +38,7 @@
 using System.Collections.Generic;
 using System.Runtime.CompilerServices;
 using System.Runtime.Serialization;
+using System.Diagnostics;
 using System.Diagnostics.Contracts;
 
 namespace System
index 88e2e21..00883b3 100644 (file)
@@ -22,6 +22,7 @@ using System;
 using System.Text;
 using System.Threading;
 using System.Collections;
+using System.Diagnostics;
 using System.Globalization;
 
 namespace System
index 5107fee..f359a2a 100644 (file)
@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Globalization;
 using System.IO;
 using System.Security;
index 3dd0aec..29ea33a 100644 (file)
@@ -4,6 +4,7 @@
 
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
+using System.Diagnostics;
 using System.Diagnostics.Contracts;
 using System.Globalization;
 using System.Runtime.Serialization;