Synchronize src\mscorlib\corefx with CoreRT (dotnet/coreclr#9251)
authorJan Kotas <jkotas@microsoft.com>
Wed, 1 Feb 2017 20:40:59 +0000 (12:40 -0800)
committerGitHub <noreply@github.com>
Wed, 1 Feb 2017 20:40:59 +0000 (12:40 -0800)
Commit migrated from https://github.com/dotnet/coreclr/commit/76e174f3bd92ee3ce8412b2e0f25e18bf0b77068

38 files changed:
src/coreclr/src/mscorlib/corefx/SR.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/Calendar.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/CalendarWeekRule.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/CalendricalCalculationsHelper.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/CharUnicodeInfo.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/ChineseLunisolarCalendar.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/CompareInfo.Windows.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/CultureData.Windows.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/CultureNotFoundException.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/CultureTypes.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/DigitShapes.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/EastAsianLunisolarCalendar.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/GregorianCalendar.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/HebrewCalendar.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/HijriCalendar.Win32.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/HijriCalendar.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/IdnMapping.Windows.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.Win32.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/JapaneseLunisolarCalendar.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/JulianCalendar.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/KoreanCalendar.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/KoreanLunisolarCalendar.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/SortKey.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/SortVersion.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/StringInfo.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/TaiwanCalendar.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/TaiwanLunisolarCalendar.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/TextElementEnumerator.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/TextInfo.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/ThaiBuddhistCalendar.cs
src/coreclr/src/mscorlib/corefx/System/Globalization/UmAlQuraCalendar.cs
src/coreclr/src/mscorlib/corefx/System/IO/FileStream.NetStandard17.cs [deleted file]
src/coreclr/src/mscorlib/corefx/System/IO/FileStream.cs
src/coreclr/src/mscorlib/mscorlib.shared.sources.props
src/coreclr/src/mscorlib/src/System/IO/File.cs
src/coreclr/src/mscorlib/src/System/IO/StreamReader.cs
src/coreclr/src/mscorlib/src/System/Resources/ResourceReader.cs

index 5f96a40..91cc0c6 100644 (file)
@@ -620,4 +620,9 @@ internal static class SR
     {
         get { return Environment.GetResourceString("SpinLock_IsHeldByCurrentThread"); }
     }
+
+    internal static string ObjectDisposed_StreamIsClosed
+    {
+        get { return Environment.GetResourceString("ObjectDisposed_StreamIsClosed"); }
+    }
 }
index 78e9f00..0ff5040 100644 (file)
@@ -29,7 +29,6 @@ namespace System.Globalization
     // since most of the calendars (or all?) have the same way of calcuating hour/minute/second.
 
     [Serializable]
