[corlib] corcompare update
authorMarek Safar <marek.safar@gmail.com>
Mon, 25 Aug 2014 11:08:12 +0000 (13:08 +0200)
committerMarek Safar <marek.safar@gmail.com>
Mon, 25 Aug 2014 11:12:42 +0000 (13:12 +0200)
14 files changed:
mcs/class/corlib/System.IO/UnmanagedMemoryStream.cs
mcs/class/corlib/System.Reflection/ParameterInfo.cs
mcs/class/corlib/System.Runtime.InteropServices.WindowsRuntime/InterfaceImplementedInVersionAttribute.cs
mcs/class/corlib/System.Runtime.Serialization/FormatterServices.cs
mcs/class/corlib/System.Runtime.Versioning/CompatibilitySwitch.cs [new file with mode: 0644]
mcs/class/corlib/System.Runtime/GCSettings.cs
mcs/class/corlib/System.Security.Claims/AuthenticationTypes.cs [deleted file]
mcs/class/corlib/System.Security.Claims/ClaimTypes.cs
mcs/class/corlib/System.Security.Principal/GenericIdentity.cs
mcs/class/corlib/System.Security.Principal/GenericPrincipal.cs
mcs/class/corlib/System.Security.Principal/WindowsIdentity.cs
mcs/class/corlib/System.Security.Principal/WindowsPrincipal.cs
mcs/class/corlib/System.Threading/Volatile.cs
mcs/class/corlib/corlib.dll.sources

index 4083e35d73b7df5f386cbbdeac9177dec5e23208..3c5bf402f1c0d4b0af3b99b63162d9e0ee925627 100644 (file)
 using System;
 using System.IO;
 using System.Runtime.InteropServices;
+#if NET_4_5
+using System.Threading;
+using System.Threading.Tasks;
+#endif
 
 namespace System.IO
 {
@@ -48,6 +52,9 @@ namespace System.IO
 #if NET_4_0
                SafeBuffer safebuffer;
 #endif
+#if NET_4_5
+               Task<int> read_task;
+#endif
                
                internal event EventHandler Closed;
                
@@ -209,6 +216,36 @@ namespace System.IO
                        return progress;
                }
 
+#if NET_4_5
+               public override Task<int> ReadAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
+               {
+                       if (buffer == null)
+                               throw new ArgumentNullException("buffer");
+                       if (offset < 0)
+                               throw new ArgumentOutOfRangeException("offset", "Non-negative number required.");
+                       if (count < 0)
+                               throw new ArgumentOutOfRangeException("count", "Non-negative number required.");
+                       if ((buffer.Length - offset) < count)
+                               throw new ArgumentException("The length of the buffer array minus the offset parameter is less than the count parameter");
+
+                       if (cancellationToken.IsCancellationRequested)
+                               return TaskConstants<int>.Canceled;
+
+                       try {
+                               count = Read (buffer, offset, count);
+
+                               // Try not to allocate a new task for every buffer read
+                               if (read_task == null || read_task.Result != count)
+                                       read_task = Task<int>.FromResult (count);
+
+                               return read_task;
+                       } catch (Exception ex) {
+                               return Task<int>.FromException (ex);
+                       }
+               }
+
+#endif
+
                public override int ReadByte ()
                {
                        if (closed)
@@ -293,6 +330,21 @@ namespace System.IO
                        //This method performs no action for this class
                        //but is included as part of the Stream base class
                }
+
+#if NET_4_5
+               public override Task FlushAsync (CancellationToken cancellationToken)
+               {
+                       if (cancellationToken.IsCancellationRequested)
+                               return TaskConstants.Canceled;
+
+                       try {
+                               Flush ();
+                               return TaskConstants.Finished;
+                       } catch (Exception ex) {
+                               return Task<object>.FromException (ex);
+                       }
+               }
+#endif 
                 
                protected override void Dispose (bool disposing)
                {
@@ -349,6 +401,32 @@ namespace System.IO
                        if (current_position > length)
                                length = current_position;
                }
