The Labs \ Source Viewer \ SSCLI \ System.Diagnostics \ DefaultFilter

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. namespace System.Diagnostics
  16. {
  17.    
  18.    
  19.     using System;
  20.     // A Filter is used to decide whether an assert failure
  21.     // should terminate the program (or invoke the debugger).
  22.     // Typically this is done by popping up a dialog & asking the user.
  23.     //
  24.     // The default filter brings up a simple Win32 dialog with 3 buttons.
  25.    
  26.     [Serializable()]
  27.     internal abstract class AssertFilter
  28.     {
  29.        
  30.         // Called when an assert fails. This should be overridden with logic which
  31.         // determines whether the program should terminate or not. Typically this
  32.         // is done by asking the user.
  33.         //
  34.        
  35.         public abstract AssertFilters AssertFailure(string condition, string message, StackTrace location);
  36.        
  37.     }
  38.     // No data, does not need to be marked with the serializable attribute
  39.     internal class DefaultFilter : AssertFilter
  40.     {
  41.         internal DefaultFilter()
  42.         {
  43.         }
  44.        
  45.        
  46.         public override AssertFilters AssertFailure(string condition, string message, StackTrace location)
  47.         {
  48.             return (AssertFilters)Assert.ShowDefaultAssertDialog(condition, message);
  49.         }
  50.     }
  51.    
  52. }

Developer Fusion