-    [System.Runtime.InteropServices.ComVisible(true)]
     public abstract partial class Calendar : ICloneable
     {
         // Number of 100ns (10E-7 second) ticks per time unit
@@ -77,7 +76,6 @@ namespace System.Globalization
 
         // The minimum supported DateTime range for the calendar.
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public virtual DateTime MinSupportedDateTime
         {
             get
@@ -88,7 +86,6 @@ namespace System.Globalization
 
         // The maximum supported DateTime range for the calendar.
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public virtual DateTime MaxSupportedDateTime
         {
             get
@@ -97,7 +94,6 @@ namespace System.Globalization
             }
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public virtual CalendarAlgorithmType AlgorithmType
         {
             get
@@ -138,7 +134,6 @@ namespace System.Globalization
         //  Detect if the object is readonly.
         //
         ////////////////////////////////////////////////////////////////////////
-        [System.Runtime.InteropServices.ComVisible(false)]
         public bool IsReadOnly
         {
             get { return (_isReadOnly); }
@@ -151,7 +146,6 @@ namespace System.Globalization
         //  Is the implementation of ICloneable.
         //
         ////////////////////////////////////////////////////////////////////////
-        [System.Runtime.InteropServices.ComVisible(false)]
         public virtual object Clone()
         {
             object o = MemberwiseClone();
@@ -167,7 +161,6 @@ namespace System.Globalization
         //  readonly.
         //
         ////////////////////////////////////////////////////////////////////////
-        [System.Runtime.InteropServices.ComVisible(false)]
         public static Calendar ReadOnly(Calendar calendar)
         {
             if (calendar == null) { throw new ArgumentNullException(nameof(calendar)); }
@@ -708,7 +701,6 @@ namespace System.Globalization
         // if this calendar does not have leap month, or this year is not a leap year.
         //
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public virtual int GetLeapMonth(int year)
         {
             return (GetLeapMonth(year, CurrentEra));
@@ -718,7 +710,6 @@ namespace System.Globalization
         // if this calendar does not have leap month, or this year is not a leap year.
         //
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public virtual int GetLeapMonth(int year, int era)
         {
             if (!IsLeapYear(year, era))
index 490951e..4013ce7 100644 (file)
@@ -7,7 +7,6 @@ using System;
 namespace System.Globalization
 {
     [Serializable]
-    [System.Runtime.InteropServices.ComVisible(true)]
     public enum CalendarWeekRule
     {
         FirstDay = 0,           // Week 1 begins on the first day of the year
index 149e63c..7de75d6 100644 (file)
@@ -22,8 +22,8 @@ namespace System.Globalization
         private const int SecondsPerMinute = 60;
         private const int MinutesPerDegree = 60;
 
-        private static readonly long StartOf1810 = GetNumberOfDays(new DateTime(1810, 1, 1));
-        private static readonly long StartOf1900Century = GetNumberOfDays(new DateTime(1900, 1, 1));
+        private static readonly long s_startOf1810 = GetNumberOfDays(new DateTime(1810, 1, 1));
+        private static readonly long s_startOf1900Century = GetNumberOfDays(new DateTime(1900, 1, 1));
 
         private static readonly double[] s_coefficients1900to1987 = new double[] { -0.00002, 0.000297, 0.025184, -0.181133, 0.553040, -0.861938, 0.677066, -0.212591 };
         private static readonly double[] s_coefficients1800to1899 = new double[] { -0.000009, 0.003844, 0.083563, 0.865736, 4.867575, 15.845535, 31.332267, 38.291999, 28.316289, 11.636204, 2.043794 };
@@ -146,7 +146,7 @@ namespace System.Globalization
         private static double CenturiesFrom1900(int gregorianYear)
         {
             long july1stOfYear = GetNumberOfDays(new DateTime(gregorianYear, 7, 1));
-            return (double)(july1stOfYear - StartOf1900Century) / DaysInUniformLengthCentury;
+            return (double)(july1stOfYear - s_startOf1900Century) / DaysInUniformLengthCentury;
         }
 
         // the following formulas defines a polynomial function which gives us the amount that the earth is slowing down for specific year ranges
@@ -154,7 +154,7 @@ namespace System.Globalization
         {
             Debug.Assert(gregorianYear < 1620 || 2020 <= gregorianYear);
             long january1stOfYear = GetNumberOfDays(new DateTime(gregorianYear, 1, 1));
-            double daysSinceStartOf1810 = january1stOfYear - StartOf1810;
+            double daysSinceStartOf1810 = january1stOfYear - s_startOf1810;
             double x = TwelveHours + daysSinceStartOf1810;
             return ((Math.Pow(x, 2) / 41048480) - 15) / SecondsPerDay;
         }
index dc38ca4..38ce441 100644 (file)
@@ -194,7 +194,7 @@ namespace System.Globalization
             // Get the level 2 WORD offset from the 4 - 7 bit of ch.  This provides the base offset of the level 3 table.
             // Note that & has the lower precedence than addition, so don't forget the parathesis.
             index = s_pNumericLevel1Index[index + ((ch >> 4) & 0x000f)];
-            
+
             fixed (ushort* pUshortPtr = &(s_pNumericLevel1Index[index]))
             {
                 byte* pBytePtr = (byte*)pUshortPtr;
@@ -238,46 +238,46 @@ namespace System.Globalization
             return (InternalGetNumericValue(InternalConvertToUtf32(s, index)));
         }
 
-        public static int GetDecimalDigitValue(char ch) 
+        public static int GetDecimalDigitValue(char ch)
         {
-            return (sbyte) (InternalGetDigitValues(ch) >> 8);
+            return (sbyte)(InternalGetDigitValues(ch) >> 8);
         }
 
-        public static int GetDecimalDigitValue(String s, int index) 
+        public static int GetDecimalDigitValue(String s, int index)
         {
-            if (s == null) 
+            if (s == null)
             {
                 throw new ArgumentNullException(nameof(s));
             }
-            
-            if (index < 0 || index >= s.Length) 
+
+            if (index < 0 || index >= s.Length)
             {
                 throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
             }
             Contract.EndContractBlock();
 
-            return (sbyte) (InternalGetDigitValues(InternalConvertToUtf32(s, index)) >> 8);
+            return (sbyte)(InternalGetDigitValues(InternalConvertToUtf32(s, index)) >> 8);
         }
-        
+
         public static int GetDigitValue(char ch)
         {
-            return (sbyte) (InternalGetDigitValues(ch) & 0x00FF);
+            return (sbyte)(InternalGetDigitValues(ch) & 0x00FF);
         }
 
-        public static int GetDigitValue(String s, int index) 
+        public static int GetDigitValue(String s, int index)
         {
-            if (s == null) 
+            if (s == null)
             {
                 throw new ArgumentNullException(nameof(s));
             }
-            
-            if (index < 0 || index >= s.Length) 
+
+            if (index < 0 || index >= s.Length)
             {
                 throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
             }
-            
+
             Contract.EndContractBlock();
-            return (sbyte) (InternalGetDigitValues(InternalConvertToUtf32(s, index)) & 0x00FF);
+            return (sbyte)(InternalGetDigitValues(InternalConvertToUtf32(s, index)) & 0x00FF);
         }
 
         public static UnicodeCategory GetUnicodeCategory(char ch)
index 271d980..5002555 100644 (file)
@@ -42,7 +42,6 @@ namespace System.Globalization
         internal static DateTime minDate = new DateTime(MIN_GREGORIAN_YEAR, MIN_GREGORIAN_MONTH, MIN_GREGORIAN_DAY);
         internal static DateTime maxDate = new DateTime((new DateTime(MAX_GREGORIAN_YEAR, MAX_GREGORIAN_MONTH, MAX_GREGORIAN_DAY, 23, 59, 59, 999)).Ticks + 9999);
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override DateTime MinSupportedDateTime
         {
             get
@@ -52,7 +51,6 @@ namespace System.Globalization
         }
 
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override DateTime MaxSupportedDateTime
         {
             get
@@ -318,9 +316,9 @@ namespace System.Globalization
             }
         }
 
-        internal override int GetYearInfo(int LunarYear, int Index)
+        internal override int GetYearInfo(int lunarYear, int index)
         {
-            if ((LunarYear < MIN_LUNISOLAR_YEAR) || (LunarYear > MAX_LUNISOLAR_YEAR))
+            if ((lunarYear < MIN_LUNISOLAR_YEAR) || (lunarYear > MAX_LUNISOLAR_YEAR))
             {
                 throw new ArgumentOutOfRangeException(
                             "year",
@@ -330,7 +328,7 @@ namespace System.Globalization
             }
             Contract.EndContractBlock();
 
-            return s_yinfo[LunarYear - MIN_LUNISOLAR_YEAR, Index];
+            return s_yinfo[lunarYear - MIN_LUNISOLAR_YEAR, index];
         }
 
         internal override int GetYear(int year, DateTime time)
@@ -362,7 +360,6 @@ namespace System.Globalization
         {
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override int GetEra(DateTime time)
         {
             CheckTicksRange(time.Ticks);
@@ -387,7 +384,6 @@ namespace System.Globalization
         }
 
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override int[] Eras
         {
             get
index 4ebaf9c..d493652 100644 (file)
@@ -351,7 +351,7 @@ namespace System.Globalization
 
         private unsafe SortKey CreateSortKey(String source, CompareOptions options)
         {
-            if (source==null) { throw new ArgumentNullException(nameof(source)); }
+            if (source == null) { throw new ArgumentNullException(nameof(source)); }
             Contract.EndContractBlock();
 
             if ((options & ValidSortkeyCtorMaskOffFlags) != 0)
@@ -362,7 +362,7 @@ namespace System.Globalization
             throw new NotImplementedException();
         }
 
-        private static unsafe bool IsSortable(char *text, int length)
+        private static unsafe bool IsSortable(chartext, int length)
         {
             // CompareInfo c = CultureInfo.InvariantCulture.CompareInfo;
             // return (InternalIsSortable(c.m_dataHandle, c.m_handleOrigin, c.m_sortName, text, text.Length));
index d1c99da..0c264e5 100644 (file)
@@ -663,11 +663,10 @@ namespace System.Globalization
         {
             get { throw new NotImplementedException(); }
         }
-        
+
         internal bool IsReplacementCulture
         {
             get { throw new NotImplementedException(); }
         }
-        
     }
 }
index 64782d2..d296ad8 100644 (file)
@@ -3,14 +3,13 @@
 // See the LICENSE file in the project root for more information.
 
 using System;
-using System.Threading;
 using System.Runtime.Serialization;
+using System.Threading;
 
 namespace System.Globalization
 {
     [Serializable]
-    [System.Runtime.InteropServices.ComVisible(true)]
-    public partial class CultureNotFoundException : ArgumentException, ISerializable
+    public class CultureNotFoundException : ArgumentException, ISerializable
     {
         private string _invalidCultureName; // unrecognized culture name
         private int? _invalidCultureId;     // unrecognized culture Lcid
@@ -66,14 +65,8 @@ namespace System.Globalization
             _invalidCultureName = (string)info.GetValue("InvalidCultureName", typeof(string));
         }
 
-        [System.Security.SecurityCritical]  // auto-generated_required
         public override void GetObjectData(SerializationInfo info, StreamingContext context)
         {
-            if (info == null)
-            {
-                throw new ArgumentNullException(nameof(info));
-            }
-
             base.GetObjectData(info, context);
             info.AddValue("InvalidCultureId", _invalidCultureId, typeof(int?));
             info.AddValue("InvalidCultureName", _invalidCultureName, typeof(string));
index 80b588a..35ddff6 100644 (file)
@@ -7,7 +7,7 @@
 // the rest are obsolete or not valid on Linux
 
 namespace System.Globalization
-{    
+{
     [Serializable]
     [Flags]
     public enum CultureTypes
@@ -25,4 +25,4 @@ namespace System.Globalization
         [Obsolete("This value has been deprecated.  Please use other values in CultureTypes.")]
         FrameworkCultures           = 0x0040,               // will return only the v2 cultures marked as Framework culture.
     }
-}    
+}
index 7e40033..0e4dcc8 100644 (file)
@@ -5,6 +5,7 @@
 //
 // The enumeration constants used in NumberFormatInfo.DigitSubstitution.
 //
+
 namespace System.Globalization
 {
     [Serializable]
index 84a44a9..f82fad8 100644 (file)
@@ -14,7 +14,6 @@ namespace System.Globalization
     ////////////////////////////////////////////////////////////////////////////
 
     [Serializable]
-    [System.Runtime.InteropServices.ComVisible(true)]
     public abstract class EastAsianLunisolarCalendar : Calendar
     {
         internal const int LeapMonth = 0;
index c2ed2e0..be5b65b 100644 (file)
@@ -19,7 +19,6 @@ namespace System.Globalization
     // 1 BeforeCurrentEra (BC)
 
     [Serializable]
-    [System.Runtime.InteropServices.ComVisible(true)]
 
     public class GregorianCalendar : Calendar
     {
@@ -66,7 +65,6 @@ namespace System.Globalization
             }
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override DateTime MinSupportedDateTime
         {
             get
@@ -75,7 +73,6 @@ namespace System.Globalization
             }
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override DateTime MaxSupportedDateTime
         {
             get
@@ -84,7 +81,6 @@ namespace System.Globalization
             }
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override CalendarAlgorithmType AlgorithmType
         {
             get
@@ -510,7 +506,6 @@ namespace System.Globalization
         // if this calendar does not have leap month, or this year is not a leap year.
         //
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override int GetLeapMonth(int year, int era)
         {
             if (era != CurrentEra && era != ADEra)
index 7e63708..b4f54f8 100644 (file)
@@ -63,7 +63,6 @@ namespace System.Globalization
 
 
     [Serializable]
-    [System.Runtime.InteropServices.ComVisible(true)]
     public class HebrewCalendar : Calendar
     {
         public static readonly int HebrewEra = 1;
index 5f46dce..869b809 100644 (file)
@@ -8,9 +8,10 @@ namespace System.Globalization
 {
     public partial class HijriCalendar : Calendar
     {
-        private static int GetHijriDateAdjustment()
+        private int GetHijriDateAdjustment()
         {
-            if (_hijriAdvance == Int32.MinValue) {
+            if (_hijriAdvance == Int32.MinValue)
+            {
                 // Never been set before.  Use the system value from registry.
                 _hijriAdvance = GetAdvanceHijriDate();
             }
@@ -36,11 +37,13 @@ namespace System.Globalization
         **      "AddHijriDate+1"  =>  Add +1 days to the current calculated Hijri date.
         **      "AddHijriDate+2"  =>  Add +2 days to the current calculated Hijri date.
         ============================================================================*/
-        private static int GetAdvanceHijriDate() {
+        private static int GetAdvanceHijriDate()
+        {
             int hijriAdvance = 0;
             Microsoft.Win32.RegistryKey key = null;
 
-            try {
+            try
+            {
                 // Open in read-only mode.
                 // Use InternalOpenSubKey so that we avoid the security check.
                 key = RegistryKey.GetBaseKey(RegistryKey.HKEY_CURRENT_USER).OpenSubKey(InternationalRegKey, false);
@@ -49,21 +52,28 @@ namespace System.Globalization
             catch (ObjectDisposedException) { return 0; }
             catch (ArgumentException) { return 0; }
 
-            if (key != null) {
-                try {
+            if (key != null)
+            {
+                try
+                {
                     Object value = key.InternalGetValue(HijriAdvanceRegKeyEntry, null, false, false);
-                    if (value == null) {
+                    if (value == null)
+                    {
                         return (0);
                     }
                     String str = value.ToString();
-                    if (String.Compare(str, 0, HijriAdvanceRegKeyEntry, 0, HijriAdvanceRegKeyEntry.Length, StringComparison.OrdinalIgnoreCase) == 0) {
+                    if (String.Compare(str, 0, HijriAdvanceRegKeyEntry, 0, HijriAdvanceRegKeyEntry.Length, StringComparison.OrdinalIgnoreCase) == 0)
+                    {
                         if (str.Length == HijriAdvanceRegKeyEntry.Length)
                             hijriAdvance = -1;
-                        else {
+                        else
+                        {
                             str = str.Substring(HijriAdvanceRegKeyEntry.Length);
-                            try {
+                            try
+                            {
                                 int advance = Int32.Parse(str.ToString(), CultureInfo.InvariantCulture);
-                                if ((advance >= MinAdvancedHijri) && (advance <= MaxAdvancedHijri)) {
+                                if ((advance >= MinAdvancedHijri) && (advance <= MaxAdvancedHijri))
+                                {
                                     hijriAdvance = advance;
                                 }
                             }
@@ -75,10 +85,10 @@ namespace System.Globalization
                         }
                     }
                 }
-                finally {
+                finally
+                {
                     key.Close();
                 }
-
             }
             return (hijriAdvance);
         }
index 156b210..0c72d9e 100644 (file)
@@ -45,7 +45,6 @@ namespace System.Globalization
     */
 
     [Serializable]
-    [System.Runtime.InteropServices.ComVisible(true)]
     public partial class HijriCalendar : Calendar
     {
         public static readonly int HijriEra = 1;
@@ -72,7 +71,6 @@ namespace System.Globalization
         internal static readonly DateTime calendarMaxValue = DateTime.MaxValue;
 
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override DateTime MinSupportedDateTime
         {
             get
@@ -82,7 +80,6 @@ namespace System.Globalization
         }
 
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override DateTime MaxSupportedDateTime
         {
             get
@@ -91,7 +88,6 @@ namespace System.Globalization
             }
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override CalendarAlgorithmType AlgorithmType
         {
             get
@@ -565,7 +561,6 @@ namespace System.Globalization
         // if this calendar does not have leap month, or this year is not a leap year.
         //
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override int GetLeapMonth(int year, int era)
         {
             CheckYearRange(year, era);
index f39457b..3d3292e 100644 (file)
@@ -7,7 +7,7 @@ using System.Runtime.InteropServices;
 
 namespace System.Globalization
 {
-    sealed partial class IdnMapping
+    public sealed partial class IdnMapping
     {
         private unsafe string GetAsciiCore(char* unicode, int count)
         {
index bbde320..a83c4fa 100644 (file)
@@ -33,7 +33,7 @@ namespace System.Globalization
             // Look in the registry key and see if we can find any ranges
             int iFoundEras = 0;
             EraInfo[] registryEraRanges = null;
-            
+
             try
             {
                 // Need to access registry
@@ -59,7 +59,7 @@ namespace System.Globalization
 
                         // Remember we found one.
                         registryEraRanges[iFoundEras] = era;
-                        iFoundEras++;                        
+                        iFoundEras++;
                     }
                 }
             }
@@ -109,7 +109,7 @@ namespace System.Globalization
                 else
                 {
                     // Rest are until the next era (remember most recent era is first in array)
-                    registryEraRanges[i].maxEraYear = registryEraRanges[i-1].yearOffset + 1 - registryEraRanges[i].yearOffset;
+                    registryEraRanges[i].maxEraYear = registryEraRanges[i - 1].yearOffset + 1 - registryEraRanges[i].yearOffset;
                 }
             }
 
@@ -147,7 +147,7 @@ namespace System.Globalization
         {
             // Need inputs
             if (value == null || data == null) return null;
-            
+
             //
             // Get Date
             //
@@ -159,9 +159,9 @@ namespace System.Globalization
             int month;
             int day;
 
-            if (!Int32.TryParse(value.Substring(0,4), NumberStyles.None, NumberFormatInfo.InvariantInfo, out year) ||
-                !Int32.TryParse(value.Substring(5,2), NumberStyles.None, NumberFormatInfo.InvariantInfo, out month) ||
-                !Int32.TryParse(value.Substring(8,2), NumberStyles.None, NumberFormatInfo.InvariantInfo, out day))
+            if (!Int32.TryParse(value.Substring(0, 4), NumberStyles.None, NumberFormatInfo.InvariantInfo, out year) ||
+                !Int32.TryParse(value.Substring(5, 2), NumberStyles.None, NumberFormatInfo.InvariantInfo, out month) ||
+                !Int32.TryParse(value.Substring(8, 2), NumberStyles.None, NumberFormatInfo.InvariantInfo, out day))
             {
                 // Couldn't convert integer, fail
                 return null;
@@ -171,7 +171,7 @@ namespace System.Globalization
             // Get Strings
             //
             // Needs to be a certain length e_a_E_A at least (7 chars, exactly 4 groups)
-            String[] names = data.Split(new char[] {'_'});
+            String[] names = data.Split('_');
 
             // Should have exactly 4 parts
             // 0 - Era Name
@@ -192,18 +192,18 @@ namespace System.Globalization
             // Note that the era # and max era year need cleaned up after sorting
             // Don't use the full English Era Name (names[2])
             //
-            return new EraInfo( 0, year, month, day, year - 1, 1, 0, 
+            return new EraInfo(0, year, month, day, year - 1, 1, 0,
                                 names[0], names[1], names[3]);
         }
 
         // PAL Layer ends here
 
-        private static string[] JapaneseErasEnglishNames = new String[] { "M", "T", "S", "H" };
+        private static string[] s_japaneseErasEnglishNames = new String[] { "M", "T", "S", "H" };
 
         private static string GetJapaneseEnglishEraName(int era)
         {
             Debug.Assert(era > 0);
-            return era <= JapaneseErasEnglishNames.Length ? JapaneseErasEnglishNames[era - 1] : " ";
+            return era <= s_japaneseErasEnglishNames.Length ? s_japaneseErasEnglishNames[era - 1] : " ";
         }
     }
 }
index 0b0fa77..f0216c8 100644 (file)
@@ -39,13 +39,11 @@ namespace System.Globalization
 
 
     [Serializable]
-    [System.Runtime.InteropServices.ComVisible(true)]
     public partial class JapaneseCalendar : Calendar
     {
         internal static readonly DateTime calendarMinValue = new DateTime(1868, 9, 8);
 
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override DateTime MinSupportedDateTime
         {
             get
@@ -54,7 +52,6 @@ namespace System.Globalization
             }
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override DateTime MaxSupportedDateTime
         {
             get
@@ -63,7 +60,6 @@ namespace System.Globalization
             }
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override CalendarAlgorithmType AlgorithmType
         {
             get
@@ -233,7 +229,6 @@ namespace System.Globalization
 
 
         [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
         {
             return (helper.GetWeekOfYear(time, rule, firstDayOfWeek));
@@ -281,7 +276,6 @@ namespace System.Globalization
         // if this calendar does not have leap month, or this year is not a leap year.
         //
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override int GetLeapMonth(int year, int era)
         {
             return (helper.GetLeapMonth(year, era));
index ecdaced..cc3d349 100644 (file)
@@ -206,9 +206,9 @@ namespace System.Globalization
             }
         }
 
-        internal override int GetYearInfo(int LunarYear, int Index)
+        internal override int GetYearInfo(int lunarYear, int index)
         {
-            if ((LunarYear < MIN_LUNISOLAR_YEAR) || (LunarYear > MAX_LUNISOLAR_YEAR))
+            if ((lunarYear < MIN_LUNISOLAR_YEAR) || (lunarYear > MAX_LUNISOLAR_YEAR))
             {
                 throw new ArgumentOutOfRangeException(
                             "year",
@@ -220,7 +220,7 @@ namespace System.Globalization
             }
             Contract.EndContractBlock();
 
-            return s_yinfo[LunarYear - MIN_LUNISOLAR_YEAR, Index];
+            return s_yinfo[lunarYear - MIN_LUNISOLAR_YEAR, index];
         }
 
         internal override int GetYear(int year, DateTime time)
index a4277c6..43e6ad0 100644 (file)
@@ -19,7 +19,6 @@ namespace System.Globalization
     //*      Julia       0001/01/03   9999/10/19
 
     [Serializable]
-    [System.Runtime.InteropServices.ComVisible(true)]
     public class JulianCalendar : Calendar
     {
         public static readonly int JulianEra = 1;
@@ -49,7 +48,6 @@ namespace System.Globalization
         internal int MaxYear = 9999;
 
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override DateTime MinSupportedDateTime
         {
             get
@@ -58,7 +56,6 @@ namespace System.Globalization
             }
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override DateTime MaxSupportedDateTime
         {
             get
@@ -67,7 +64,6 @@ namespace System.Globalization
             }
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override CalendarAlgorithmType AlgorithmType
         {
             get
@@ -346,7 +342,6 @@ namespace System.Globalization
         // if this calendar does not have leap month, or this year is not a leap year.
         //
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override int GetLeapMonth(int year, int era)
         {
             CheckYearEraRange(year, era);
index 27d0aa8..b015aa0 100644 (file)
@@ -25,7 +25,6 @@ namespace System.Globalization
 
 
     [Serializable]
-    [System.Runtime.InteropServices.ComVisible(true)]
     public class KoreanCalendar : Calendar
     {
         //
@@ -51,7 +50,6 @@ namespace System.Globalization
         internal GregorianCalendarHelper helper;
 
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override DateTime MinSupportedDateTime
         {
             get
@@ -60,7 +58,6 @@ namespace System.Globalization
             }
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override DateTime MaxSupportedDateTime
         {
             get
@@ -69,7 +66,6 @@ namespace System.Globalization
             }
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override CalendarAlgorithmType AlgorithmType
         {
             get
@@ -160,7 +156,6 @@ namespace System.Globalization
 
 
         [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
         {
             return (helper.GetWeekOfYear(time, rule, firstDayOfWeek));
@@ -199,7 +194,6 @@ namespace System.Globalization
         // if this calendar does not have leap month, or this year is not a leap year.
         //
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override int GetLeapMonth(int year, int era)
         {
             return (helper.GetLeapMonth(year, era));
index 07d85a4..6d09128 100644 (file)
@@ -1251,9 +1251,9 @@ namespace System.Globalization
             }
         }
 
-        internal override int GetYearInfo(int LunarYear, int Index)
+        internal override int GetYearInfo(int lunarYear, int index)
         {
-            if ((LunarYear < MIN_LUNISOLAR_YEAR) || (LunarYear > MAX_LUNISOLAR_YEAR))
+            if ((lunarYear < MIN_LUNISOLAR_YEAR) || (lunarYear > MAX_LUNISOLAR_YEAR))
             {
                 throw new ArgumentOutOfRangeException(
                             "year",
@@ -1264,7 +1264,7 @@ namespace System.Globalization
                                 MAX_LUNISOLAR_YEAR));
             }
             Contract.EndContractBlock();
-            return s_yinfo[LunarYear - MIN_LUNISOLAR_YEAR, Index];
+            return s_yinfo[lunarYear - MIN_LUNISOLAR_YEAR, index];
         }
 
         internal override int GetYear(int year, DateTime time)
index fc151fa..9e22a6f 100644 (file)
@@ -19,7 +19,6 @@ namespace System.Globalization {
     using System.Diagnostics;
     using System.Diagnostics.Contracts;
 
-    [System.Runtime.InteropServices.ComVisible(true)]
     [Serializable]
     public partial class SortKey
     {
index 72aa6d6..983179c 100644 (file)
@@ -5,7 +5,7 @@
 using System;
 using System.Diagnostics.Contracts;
 
-namespace System.Globalization 
+namespace System.Globalization
 {
     [Serializable]
     public sealed class SortVersion : IEquatable<SortVersion>
@@ -13,48 +13,48 @@ namespace System.Globalization
         private int _nlsVersion;
         private Guid _sortId;
 
-        public int FullVersion 
+        public int FullVersion
         {
-            get 
+            get
             {
                 return _nlsVersion;
             }
         }
 
-        public Guid SortId 
+        public Guid SortId
         {
-            get 
+            get
             {
                 return _sortId;
             }
         }
 
-        public SortVersion(int fullVersion, Guid sortId) 
-        {           
+        public SortVersion(int fullVersion, Guid sortId)
+        {
             _sortId = sortId;
             _nlsVersion = fullVersion;
         }
 
-        internal SortVersion(int nlsVersion, int effectiveId, Guid customVersion) 
+        internal SortVersion(int nlsVersion, int effectiveId, Guid customVersion)
         {
             _nlsVersion = nlsVersion;
 
-            if (customVersion == Guid.Empty) 
+            if (customVersion == Guid.Empty)
             {
-                byte b1 = (byte) (effectiveId >> 24);
-                byte b2 = (byte) ((effectiveId  & 0x00FF0000) >> 16);
-                byte b3 = (byte) ((effectiveId  & 0x0000FF00) >> 8);
-                byte b4 = (byte) (effectiveId  & 0xFF);
-                customVersion = new Guid(0,0,0,0,0,0,0,b1,b2,b3,b4);
+                byte b1 = (byte)(effectiveId >> 24);
+                byte b2 = (byte)((effectiveId & 0x00FF0000) >> 16);
+                byte b3 = (byte)((effectiveId & 0x0000FF00) >> 8);
+                byte b4 = (byte)(effectiveId & 0xFF);
+                customVersion = new Guid(0, 0, 0, 0, 0, 0, 0, b1, b2, b3, b4);
             }
 
             _sortId = customVersion;
         }
 
-        public override bool Equals(object obj) 
+        public override bool Equals(object obj)
         {
             SortVersion n = obj as SortVersion;
-            if (n != null) 
+            if (n != null)
             {
                 return this.Equals(n);
             }
@@ -62,9 +62,9 @@ namespace System.Globalization
             return false;
         }
 
-        public bool Equals(SortVersion other) 
+        public bool Equals(SortVersion other)
         {
-            if (other == null) 
+            if (other == null)
             {
                 return false;
             }
@@ -72,19 +72,19 @@ namespace System.Globalization
             return _nlsVersion == other._nlsVersion && _sortId == other._sortId;
         }
 
-        public override int GetHashCode() 
-        { 
-            return _nlsVersion * 7 | _sortId.GetHashCode(); 
+        public override int GetHashCode()
+        {
+            return _nlsVersion * 7 | _sortId.GetHashCode();
         }
 
-        public static bool operator ==(SortVersion left, SortVersion right) 
+        public static bool operator ==(SortVersion left, SortVersion right)
         {
-            if (((object) left) != null) 
+            if (((object)left) != null)
             {
                 return left.Equals(right);
             }
 
-            if (((object) right) != null) 
+            if (((object)right) != null)
             {
                 return right.Equals(left);
             }
@@ -93,7 +93,7 @@ namespace System.Globalization
             return true;
         }
 
-        public static bool operator !=(SortVersion left, SortVersion right) 
+        public static bool operator !=(SortVersion left, SortVersion right)
         {
             return !(left == right);
         }
index 7558002..f1dd305 100644 (file)
@@ -20,7 +20,6 @@ using System.Runtime.Serialization;
 namespace System.Globalization
 {
     [Serializable]
-    [System.Runtime.InteropServices.ComVisible(true)]
     public class StringInfo
     {
         [OptionalField(VersionAdded = 2)] 
@@ -53,7 +52,6 @@ namespace System.Globalization
             }
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override bool Equals(Object value)
         {
             StringInfo that = value as StringInfo;
@@ -64,7 +62,6 @@ namespace System.Globalization
             return (false);
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override int GetHashCode()
         {
             return _str.GetHashCode();
index 36edd5b..2e735e0 100644 (file)
@@ -22,7 +22,6 @@ namespace System.Globalization
     ============================================================================*/
 
     [Serializable]
-    [System.Runtime.InteropServices.ComVisible(true)]
     public class TaiwanCalendar : Calendar
     {
         //
@@ -65,7 +64,6 @@ namespace System.Globalization
         internal static readonly DateTime calendarMinValue = new DateTime(1912, 1, 1);
 
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override DateTime MinSupportedDateTime
         {
             get
@@ -74,7 +72,6 @@ namespace System.Globalization
             }
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override DateTime MaxSupportedDateTime
         {
             get
@@ -83,7 +80,6 @@ namespace System.Globalization
             }
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override CalendarAlgorithmType AlgorithmType
         {
             get
@@ -166,7 +162,6 @@ namespace System.Globalization
 
 
         [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
         {
             return (helper.GetWeekOfYear(time, rule, firstDayOfWeek));
@@ -205,7 +200,6 @@ namespace System.Globalization
         // if this calendar does not have leap month, or this year is not a leap year.
         //
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override int GetLeapMonth(int year, int era)
         {
             return (helper.GetLeapMonth(year, era));
index 42b7f24..1f75ac9 100644 (file)
@@ -264,9 +264,9 @@ namespace System.Globalization
             }
         }
 
-        internal override int GetYearInfo(int LunarYear, int Index)
+        internal override int GetYearInfo(int lunarYear, int index)
         {
-            if ((LunarYear < MIN_LUNISOLAR_YEAR) || (LunarYear > MAX_LUNISOLAR_YEAR))
+            if ((lunarYear < MIN_LUNISOLAR_YEAR) || (lunarYear > MAX_LUNISOLAR_YEAR))
             {
                 throw new ArgumentOutOfRangeException(
                             "year",
@@ -278,7 +278,7 @@ namespace System.Globalization
             }
             Contract.EndContractBlock();
 
-            return s_yinfo[LunarYear - MIN_LUNISOLAR_YEAR, Index];
+            return s_yinfo[lunarYear - MIN_LUNISOLAR_YEAR, index];
         }
 
         internal override int GetYear(int year, DateTime time)
index c0ffc65..464897b 100644 (file)
@@ -21,7 +21,6 @@ namespace System.Globalization
     //
 
     [Serializable]
-    [System.Runtime.InteropServices.ComVisible(true)]
     public class TextElementEnumerator : IEnumerator
     {
         private String _str;
index 5bb376f..172bbd2 100644 (file)
@@ -188,7 +188,6 @@ namespace System.Globalization
             }
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public int LCID 
         {
             get 
@@ -220,7 +219,6 @@ namespace System.Globalization
         //  Detect if the object is readonly.
         //
         ////////////////////////////////////////////////////////////////////////
-        [System.Runtime.InteropServices.ComVisible(false)]
         public bool IsReadOnly
         {
             get { return (_isReadOnly); }
@@ -248,7 +246,6 @@ namespace System.Globalization
         //  readonly.
         //
         ////////////////////////////////////////////////////////////////////////
-        [System.Runtime.InteropServices.ComVisible(false)]
         public static TextInfo ReadOnly(TextInfo textInfo)
         {
             if (textInfo == null) { throw new ArgumentNullException(nameof(textInfo)); }
index 8ebbfa0..9e6e304 100644 (file)
@@ -21,7 +21,6 @@ namespace System.Globalization
     ============================================================================*/
 
     [Serializable]
-    [System.Runtime.InteropServices.ComVisible(true)]
     public class ThaiBuddhistCalendar : Calendar
     {
         // Initialize our era info.
@@ -38,7 +37,6 @@ namespace System.Globalization
         internal GregorianCalendarHelper helper;
 
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override DateTime MinSupportedDateTime
         {
             get
@@ -47,7 +45,6 @@ namespace System.Globalization
             }
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override DateTime MaxSupportedDateTime
         {
             get
@@ -56,7 +53,6 @@ namespace System.Globalization
             }
         }
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override CalendarAlgorithmType AlgorithmType
         {
             get
@@ -128,7 +124,6 @@ namespace System.Globalization
 
 
         [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
         {
             return (helper.GetWeekOfYear(time, rule, firstDayOfWeek));
@@ -167,7 +162,6 @@ namespace System.Globalization
         // if this calendar does not have leap month, or this year is not a leap year.
         //
 
-        [System.Runtime.InteropServices.ComVisible(false)]
         public override int GetLeapMonth(int year, int era)
         {
             return (helper.GetLeapMonth(year, era));
index 997c5f2..7b47d9c 100644 (file)
@@ -41,7 +41,7 @@ namespace System.Globalization
 
         private static DateMapping[] InitDateMapping()
         {
-            short[] rawData = new short[] 
+            short[] rawData = new short[]
             {
                 //These data is taken from Tables/Excel/UmAlQura.xls please make sure that the two places are in sync
                 /*  DaysPerM     GY      GM     GD     D1   D2   D3   D4   D5   D6   D7   D8   D9   D10  D11  D12    
diff --git a/src/coreclr/src/mscorlib/corefx/System/IO/FileStream.NetStandard17.cs b/src/coreclr/src/mscorlib/corefx/System/IO/FileStream.NetStandard17.cs
deleted file mode 100644 (file)
index dc1385f..0000000
+++ /dev/null
@@ -1,76 +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 Microsoft.Win32.SafeHandles;
-using System.Threading.Tasks;
-using System.Diagnostics;
-using System.Threading;
-
-namespace System.IO
-{
-    public partial class FileStream : Stream
-    {
-        public override IAsyncResult BeginRead(byte[] array, int offset, int numBytes, AsyncCallback callback, object state)
-        {
-            if (array == null)
-                throw new ArgumentNullException(nameof(array));
-            if (offset < 0)
-                throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
-            if (numBytes < 0)
-                throw new ArgumentOutOfRangeException(nameof(numBytes), SR.ArgumentOutOfRange_NeedNonNegNum);
-            if (array.Length - offset < numBytes)
-                throw new ArgumentException(SR.Argument_InvalidOffLen);
-
-            if (IsClosed) throw new ObjectDisposedException(SR.ObjectDisposed_FileClosed);
-            if (!CanRead) throw new NotSupportedException(SR.NotSupported_UnreadableStream);
-
-            if (!IsAsync)
-                return base.BeginRead(array, offset, numBytes, callback, state);
-            else
-                return TaskToApm.Begin(ReadAsyncInternal(array, offset, numBytes, CancellationToken.None), callback, state);
-        }
-
-        public override IAsyncResult BeginWrite(byte[] array, int offset, int numBytes, AsyncCallback callback, object state)
-        {
-            if (array == null)
-                throw new ArgumentNullException(nameof(array));
-            if (offset < 0)
-                throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
-            if (numBytes < 0)
-                throw new ArgumentOutOfRangeException(nameof(numBytes), SR.ArgumentOutOfRange_NeedNonNegNum);
-            if (array.Length - offset < numBytes)
-                throw new ArgumentException(SR.Argument_InvalidOffLen);
-
-            if (IsClosed) throw new ObjectDisposedException(SR.ObjectDisposed_FileClosed);
-            if (!CanWrite) throw new NotSupportedException(SR.NotSupported_UnwritableStream);
-
-            if (!IsAsync)
-                return base.BeginWrite(array, offset, numBytes, callback, state);
-            else
-                return TaskToApm.Begin(WriteAsyncInternal(array, offset, numBytes, CancellationToken.None), callback, state);
-        }
-
-        public override int EndRead(IAsyncResult asyncResult)
-        {
-            if (asyncResult == null)
-                throw new ArgumentNullException(nameof(asyncResult));
-
-            if (!IsAsync)
-                return base.EndRead(asyncResult);
-            else
-                return TaskToApm.End<int>(asyncResult);
-        }
-
-        public override void EndWrite(IAsyncResult asyncResult)
-        {
-            if (asyncResult == null)
-                throw new ArgumentNullException(nameof(asyncResult));
-
-            if (!IsAsync)
-                base.EndWrite(asyncResult);
-            else
-                TaskToApm.End(asyncResult);
-        }
-    }
-}
index 398f5a6..7db8518 100644 (file)
@@ -139,20 +139,6 @@ namespace System.IO
             this(path, mode, access, share, bufferSize, useAsync ? FileOptions.Asynchronous : FileOptions.None)
         { }
 
-        internal FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options, string msgPath, bool bFromProxy)
-            : this(path, mode, access, share, bufferSize, options, msgPath, bFromProxy, useLongPath: false)
-        {
-        }
-
-        internal FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options, string msgPath, bool bFromProxy, bool useLongPath)
-            : this(path, mode, access, share, bufferSize, options)
-        {
-            // msgPath is the path that is handed back to untrusted code, CoreCLR is always full trust
-            // bFromProxy is also related to asserting rights for limited trust and also can be ignored
-            // useLongPath was used to get around the legacy MaxPath check, this is no longer applicable as everything supports long paths
-            // checkHost is also related to limited trust scenarios
-        }
-
         public FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options)
         {
             if (path == null)
@@ -225,24 +211,6 @@ namespace System.IO
             return handle.IsAsync.HasValue ? handle.IsAsync.Value : false;
         }
 
-        // InternalOpen, InternalCreate, and InternalAppend:
-        // Factory methods for FileStream used by File, FileInfo, and ReadLinesIterator
-        // Specifies default access and sharing options for FileStreams created by those classes
-        internal static FileStream InternalOpen(string path, int bufferSize = DefaultBufferSize, bool useAsync = DefaultIsAsync)
-        {
-            return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize, useAsync);
-        }
-
-        internal static FileStream InternalCreate(string path, int bufferSize = DefaultBufferSize, bool useAsync = DefaultIsAsync)
-        {
-            return new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, bufferSize, useAsync);
-        }
-
-        internal static FileStream InternalAppend(string path, int bufferSize = DefaultBufferSize, bool useAsync = DefaultIsAsync)
-        {
-            return new FileStream(path, FileMode.Append, FileAccess.Write, FileShare.Read, bufferSize, useAsync);
-        }
-
         [Obsolete("This property has been deprecated.  Please use FileStream's SafeFileHandle property instead.  http://go.microsoft.com/fwlink/?linkid=14202")]
         public virtual IntPtr Handle { get { return SafeFileHandle.DangerousGetHandle(); } }
 
@@ -650,5 +618,67 @@ namespace System.IO
             // on Dispose(false) call.
             Dispose(false);
         }
+
+        public override IAsyncResult BeginRead(byte[] array, int offset, int numBytes, AsyncCallback callback, object state)
+        {
+            if (array == null)
+                throw new ArgumentNullException(nameof(array));
+            if (offset < 0)
+                throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
+            if (numBytes < 0)
+                throw new ArgumentOutOfRangeException(nameof(numBytes), SR.ArgumentOutOfRange_NeedNonNegNum);
+            if (array.Length - offset < numBytes)
+                throw new ArgumentException(SR.Argument_InvalidOffLen);
+
+            if (IsClosed) throw new ObjectDisposedException(SR.ObjectDisposed_FileClosed);
+            if (!CanRead) throw new NotSupportedException(SR.NotSupported_UnreadableStream);
+
+            if (!IsAsync)
+                return base.BeginRead(array, offset, numBytes, callback, state);
+            else
+                return TaskToApm.Begin(ReadAsyncInternal(array, offset, numBytes, CancellationToken.None), callback, state);
+        }
+
+        public override IAsyncResult BeginWrite(byte[] array, int offset, int numBytes, AsyncCallback callback, object state)
+        {
+            if (array == null)
+                throw new ArgumentNullException(nameof(array));
+            if (offset < 0)
+                throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
+            if (numBytes < 0)
+                throw new ArgumentOutOfRangeException(nameof(numBytes), SR.ArgumentOutOfRange_NeedNonNegNum);
+            if (array.Length - offset < numBytes)
+                throw new ArgumentException(SR.Argument_InvalidOffLen);
+
+            if (IsClosed) throw new ObjectDisposedException(SR.ObjectDisposed_FileClosed);
+            if (!CanWrite) throw new NotSupportedException(SR.NotSupported_UnwritableStream);
+
+            if (!IsAsync)
+                return base.BeginWrite(array, offset, numBytes, callback, state);
+            else
+                return TaskToApm.Begin(WriteAsyncInternal(array, offset, numBytes, CancellationToken.None), callback, state);
+        }
+
+        public override int EndRead(IAsyncResult asyncResult)
+        {
+            if (asyncResult == null)
+                throw new ArgumentNullException(nameof(asyncResult));
+
+            if (!IsAsync)
+                return base.EndRead(asyncResult);
+            else
+                return TaskToApm.End<int>(asyncResult);
+        }
+
+        public override void EndWrite(IAsyncResult asyncResult)
+        {
+            if (asyncResult == null)
+                throw new ArgumentNullException(nameof(asyncResult));
+
+            if (!IsAsync)
+                base.EndWrite(asyncResult);
+            else
+                TaskToApm.End(asyncResult);
+        }
     }
 }
index 9688e28..32156e3 100644 (file)
   </ItemGroup>
   <ItemGroup>
     <FileStreamSources Include="$(CoreFxSourcesRoot)\System\IO\FileStream.cs" />
-    <FileStreamSources Include="$(CoreFxSourcesRoot)\System\IO\FileStream.NetStandard17.cs" />
     <FileStreamSources Include="$(CoreFxSourcesRoot)\System\IO\Error.cs" />
   </ItemGroup>
   <ItemGroup Condition="'$(TargetsUnix)' == 'true'">
index 0adf822..b5464d7 100644 (file)
@@ -88,7 +88,7 @@ namespace System.IO
         {
             byte[] bytes;
             using(FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 
-                FileStream.DefaultBufferSize, FileOptions.None, Path.GetFileName(path), false, false)) {
+                FileStream.DefaultBufferSize, FileOptions.None)) {
                 // Do a blocking read
                 int index = 0;
                 long fileLength = fs.Length;
index 708db08..b96c9ee 100644 (file)
@@ -188,7 +188,7 @@ namespace System.IO
                 throw new ArgumentOutOfRangeException(nameof(bufferSize), Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
             Contract.EndContractBlock();
 
-            Stream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, DefaultFileStreamBufferSize, FileOptions.SequentialScan, Path.GetFileName(path), false, false);
+            Stream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, DefaultFileStreamBufferSize, FileOptions.SequentialScan);
             Init(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, false);
         }
         
index 0bde286..a03f4d8 100644 (file)
@@ -112,7 +112,7 @@ namespace System.Resources {
         public ResourceReader(String fileName)
         {
             _resCache = new Dictionary<String, ResourceLocator>(FastResourceComparer.Default);
-            _store = new BinaryReader(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read, DefaultFileStreamBufferSize, FileOptions.RandomAccess, Path.GetFileName(fileName), false), Encoding.UTF8);
+            _store = new BinaryReader(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read, DefaultFileStreamBufferSize, FileOptions.RandomAccess), Encoding.UTF8);
             BCLDebug.Log("RESMGRFILEFORMAT", "ResourceReader .ctor(String).  UnmanagedMemoryStream: "+(_ums!=null));
 
             try {