次の方法で共有


DebuggerDisableUserUnhandledExceptionsAttribute クラス

定義

BreakForUserUnhandledException(Exception) API をサポートする .NET デバッガーがアタッチされている場合、BreakForUserUnhandledException(Exception) が呼び出されない限り、この属性を持つメソッドによって例外がキャッチされても、デバッガーはユーザーが処理しない例外を中断しません。

public ref class DebuggerDisableUserUnhandledExceptionsAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Method)]
public sealed class DebuggerDisableUserUnhandledExceptionsAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method)>]
type DebuggerDisableUserUnhandledExceptionsAttribute = class
    inherit Attribute
Public NotInheritable Class DebuggerDisableUserUnhandledExceptionsAttribute
Inherits Attribute
継承
DebuggerDisableUserUnhandledExceptionsAttribute
属性

注釈

Visual Studio では、非同期のユーザーがハンドルしない例外をキャッチするためのサポートが追加され、既定で有効になっています。 この機能は、同期メソッドには長い間存在してきましたが、async/await メソッドには存在しません。 BreakForUserUnhandledException(Exception) メソッドは、特定のメソッドの機能を無効にします。 これは、ユーザー コードを通じて伝達されるが、フレームワーク コードによって処理されることが予想される例外に役立ちます。 この属性は、BreakForUserUnhandledException(Exception)と共に使用するように設計されています。

[MethodImpl(MethodImplOptions.NoInlining)]
[DebuggerDisableUserUnhandledExceptions]
static async Task InvokeUserCode(Func<Task> userCode)
{
  try
  {
      await userCode();
  }
  catch (Exception ex)
  {
      if (TryHandleWithFilter(ex))
      {
          return; // example case where we don't want to break for user-unhandled exceptions
      }

      Debugger.BreakForUserUnhandledException(e); // debugger will stop here and show the exception if attached.
  }
}

コンストラクター

名前 説明
DebuggerDisableUserUnhandledExceptionsAttribute()

DebuggerDisableUserUnhandledExceptionsAttribute クラスの新しいインスタンスを初期化します。

プロパティ

名前 説明
TypeId

派生クラスで実装されている場合は、この Attributeの一意の識別子を取得します。

(継承元 Attribute)

メソッド

名前 説明
Equals(Object)

このインスタンスが指定したオブジェクトと等しいかどうかを示す値を返します。

(継承元 Attribute)
GetHashCode()

このインスタンスのハッシュ コードを返します。

(継承元 Attribute)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
IsDefaultAttribute()

派生クラスでオーバーライドされた場合、このインスタンスの値が派生クラスの既定値であるかどうかを示します。

(継承元 Attribute)
Match(Object)

派生クラスでオーバーライドされた場合、このインスタンスが指定したオブジェクトと等しいかどうかを示す値を返します。

(継承元 Attribute)
MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象