+
+#if NET_4_5
+               public override Task WriteAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
+               {
+                       if (buffer == null)
+                               throw new ArgumentNullException("The buffer parameter is a null reference");
+                       if (offset < 0)
+                               throw new ArgumentOutOfRangeException("offset", "Non-negative number required.");
+                       if (count < 0)
+                               throw new ArgumentOutOfRangeException("count", "Non-negative number required.");
+                       if ((buffer.Length - offset) < count)
+                               throw new ArgumentException("The length of the buffer array minus the offset parameter is less than the count parameter");
+                       if (current_position > capacity - count)
+                               throw new NotSupportedException ("Unable to expand length of this stream beyond its capacity.");
+
+                       if (cancellationToken.IsCancellationRequested)
+                               return TaskConstants.Canceled;
+
+                       try {
+                               Write (buffer, offset, count);
+                               return TaskConstants.Finished;
+                       } catch (Exception ex) {
+                               return Task<object>.FromException (ex);
+                       }
+               }
+#endif
                
                public override void WriteByte (byte value)
                {
index 1c00fb96c10c03d9dd71430504032ae5f5f9a075..466ae0f70b5228fa0f2ecfc0ab1f58e1d27b4372 100644 (file)
@@ -35,6 +35,7 @@ using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using System.Collections.Generic;
 using System.Text;
+using System.Runtime.Serialization;
 
 namespace System.Reflection
 {
@@ -43,12 +44,16 @@ namespace System.Reflection
        [Serializable]
        [ClassInterfaceAttribute (ClassInterfaceType.None)]
        [StructLayout (LayoutKind.Sequential)]
-#if MOBILE
-       public partial class ParameterInfo : ICustomAttributeProvider {
-#else
-       public partial class ParameterInfo : ICustomAttributeProvider, _ParameterInfo {
+       public partial class ParameterInfo : ICustomAttributeProvider
+
+#if !MOBILE
+       , _ParameterInfo
 #endif
 
+#if NET_4_0
+       , IObjectReference
+#endif
+       {
                protected Type ClassImpl;
                protected object DefaultValueImpl;
                protected MemberInfo MemberImpl;
@@ -245,6 +250,11 @@ namespace System.Reflection
                        return new object [0];
                }
 
+               public object GetRealObject (StreamingContext context)
+               {
+                       throw new NotImplementedException ();
+               }               
+
                public virtual bool IsDefined( Type attributeType, bool inherit) {
                        return false;
                }
index 995019325e21348f613689394333d06df6ce844a..c2e45b40c183704cecd7fdffeb2287186c6eaa17 100644 (file)
@@ -1,4 +1,3 @@
-#if NET_4_5
 //
 // InterfaceImplementedInVersionAttribute.cs
 //
 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
-using System;
+
+#if NET_4_5
 using System.Runtime.CompilerServices;
 
 namespace System.Runtime.InteropServices.WindowsRuntime
 {
-       [AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
+       [AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
        public sealed class InterfaceImplementedInVersionAttribute : Attribute
        {
                public InterfaceImplementedInVersionAttribute (Type interfaceType, byte majorVersion, byte minorVersion,
index 032ab2e5f2716fe39ffb204dd6e59c20b85cfb9e..f8171915a41777a68a75bd7027d496b839a12894 100644 (file)
@@ -40,16 +40,23 @@ using System.Globalization;
 namespace System.Runtime.Serialization
 {
        [System.Runtime.InteropServices.ComVisibleAttribute (true)]
-       public sealed class FormatterServices
+#if NET_4_5
+       static
+#else
+       sealed
+#endif
+       public class FormatterServices
        {
                private const BindingFlags fieldFlags = BindingFlags.Public |
                                                        BindingFlags.Instance |
                                                        BindingFlags.NonPublic |
                                                        BindingFlags.DeclaredOnly;
 
+#if !NET_4_5
                private FormatterServices ()
                {
                }
+#endif
 
                public static object [] GetObjectData (object obj, MemberInfo [] members)
                {
diff --git a/mcs/class/corlib/System.Runtime.Versioning/CompatibilitySwitch.cs b/mcs/class/corlib/System.Runtime.Versioning/CompatibilitySwitch.cs
new file mode 100644 (file)
index 0000000..15b61d7
--- /dev/null
@@ -0,0 +1,46 @@
+//
+// CompatibilitySwitch.cs
+//
+// Authors:
+//  Marek Safar (marek.safar@gmail.com)
+//
+// Copyright 2014 Xamarin Inc
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_4_5
+
+namespace System.Runtime.Versioning {
+       public static class CompatibilitySwitch
+       {
+               public static bool IsEnabled (string compatibilitySwitchName)
+               {
+                       return false;
+               }
+
+               public static string GetValue (string compatibilitySwitchName)
+               {
+                       return null;
+               }
+       }
+}
+
+#endif
\ No newline at end of file
index dd7ce6a7e1315ce6b39019dfef931f99aca4fd76..7e65ffa2e826258dffd575d3cbba4be2d98d449f 100644 (file)
@@ -37,12 +37,21 @@ namespace System.Runtime
                        get { return false; }
                }
 
-               [MonoTODO ("Always returns GCLatencyMode.Interactive and ignores set (.NET 2.0 SP1 member)")]
+               [MonoTODO ("Always returns GCLatencyMode.Interactive and ignores set")]
                public static GCLatencyMode LatencyMode {
                        [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
                        get { return GCLatencyMode.Interactive; }
                        [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
                        set { ; }
                }
+
+#if NET_4_5
+               public static GCLargeObjectHeapCompactionMode LargeObjectHeapCompactionMode {
+                       [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
+                       get;
+                       [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
+                       set;
+               }
+#endif
        }
 }
diff --git a/mcs/class/corlib/System.Security.Claims/AuthenticationTypes.cs b/mcs/class/corlib/System.Security.Claims/AuthenticationTypes.cs
deleted file mode 100644 (file)
index 23472dc..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// Claim.cs
-//
-// Authors:
-//  Miguel de Icaza (miguel@xamarin.com)
-//
-// Copyright 2014 Xamarin Inc
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-
-namespace System.Security.Claims {
-
-       public static class AuthenticationTypes {
-               public const string Basic = "Basic";
-               public const string Federation = "Federation";
-               public const string Kerberos = "Kerberos";
-               public const string Negotiate = "Negotiate";
-               public const string Password = "Password";
-               public const string Signature = "Signature";
-               public const string Windows = "Windows";
-               public const string X509 = "X509";
-       }
-}
index e1fa6e36ecd7ee84141d23b499b82a34c687edc3..562c89d03be092a384c43fade6449a3ab52c4bd0 100644 (file)
@@ -44,29 +44,25 @@ namespace System.Security.Claims
 
                public const string AuthorizationDecision = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/authorizationdecision";
 
-               public const string ClaimsType2005Namespace = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims";
-
-               public const string ClaimsType2009Namespace = "http://schemas.xmlsoap.org/ws/2009/09/identity/claims";
-
-               public const string ClaimsTypeNamespace = "http://schemas.microsoft.com/ws/2008/06/identity/claims";
-
                public const string CookiePath = "http://schemas.microsoft.com/ws/2008/06/identity/claims/cookiepath";
 
                public const string Country = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/country";
 
                public const string DateOfBirth = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dateofbirth";
 
-               public const string DenyOnlyPrimaryGroup = "http://schemas.microsoft.com/ws/2008/06/identity/claims/denyonlyprimarygroup";
+               public const string DenyOnlyPrimaryGroupSid = "http://schemas.microsoft.com/ws/2008/06/identity/claims/denyonlyprimarygroupsid";
 
                public const string DenyOnlyPrimarySid = "http://schemas.microsoft.com/ws/2008/06/identity/claims/denyonlyprimarysid";
 
                public const string DenyOnlySid = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/denyonlysid";
 
+               public const string DenyOnlyWindowsDeviceGroup = "http://schemas.microsoft.com/ws/2008/06/identity/claims/denyonlywindowsdevicegroup";
+
                public const string Dns = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dns";
 
                public const string Dsa = "http://schemas.microsoft.com/ws/2008/06/identity/claims/dsa";
 
-               public const string Email = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/email";
+               public const string Email = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress";
 
                public const string Expiration = "http://schemas.microsoft.com/ws/2008/06/identity/claims/expiration";
 
@@ -96,8 +92,6 @@ namespace System.Security.Claims
 
                public const string PostalCode = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/postalcode";
 
-               public const string PPID = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier";
-
                public const string PrimaryGroupSid = "http://schemas.microsoft.com/ws/2008/06/identity/claims/primarygroupsid";
 
                public const string PrimarySid = "http://schemas.microsoft.com/ws/2008/06/identity/claims/primarysid";
@@ -134,6 +128,16 @@ namespace System.Security.Claims
 
                public const string WindowsAccountName = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname";
 
+               public const string WindowsDeviceClaim = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsdeviceclaim";
+
+               public const string WindowsDeviceGroup = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsdevicegroup";
+
+               public const string WindowsFqbnVersion = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsfqbnversion";
+
+               public const string WindowsSubAuthority = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowssubauthority";
+
+               public const string WindowsUserClaim = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsuserclaim";
+
                public const string X500DistinguishedName = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/x500distinguishedname";
        }
 }
index ad563de9cd346d9a12d9acc267544ba1b9c6be12..6bbf305af5bbf303188537c603a7da8dd6096097 100644 (file)
@@ -29,6 +29,7 @@
 //
 
 using System.Runtime.InteropServices;
+using System.Collections.Generic;
 #if NET_4_5
 using System.Security.Claims;
 #endif
@@ -70,6 +71,13 @@ namespace System.Security.Principal {
                {
                }
 
+#if NET_4_5
+               protected GenericIdentity (GenericIdentity identity)
+                       : base (identity)
+               {
+               }
+#endif
+
 #if NET_4_5
                override
 #else
@@ -102,5 +110,13 @@ namespace System.Security.Principal {
                                return (m_name.Length > 0);
                        }
                }
+
+#if NET_4_5
+               public override IEnumerable<Claim> Claims {
+                       get {
+                               return base.Claims;
+                       }
+               }
+#endif
        }
 }
index 5272ad727caa00fa6cff7c38e44e033301a829b6..3b8e8d4bd20e3cc1708f3b5aa2f36728035b4e56 100644 (file)
 //
 
 using System.Runtime.InteropServices;
+#if NET_4_5
+using System.Security.Claims;
+#endif
 
 namespace System.Security.Principal {
 
        [Serializable]
        [ComVisible (true)]
-       public class GenericPrincipal : IPrincipal {
+       public class GenericPrincipal :
+#if NET_4_5
+               ClaimsPrincipal
+#else
+               IPrincipal
+#endif
+       {
 
                // field names are serialization compatible with .net
                private IIdentity m_identity;
@@ -58,11 +67,21 @@ namespace System.Security.Principal {
                        get { return m_roles; }
                }
 
-               public virtual IIdentity Identity {
+#if NET_4_5
+               override
+#else
+               virtual
+#endif
+               public IIdentity Identity {
                        get { return m_identity; }
                }
 
-               public virtual bool IsInRole (string role)
+#if NET_4_5
+               override
+#else
+               virtual
+#endif
+               public bool IsInRole (string role)
                {
                        if (m_roles == null)
                                return false;
index 3599d6429ecf851435160fcbf4f791b9169d9f25..698583f9ead346f9e0c67135d1b09349c5cd1173 100644 (file)
@@ -52,6 +52,11 @@ namespace System.Security.Principal {
 
                static private IntPtr invalidWindows = IntPtr.Zero;
 
+#if NET_4_5
+               [NonSerialized]
+               public new const string DefaultIssuer = "AD AUTHORITY";
+#endif
+
                [SecurityPermission (SecurityAction.Demand, ControlPrincipal=true)]
                public WindowsIdentity (IntPtr userToken) 
                        : this (userToken, null, WindowsAccountType.Normal, false)
index 7d7842e0b9343d24e9d162a1ac1d573bd5317bf1..bbadfa47888745a1d9b3961d1302f5bdd6b6cf0d 100644 (file)
 using System.Collections;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
+#if NET_4_5
+using System.Security.Claims;
+#endif
 
 namespace System.Security.Principal {
 
        [Serializable]
        [ComVisible (true)]
-       public class WindowsPrincipal : IPrincipal {
-
+       public class WindowsPrincipal :
+#if NET_4_5
+               ClaimsPrincipal
+#else
+               IPrincipal
+#endif
+       {
                private WindowsIdentity _identity;
                // http://groups.google.ca/groups?q=WindowsPrincipal+m_roles&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=OghXf4OgCHA.4228%40tkmsftngp08&rnum=4
                private string [] m_roles;
@@ -53,8 +61,12 @@ namespace System.Security.Principal {
                }
 
                // properties
-
-               public virtual IIdentity Identity {
+#if NET_4_5
+               override
+#else
+               virtual
+#endif
+               public IIdentity Identity {
                        get { return _identity; }
                }
 
@@ -102,7 +114,12 @@ namespace System.Security.Principal {
                        }
                }
 
-               public virtual bool IsInRole (string role)
+#if NET_4_5
+               override
+#else
+               virtual
+#endif
+               public bool IsInRole (string role)
                {
                        if (role == null)
                                return false;   // ArgumentNullException
index 5e92c3c8e4109284792afa37297cefb1ad942ad7..92646ceee50fc429aa06c0cac5f1e158cad875bf 100644 (file)
@@ -91,6 +91,7 @@ namespace System.Threading
                public extern static float Read (ref float location);
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
+               [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
                public extern static T Read<T> (ref T location) where T : class;
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
@@ -151,6 +152,7 @@ namespace System.Threading
                public extern static void Write (ref float location, float value);
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
+               [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
                public extern static void Write<T>(ref T location, T value) where T : class;
        }
 }
index c221c70a628af299a062eec2dd733e1b0a65f528..2626ca0fa3e3a219d2a44cd9f38b0657aeecee1d 100644 (file)
@@ -1183,6 +1183,7 @@ System.Runtime.Serialization.Formatters.Binary/CodeGenerator.cs
 System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs
 System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs
 System.Runtime.Serialization.Formatters.Binary/MessageFormatter.cs
+System.Runtime.Versioning/CompatibilitySwitch.cs
 System.Runtime.Versioning/ComponentGuaranteesAttribute.cs
 System.Runtime.Versioning/ComponentGuaranteesOptions.cs
 System.Runtime.Versioning/ResourceConsumptionAttribute.cs