Use Debug.Assert : Debug « Development « VB.Net Tutorial






Imports System.IO
Module Module1

    Sub Main()
        Dim FileStr As StreamWriter

        System.Diagnostics.Debug.Assert(Not (FileStr Is Nothing), "FileStr is NULL")

        System.Diagnostics.Debug.Assert(Directory.Exists("\Temp"), "\Temp does not exist")

    End Sub

End Module








7.20.Debug
7.20.1.Convert Debug message to a file
7.20.2.Debug Status
7.20.3.Use Debug.Assert