Remove CER metadata (dotnet/coreclr#9487)
authorDan Moseley <danmose@microsoft.com>
Fri, 10 Feb 2017 08:13:09 +0000 (00:13 -0800)
committerJan Kotas <jkotas@microsoft.com>
Fri, 10 Feb 2017 08:13:09 +0000 (00:13 -0800)
Commit migrated from https://github.com/dotnet/coreclr/commit/6d3dea27ecf6e6c35e6be76dc3132f14c3ef0d35

50 files changed:
src/coreclr/src/mscorlib/src/Internal/Runtime/Augments/RuntimeThread.cs
src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs
src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs
src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs
src/coreclr/src/mscorlib/src/Microsoft/Win32/UnsafeNativeMethods.cs
src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs
src/coreclr/src/mscorlib/src/System/AppDomain.cs
src/coreclr/src/mscorlib/src/System/Array.cs
src/coreclr/src/mscorlib/src/System/Buffer.cs
src/coreclr/src/mscorlib/src/System/Collections/Hashtable.cs
src/coreclr/src/mscorlib/src/System/Decimal.cs
src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs
src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs
src/coreclr/src/mscorlib/src/System/Double.cs
src/coreclr/src/mscorlib/src/System/Environment.cs
src/coreclr/src/mscorlib/src/System/GC.cs
src/coreclr/src/mscorlib/src/System/IntPtr.cs
src/coreclr/src/mscorlib/src/System/Math.cs
src/coreclr/src/mscorlib/src/System/MathF.cs
src/coreclr/src/mscorlib/src/System/Object.cs
src/coreclr/src/mscorlib/src/System/Reflection/ConstructorInfo.cs
src/coreclr/src/mscorlib/src/System/Reflection/EventInfo.cs
src/coreclr/src/mscorlib/src/System/Reflection/FieldInfo.cs
src/coreclr/src/mscorlib/src/System/Reflection/MethodInfo.cs
src/coreclr/src/mscorlib/src/System/Reflection/PropertyInfo.cs
src/coreclr/src/mscorlib/src/System/RtType.cs
src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs
src/coreclr/src/mscorlib/src/System/Runtime/ExceptionServices/ExceptionNotification.cs
src/coreclr/src/mscorlib/src/System/Runtime/GcSettings.cs
src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/CriticalHandle.cs
src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs
src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/SafeBuffer.cs
src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/SafeHandle.cs
src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeBufferHelper.cs
src/coreclr/src/mscorlib/src/System/Runtime/MemoryFailPoint.cs
src/coreclr/src/mscorlib/src/System/Runtime/Reliability/CriticalFinalizerObject.cs
src/coreclr/src/mscorlib/src/System/RuntimeHandles.cs
src/coreclr/src/mscorlib/src/System/SharedStatics.cs
src/coreclr/src/mscorlib/src/System/Single.cs
src/coreclr/src/mscorlib/src/System/String.Comparison.cs
src/coreclr/src/mscorlib/src/System/StubHelpers.cs
src/coreclr/src/mscorlib/src/System/Threading/Interlocked.cs
src/coreclr/src/mscorlib/src/System/Threading/Monitor.cs
src/coreclr/src/mscorlib/src/System/Threading/Mutex.cs
src/coreclr/src/mscorlib/src/System/Threading/SynchronizationContext.cs
src/coreclr/src/mscorlib/src/System/Threading/Thread.cs
src/coreclr/src/mscorlib/src/System/Threading/ThreadPool.cs
src/coreclr/src/mscorlib/src/System/Threading/Timer.cs
src/coreclr/src/mscorlib/src/System/Threading/Volatile.cs
src/coreclr/src/mscorlib/src/System/Threading/WaitHandle.cs

index 52d0e34..58eff98 100644 (file)
@@ -148,11 +148,9 @@ namespace Internal.Runtime.Augments
 #endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT
 
 #if FEATURE_COMINTEROP
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [MethodImpl(MethodImplOptions.InternalCall)]
         public extern void DisableComObjectEagerCleanup();
 #else // !FEATURE_COMINTEROP
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public void DisableComObjectEagerCleanup()
         {
             Debug.Assert(false); // the Thread class in CoreFX should have handled this case
index 6bf65b0..a1e5bc4 100644 (file)
@@ -29,7 +29,6 @@ namespace Microsoft.Win32.SafeHandles {
 
         [DllImport(Win32Native.ADVAPI32)]
         [SuppressUnmanagedCodeSecurity]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static extern int RegCloseKey(IntPtr hKey);
     }
 }
index caacc69..0ebcd5c 100644 (file)
@@ -30,7 +30,6 @@ namespace Microsoft.Win32.SafeHandles {
         {
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public SafeWaitHandle(IntPtr existingHandle, bool ownsHandle) : base(ownsHandle)
         {
             SetHandle(existingHandle);
index 3d9a9fa..6241813 100644 (file)
@@ -23,7 +23,6 @@ namespace Microsoft.Win32.SafeHandles
     // Class of safe handle which uses 0 or -1 as an invalid handle.
     public abstract class SafeHandleZeroOrMinusOneIsInvalid : SafeHandle
     {
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         protected SafeHandleZeroOrMinusOneIsInvalid(bool ownsHandle) : base(IntPtr.Zero, ownsHandle) 
         {
         }
@@ -42,7 +41,6 @@ namespace Microsoft.Win32.SafeHandles
     // Class of safe handle which uses only -1 as an invalid handle.
     public abstract class SafeHandleMinusOneIsInvalid : SafeHandle
     {
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         protected SafeHandleMinusOneIsInvalid(bool ownsHandle) : base(new IntPtr(-1), ownsHandle) 
         {
         }
@@ -61,7 +59,6 @@ namespace Microsoft.Win32.SafeHandles
     // Class of critical handle which uses 0 or -1 as an invalid handle.
     public abstract class CriticalHandleZeroOrMinusOneIsInvalid : CriticalHandle
     {
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         protected CriticalHandleZeroOrMinusOneIsInvalid() : base(IntPtr.Zero) 
         {
         }
@@ -74,7 +71,6 @@ namespace Microsoft.Win32.SafeHandles
     // Class of critical handle which uses only -1 as an invalid handle.
     public abstract class CriticalHandleMinusOneIsInvalid : CriticalHandle
     {
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         protected CriticalHandleMinusOneIsInvalid() : base(new IntPtr(-1)) 
         {
         }
index a86f790..6e37b9c 100644 (file)
@@ -58,7 +58,6 @@ namespace Microsoft.Win32 {
                 
         [DllImport(Win32Native.KERNEL32, CharSet=System.Runtime.InteropServices.CharSet.Unicode)]
         [return: MarshalAs(UnmanagedType.Bool)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static extern bool FreeLibrary(IntPtr hModule);
 
 
index 06bf82a..b081b16 100644 (file)
@@ -484,16 +484,13 @@ namespace Microsoft.Win32 {
         }
 
         [DllImport(KERNEL32, EntryPoint="LocalAlloc")]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         internal static extern IntPtr LocalAlloc_NoSafeHandle(int uFlags, UIntPtr sizetdwBytes);
 
         [DllImport(KERNEL32, SetLastError=true)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static extern IntPtr LocalFree(IntPtr handle);
 
         // MSDN says the length is a SIZE_T.
         [DllImport(NTDLL, EntryPoint = "RtlZeroMemory")]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static extern void ZeroMemory(IntPtr address, UIntPtr length);
 
         internal static bool GlobalMemoryStatusEx(ref MEMORYSTATUSEX buffer)
@@ -512,11 +509,9 @@ namespace Microsoft.Win32 {
         // the MemoryFailPoint implementation (within a CER) to increase the 
         // size of the page file, ignoring any host memory allocators.
         [DllImport(KERNEL32, SetLastError=true)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         unsafe internal static extern void * VirtualAlloc(void* address, UIntPtr numBytes, int commitOrReserve, int pageProtectionMode);
 
         [DllImport(KERNEL32, SetLastError=true)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         unsafe internal static extern bool VirtualFree(void* address, UIntPtr numBytes, int pageFreeMode);
 
         [DllImport(KERNEL32, CharSet=CharSet.Ansi, ExactSpelling=true, EntryPoint="lstrlenA")]
@@ -526,24 +521,19 @@ namespace Microsoft.Win32 {
         internal static extern int lstrlenW(IntPtr ptr);
 
         [DllImport(Win32Native.OLEAUT32, CharSet = CharSet.Unicode)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         internal static extern IntPtr SysAllocStringLen(String src, int len);  // BSTR
 
         [DllImport(Win32Native.OLEAUT32)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static extern uint SysStringLen(IntPtr bstr);
 
         [DllImport(Win32Native.OLEAUT32)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static extern void SysFreeString(IntPtr bstr);
 
 #if FEATURE_COMINTEROP
         [DllImport(Win32Native.OLEAUT32)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]            
         internal static extern IntPtr SysAllocStringByteLen(byte[] str, uint len);  // BSTR
 
         [DllImport(Win32Native.OLEAUT32)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static extern uint SysStringByteLen(IntPtr bstr);
 
 #endif
@@ -561,18 +551,15 @@ namespace Microsoft.Win32 {
         internal static extern SafeWaitHandle OpenEvent(/* DWORD */ int desiredAccess, bool inheritHandle, String name);
 
         [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]            
         internal static extern SafeWaitHandle CreateMutex(SECURITY_ATTRIBUTES lpSecurityAttributes, bool initialOwner, String name);
 
         [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
         internal static extern SafeWaitHandle OpenMutex(/* DWORD */ int desiredAccess, bool inheritHandle, String name);
   
         [DllImport(KERNEL32, SetLastError=true)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]            
         internal static extern bool ReleaseMutex(SafeWaitHandle handle);
 
         [DllImport(KERNEL32, SetLastError=true)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static extern bool CloseHandle(IntPtr handle);
 
         [DllImport(KERNEL32, SetLastError=true)]
@@ -582,7 +569,6 @@ namespace Microsoft.Win32 {
         internal static extern SafeWaitHandle CreateSemaphore(SECURITY_ATTRIBUTES lpSecurityAttributes, int initialCount, int maximumCount, String name);
 
         [DllImport(KERNEL32, SetLastError = true)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [return: MarshalAs(UnmanagedType.Bool)]
         internal static extern bool ReleaseSemaphore(SafeWaitHandle handle, int releaseCount, out int previousCount);
 
@@ -765,7 +751,6 @@ namespace Microsoft.Win32 {
                     WIN32_FIND_DATA lpFindFileData);
 
         [DllImport(KERNEL32)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static extern bool FindClose(IntPtr handle);
 
         [DllImport(KERNEL32, SetLastError = true, ExactSpelling = true)]
index e3d2b4b..c698739 100644 (file)
@@ -1407,14 +1407,12 @@ namespace System
 
         public Int32 Id
         {
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]  
             get {
                 return GetId();
             }
         }
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]              
         internal extern Int32 GetId();
 
     }
index 8694b5a..23989f3 100644 (file)
@@ -41,7 +41,6 @@ namespace System {
             return new ReadOnlyCollection<T>(array);
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static void Resize<T>(ref T[] array, int newSize) {
             if (newSize < 0)
                 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.newSize, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
@@ -225,7 +224,6 @@ namespace System {
         // Copies length elements from sourceArray, starting at index 0, to
         // destinationArray, starting at index 0.
         //
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Copy(Array sourceArray, Array destinationArray, int length)
         {
             if (sourceArray == null)
@@ -246,7 +244,6 @@ namespace System {
         // Copies length elements from sourceArray, starting at sourceIndex, to
         // destinationArray, starting at destinationIndex.
         //
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Copy(Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length) 
         {
             Copy(sourceArray, sourceIndex, destinationArray, destinationIndex, length, false);
@@ -256,7 +253,6 @@ namespace System {
         // instance & might fail when called from within a CER, or if the
         // reliable flag is true, it will either always succeed or always
         // throw an exception with no side effects.
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         internal static extern void Copy(Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length, bool reliable);
 
@@ -265,13 +261,11 @@ namespace System {
         // compatible array types based on the array element type - this 
         // method does not support casting, boxing, or primitive widening.
         // It will up-cast, assuming the array types are correct.
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static void ConstrainedCopy(Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length)
         {
             Copy(sourceArray, sourceIndex, destinationArray, destinationIndex, length, true);
         }
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Copy(Array sourceArray, Array destinationArray, long length)
         {
             if (length > Int32.MaxValue || length < Int32.MinValue)
@@ -280,7 +274,6 @@ namespace System {
             Array.Copy(sourceArray, destinationArray, (int) length);
         }
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Copy(Array sourceArray, long sourceIndex, Array destinationArray, long destinationIndex, long length)
         {
             if (sourceIndex > Int32.MaxValue || sourceIndex < Int32.MinValue)
@@ -298,7 +291,6 @@ namespace System {
         // at index.
         //
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static extern void Clear(Array array, int index, int length);
         
         // The various Get values...
@@ -534,12 +526,10 @@ namespace System {
 
         public extern int Length {
             [Pure]
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
             [MethodImpl(MethodImplOptions.InternalCall)]
             get;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         private static int GetMedian(int low, int hi) {
             // Note both may be negative, if we are dealing with arrays w/ negative lower bounds.
             Contract.Requires(low <= hi);
@@ -557,7 +547,6 @@ namespace System {
 
         public extern long LongLength {
             [Pure]
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
             [MethodImpl(MethodImplOptions.InternalCall)]
             get;
         }
@@ -574,22 +563,18 @@ namespace System {
 
         public extern int Rank {
             [Pure]
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
             [MethodImplAttribute(MethodImplOptions.InternalCall)]
             get;
         }
 
         [Pure]
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public extern int GetUpperBound(int dimension);
 
         [Pure]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         public extern int GetLowerBound(int dimension);
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         internal extern int GetDataPtrOffsetInternal();
 
@@ -756,7 +741,6 @@ namespace System {
         // is larger than the given search value.
         // 
         [Pure]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int BinarySearch(Array array, Object value) {
             if (array==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -780,7 +764,6 @@ namespace System {
         // is larger than the given search value.
         // 
         [Pure]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int BinarySearch(Array array, int index, int length, Object value) {
             return BinarySearch(array, index, length, value, null);
         }
@@ -800,7 +783,6 @@ namespace System {
         // is larger than the given search value.
         // 
         [Pure]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int BinarySearch(Array array, Object value, IComparer comparer) {
             if (array==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -825,7 +807,6 @@ namespace System {
         // is larger than the given search value.
         // 
         [Pure]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int BinarySearch(Array array, int index, int length, Object value, IComparer comparer) {
             if (array==null) 
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -896,11 +877,9 @@ namespace System {
         }
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         private static extern bool TrySZBinarySearch(Array sourceArray, int sourceIndex, int count, Object value, out int retVal);
         
         [Pure]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int BinarySearch<T>(T[] array, T value) {
             if (array==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -909,7 +888,6 @@ namespace System {
         }
 
         [Pure]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int BinarySearch<T>(T[] array, T value, System.Collections.Generic.IComparer<T> comparer) {
             if (array==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -918,13 +896,11 @@ namespace System {
         }
 
         [Pure]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int BinarySearch<T>(T[] array, int index, int length, T value) {
             return BinarySearch<T>(array, index, length, value, null);
         }
 
         [Pure]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int BinarySearch<T>(T[] array, int index, int length, T value, System.Collections.Generic.IComparer<T> comparer) {
             if (array==null) 
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -987,7 +963,6 @@ namespace System {
         }
 
         [Pure]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static T[] Empty<T>()
         {
             Contract.Ensures(Contract.Result<T[]>() != null);
@@ -1225,7 +1200,6 @@ namespace System {
         // The array is searched forwards, and the elements of the array are
         // compared to the given value using the Object.Equals method.
         // 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int IndexOf(Array array, Object value) {
             if (array==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -1241,7 +1215,6 @@ namespace System {
         // elements of the array are compared to the given value using the
         // Object.Equals method.
         // 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int IndexOf(Array array, Object value, int startIndex) {
             if (array==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -1257,7 +1230,6 @@ namespace System {
         // elements of the array are compared to the given value using the
         // Object.Equals method.
         // 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int IndexOf(Array array, Object value, int startIndex, int count) {
             if (array==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -1352,7 +1324,6 @@ namespace System {
         }
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         private static extern bool TrySZIndexOf(Array sourceArray, int sourceIndex, int count, Object value, out int retVal);
         
 
@@ -1360,7 +1331,6 @@ namespace System {
         // The array is searched backwards, and the elements of the array are
         // compared to the given value using the Object.Equals method.
         // 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int LastIndexOf(Array array, Object value) {
             if (array==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -1375,7 +1345,6 @@ namespace System {
         // startIndex and ending at index 0. The elements of the array are
         // compared to the given value using the Object.Equals method.
         // 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int LastIndexOf(Array array, Object value, int startIndex) {
             if (array == null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -1391,7 +1360,6 @@ namespace System {
         // the array are compared to the given value using the Object.Equals
         // method.
         // 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int LastIndexOf(Array array, Object value, int startIndex, int count) {
             if (array==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -1503,7 +1471,6 @@ namespace System {
         }
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         private static extern bool TrySZLastIndexOf(Array sourceArray, int sourceIndex, int count, Object value, out int retVal);
 
 
@@ -1512,7 +1479,6 @@ namespace System {
         // located at index length - i - 1, where length is the
         // length of the array.
         // 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Reverse(Array array) {
             if (array==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -1526,7 +1492,6 @@ namespace System {
         // index index + (index + count - i - 1).
         // Reliability note: This may fail because it may have to box objects.
         // 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Reverse(Array array, int index, int length) {
             if (array==null) 
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -1570,10 +1535,8 @@ namespace System {
         }
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         private static extern bool TrySZReverse(Array array, int index, int count);
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Reverse<T>(T[] array)
         {
             if (array == null)
@@ -1582,7 +1545,6 @@ namespace System {
             Reverse(array, 0, array.Length);
         }
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Reverse<T>(T[] array, int index, int length)
         {
             if (array == null)
@@ -1611,7 +1573,6 @@ namespace System {
         // other using the IComparable interface, which must be implemented
         // by all elements of the array.
         // 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Sort(Array array) {
             if (array==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -1625,7 +1586,6 @@ namespace System {
         // keys to each other using the IComparable interface, which must be
         // implemented by all elements of the keys array.
         // 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Sort(Array keys, Array items) {
             if (keys==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.keys);
@@ -1637,7 +1597,6 @@ namespace System {
         // elements to each other using the IComparable interface, which
         // must be implemented by all elements in the given section of the array.
         // 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Sort(Array array, int index, int length) {
             Sort(array, null, index, length, null);
         }
@@ -1648,7 +1607,6 @@ namespace System {
         // keys to each other using the IComparable interface, which must be
         // implemented by all elements of the keys array.
         // 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Sort(Array keys, Array items, int index, int length) {
             Sort(keys, items, index, length, null);
         }
@@ -1659,7 +1617,6 @@ namespace System {
         // IComparable interface, which in that case must be implemented by
         // all elements of the array.
         // 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Sort(Array array, IComparer comparer) {
             if (array==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -1675,7 +1632,6 @@ namespace System {
         // the IComparable interface, which in that case must be implemented
         // by all elements of the keys array.
         // 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Sort(Array keys, Array items, IComparer comparer) {
             if (keys==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.keys);
@@ -1689,7 +1645,6 @@ namespace System {
         // the IComparable interface, which in that case must be implemented
         // by all elements in the given section of the array.
         // 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Sort(Array array, int index, int length, IComparer comparer) {
             Sort(array, null, index, length, comparer);
         }
@@ -1702,7 +1657,6 @@ namespace System {
         // the IComparable interface, which in that case must be implemented
         // by all elements of the given section of the keys array.
         // 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Sort(Array keys, Array items, int index, int length, IComparer comparer) {
             if (keys==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.keys);
@@ -1744,10 +1698,8 @@ namespace System {
         }
         
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         private static extern bool TrySZSort(Array keys, Array items, int left, int right);
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Sort<T>(T[] array) {
             if (array==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -1755,7 +1707,6 @@ namespace System {
             Sort<T>(array, 0, array.Length, null);
         }
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Sort<TKey, TValue>(TKey[] keys, TValue[] items) {
             if (keys==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.keys);
@@ -1763,17 +1714,14 @@ namespace System {
             Sort<TKey, TValue>(keys, items, 0, keys.Length, null);
         }
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Sort<T>(T[] array, int index, int length) {
             Sort<T>(array, index, length, null);
         }
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Sort<TKey, TValue>(TKey[] keys, TValue[] items, int index, int length) {
             Sort<TKey, TValue>(keys, items, index, length, null);
         }
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Sort<T>(T[] array, System.Collections.Generic.IComparer<T> comparer) {
             if (array == null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -1781,7 +1729,6 @@ namespace System {
             Sort<T>(array, 0, array.Length, comparer);
         }
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Sort<TKey, TValue>(TKey[] keys, TValue[] items, System.Collections.Generic.IComparer<TKey> comparer) {
             if (keys==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.keys);
@@ -1789,7 +1736,6 @@ namespace System {
             Sort<TKey, TValue>(keys, items, 0, keys.Length, comparer);
         }
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Sort<T>(T[] array, int index, int length, System.Collections.Generic.IComparer<T> comparer) {
             if (array==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -1812,7 +1758,6 @@ namespace System {
             }
         }
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         public static void Sort<TKey, TValue>(TKey[] keys, TValue[] items, int index, int length, System.Collections.Generic.IComparer<TKey> comparer) {
             if (keys==null)
                 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.keys);
index d2c203c..662b240 100644 (file)
@@ -204,7 +204,6 @@ namespace System {
                 *(src + len) = 0;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal unsafe static void Memcpy(byte[] dest, int destIndex, byte* src, int srcIndex, int len) {
             Debug.Assert( (srcIndex >= 0) && (destIndex >= 0) && (len >= 0), "Index and length must be non-negative!");
             Debug.Assert(dest.Length - destIndex >= len, "not enough bytes in dest");
@@ -217,7 +216,6 @@ namespace System {
             }
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal unsafe static void Memcpy(byte* pDest, int destIndex, byte[] src, int srcIndex, int len)
         {
             Debug.Assert( (srcIndex >= 0) && (destIndex >= 0) && (len >= 0), "Index and length must be non-negative!");        
@@ -241,7 +239,6 @@ namespace System {
         // 1. This method is given access to other internal dlls and this close to release we do not want to change it.
         // 2. It is difficult to get this right for arm and again due to release dates we would like to visit it later.
         [FriendAccessAllowed]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
 #if ARM
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         internal unsafe static extern void Memcpy(byte* dest, byte* src, int len);
@@ -254,7 +251,6 @@ namespace System {
 #endif // ARM
 
         // This method has different signature for x64 and other platforms and is done for performance reasons.
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal unsafe static void Memmove(byte* dest, byte* src, nuint len)
         {
             // P/Invoke into the native version when the buffers are overlapping and the copy needs to be performed backwards
@@ -580,7 +576,6 @@ namespace System {
 
         // Non-inlinable wrapper around the QCall that avoids poluting the fast path
         // with P/Invoke prolog/epilog.
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [MethodImplAttribute(MethodImplOptions.NoInlining)]
         private unsafe static void _Memmove(byte* dest, byte* src, nuint len)
         {
@@ -589,7 +584,6 @@ namespace System {
 
         [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
         [SuppressUnmanagedCodeSecurity]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         extern private unsafe static void __Memmove(byte* dest, byte* src, nuint len);
 
         // The attributes on this method are chosen for best JIT performance. 
index 3447b99..d1831dd 100644 (file)
@@ -273,7 +273,6 @@ namespace System.Collections {
         }
 
         // Removes all entries from this hashtable.
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public virtual void Clear() {
             Debug.Assert(!isWriterInProgress, "Race condition detected in usages of Hashtable - multiple threads appear to be writing to a Hashtable instance simultaneously!  Don't do that - use Hashtable.Synchronized.");
 
@@ -512,7 +511,6 @@ namespace System.Collections {
             version++;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         private void rehash( int newsize, bool forceNewHashCode ) {
 
             // reset occupancy
@@ -645,7 +643,6 @@ namespace System.Collections {
         // Inserts an entry into this hashtable. This method is called from the Set
         // and Add methods. If the add parameter is true and the given key already
         // exists in the hashtable, an exception is thrown.
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         private void Insert (Object key, Object nvalue, bool add) {
             if (key == null) {
                 throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
@@ -779,7 +776,6 @@ namespace System.Collections {
         // key exists in the hashtable, it is removed. An ArgumentException is
         // thrown if the key is null.
         // 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public virtual void Remove(Object key) {
             if (key == null) {
                 throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
@@ -1363,7 +1359,6 @@ namespace System.Collections {
 
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static bool IsPrime(int candidate) 
         {
             if ((candidate & 1) != 0) 
@@ -1379,7 +1374,6 @@ namespace System.Collections {
             return (candidate == 2);
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static int GetPrime(int min) 
         {
             if (min < 0)
index e7ee421..a01ed19 100644 (file)
@@ -354,13 +354,11 @@ namespace System {
         // Compares two Decimal values, returning an integer that indicates their
         // relationship.
         //
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static int Compare(Decimal d1, Decimal d2) {
             return FCallCompare(ref d1, ref d2);
         }
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         private static extern int FCallCompare(ref Decimal d1, ref Decimal d2);
     
         // Compares this object to another object, returning an integer that
@@ -621,14 +619,12 @@ namespace System {
     
         // Returns the larger of two Decimal values.
         //
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static Decimal Max(Decimal d1, Decimal d2) {
             return FCallCompare(ref d1, ref d2) >= 0? d1: d2;
         }
     
         // Returns the smaller of two Decimal values.
         //
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static Decimal Min(Decimal d1, Decimal d2) {
             return FCallCompare(ref d1, ref d2) < 0? d1: d2;
         }
index 7fa3e73..93d6c48 100644 (file)
@@ -293,7 +293,6 @@ namespace System.Diagnostics.Contracts {
         [Conditional("DEBUG")]
         [Conditional("CONTRACTS_FULL")]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         public static void Assume(bool condition)
         {
@@ -314,7 +313,6 @@ namespace System.Diagnostics.Contracts {
         [Conditional("DEBUG")]
         [Conditional("CONTRACTS_FULL")]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         public static void Assume(bool condition, String userMessage)
         {
@@ -335,7 +333,6 @@ namespace System.Diagnostics.Contracts {
         [Conditional("DEBUG")]
         [Conditional("CONTRACTS_FULL")]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         public static void Assert(bool condition)
         {
@@ -352,7 +349,6 @@ namespace System.Diagnostics.Contracts {
         [Conditional("DEBUG")]
         [Conditional("CONTRACTS_FULL")]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         public static void Assert(bool condition, String userMessage)
         {
@@ -376,7 +372,6 @@ namespace System.Diagnostics.Contracts {
         [Pure]
         [Conditional("CONTRACTS_FULL")]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         public static void Requires(bool condition)
         {
@@ -396,7 +391,6 @@ namespace System.Diagnostics.Contracts {
         [Pure]
         [Conditional("CONTRACTS_FULL")]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         public static void Requires(bool condition, String userMessage)
         {
@@ -416,7 +410,6 @@ namespace System.Diagnostics.Contracts {
         [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")]
         [Pure]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         public static void Requires<TException>(bool condition) where TException : Exception
         {
@@ -438,7 +431,6 @@ namespace System.Diagnostics.Contracts {
         [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")]
         [Pure]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         public static void Requires<TException>(bool condition, String userMessage) where TException : Exception
         {
@@ -461,7 +453,6 @@ namespace System.Diagnostics.Contracts {
         [Pure]
         [Conditional("CONTRACTS_FULL")]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         public static void Ensures(bool condition)
         {
@@ -481,7 +472,6 @@ namespace System.Diagnostics.Contracts {
         [Pure]
         [Conditional("CONTRACTS_FULL")]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         public static void Ensures(bool condition, String userMessage)
         {
@@ -502,7 +492,6 @@ namespace System.Diagnostics.Contracts {
         [Conditional("CONTRACTS_FULL")]
         [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Justification = "Exception type used in tools.")]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         public static void EnsuresOnThrow<TException>(bool condition) where TException : Exception
         {
@@ -524,7 +513,6 @@ namespace System.Diagnostics.Contracts {
         [Conditional("CONTRACTS_FULL")]
         [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Justification = "Exception type used in tools.")]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         public static void EnsuresOnThrow<TException>(bool condition, String userMessage) where TException : Exception
         {
@@ -544,7 +532,6 @@ namespace System.Diagnostics.Contracts {
         [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Justification = "Not intended to be called at runtime.")]
         [Pure]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
 #endif
         public static T Result<T>() { return default(T); }
 
@@ -560,7 +547,6 @@ namespace System.Diagnostics.Contracts {
         [SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "0#", Justification = "Not intended to be called at runtime.")]
         [Pure]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
 #endif
         public static T ValueAtReturn<T>(out T value) { value = default(T); return value; }
 
@@ -576,7 +562,6 @@ namespace System.Diagnostics.Contracts {
         [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "value")]
         [Pure]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
 #endif
         public static T OldValue<T>(T value) { return default(T); }
 
@@ -598,7 +583,6 @@ namespace System.Diagnostics.Contracts {
         [Pure]
         [Conditional("CONTRACTS_FULL")]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         public static void Invariant(bool condition)
         {
@@ -618,7 +602,6 @@ namespace System.Diagnostics.Contracts {
         [Pure]
         [Conditional("CONTRACTS_FULL")]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         public static void Invariant(bool condition, String userMessage)
         {
@@ -643,7 +626,6 @@ namespace System.Diagnostics.Contracts {
         /// <seealso cref="System.Collections.Generic.List&lt;T&gt;.TrueForAll"/>
         [Pure]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]  // Assumes predicate obeys CER rules.
 #endif
         public static bool ForAll(int fromInclusive, int toExclusive, Predicate<int> predicate)
         {
@@ -674,7 +656,6 @@ namespace System.Diagnostics.Contracts {
         /// <seealso cref="System.Collections.Generic.List&lt;T&gt;.TrueForAll"/>
         [Pure]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]  // Assumes predicate & collection enumerator obey CER rules.
 #endif
         public static bool ForAll<T>(IEnumerable<T> collection, Predicate<T> predicate)
         {
@@ -705,7 +686,6 @@ namespace System.Diagnostics.Contracts {
         /// <seealso cref="System.Collections.Generic.List&lt;T&gt;.Exists"/>
         [Pure]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]  // Assumes predicate obeys CER rules.
 #endif
         public static bool Exists(int fromInclusive, int toExclusive, Predicate<int> predicate)
         {
@@ -735,7 +715,6 @@ namespace System.Diagnostics.Contracts {
         /// <seealso cref="System.Collections.Generic.List&lt;T&gt;.Exists"/>
         [Pure]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]  // Assumes predicate & collection enumerator obey CER rules.
 #endif
         public static bool Exists<T>(IEnumerable<T> collection, Predicate<T> predicate)
         {
@@ -764,7 +743,6 @@ namespace System.Diagnostics.Contracts {
         /// </summary>
         [Conditional("CONTRACTS_FULL")]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
 #endif
         public static void EndContractBlock() { }
 
@@ -825,7 +803,6 @@ namespace System.Diagnostics.Contracts.Internal
         [SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")]
         [System.Diagnostics.DebuggerNonUserCode]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         public static string RaiseContractFailedEvent(ContractFailureKind failureKind, String userMessage, String conditionText, Exception innerException)
         {
@@ -837,7 +814,6 @@ namespace System.Diagnostics.Contracts.Internal
         /// </summary>
         [System.Diagnostics.DebuggerNonUserCode]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
 #endif
         public static void TriggerFailure(ContractFailureKind kind, String displayMessage, String userMessage, String conditionText, Exception innerException)
         {
@@ -864,7 +840,6 @@ namespace System.Runtime.CompilerServices
         [SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")]
         [System.Diagnostics.DebuggerNonUserCode]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         public static string RaiseContractFailedEvent(ContractFailureKind failureKind, String userMessage, String conditionText, Exception innerException)
         {
@@ -879,7 +854,6 @@ namespace System.Runtime.CompilerServices
         /// </summary>
         [System.Diagnostics.DebuggerNonUserCode]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
 #endif
         public static void TriggerFailure(ContractFailureKind kind, String displayMessage, String userMessage, String conditionText, Exception innerException)
         {
index 4adf742..5f4de4f 100644 (file)
@@ -92,7 +92,6 @@ namespace System.Diagnostics.Contracts {
         [SuppressMessage("Microsoft.Portability", "CA1903:UseOnlyApiFromTargetedFramework", MessageId = "System.Security.SecuritySafeCriticalAttribute")]
         [System.Diagnostics.DebuggerNonUserCode]
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         static partial void ReportFailure(ContractFailureKind failureKind, String userMessage, String conditionText, Exception innerException)
         {
@@ -144,7 +143,6 @@ namespace System.Diagnostics.Contracts {
         internal Exception thrownDuringHandler;
 
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         public ContractFailedEventArgs(ContractFailureKind failureKind, String message, String condition, Exception originalException)
         {
@@ -421,7 +419,6 @@ namespace System.Runtime.CompilerServices
         }
 
 #if FEATURE_RELIABILITY_CONTRACTS
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
         private static String GetDisplayMessage(ContractFailureKind failureKind, String userMessage, String conditionText)
         {
index 5319cba..1e4e477 100644 (file)
@@ -82,7 +82,6 @@ namespace System {
         }
 
         [Pure]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public unsafe static bool IsNaN(double d)
         {
index 26346c5..8fa4ce4 100644 (file)
@@ -70,7 +70,6 @@ namespace System {
             // Is this thread currently doing infinite resource lookups?
             private int infinitelyRecursingCount;
             
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
             internal String GetResourceString(String key)  {
                 if (key == null || key.Length == 0) {
                     Debug.Assert(false, "Environment::GetResourceString with null or empty key.  Bug in caller, or weird recursive loading problem?");
@@ -175,7 +174,6 @@ namespace System {
         // Private object for locking instead of locking on a public type for SQL reliability work.
         private static Object s_InternalSyncObject;
         private static Object InternalSyncObject {
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
             get {
                 if (s_InternalSyncObject == null) {
                     Object o = new Object();
@@ -669,7 +667,6 @@ namespace System {
         }
         public static int CurrentManagedThreadId
         {
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
             get
             {
                 return Thread.CurrentThread.ManagedThreadId;
index 225fefd..fd09ef7 100644 (file)
@@ -97,7 +97,6 @@ namespace System {
         private static extern int GetMaxGeneration();
     
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         private static extern int _CollectionCount (int generation, int getSpecialGCCount);
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -205,7 +204,6 @@ namespace System {
             _Collect(generation, iInternalModes);
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static int CollectionCount (int generation) 
         {
             if (generation<0) 
@@ -252,7 +250,6 @@ namespace System {
         // If we insert a call to GC.KeepAlive(this) at the end of Problem(), then
         // Foo doesn't get finalized and the stream stays open.
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // disable optimizations
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static void KeepAlive(Object obj)
         {
         }
@@ -283,10 +280,8 @@ namespace System {
         // Indicates that the system should not call the Finalize() method on
         // an object that would normally require this call.
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         private static extern void _SuppressFinalize(Object o);
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static void SuppressFinalize(Object obj) {
             if (obj == null)
                 throw new ArgumentNullException(nameof(obj));
index a2f5c77..dbddcd3 100644 (file)
@@ -31,13 +31,11 @@ namespace System {
 
         // fast way to compare IntPtr to (IntPtr)0 while IntPtr.Zero doesn't work due to slow statics access
         [Pure]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal unsafe bool IsNull()
         {
             return (this.m_value == null);
         }
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         [System.Runtime.Versioning.NonVersionable]
         public unsafe IntPtr(int value)
         {
@@ -48,7 +46,6 @@ namespace System {
 #endif
         }
     
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         [System.Runtime.Versioning.NonVersionable]
         public unsafe IntPtr(long value)
         {
@@ -60,7 +57,6 @@ namespace System {
         }
 
         [CLSCompliant(false)]
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         [System.Runtime.Versioning.NonVersionable]
         public unsafe IntPtr(void* value)
         {
@@ -110,7 +106,6 @@ namespace System {
 #endif
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public unsafe int ToInt32() {
 #if BIT64
@@ -121,7 +116,6 @@ namespace System {
 #endif
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public unsafe long ToInt64() {
 #if BIT64
@@ -151,14 +145,12 @@ namespace System {
         }
 
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         [System.Runtime.Versioning.NonVersionable]
         public static explicit operator IntPtr (int value) 
         {
             return new IntPtr(value);
         }
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         [System.Runtime.Versioning.NonVersionable]
         public static explicit operator IntPtr (long value) 
         {
@@ -200,28 +192,24 @@ namespace System {
 #endif
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public unsafe static bool operator == (IntPtr value1, IntPtr value2) 
         {
             return value1.m_value == value2.m_value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public unsafe static bool operator != (IntPtr value1, IntPtr value2) 
         {
             return value1.m_value != value2.m_value;
         }
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         [System.Runtime.Versioning.NonVersionable]
         public static IntPtr Add(IntPtr pointer, int offset)
         {
             return pointer + offset;
         }
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         [System.Runtime.Versioning.NonVersionable]
         public static IntPtr operator +(IntPtr pointer, int offset) 
         {
@@ -232,13 +220,11 @@ namespace System {
 #endif
         }
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         [System.Runtime.Versioning.NonVersionable]
         public static IntPtr Subtract(IntPtr pointer, int offset) {
             return pointer - offset;
         }
 
-        [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
         [System.Runtime.Versioning.NonVersionable]
         public static IntPtr operator -(IntPtr pointer, int offset) {
 #if BIT64
@@ -251,7 +237,6 @@ namespace System {
         public static int Size
         {
             [Pure]
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
             [System.Runtime.Versioning.NonVersionable]
             get
             {
@@ -265,7 +250,6 @@ namespace System {
     
 
         [CLSCompliant(false)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public unsafe void* ToPointer()
         {
index 3ac1f06..8b2af3d 100644 (file)
@@ -149,7 +149,6 @@ namespace System {
         return InternalTruncate(d);
       }
             
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       [MethodImplAttribute(MethodImplOptions.InternalCall)]
       public static extern double Sqrt(double d);
       [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -294,58 +293,49 @@ namespace System {
       **Returns the larger of val1 and val2
       ============================================================================*/
       [CLSCompliant(false)]
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       [System.Runtime.Versioning.NonVersionable]
       public static sbyte Max(sbyte val1, sbyte val2) {
         return (val1>=val2)?val1:val2;
       }
     
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       [System.Runtime.Versioning.NonVersionable]
       public static byte Max(byte val1, byte val2) {
         return (val1>=val2)?val1:val2;
       }
     
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       [System.Runtime.Versioning.NonVersionable]
       public static short Max(short val1, short val2) {
         return (val1>=val2)?val1:val2;
       }
     
       [CLSCompliant(false)]
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       [System.Runtime.Versioning.NonVersionable]
       public static ushort Max(ushort val1, ushort val2) {
         return (val1>=val2)?val1:val2;
       }
     
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       [System.Runtime.Versioning.NonVersionable]
       public static int Max(int val1, int val2) {
         return (val1>=val2)?val1:val2;
       }
     
       [CLSCompliant(false)]
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       [System.Runtime.Versioning.NonVersionable]
       public static uint Max(uint val1, uint val2) {
         return (val1>=val2)?val1:val2;
       }
     
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       [System.Runtime.Versioning.NonVersionable]
       public static long Max(long val1, long val2) {
         return (val1>=val2)?val1:val2;
       }
     
       [CLSCompliant(false)]
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       [System.Runtime.Versioning.NonVersionable]
       public static ulong Max(ulong val1, ulong val2) {
         return (val1>=val2)?val1:val2;
       }
     
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       public static float Max(float val1, float val2) {
         if (val1 > val2)
             return val1;
@@ -356,7 +346,6 @@ namespace System {
         return val2;
       }
     
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       public static double Max(double val1, double val2) {
         if (val1 > val2)
             return val1;
@@ -367,7 +356,6 @@ namespace System {
         return val2;
       }
     
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       public static Decimal Max(Decimal val1, Decimal val2) {
         return Decimal.Max(val1,val2);
       }
@@ -376,58 +364,49 @@ namespace System {
       **Returns the smaller of val1 and val2.
       ============================================================================*/
       [CLSCompliant(false)]
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       [System.Runtime.Versioning.NonVersionable]
       public static sbyte Min(sbyte val1, sbyte val2) {
         return (val1<=val2)?val1:val2;
       }
     
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       [System.Runtime.Versioning.NonVersionable]
       public static byte Min(byte val1, byte val2) {
         return (val1<=val2)?val1:val2;
       }
     
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       [System.Runtime.Versioning.NonVersionable]
       public static short Min(short val1, short val2) {
         return (val1<=val2)?val1:val2;
       }
     
       [CLSCompliant(false)]
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       [System.Runtime.Versioning.NonVersionable]
       public static ushort Min(ushort val1, ushort val2) {
         return (val1<=val2)?val1:val2;
       }
     
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       [System.Runtime.Versioning.NonVersionable]
       public static int Min(int val1, int val2) {
         return (val1<=val2)?val1:val2;
       }
     
       [CLSCompliant(false)]
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       [System.Runtime.Versioning.NonVersionable]
       public static uint Min(uint val1, uint val2) {
         return (val1<=val2)?val1:val2;
       }
     
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       [System.Runtime.Versioning.NonVersionable]
       public static long Min(long val1, long val2) {
         return (val1<=val2)?val1:val2;
       }
     
       [CLSCompliant(false)]
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       [System.Runtime.Versioning.NonVersionable]
       public static ulong Min(ulong val1, ulong val2) {
         return (val1<=val2)?val1:val2;
       }
     
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       public static float Min(float val1, float val2) {
         if (val1 < val2)
             return val1;
@@ -438,7 +417,6 @@ namespace System {
         return val2;
       }
     
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       public static double Min(double val1, double val2) {
         if (val1 < val2)
             return val1;
@@ -449,7 +427,6 @@ namespace System {
         return val2;
       }
     
-      [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
       public static Decimal Min(Decimal val1, Decimal val2) {
         return Decimal.Min(val1,val2);
       }
index fb80092..545774c 100644 (file)
@@ -143,10 +143,8 @@ namespace System {
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         public static extern float Log10(float x);
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static float Max(float x, float y) => Math.Max(x, y);
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static float Min(float x, float y) => Math.Min(x, y);
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -201,7 +199,6 @@ namespace System {
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         public static extern float Sinh(float x);
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         public static extern float Sqrt(float x);
 
index d8d9a0e..1f47d8c 100644 (file)
@@ -37,7 +37,6 @@ namespace System
 public class Object
 {
     // Creates a new instance of an Object.
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     [System.Runtime.Versioning.NonVersionable]
     public Object()
     {            
@@ -73,7 +72,6 @@ public class Object
         return objA.Equals(objB);
     }
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     [System.Runtime.Versioning.NonVersionable]
     public static bool ReferenceEquals (Object objA, Object objB) {
         return objA == objB;
@@ -101,7 +99,6 @@ public class Object
 
     // Allow an object to free resources before the object is reclaimed by the GC.
     // 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     [System.Runtime.Versioning.NonVersionable]
     ~Object()
     {
index 195ee11..c8d71bc 100644 (file)
@@ -211,7 +211,6 @@ namespace System.Reflection
             }
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal override bool CacheEquals(object o)
         {
             RuntimeConstructorInfo m = o as RuntimeConstructorInfo;
index f57728b..9b529c2 100644 (file)
@@ -232,7 +232,6 @@ namespace System.Reflection
         #endregion
 
         #region Internal Members
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal override bool CacheEquals(object o)
         {
             RuntimeEventInfo m = o as RuntimeEventInfo;
index ffb9e59..7b6517c 100644 (file)
@@ -449,7 +449,6 @@ namespace System.Reflection
             }
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal override bool CacheEquals(object o)
         {
             RtFieldInfo m = o as RtFieldInfo;
@@ -752,7 +751,6 @@ namespace System.Reflection
         #endregion
 
         #region Internal Members
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal override bool CacheEquals(object o)
         {
             MdFieldInfo m = o as MdFieldInfo;
index 576a808..5ce1246 100644 (file)
@@ -265,7 +265,6 @@ namespace System.Reflection
             return sbName.ToString();
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal override bool CacheEquals(object o) 
         { 
             RuntimeMethodInfo m = o as RuntimeMethodInfo;
index 68c15af..e8c2837 100644 (file)
@@ -192,7 +192,6 @@ namespace System.Reflection
         #endregion
 
         #region Internal Members
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal override bool CacheEquals(object o)
         {
             RuntimePropertyInfo m = o as RuntimePropertyInfo;
index 80f0626..a24ee67 100644 (file)
@@ -403,7 +403,6 @@ namespace System
                 // May replace the list with a new one if certain cache
                 // lookups succeed.  Also, may modify the contents of the list
                 // after merging these new data structures with cached ones.
-                [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
                 internal void Insert(ref T[] list, string name, MemberListType listType)
                 {
                     bool lockTaken = false;
@@ -481,7 +480,6 @@ namespace System
                 }
 
                 // Modifies the existing list.
-                [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
                 private void MergeWithGlobalList(T[] list)
                 {
                     T[] cachedMembers = m_allMembers;
@@ -1606,7 +1604,6 @@ namespace System
 
             internal bool IsGlobal 
             { 
-                [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
                 get { return m_isGlobal; } 
             }
 
@@ -2508,7 +2505,6 @@ namespace System
         #endregion
 
         #region Private\Internal Members
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal override bool CacheEquals(object o)
         {
             RuntimeType m = o as RuntimeType;
@@ -3220,7 +3216,6 @@ namespace System
             }
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal sealed override RuntimeTypeHandle GetTypeHandleInternal()
         {
             return new RuntimeTypeHandle(this);
index 198a4ab..509e527 100644 (file)
@@ -130,7 +130,6 @@ namespace System.Runtime.CompilerServices {
         // Note: this method is not part of the CER support, and is not to be confused with ProbeForSufficientStack
         // below.
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static extern void EnsureSufficientExecutionStack();
 
         // This method ensures that there is sufficient stack to execute the average Framework function.
@@ -138,7 +137,6 @@ namespace System.Runtime.CompilerServices {
         // Note: this method is not part of the CER support, and is not to be confused with ProbeForSufficientStack
         // below.
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static extern bool TryEnsureSufficientExecutionStack();
 
         public static void ProbeForSufficientStack()
@@ -147,7 +145,6 @@ namespace System.Runtime.CompilerServices {
 
         // This method is a marker placed immediately before a try clause to mark the corresponding catch and finally blocks as
         // constrained. There's no code here other than the probe because most of the work is done at JIT time when we spot a call to this routine.
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static void PrepareConstrainedRegions()
         {
             ProbeForSufficientStack();
@@ -155,7 +152,6 @@ namespace System.Runtime.CompilerServices {
 
         // When we detect a CER with no calls, we can point the JIT to this non-probing version instead
         // as we don't need to probe.
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static void PrepareConstrainedRegionsNoOP()
         {
         }
@@ -167,7 +163,6 @@ namespace System.Runtime.CompilerServices {
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         public static extern void ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData);
 
-        [PrePrepareMethod]
         internal static void ExecuteBackoutCodeHelper(Object backoutCode, Object userData, bool exceptionThrown)
         {
             ((CleanupCode)backoutCode)(userData, exceptionThrown);
index ca316ff..1b3e25b 100644 (file)
@@ -29,7 +29,6 @@ namespace System.Runtime.ExceptionServices {
         // Returns the exception object pertaining to the first chance exception
         public Exception Exception
         {
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
             get { return m_Exception; }
         }
 
index 713cbd4..11143c5 100644 (file)
@@ -39,14 +39,12 @@ namespace System.Runtime {
         
         public static GCLatencyMode LatencyMode
         {
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
             get 
             {
                 return (GCLatencyMode)(GC.GetGCLatencyMode());
             }
 
             // We don't want to allow this API when hosted.
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
             set 
             {
                 if ((value < GCLatencyMode.Batch) || (value > GCLatencyMode.SustainedLowLatency))
@@ -62,14 +60,12 @@ namespace System.Runtime {
 
         public static GCLargeObjectHeapCompactionMode LargeObjectHeapCompactionMode
         {
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
             get 
             {
                 return (GCLargeObjectHeapCompactionMode)(GC.GetLOHCompactionMode());
             }
 
             // We don't want to allow this API when hosted.
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
             set 
             {
                 if ((value < GCLargeObjectHeapCompactionMode.Default) || 
index a9a7aac..8402701 100644 (file)
@@ -149,7 +149,6 @@ public abstract class CriticalHandle : CriticalFinalizerObject, IDisposable
     private bool _isClosed;     // Set by SetHandleAsInvalid or Close/Dispose/finalization.
 
     // Creates a CriticalHandle class.  Users must then set the Handle property or allow P/Invoke marshaling to set it implicitly.
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     protected CriticalHandle(IntPtr invalidHandleValue)
     {
         handle = invalidHandleValue;
@@ -166,13 +165,11 @@ public abstract class CriticalHandle : CriticalFinalizerObject, IDisposable
     // Adding an empty default constructor for annotation purposes
     private CriticalHandle(){} 
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     ~CriticalHandle()
     {
         Dispose(false);
     }
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     private void Cleanup()
     {
         if (IsClosed)
@@ -196,10 +193,8 @@ public abstract class CriticalHandle : CriticalFinalizerObject, IDisposable
     }
 
     [MethodImplAttribute(MethodImplOptions.InternalCall)]
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     private extern void FireCustomerDebugProbe();
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     protected void SetHandle(IntPtr handle) {
         this.handle = handle;
     }
@@ -207,7 +202,6 @@ public abstract class CriticalHandle : CriticalFinalizerObject, IDisposable
     // Returns whether the handle has been explicitly marked as closed
     // (Close/Dispose) or invalid (SetHandleAsInvalid).
     public bool IsClosed {
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         get { return _isClosed; }
     }
 
@@ -216,22 +210,18 @@ public abstract class CriticalHandle : CriticalFinalizerObject, IDisposable
     // know what an invalid handle looks like, so this method is abstract and
     // must be provided by a derived type.
     public abstract bool IsInvalid {
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         get;
     }
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     public void Close() {
         Dispose(true);
     }
     
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     public void Dispose()
     {
         Dispose(true);
     }
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     protected virtual void Dispose(bool disposing)
     {
         Cleanup();
@@ -241,7 +231,6 @@ public abstract class CriticalHandle : CriticalFinalizerObject, IDisposable
     // your handle is invalid and you want to record that information.
     // An example is calling a syscall and getting back ERROR_INVALID_HANDLE.
     // This method will normally leak handles!
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     public void SetHandleAsInvalid()
     {
         _isClosed = true;
@@ -256,7 +245,6 @@ public abstract class CriticalHandle : CriticalFinalizerObject, IDisposable
     // The boolean returned should be true for success and false if a
     // catastrophic error occurred and you wish to trigger a diagnostic for
     // debugging purposes (the SafeHandleCriticalFailure MDA).
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     protected abstract bool ReleaseHandle();
 }
 
index 2f4ddf4..9e9103b 100644 (file)
@@ -75,7 +75,6 @@ namespace System.Runtime.InteropServices
 #endif
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         private static bool IsNotWin32Atom(IntPtr ptr)
         {
 #if FEATURE_PAL
@@ -251,7 +250,6 @@ namespace System.Runtime.InteropServices
         /// </summary>
         /// <typeparam name="T">Provide a value type to figure out its size</typeparam>
         /// <returns>The aligned size of T in bytes.</returns>
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         internal static uint AlignedSizeOf<T>() where T : struct
         {
             uint size = SizeOfType(typeof(T));
@@ -269,13 +267,11 @@ namespace System.Runtime.InteropServices
         // Type must be a value type with no object reference fields.  We only
         // assert this, due to the lack of a suitable generic constraint.
         [MethodImpl(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static extern uint SizeOfType(Type type);
 
         // Type must be a value type with no object reference fields.  We only
         // assert this, due to the lack of a suitable generic constraint.
         [MethodImpl(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         private static extern uint AlignedSizeOfType(Type type);
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -468,7 +464,6 @@ namespace System.Runtime.InteropServices
             throw new PlatformNotSupportedException();
         }
  
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static unsafe int ReadInt32(IntPtr ptr, int ofs)
         {
             try
@@ -498,13 +493,11 @@ namespace System.Runtime.InteropServices
             }
         }
     
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static int ReadInt32(IntPtr ptr)
         {
             return ReadInt32(ptr,0);
         }
        
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static IntPtr ReadIntPtr([MarshalAs(UnmanagedType.AsAny),In] Object ptr, int ofs)
         {
             #if BIT64
@@ -514,7 +507,6 @@ namespace System.Runtime.InteropServices
             #endif
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static IntPtr ReadIntPtr(IntPtr ptr, int ofs)
         {
             #if BIT64
@@ -524,7 +516,6 @@ namespace System.Runtime.InteropServices
             #endif
         }
     
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static IntPtr ReadIntPtr(IntPtr ptr)
         {
             #if BIT64
@@ -572,7 +563,6 @@ namespace System.Runtime.InteropServices
             }
         }
     
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static long ReadInt64(IntPtr ptr)
         {
             return ReadInt64(ptr,0);
@@ -766,7 +756,6 @@ namespace System.Runtime.InteropServices
         // GetLastWin32Error
         //====================================================================
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static extern int GetLastWin32Error();
     
 
@@ -774,14 +763,12 @@ namespace System.Runtime.InteropServices
         // SetLastWin32Error
         //====================================================================
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static extern void SetLastWin32Error(int error);
     
 
         //====================================================================
         // GetHRForLastWin32Error
         //====================================================================
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static int GetHRForLastWin32Error()
         {
             int dwLastError = GetLastWin32Error();
@@ -983,7 +970,6 @@ namespace System.Runtime.InteropServices
         //====================================================================
         // Memory allocation and deallocation.
         //====================================================================
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static IntPtr AllocHGlobal(IntPtr cb)
         {
             // For backwards compatibility on 32 bit platforms, ensure we pass values between 
@@ -1007,13 +993,11 @@ namespace System.Runtime.InteropServices
             return pNewMem;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static IntPtr AllocHGlobal(int cb)
         {
             return AllocHGlobal((IntPtr)cb);
         }
         
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static void FreeHGlobal(IntPtr hglobal)
         {
             if (IsNotWin32Atom(hglobal)) {
@@ -1558,7 +1542,6 @@ namespace System.Runtime.InteropServices
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         public static extern int /* ULONG */ AddRef(IntPtr /* IUnknown */ pUnk );
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static extern int /* ULONG */ Release(IntPtr /* IUnknown */ pUnk );
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
index 0f914fb..ee5c3d8 100644 (file)
@@ -174,7 +174,6 @@ using System.Diagnostics.Contracts;
         /// the pointer from within the SafeBuffer.  You must set
         /// pointer to null before calling this method.</param>
         [CLSCompliant(false)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public void AcquirePointer(ref byte* pointer)
         {
             if (_numBytes == Uninitialized)
@@ -193,7 +192,6 @@ using System.Diagnostics.Contracts;
             }
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public void ReleasePointer()
         {
             if (_numBytes == Uninitialized)
@@ -211,7 +209,6 @@ using System.Diagnostics.Contracts;
         /// may have to consider alignment.</param>
         /// <returns>An instance of T read from memory.</returns>
         [CLSCompliant(false)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public T Read<T>(ulong byteOffset) where T : struct {
             if (_numBytes == Uninitialized)
                 throw NotInitialized();
@@ -239,7 +236,6 @@ using System.Diagnostics.Contracts;
         }
 
         [CLSCompliant(false)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public void ReadArray<T>(ulong byteOffset, T[] array, int index, int count)
             where T : struct
         {
@@ -286,7 +282,6 @@ using System.Diagnostics.Contracts;
         /// may have to consider alignment.</param>
         /// <param name="value">The value type to write to memory.</param>
         [CLSCompliant(false)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public void Write<T>(ulong byteOffset, T value) where T : struct {
             if (_numBytes == Uninitialized)
                 throw NotInitialized();
@@ -311,7 +306,6 @@ using System.Diagnostics.Contracts;
         }
 
         [CLSCompliant(false)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public void WriteArray<T>(ulong byteOffset, T[] array, int index, int count)
             where T : struct
         {
@@ -354,7 +348,6 @@ using System.Diagnostics.Contracts;
         /// </summary>
         [CLSCompliant(false)]
         public ulong ByteLength {
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
             get {
                 if (_numBytes == Uninitialized)
                     throw NotInitialized();
@@ -366,7 +359,6 @@ using System.Diagnostics.Contracts;
         /* No indexer.  The perf would be misleadingly bad.  People should use 
          * AcquirePointer and ReleasePointer instead.  */
         
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         private void SpaceCheck(byte* ptr, ulong sizeInBytes)
         {
             if ((ulong)_numBytes < sizeInBytes)
@@ -375,13 +367,11 @@ using System.Diagnostics.Contracts;
                 NotEnoughRoom();
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         private static void NotEnoughRoom()
         {
             throw new ArgumentException(Environment.GetResourceString("Arg_BufferTooSmall"));
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         private static InvalidOperationException NotInitialized()
         {
             Debug.Assert(false, "Uninitialized SafeBuffer!  Someone needs to call Initialize before using this instance!");
@@ -390,7 +380,6 @@ using System.Diagnostics.Contracts;
 
         // FCALL limitations mean we can't have generic FCALL methods.  However, we can pass 
         // TypedReferences to FCALL methods.
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static void GenericPtrToStructure<T>(byte* ptr, out T structure, uint sizeofT) where T : struct
         {
             structure = default(T);  // Dummy assignment to silence the compiler
@@ -398,17 +387,14 @@ using System.Diagnostics.Contracts;
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         private static extern void PtrToStructureNative(byte* ptr, /*out T*/ TypedReference structure, uint sizeofT);
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static void GenericStructureToPtr<T>(ref T structure, byte* ptr, uint sizeofT) where T : struct
         {
             StructureToPtrNative(__makeref(structure), ptr, sizeofT);
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         private static extern void StructureToPtrNative(/*ref T*/ TypedReference structure, byte* ptr, uint sizeofT);
     }
 }
index 733ddfe..591caa2 100644 (file)
@@ -153,7 +153,6 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable
     // Creates a SafeHandle class.  Users must then set the Handle property.
     // To prevent the SafeHandle from being freed, write a subclass that
     // doesn't define a finalizer.
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     protected SafeHandle(IntPtr invalidHandleValue, bool ownsHandle)
     {
         handle = invalidHandleValue;
@@ -189,11 +188,9 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable
         Dispose(false);
     }
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     [MethodImplAttribute(MethodImplOptions.InternalCall)]
     extern void InternalFinalize();
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     protected void SetHandle(IntPtr handle) {
         this.handle = handle;
     }
@@ -212,33 +209,27 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable
     //     any way, this can lead to a handle recycling security attack (i.e. an
     //     untrusted caller can query data on the handle you've just returned
     //     and get back information for an entirely unrelated resource).
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     public IntPtr DangerousGetHandle()
     {
         return handle;
     }
 
     public bool IsClosed {
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         get { return (_state & 1) == 1; }
     }
 
     public abstract bool IsInvalid {
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         get;
     }
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     public void Close() {
         Dispose(true);
     }
     
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     public void Dispose() {
         Dispose(true);
     }
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     protected virtual void Dispose(bool disposing)
     {
         if (disposing)
@@ -247,7 +238,6 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable
             InternalFinalize();
     }
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     [MethodImplAttribute(MethodImplOptions.InternalCall)]
     private extern void InternalDispose();
 
@@ -255,7 +245,6 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable
     // your handle is invalid and you want to record that information.
     // An example is calling a syscall and getting back ERROR_INVALID_HANDLE.
     // This method will normally leak handles!
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     [MethodImplAttribute(MethodImplOptions.InternalCall)]
     public extern void SetHandleAsInvalid();
 
@@ -267,7 +256,6 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable
     // The boolean returned should be true for success and false if the runtime
     // should fire a SafeHandleCriticalFailure MDA (CustomerDebugProbe) if that
     // MDA is enabled.
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     protected abstract bool ReleaseHandle();
 
     // Add a reason why this handle should not be relinquished (i.e. have
@@ -283,7 +271,6 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable
     // when the method is interrupted prior to processing by a thread abort or
     // when the handle has already been (or is in the process of being)
     // released.
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     [MethodImplAttribute(MethodImplOptions.InternalCall)]
     public extern void DangerousAddRef(ref bool success);
 
@@ -296,7 +283,6 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable
     // constitutes a potential security hole (via handle recycling) as well as a
     // correctness problem -- so don't ever expose Dangerous* calls out to
     // untrusted code.
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     [MethodImplAttribute(MethodImplOptions.InternalCall)]
     public extern void DangerousRelease();
 }
index a786880..551ee65 100644 (file)
@@ -21,12 +21,10 @@ internal static class WindowsRuntimeBufferHelper {
 
     [DllImport(JitHelpers.QCall)]
     [SuppressUnmanagedCodeSecurity]
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     private unsafe extern static void StoreOverlappedPtrInCCW(ObjectHandleOnStack windowsRuntimeBuffer, NativeOverlapped* overlapped);
 
 
     [FriendAccessAllowed]
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
     internal unsafe static void StoreOverlappedInCCW(Object windowsRuntimeBuffer, NativeOverlapped* overlapped) {
 
         StoreOverlappedPtrInCCW(JitHelpers.GetObjectHandleOnStack(ref windowsRuntimeBuffer), overlapped);
index 9f9d819..84b8ba9 100644 (file)
@@ -393,7 +393,6 @@ namespace System.Runtime
             GC.SuppressFinalize(this);
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         private void Dispose(bool disposing)
         {
             // This is just bookkeeping to ensure multiple threads can really
index 56a4189..6d6d6f3 100644 (file)
@@ -23,12 +23,10 @@ namespace System.Runtime.ConstrainedExecution
 {
     public abstract class CriticalFinalizerObject
     {
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         protected CriticalFinalizerObject()
         {
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         ~CriticalFinalizerObject()
         {
         }
index 504f3ac..39c85ad 100644 (file)
@@ -97,7 +97,6 @@ namespace System
             return m_type != null ? m_type.GetHashCode() : 0;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public override bool Equals(object obj)
         {
             if(!(obj is RuntimeTypeHandle))
@@ -107,7 +106,6 @@ namespace System
             return handle.m_type == m_type;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public bool Equals(RuntimeTypeHandle handle)
         {
             return handle.m_type == m_type;
@@ -228,11 +226,9 @@ namespace System
         internal extern static RuntimeAssembly GetAssembly(RuntimeType type);
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal extern static RuntimeModule GetModule(RuntimeType type);
 
         [CLSCompliant(false)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public ModuleHandle GetModuleHandle()
         {
             return new ModuleHandle(RuntimeTypeHandle.GetModule(m_type));
@@ -841,7 +837,6 @@ namespace System
             return ValueType.GetHashCodeOfPtr(Value);
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public override bool Equals(object obj)
         {
             if (!(obj is RuntimeMethodHandle))
@@ -862,7 +857,6 @@ namespace System
             return !left.Equals(right);
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public bool Equals(RuntimeMethodHandle handle)
         {
             return handle.Value == Value;
@@ -1199,7 +1193,6 @@ namespace System
             return ValueType.GetHashCodeOfPtr(Value);
         }
         
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public override bool Equals(object obj)
         {
             if (!(obj is RuntimeFieldHandle))
@@ -1210,7 +1203,6 @@ namespace System
             return handle.Value == Value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public unsafe bool Equals(RuntimeFieldHandle handle)
         {
             return handle.Value == Value;
@@ -1373,7 +1365,6 @@ namespace System
             return m_ptr != null ? m_ptr.GetHashCode() : 0;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public override bool Equals(object obj)
         {
             if (!(obj is ModuleHandle))
@@ -1384,7 +1375,6 @@ namespace System
             return handle.m_ptr == m_ptr;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public unsafe bool Equals(ModuleHandle handle)
         {
             return handle.m_ptr == m_ptr;
index 0f6dca1..d936433 100644 (file)
@@ -45,7 +45,6 @@ namespace System
         // Stored as a long because we need to use Interlocked.Add.
         private long _memFailPointReservedMemory;
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static long AddMemoryFailPointReservation(long size)
         {
             // Size can legitimately be negative - see Dispose.
index c24e29d..657d7ae 100644 (file)
@@ -57,7 +57,6 @@ namespace System {
         }
 
         [Pure]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public unsafe static bool IsNaN(float f) {
             return (*(int*)(&f) & 0x7FFFFFFF) > 0x7F800000;
index 287e06c..2ac1d78 100644 (file)
@@ -73,7 +73,6 @@ namespace System
         // Search/Query methods
         //
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         private unsafe static bool EqualsHelper(String strA, String strB)
         {
             Contract.Requires(strA != null);
@@ -134,7 +133,6 @@ namespace System
             }
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         private unsafe static bool StartsWithOrdinalHelper(String str, String startsWith)
         {
             Contract.Requires(str != null);
@@ -792,7 +790,6 @@ namespace System
         }
 
         // Determines whether two strings match.
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public override bool Equals(Object obj)
         {
             if (this == null)                        // this is necessary to guard against reverse-pinvokes and
@@ -813,7 +810,6 @@ namespace System
 
         // Determines whether two strings match.
         [Pure]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public bool Equals(String value)
         {
             if (this == null)                        // this is necessary to guard against reverse-pinvokes and
@@ -983,7 +979,6 @@ namespace System
 
         // Gets a hash code for this string.  If strings A and B are such that A.Equals(B), then
         // they will return the same hash code.
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public override int GetHashCode()
         {
 #if FEATURE_RANDOMIZED_STRING_HASHING
@@ -998,12 +993,10 @@ namespace System
 
         // Gets a hash code for this string and this comparison. If strings A and B and comparition C are such
         // that String.Equals(A, B, C), then they will return the same hash code with this comparison C.
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public int GetHashCode(StringComparison comparisonType) => StringComparer.FromComparison(comparisonType).GetHashCode(this);
 
         // Use this if and only if you need the hashcode to not change across app domains (e.g. you have an app domain agile
         // hash table).
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         internal int GetLegacyNonRandomizedHashCode() {
             unsafe {
                 fixed (char* src = &m_firstChar) {
index ad631fb..2d5926b 100644 (file)
@@ -19,7 +19,6 @@ namespace  System.StubHelpers {
     using System.Diagnostics;
     using System.Diagnostics.Contracts;
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class AnsiCharMarshaler
     {
         // The length of the returned array is an approximation based on the length of the input string and the system
@@ -54,7 +53,6 @@ namespace  System.StubHelpers {
         }
     }  // class AnsiCharMarshaler
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class CSTRMarshaler
     {
         static internal unsafe IntPtr ConvertToNative(int flags, string strManaged, IntPtr pNativeBuffer)
@@ -122,7 +120,6 @@ namespace  System.StubHelpers {
         }
     }  // class CSTRMarshaler
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class UTF8Marshaler
     {
         const int MAX_UTF8_CHAR_SIZE = 3;
@@ -179,7 +176,6 @@ namespace  System.StubHelpers {
         }
     }
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class UTF8BufferMarshaler
     {
         static internal unsafe IntPtr ConvertToNative(StringBuilder sb, IntPtr pNativeBuffer, int flags)
@@ -230,7 +226,6 @@ namespace  System.StubHelpers {
 
 #if FEATURE_COMINTEROP
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class BSTRMarshaler
     {
         static internal unsafe IntPtr ConvertToNative(string strManaged, IntPtr pNativeBuffer)
@@ -358,7 +353,6 @@ namespace  System.StubHelpers {
 #endif // FEATURE_COMINTEROP
 
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class VBByValStrMarshaler
     {
         static internal unsafe IntPtr ConvertToNative(string strManaged, bool fBestFit, bool fThrowOnUnmappableChar, ref int cch)
@@ -424,7 +418,6 @@ namespace  System.StubHelpers {
 
 #if FEATURE_COMINTEROP
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class AnsiBSTRMarshaler
     {
         static internal unsafe IntPtr ConvertToNative(int flags, string strManaged)
@@ -476,7 +469,6 @@ namespace  System.StubHelpers {
 #endif // FEATURE_COMINTEROP
 
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class WSTRBufferMarshaler
     {
         static internal IntPtr ConvertToNative(string strManaged)
@@ -507,7 +499,6 @@ namespace  System.StubHelpers {
         public Int64 UniversalTime;
     };
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class DateTimeOffsetMarshaler {
 
         // Numer of ticks counted between 0001-01-01, 00:00:00 and 1601-01-01, 00:00:00.
@@ -535,7 +526,6 @@ namespace  System.StubHelpers {
 
 
 #if FEATURE_COMINTEROP
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class HStringMarshaler
     {
         // Slow-path, which requires making a copy of the managed string into the resulting HSTRING
@@ -598,7 +588,6 @@ namespace  System.StubHelpers {
         }
     }  // class HStringMarshaler
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class ObjectMarshaler
     {
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -613,7 +602,6 @@ namespace  System.StubHelpers {
 
 #endif // FEATURE_COMINTEROP
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class ValueClassMarshaler
     {
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -626,7 +614,6 @@ namespace  System.StubHelpers {
         static internal extern void ClearNative(IntPtr dst, IntPtr pMT);
     }  // class ValueClassMarshaler
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class DateMarshaler
     {
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -638,7 +625,6 @@ namespace  System.StubHelpers {
     }  // class DateMarshaler
 
 #if FEATURE_COMINTEROP
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     [FriendAccessAllowed]
     internal static class InterfaceMarshaler
     {
@@ -658,7 +644,6 @@ namespace  System.StubHelpers {
 #endif // FEATURE_COMINTEROP
 
 #if FEATURE_COMINTEROP
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class UriMarshaler
     {
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -714,7 +699,6 @@ namespace  System.StubHelpers {
     }
 #endif // FEATURE_COMINTEROP
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class MngdNativeArrayMarshaler
     {
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -741,7 +725,6 @@ namespace  System.StubHelpers {
     }  // class MngdNativeArrayMarshaler
 
 #if FEATURE_COMINTEROP
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class MngdSafeArrayMarshaler
     {
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -763,7 +746,6 @@ namespace  System.StubHelpers {
         static internal extern void ClearNative(IntPtr pMarshalState, ref object pManagedHome, IntPtr pNativeHome);
     }  // class MngdSafeArrayMarshaler
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class MngdHiddenLengthArrayMarshaler
     {
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -924,7 +906,6 @@ namespace  System.StubHelpers {
 
 #endif // FEATURE_COMINTEROP
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class MngdRefCustomMarshaler
     {
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -943,7 +924,6 @@ namespace  System.StubHelpers {
         static internal extern void ClearManaged(IntPtr pMarshalState, ref object pManagedHome, IntPtr pNativeHome);
     }  // class MngdRefCustomMarshaler
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal struct AsAnyMarshaler
     {
         private const ushort VTHACK_ANSICHAR = 253;
@@ -1283,7 +1263,6 @@ namespace  System.StubHelpers {
     }  // struct AsAnyMarshaler
 
 #if FEATURE_COMINTEROP
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class NullableMarshaler
     {    
         static internal IntPtr ConvertToNative<T>(ref Nullable<T> pManaged) where T : struct
@@ -1345,7 +1324,6 @@ namespace  System.StubHelpers {
         internal static extern System.Type GetTypeFromWinRTTypeName(string typeName, out bool isPrimitive);
     }
     
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class SystemTypeMarshaler
     {   
         internal static unsafe void ConvertToNative(System.Type managedType, TypeNameNative *pNativeType)
@@ -1432,7 +1410,6 @@ namespace  System.StubHelpers {
     }  // class SystemTypeMarshaler
 
     // For converting WinRT's Windows.Foundation.HResult into System.Exception and vice versa.
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class HResultExceptionMarshaler
     {
         static internal unsafe int ConvertToNative(Exception ex)
@@ -1470,7 +1447,6 @@ namespace  System.StubHelpers {
         }
     }  // class HResultExceptionMarshaler
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal static class KeyValuePairMarshaler
     {    
         internal static IntPtr ConvertToNative<K, V>([In] ref KeyValuePair<K, V> pair)
@@ -1535,7 +1511,6 @@ namespace  System.StubHelpers {
         public bool m_owned;
     }  // class CleanupWorkListElement
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     internal sealed class CleanupWorkList
     {
         private List<CleanupWorkListElement> m_list = new List<CleanupWorkListElement>();
@@ -1546,7 +1521,6 @@ namespace  System.StubHelpers {
             m_list.Add(elem);
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public void Destroy()
         {
             for (int i = m_list.Count - 1; i >= 0; i--)
@@ -1557,7 +1531,6 @@ namespace  System.StubHelpers {
         }
     }  // class CleanupWorkList
 
-    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
     [SuppressUnmanagedCodeSecurityAttribute()]
     internal static class StubHelpers
     {
@@ -1594,7 +1567,6 @@ namespace  System.StubHelpers {
             return SafeHandleAddRef(handle, ref element.m_owned);
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         static internal void DestroyCleanupList(ref CleanupWorkList pCleanupWorkList)
         {
             if (pCleanupWorkList != null)
@@ -1656,7 +1628,6 @@ namespace  System.StubHelpers {
         }
 
         // Releases the SH (to be called from finally block).
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         static internal void SafeHandleRelease(SafeHandle pHandle)
         {
             if (pHandle == null)
index 70e6b45..131d51a 100644 (file)
@@ -24,13 +24,11 @@ namespace System.Threading
          *                        long
          *****************************/
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static int Increment(ref int location)
         {
             return Add(ref location, 1);
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static long Increment(ref long location)
         {
             return Add(ref location, 1);
@@ -42,7 +40,6 @@ namespace System.Threading
          *                        long
          *****************************/
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static int Decrement(ref int location)
         {
             return Add(ref location, -1);
@@ -64,7 +61,6 @@ namespace System.Threading
          *****************************/
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static extern int Exchange(ref int location1, int value);
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -77,14 +73,11 @@ namespace System.Threading
         public static extern double Exchange(ref double location1, double value);
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static extern Object Exchange(ref Object location1, Object value);
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static extern IntPtr Exchange(ref IntPtr location1, IntPtr value);
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static T Exchange<T>(ref T location1, T value) where T : class
         {
             _Exchange(__makeref(location1), __makeref(value));
@@ -96,7 +89,6 @@ namespace System.Threading
         }
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         private static extern void _Exchange(TypedReference location1, TypedReference value);
 
         /******************************
@@ -110,7 +102,6 @@ namespace System.Threading
          *****************************/
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static extern int CompareExchange(ref int location1, int value, int comparand);    
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -123,11 +114,9 @@ namespace System.Threading
         public static extern double CompareExchange(ref double location1, double value, double comparand);    
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static extern Object CompareExchange(ref Object location1, Object value, Object comparand);
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static extern IntPtr CompareExchange(ref IntPtr location1, IntPtr value, IntPtr comparand);
 
         /*****************************************************************
@@ -154,7 +143,6 @@ namespace System.Threading
          * for details.
          *****************************************************************/
         
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static T CompareExchange<T>(ref T location1, T value, T comparand) where T : class
         {
             // _CompareExchange() passes back the value read from location1 via local named 'value'
@@ -163,12 +151,10 @@ namespace System.Threading
         }
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         private static extern void _CompareExchange(TypedReference location1, TypedReference value, Object comparand);
 
         // BCL-internal overload that returns success via a ref bool param, useful for reliable spin locks.
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static extern int CompareExchange(ref int location1, int value, int comparand, ref bool succeeded);
 
         /******************************
@@ -178,19 +164,16 @@ namespace System.Threading
          *****************************/
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static extern int ExchangeAdd(ref int location1, int value);
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         internal static extern long ExchangeAdd(ref long location1, long value);
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static int Add(ref int location1, int value) 
         {
             return ExchangeAdd(ref location1, value) + value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static long Add(ref long location1, long value) 
         {
             return ExchangeAdd(ref location1, value) + value;
index af96336..fdbc384 100644 (file)
@@ -74,7 +74,6 @@ namespace System.Threading {
         **             own the lock.
         =========================================================================*/
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static extern void Exit(Object obj);
     
         /*=========================================================================
index 68b7685..dcb8213 100644 (file)
@@ -34,13 +34,11 @@ namespace System.Threading
         {
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public Mutex(bool initiallyOwned, String name, out bool createdNew)
             : this(initiallyOwned, name, out createdNew, (MutexSecurity)null)
         {
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         internal unsafe Mutex(bool initiallyOwned, String name, out bool createdNew, MutexSecurity mutexSecurity)
         {
             if (name == string.Empty)
@@ -60,7 +58,6 @@ namespace System.Threading
             CreateMutexWithGuaranteedCleanup(initiallyOwned, name, out createdNew, secAttrs);
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         internal void CreateMutexWithGuaranteedCleanup(bool initiallyOwned, String name, out bool createdNew, Win32Native.SECURITY_ATTRIBUTES secAttrs)
         {
             RuntimeHelpers.CleanupCode cleanupCode = new RuntimeHelpers.CleanupCode(MutexCleanupCode);
@@ -83,7 +80,6 @@ namespace System.Threading
             Win32Native.SECURITY_ATTRIBUTES m_secAttrs;
             Mutex m_mutex;
 
-            [PrePrepareMethod]
             internal MutexTryCodeHelper(bool initiallyOwned,MutexCleanupInfo cleanupInfo, String name, Win32Native.SECURITY_ATTRIBUTES secAttrs, Mutex mutex)
             {
                 Debug.Assert(name == null || name.Length != 0);
@@ -95,7 +91,6 @@ namespace System.Threading
                 m_mutex = mutex;
             }
 
-            [PrePrepareMethod]
             internal void MutexTryCode(object userData)
             {  
                 SafeWaitHandle mutexHandle = null;
@@ -149,7 +144,6 @@ namespace System.Threading
             }
         }
 
-        [PrePrepareMethod]
         private void MutexCleanupCode(Object userData, bool exceptionThrown)
         {
             MutexCleanupInfo cleanupInfo = (MutexCleanupInfo) userData;
@@ -177,21 +171,17 @@ namespace System.Threading
             }
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public Mutex(bool initiallyOwned, String name) : this(initiallyOwned, name, out dummyBool) {
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public Mutex(bool initiallyOwned) : this(initiallyOwned, null, out dummyBool)
         {
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public Mutex() : this(false, null, out dummyBool)
         {
         }
         
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         private Mutex(SafeWaitHandle handle)
         {
             SetHandleInternal(handle);
@@ -290,7 +280,6 @@ namespace System.Threading
         // Note: To call ReleaseMutex, you must have an ACL granting you
         // MUTEX_MODIFY_STATE rights (0x0001).  The other interesting value
         // in a Mutex's ACL is MUTEX_ALL_ACCESS (0x1F0001).
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public void ReleaseMutex()
         {
             if (Win32Native.ReleaseMutex(safeWaitHandle))
@@ -302,7 +291,6 @@ namespace System.Threading
             }
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         static int CreateMutexHandle(bool initiallyOwned, String name, Win32Native.SECURITY_ATTRIBUTES securityAttribute, out SafeWaitHandle mutexHandle)
         {
             int errorCode;
index 20d56ba..f4b3c79 100644 (file)
@@ -130,7 +130,6 @@ namespace System.Threading
 
         // Method called when the CLR does a wait operation
         [CLSCompliant(false)]
-        [PrePrepareMethod]
         public virtual int Wait(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)
         {
             return WaitHelper(waitHandles, waitAll, millisecondsTimeout);
@@ -138,8 +137,6 @@ namespace System.Threading
 
         // Method that can be called by Wait overrides
         [CLSCompliant(false)]
-        [PrePrepareMethod]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         protected static int WaitHelper(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)
         {
             if (waitHandles == null)
@@ -154,9 +151,7 @@ namespace System.Threading
         // Static helper to which the above method can delegate to in order to get the default
         // COM behavior.
         [CLSCompliant(false)]
-        [PrePrepareMethod]
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         private static extern int WaitHelperNative(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout);
 
         public static void SetSynchronizationContext(SynchronizationContext syncContext)
index 319ae1c..d280027 100644 (file)
@@ -211,7 +211,6 @@ namespace System.Threading {
 
         extern public new int ManagedThreadId
         {
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
             [MethodImplAttribute(MethodImplOptions.InternalCall)]
             get;
         }
@@ -339,10 +338,8 @@ namespace System.Threading {
            a explict busy loop because the hardware can be informed that it is busy waiting. */
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         private static extern void SpinWaitInternal(int iterations);
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static new void SpinWait(int iterations)
         {
             SpinWaitInternal(iterations);
@@ -350,17 +347,14 @@ namespace System.Threading {
 
         [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
         [SuppressUnmanagedCodeSecurity]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         private static extern bool YieldInternal();
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         internal static new bool Yield()
         {
             return YieldInternal();
         }
         
         public static new Thread CurrentThread {
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
             get {
                 Contract.Ensures(Contract.Result<Thread>() != null);
                 return GetCurrentThreadNative();
@@ -394,14 +388,12 @@ namespace System.Threading {
         /*=========================================================================
         ** Clean up the thread when it goes away.
         =========================================================================*/
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         ~Thread()
         {
             // Delegate to the unmanaged portion.
             InternalFinalize();
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         private extern void InternalFinalize();
 
index 1002aa0..adf0615 100644 (file)
@@ -713,7 +713,6 @@ namespace System.Threading
             registeredWaitHandle = handle;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         internal void SetWaitObject(WaitHandle waitObject)
         {
             // needed for DangerousAddRef
@@ -731,7 +730,6 @@ namespace System.Threading
             }
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         internal bool Unregister(
              WaitHandle     waitObject          // object to be notified when all callbacks to delegates have completed
              )
@@ -1515,7 +1513,6 @@ namespace System.Threading
         }
 
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         private static extern bool BindIOCompletionCallbackNative(IntPtr fileHandle);
     }
 }
index c874b08..93d2922 100644 (file)
@@ -107,7 +107,6 @@ namespace System.Threading
             {
             }
 
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
             protected override bool ReleaseHandle()
             {
                 return DeleteAppDomainTimer(handle);
@@ -204,7 +203,6 @@ namespace System.Threading
 
         [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
         [SuppressUnmanagedCodeSecurity]
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         static extern bool DeleteAppDomainTimer(IntPtr handle);
 
         #endregion
index 3894b43..c94a69a 100644 (file)
@@ -26,7 +26,6 @@ namespace System.Threading
     //
     public static class Volatile
     {
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public static bool Read(ref bool location)
         {
@@ -38,7 +37,6 @@ namespace System.Threading
             return value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [CLSCompliant(false)]
         [System.Runtime.Versioning.NonVersionable]
         public static sbyte Read(ref sbyte location)
@@ -51,7 +49,6 @@ namespace System.Threading
             return value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public static byte Read(ref byte location)
         {
@@ -63,7 +60,6 @@ namespace System.Threading
             return value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public static short Read(ref short location)
         {
@@ -75,7 +71,6 @@ namespace System.Threading
             return value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [CLSCompliant(false)]
         [System.Runtime.Versioning.NonVersionable]
         public static ushort Read(ref ushort location)
@@ -88,7 +83,6 @@ namespace System.Threading
             return value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public static int Read(ref int location)
         {
@@ -100,7 +94,6 @@ namespace System.Threading
             return value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [CLSCompliant(false)]
         [System.Runtime.Versioning.NonVersionable]
         public static uint Read(ref uint location)
@@ -114,7 +107,6 @@ namespace System.Threading
         }
 
 #if BIT64
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public static long Read(ref long location)
         {
@@ -126,7 +118,6 @@ namespace System.Threading
             return value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [CLSCompliant(false)]
         [System.Runtime.Versioning.NonVersionable]
         public static ulong Read(ref ulong location)
@@ -139,7 +130,6 @@ namespace System.Threading
             return value;
         }
 #else
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static long Read(ref long location)
         {
             //
@@ -151,7 +141,6 @@ namespace System.Threading
             return Interlocked.CompareExchange(ref location, 0, 0);
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [CLSCompliant(false)]
         public static ulong Read(ref ulong location)
         {
@@ -169,7 +158,6 @@ namespace System.Threading
         }
 #endif
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public static IntPtr Read(ref IntPtr location)
         {
@@ -181,7 +169,6 @@ namespace System.Threading
             return value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [CLSCompliant(false)]
         [System.Runtime.Versioning.NonVersionable]
         public static UIntPtr Read(ref UIntPtr location)
@@ -194,7 +181,6 @@ namespace System.Threading
             return value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public static float Read(ref float location)
         {
@@ -206,7 +192,6 @@ namespace System.Threading
             return value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public static double Read(ref double location)
         {
@@ -219,7 +204,6 @@ namespace System.Threading
             return Interlocked.CompareExchange(ref location, 0, 0);
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public static T Read<T>(ref T location) where T : class
         {
@@ -234,7 +218,6 @@ namespace System.Threading
 
 
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public static void Write(ref bool location, bool value)
         {
@@ -245,7 +228,6 @@ namespace System.Threading
             location = value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [CLSCompliant(false)]
         [System.Runtime.Versioning.NonVersionable]
         public static void Write(ref sbyte location, sbyte value)
@@ -257,7 +239,6 @@ namespace System.Threading
             location = value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public static void Write(ref byte location, byte value)
         {
@@ -268,7 +249,6 @@ namespace System.Threading
             location = value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public static void Write(ref short location, short value)
         {
@@ -279,7 +259,6 @@ namespace System.Threading
             location = value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [CLSCompliant(false)]
         [System.Runtime.Versioning.NonVersionable]
         public static void Write(ref ushort location, ushort value)
@@ -291,7 +270,6 @@ namespace System.Threading
             location = value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public static void Write(ref int location, int value)
         {
@@ -302,7 +280,6 @@ namespace System.Threading
             location = value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [CLSCompliant(false)]
         [System.Runtime.Versioning.NonVersionable]
         public static void Write(ref uint location, uint value)
@@ -315,7 +292,6 @@ namespace System.Threading
         }
 
 #if BIT64
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public static void Write(ref long location, long value)
         {
@@ -326,7 +302,6 @@ namespace System.Threading
             location = value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [CLSCompliant(false)]
         [System.Runtime.Versioning.NonVersionable]
         public static void Write(ref ulong location, ulong value)
@@ -338,7 +313,6 @@ namespace System.Threading
             location = value;
         }
 #else
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static void Write(ref long location, long value)
         {
             //
@@ -350,7 +324,6 @@ namespace System.Threading
             Interlocked.Exchange(ref location, value);
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [CLSCompliant(false)]
         public static void Write(ref ulong location, ulong value)
         {
@@ -374,7 +347,6 @@ namespace System.Threading
         }
 #endif
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public static void Write(ref IntPtr location, IntPtr value)
         {
@@ -385,7 +357,6 @@ namespace System.Threading
             location = value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [CLSCompliant(false)]
         [System.Runtime.Versioning.NonVersionable]
         public static void Write(ref UIntPtr location, UIntPtr value)
@@ -397,7 +368,6 @@ namespace System.Threading
             location = value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public static void Write(ref float location, float value)
         {
@@ -408,7 +378,6 @@ namespace System.Threading
             location = value;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public static void Write(ref double location, double value)
         {
@@ -421,7 +390,6 @@ namespace System.Threading
             Interlocked.Exchange(ref location, value);
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         [System.Runtime.Versioning.NonVersionable]
         public static void Write<T>(ref T location, T value) where T : class
         {
index 668ded3..d4dcd71 100644 (file)
@@ -100,7 +100,6 @@ namespace System.Threading
 
         public SafeWaitHandle SafeWaitHandle 
         {
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
             get
             {
                 if (safeWaitHandle == null)
@@ -110,7 +109,6 @@ namespace System.Threading
                 return safeWaitHandle;
             }
 
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
             set
             {
                  // Set safeWaitHandle and waitHandle in a CER so we won't take
@@ -243,7 +241,6 @@ namespace System.Threading
         ========================================================================*/
         
         [MethodImplAttribute(MethodImplOptions.InternalCall)] 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         private static extern int WaitMultiple(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext, bool WaitAll);
 
         public static bool WaitAll(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext)
@@ -348,7 +345,6 @@ namespace System.Threading
         ** (if in a synchronized context) is exited before the wait and reacquired 
         ========================================================================*/
         
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int WaitAny(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext)
         {
             if (waitHandles==null)
@@ -404,7 +400,6 @@ namespace System.Threading
                 return ret;
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int WaitAny(
                                     WaitHandle[] waitHandles, 
                                     TimeSpan timeout,
@@ -417,7 +412,6 @@ namespace System.Threading
             }
             return WaitAny(waitHandles,(int)tm, exitContext);
         }
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int WaitAny(WaitHandle[] waitHandles, TimeSpan timeout)
         {
             return WaitAny(waitHandles, timeout, true); 
@@ -427,13 +421,11 @@ namespace System.Threading
         /*========================================================================
         ** Shorthand for WaitAny with timeout = Timeout.Infinite and exitContext = true
         ========================================================================*/
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int WaitAny(WaitHandle[] waitHandles)
         {
             return WaitAny(waitHandles, Timeout.Infinite, true);
         }
 
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public static int WaitAny(WaitHandle[] waitHandles, int millisecondsTimeout)
         {
             return WaitAny(waitHandles, millisecondsTimeout, true);