diff options
author | Jan Kotas <jkotas@microsoft.com> | 2017-10-14 17:49:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-14 17:49:48 +0300 |
commit | 4f36c53f24375313a9b61e337ff8e8baad23c301 (patch) | |
tree | 4a019644717af38024765a45c1a6f4fb887e88fc /src/System.Private.Interop | |
parent | 6e1c8f0dcf9f670b37bf5b4500225d1156a16ce6 (diff) |
Delete contract annotations (#4722)
Diffstat (limited to 'src/System.Private.Interop')
16 files changed, 0 insertions, 64 deletions
diff --git a/src/System.Private.Interop/src/Shared/ComCallableObject.cs b/src/System.Private.Interop/src/Shared/ComCallableObject.cs index e6b7bcda8..dea259223 100644 --- a/src/System.Private.Interop/src/Shared/ComCallableObject.cs +++ b/src/System.Private.Interop/src/Shared/ComCallableObject.cs @@ -23,7 +23,6 @@ using System.Runtime.CompilerServices; using System.Threading; using System.Text; using System.Runtime; -using System.Diagnostics.Contracts; using Internal.NativeFormat; namespace System.Runtime.InteropServices diff --git a/src/System.Private.Interop/src/Shared/ComInterop.cs b/src/System.Private.Interop/src/Shared/ComInterop.cs index b73effc41..67439d8c4 100644 --- a/src/System.Private.Interop/src/Shared/ComInterop.cs +++ b/src/System.Private.Interop/src/Shared/ComInterop.cs @@ -21,7 +21,6 @@ using System.Runtime.CompilerServices; using System.Threading; using System.Text; using System.Runtime; -using System.Diagnostics.Contracts; using Internal.NativeFormat; namespace System.Runtime.InteropServices diff --git a/src/System.Private.Interop/src/Shared/Dictionary.cs b/src/System.Private.Interop/src/Shared/Dictionary.cs index dcd93fb26..d2750fa17 100644 --- a/src/System.Private.Interop/src/Shared/Dictionary.cs +++ b/src/System.Private.Interop/src/Shared/Dictionary.cs @@ -6,7 +6,6 @@ using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; using System.Threading; @@ -125,8 +124,6 @@ namespace System.Collections.Generic.Internal { get { - Contract.Ensures(Contract.Result<KeyCollection>() != null); - return new KeyCollection(this); } } @@ -135,8 +132,6 @@ namespace System.Collections.Generic.Internal { get { - Contract.Ensures(Contract.Result<ValueCollection>() != null); - return new ValueCollection(this); } } diff --git a/src/System.Private.Interop/src/Shared/DictionaryBase.cs b/src/System.Private.Interop/src/Shared/DictionaryBase.cs index 18337dfe5..fd2c3fb93 100644 --- a/src/System.Private.Interop/src/Shared/DictionaryBase.cs +++ b/src/System.Private.Interop/src/Shared/DictionaryBase.cs @@ -6,7 +6,6 @@ using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; namespace System.Collections.Generic.Internal diff --git a/src/System.Private.Interop/src/Shared/HashSet.cs b/src/System.Private.Interop/src/Shared/HashSet.cs index d115c3e55..83267003e 100644 --- a/src/System.Private.Interop/src/Shared/HashSet.cs +++ b/src/System.Private.Interop/src/Shared/HashSet.cs @@ -6,7 +6,6 @@ using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; using System.Threading; @@ -159,8 +158,6 @@ namespace System.Collections.Generic.Internal { get { - Contract.Ensures(Contract.Result<KeyCollection>() != null); - return new KeyCollection(this); } } diff --git a/src/System.Private.Interop/src/Shared/List.cs b/src/System.Private.Interop/src/Shared/List.cs index d3b612c0f..7f214a215 100644 --- a/src/System.Private.Interop/src/Shared/List.cs +++ b/src/System.Private.Interop/src/Shared/List.cs @@ -6,7 +6,6 @@ using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; namespace System.Collections.Generic.Internal @@ -29,7 +28,6 @@ namespace System.Collections.Generic.Internal public List(int capacity) { if (capacity < 0) throw new ArgumentOutOfRangeException(nameof(capacity), SR.ArgumentOutOfRange_NeedNonNegNum); - Contract.EndContractBlock(); _items = new T[capacity]; } @@ -42,7 +40,6 @@ namespace System.Collections.Generic.Internal { if (collection == null) throw new ArgumentNullException(nameof(collection)); - Contract.EndContractBlock(); ICollection<T> c = collection as ICollection<T>; @@ -86,7 +83,6 @@ namespace System.Collections.Generic.Internal { get { - Contract.Ensures(Contract.Result<int>() >= 0); return _items.Length; } set @@ -96,8 +92,6 @@ namespace System.Collections.Generic.Internal throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_SmallCapacity); } - Contract.EndContractBlock(); - if (value != _items.Length) { if (value > 0) @@ -119,7 +113,6 @@ namespace System.Collections.Generic.Internal { get { - Contract.Ensures(Contract.Result<int>() >= 0); return _size; } } @@ -136,8 +129,6 @@ namespace System.Collections.Generic.Internal throw new ArgumentOutOfRangeException(); } - Contract.EndContractBlock(); - return _items[index]; } @@ -148,8 +139,6 @@ namespace System.Collections.Generic.Internal throw new ArgumentOutOfRangeException(); } - Contract.EndContractBlock(); - _items[index] = value; _version++; } @@ -224,7 +213,6 @@ namespace System.Collections.Generic.Internal { throw new ArgumentException(SR.Argument_InvalidOffLen); } - Contract.EndContractBlock(); // Delegate rest of error checking to Array.Copy. Array.Copy(_items, index, array, arrayIndex, count); @@ -268,9 +256,6 @@ namespace System.Collections.Generic.Internal // public int IndexOf(T item) { - Contract.Ensures(Contract.Result<int>() >= -1); - Contract.Ensures(Contract.Result<int>() < Count); - return Array.IndexOf(_items, item, 0, _size); } @@ -288,10 +273,6 @@ namespace System.Collections.Generic.Internal if (index > _size) throw new ArgumentOutOfRangeException(nameof(index)); - Contract.Ensures(Contract.Result<int>() >= -1); - Contract.Ensures(Contract.Result<int>() < Count); - Contract.EndContractBlock(); - return Array.IndexOf(_items, item, index, _size - index); } @@ -312,10 +293,6 @@ namespace System.Collections.Generic.Internal if (count < 0 || index > _size - count) throw new ArgumentOutOfRangeException(nameof(count)); - Contract.Ensures(Contract.Result<int>() >= -1); - Contract.Ensures(Contract.Result<int>() < Count); - Contract.EndContractBlock(); - return Array.IndexOf(_items, item, index, count); } @@ -330,7 +307,6 @@ namespace System.Collections.Generic.Internal { throw new ArgumentOutOfRangeException(nameof(index)); } - Contract.EndContractBlock(); if (_size == _items.Length) EnsureCapacity(_size + 1); @@ -369,7 +345,6 @@ namespace System.Collections.Generic.Internal { throw new ArgumentOutOfRangeException(nameof(index)); } - Contract.EndContractBlock(); _size--; @@ -384,9 +359,6 @@ namespace System.Collections.Generic.Internal public T[] ToArray() { - Contract.Ensures(Contract.Result<T[]>() != null); - Contract.Ensures(Contract.Result<T[]>().Length == Count); - T[] array = new T[_size]; Array.Copy(_items, 0, array, 0, _size); diff --git a/src/System.Private.Interop/src/Shared/McgComHelpers.cs b/src/System.Private.Interop/src/Shared/McgComHelpers.cs index 781232011..e3f49a8bf 100644 --- a/src/System.Private.Interop/src/Shared/McgComHelpers.cs +++ b/src/System.Private.Interop/src/Shared/McgComHelpers.cs @@ -22,7 +22,6 @@ using System.Runtime.InteropServices; using System.Threading; using System.Text; using System.Runtime; -using System.Diagnostics.Contracts; using Internal.NativeFormat; using System.Runtime.CompilerServices; diff --git a/src/System.Private.Interop/src/Shared/McgIntrinsics.cs b/src/System.Private.Interop/src/Shared/McgIntrinsics.cs index cf87beacc..1f962b018 100644 --- a/src/System.Private.Interop/src/Shared/McgIntrinsics.cs +++ b/src/System.Private.Interop/src/Shared/McgIntrinsics.cs @@ -21,7 +21,6 @@ using System.Runtime.CompilerServices; using System.Threading; using System.Text; using System.Runtime; -using System.Diagnostics.Contracts; using Internal.NativeFormat; namespace System.Runtime.InteropServices diff --git a/src/System.Private.Interop/src/Shared/McgMarshal.cs b/src/System.Private.Interop/src/Shared/McgMarshal.cs index 2c3b9e5a4..3e02dd9c7 100644 --- a/src/System.Private.Interop/src/Shared/McgMarshal.cs +++ b/src/System.Private.Interop/src/Shared/McgMarshal.cs @@ -22,7 +22,6 @@ using System.Runtime.InteropServices; using System.Threading; using System.Text; using System.Runtime; -using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; using Internal.NativeFormat; diff --git a/src/System.Private.Interop/src/Shared/McgModule.cs b/src/System.Private.Interop/src/Shared/McgModule.cs index 3c41f3f20..66d604fca 100644 --- a/src/System.Private.Interop/src/Shared/McgModule.cs +++ b/src/System.Private.Interop/src/Shared/McgModule.cs @@ -25,7 +25,6 @@ using System.Runtime.CompilerServices; using System.Threading; using System.Text; using System.Runtime; -using System.Diagnostics.Contracts; using Internal.NativeFormat; using Internal.Runtime.CompilerServices; diff --git a/src/System.Private.Interop/src/Shared/McgModuleManager.cs b/src/System.Private.Interop/src/Shared/McgModuleManager.cs index 4cea22ae1..ab41c5cdd 100644 --- a/src/System.Private.Interop/src/Shared/McgModuleManager.cs +++ b/src/System.Private.Interop/src/Shared/McgModuleManager.cs @@ -24,7 +24,6 @@ using System.Runtime.CompilerServices; using System.Threading; using System.Text; using System.Runtime; -using System.Diagnostics.Contracts; using Internal.NativeFormat; namespace System.Runtime.InteropServices diff --git a/src/System.Private.Interop/src/Shared/McgTypeHelpers.cs b/src/System.Private.Interop/src/Shared/McgTypeHelpers.cs index e965835b0..4f11ab5f1 100644 --- a/src/System.Private.Interop/src/Shared/McgTypeHelpers.cs +++ b/src/System.Private.Interop/src/Shared/McgTypeHelpers.cs @@ -23,7 +23,6 @@ using System.Runtime.InteropServices; using System.Threading; using System.Text; using System.Runtime; -using System.Diagnostics.Contracts; using Internal.NativeFormat; using System.Runtime.CompilerServices; diff --git a/src/System.Private.Interop/src/Shared/WindowsRuntimeMarshal.cs b/src/System.Private.Interop/src/Shared/WindowsRuntimeMarshal.cs index f7a413505..50b8f5b88 100644 --- a/src/System.Private.Interop/src/Shared/WindowsRuntimeMarshal.cs +++ b/src/System.Private.Interop/src/Shared/WindowsRuntimeMarshal.cs @@ -7,7 +7,6 @@ using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; -using System.Diagnostics.Contracts; using System.Security; using System.Runtime.CompilerServices; using System.Threading; @@ -32,7 +31,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime throw new ArgumentNullException(nameof(addMethod)); if (removeMethod == null) throw new ArgumentNullException(nameof(removeMethod)); - Contract.EndContractBlock(); // Managed code allows adding a null event handler, the effect is a no-op. To match this behavior // for WinRT events, we simply ignore attempts to add null. @@ -64,7 +62,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime { if (removeMethod == null) throw new ArgumentNullException(nameof(removeMethod)); - Contract.EndContractBlock(); // Managed code allows removing a null event handler, the effect is a no-op. To match this behavior // for WinRT events, we simply ignore attempts to remove null. @@ -90,7 +87,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime { if (removeMethod == null) throw new ArgumentNullException(nameof(removeMethod)); - Contract.EndContractBlock(); // Delegate to managed event registration implementation or native event registration implementation // They have completely different implementation because native side has its own unique problem to solve - diff --git a/src/System.Private.Interop/src/Shared/__ComObject.cs b/src/System.Private.Interop/src/Shared/__ComObject.cs index 11277cf61..9a0706f0c 100644 --- a/src/System.Private.Interop/src/Shared/__ComObject.cs +++ b/src/System.Private.Interop/src/Shared/__ComObject.cs @@ -23,7 +23,6 @@ using System.Runtime.CompilerServices; using System.Threading; using System.Text; using System.Runtime; -using System.Diagnostics.Contracts; using Internal.NativeFormat; diff --git a/src/System.Private.Interop/src/System/Runtime/InteropServices/Marshal.cs b/src/System.Private.Interop/src/System/Runtime/InteropServices/Marshal.cs index 28a956b6d..d2b0efb5c 100644 --- a/src/System.Private.Interop/src/System/Runtime/InteropServices/Marshal.cs +++ b/src/System.Private.Interop/src/System/Runtime/InteropServices/Marshal.cs @@ -12,7 +12,6 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.Contracts; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; @@ -141,19 +140,16 @@ namespace System.Runtime.InteropServices if (structure == null) throw new ArgumentNullException(nameof(structure)); // we never had a check for generics here - Contract.EndContractBlock(); return SizeOfHelper(structure.GetType(), true); } - [Pure] public static int SizeOf(Type t) { if (t == null) throw new ArgumentNullException(nameof(t)); if (t.TypeHandle.IsGenericType() || t.TypeHandle.IsGenericTypeDefinition()) throw new ArgumentException(SR.Argument_NeedNonGenericType, nameof(t)); - Contract.EndContractBlock(); return SizeOfHelper(t, true); } @@ -192,7 +188,6 @@ namespace System.Runtime.InteropServices if (t.TypeHandle.IsGenericType() || t.TypeHandle.IsGenericTypeDefinition()) throw new ArgumentException(SR.Argument_NeedNonGenericType, nameof(t)); - Contract.EndContractBlock(); return OffsetOfHelper(t, fieldName); } @@ -902,7 +897,6 @@ namespace System.Runtime.InteropServices { if (o == null) throw new ArgumentNullException(nameof(o)); - Contract.EndContractBlock(); __ComObject co = null; @@ -1233,7 +1227,6 @@ namespace System.Runtime.InteropServices throw new ArgumentException(SR.Argument_MustHaveLayoutOrBeBlittable, structureTypeHandle.GetDisplayName()); } - Contract.EndContractBlock(); DestroyStructureHelper(ptr, structuretype); } @@ -1302,7 +1295,6 @@ namespace System.Runtime.InteropServices if (t == null) throw new ArgumentNullException(nameof(t)); - Contract.EndContractBlock(); if (t.TypeHandle.IsGenericType() || t.TypeHandle.IsGenericTypeDefinition()) throw new ArgumentException(SR.Argument_NeedNonGenericType, nameof(t)); @@ -1334,7 +1326,6 @@ namespace System.Runtime.InteropServices if (obj != null && (obj.GetType().TypeHandle.IsGenericType() || obj.GetType().TypeHandle.IsGenericTypeDefinition())) throw new ArgumentException(SR.Argument_NeedNonGenericObject, nameof(obj)); - Contract.EndContractBlock(); Variant* pVariant = (Variant*)pDstNativeVariant; *pVariant = new Variant(obj); @@ -1354,7 +1345,6 @@ namespace System.Runtime.InteropServices // Obsolete if (pSrcNativeVariant == IntPtr.Zero) throw new ArgumentNullException(nameof(pSrcNativeVariant)); - Contract.EndContractBlock(); Variant* pNativeVar = (Variant*)pSrcNativeVariant; return pNativeVar->ToObject(); @@ -1372,7 +1362,6 @@ namespace System.Runtime.InteropServices if (cVars < 0) throw new ArgumentOutOfRangeException(nameof(cVars), SR.ArgumentOutOfRange_NeedNonNegNum); - Contract.EndContractBlock(); Object[] obj = new Object[cVars]; IntPtr aNativeVar = aSrcNativeVariant; @@ -1579,7 +1568,6 @@ namespace System.Runtime.InteropServices { if (m == null) throw new ArgumentNullException(nameof(m)); - Contract.EndContractBlock(); // Note: This method is effectively a no-op in ahead-of-time compilation scenarios. In CoreCLR and Desktop, this will pre-generate // the P/Invoke, but everything is pre-generated in CoreRT. @@ -1589,7 +1577,6 @@ namespace System.Runtime.InteropServices { if (c == null) throw new ArgumentNullException(nameof(c)); - Contract.EndContractBlock(); MethodInfo[] mi = c.GetMethods(); if (mi != null) diff --git a/src/System.Private.Interop/src/System/Runtime/InteropServices/MarshalAdapter.cs b/src/System.Private.Interop/src/System/Runtime/InteropServices/MarshalAdapter.cs index 84b046a06..599eca594 100644 --- a/src/System.Private.Interop/src/System/Runtime/InteropServices/MarshalAdapter.cs +++ b/src/System.Private.Interop/src/System/Runtime/InteropServices/MarshalAdapter.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; using System.Runtime.InteropServices.ComTypes; using System.Runtime.Versioning; |