DebuggerDisableUserUnhandledExceptionsAttribute 类     
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
如果附加支持 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 AttributePublic NotInheritable Class DebuggerDisableUserUnhandledExceptionsAttribute
Inherits Attribute- 继承
- 属性
注解
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() | 
属性
| TypeId | 在派生类中实现时,获取此 Attribute的唯一标识符。(继承自 Attribute) | 
方法
| Equals(Object) | 返回一个值,该值指示此实例是否等于指定对象。(继承自 Attribute) | 
| GetHashCode() | 返回此实例的哈希代码。(继承自 Attribute) | 
| GetType() | 获取当前实例的 Type。(继承自 Object) | 
| IsDefaultAttribute() | 在派生类中重写时,指示此实例的值是否为派生类的默认值。(继承自 Attribute) | 
| Match(Object) | 在派生类中重写时,返回一个值,该值指示此实例是否等于指定对象。(继承自 Attribute) | 
| MemberwiseClone() | 创建当前 Object的浅表副本。(继承自 Object) | 
| ToString() | 返回一个表示当前对象的字符串。(继承自 Object) |