I’m surprised to get a compile error in release mode with the following code.
I have a DEBUG only function declared
#If DEBUG Then
Private Function DEBUG_Check() As Boolean
'Do some checks
If (checks OK) Return True Else Return False
End Function
#End If
Then in the code I use it in a Debug.Assert() as follow:
Debug.Assert(DEBUG_Check())
I get a compilation error “DEBUG_Check is not declared”
I thought calls to Debug.Assert were completely removed from Release compile?
Because you’ve wrapped your code within compiler tags:
These tags tell the compiler to completely skip the code within the tag if DEBUG is not defined, which it is not in release mode, so in release mode there is no such code as DEBUG_Check().
Related to the later comments:
http://msdn.microsoft.com/en-us/library/ttcc4x86.aspx
This article is self conflicting. At one point it says:
Later, however, it says:
My interpretation is that Debug.Assert(params) is still called but to an empty shell method in release as opposed to a functional method in Debug mode. As such, parameters passed must still be valid.