diff options
Diffstat (limited to 'src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IteratorToEnumeratorAdapter.cs')
-rw-r--r-- | src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IteratorToEnumeratorAdapter.cs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IteratorToEnumeratorAdapter.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IteratorToEnumeratorAdapter.cs index f1b799aa84..e219a86769 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IteratorToEnumeratorAdapter.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IteratorToEnumeratorAdapter.cs @@ -7,6 +7,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Diagnostics; using System.Diagnostics.Contracts; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; @@ -28,11 +29,10 @@ namespace System.Runtime.InteropServices.WindowsRuntime { private IterableToEnumerableAdapter() { - Contract.Assert(false, "This class is never instantiated"); + Debug.Assert(false, "This class is never instantiated"); } // This method is invoked when GetEnumerator is called on a WinRT-backed implementation of IEnumerable<T>. - [SecurityCritical] internal IEnumerator<T> GetEnumerator_Stub<T>() { IIterable<T> _this = JitHelpers.UnsafeCast<IIterable<T>>(this); @@ -43,7 +43,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime // and it is possible that the implementation supports IEnumerable<Type>/IEnumerable<string>/IEnumerable<Exception>/ // IEnumerable<array>/IEnumerable<delegate> rather than IEnumerable<T> because T is assignable from Type/string/ // Exception/array/delegate via co-variance. - [SecurityCritical] internal IEnumerator<T> GetEnumerator_Variance_Stub<T>() where T : class { bool fUseString; @@ -70,7 +69,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime { private BindableIterableToEnumerableAdapter() { - Contract.Assert(false, "This class is never instantiated"); + Debug.Assert(false, "This class is never instantiated"); } private sealed class NonGenericToGenericIterator : IIterator<object> @@ -87,7 +86,6 @@ namespace System.Runtime.InteropServices.WindowsRuntime } // This method is invoked when GetEnumerator is called on a WinRT-backed implementation of IEnumerable. - [SecurityCritical] internal IEnumerator GetEnumerator_Stub() { IBindableIterable _this = JitHelpers.UnsafeCast<IBindableIterable>(this); @@ -123,10 +121,10 @@ namespace System.Runtime.InteropServices.WindowsRuntime { // The enumerator has not been advanced to the first element yet. if (!m_isInitialized) - ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumNotStarted); + ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumNotStarted(); // The enumerator has reached the end of the collection if (!m_hadCurrent) - ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumEnded); + ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumEnded(); return m_current; } } @@ -137,15 +135,14 @@ namespace System.Runtime.InteropServices.WindowsRuntime { // The enumerator has not been advanced to the first element yet. if (!m_isInitialized) - ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumNotStarted); + ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumNotStarted(); // The enumerator has reached the end of the collection if (!m_hadCurrent) - ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumEnded); + ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumEnded(); return m_current; } } - [SecuritySafeCritical] public bool MoveNext() { // If we've passed the end of the iteration, IEnumerable<T> should return false, while @@ -187,7 +184,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime // Translate E_CHANGED_STATE into an InvalidOperationException for an updated enumeration if (Marshal.GetHRForException(e) == __HResults.E_CHANGED_STATE) { - ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumFailedVersion); + ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion(); } else { |