CSharpTest.Net
DebugAssertionFailedException Class
Members  Example  See Also  Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net Namespace : DebugAssertionFailedException Class

Glossary Item Box

Exception class: DebugAssertionFailedException Debug Assertion Failed: {0}

Syntax

Visual Basic (Declaration) 
<SerializableAttribute()>
Public Class DebugAssertionFailedException 
   Inherits System.ApplicationException
C# 
[SerializableAttribute()]
public class DebugAssertionFailedException : System.ApplicationException 

Example

Library/Library.Test/LockingTests/TestDebugLocking.cs

C#Copy Code
DebugLockFactory<SimpleReadWriteLocking> factory = new DebugLockFactory<SimpleReadWriteLocking>(
    false, 0, 1, false, 1);

using (ILockStrategy lck = factory.Create())
{
    using (lck.Write())
    using (lck.Write()) //second lock, allow recurse 1 time as per constructor
    {
        try { using (lck.Write()) { Assert.Fail(); } }
        catch (Exception ex)
        {
            Assert.IsTrue(ex is DebugAssertionFailedException);//nesting prohibited by debug lock
        }
    }

    using (lck.Read())
    using (lck.Read()) //second lock, allow recurse 1 time as per constructor
    {
        try { using (lck.Read()) { Assert.Fail(); } }
        catch (Exception ex)
        {
            Assert.IsTrue(ex is DebugAssertionFailedException);//nesting prohibited by debug lock
        }
    }
}
VB.NETCopy Code
Dim factory As New DebugLockFactory(Of SimpleReadWriteLocking)(False, 0, 1, False, 1)

Using lck As ILockStrategy = factory.Create()
    Using lck.Write()
        Using lck.Write()
            'second lock, allow recurse 1 time as per constructor
            Try
                Using lck.Write()
                    Assert.Fail()
                End Using
            Catch ex As Exception
                    'nesting prohibited by debug lock
                Assert.IsTrue(TypeOf ex Is DebugAssertionFailedException)
            End Try
        End Using
    End Using

    Using lck.Read()
        Using lck.Read()
            'second lock, allow recurse 1 time as per constructor
            Try
                Using lck.Read()
                    Assert.Fail()
                End Using
            Catch ex As Exception
                    'nesting prohibited by debug lock
                Assert.IsTrue(TypeOf ex Is DebugAssertionFailedException)
            End Try
        End Using
    End Using
End Using

Inheritance Hierarchy

System.Object
   System.Exception
      System.ApplicationException
         CSharpTest.Net.DebugAssertionFailedException

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys