Use throw helpers in more places, add ObjectDisposedExceptionExtensions
このコミットが含まれているのは:
1 親
19eab4d7af
コミット
c35b2d9394
9ファイル変更
+97
-130
検索条件に一致するファイルはありません
@@ -1,6 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using TerraFX.Interop.Windows;
|
||||
|
||||
@@ -21,10 +20,7 @@ internal static class HRESULTExtensions
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Assert(this HRESULT result)
|
||||
{
|
||||
if ((int)result < 0)
|
||||
{
|
||||
ThrowWin32Exception(result);
|
||||
}
|
||||
default(Win32Exception).ThrowIfFailed((int)result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -35,19 +31,6 @@ internal static class HRESULTExtensions
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Assert(this int result)
|
||||
{
|
||||
if (result < 0)
|
||||
{
|
||||
ThrowWin32Exception(result);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Throws a <see cref="Win32Exception"/>.
|
||||
/// </summary>
|
||||
/// <param name="result">The input return code.</param>
|
||||
[DoesNotReturn]
|
||||
private static void ThrowWin32Exception(int result)
|
||||
{
|
||||
throw new Win32Exception(result);
|
||||
default(Win32Exception).ThrowIfFailed(result);
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする