Dynamics AX: Remove Empty Code Block Warnings

AX is very picky about having SOMETHING to do inside of a code block.  For example, the compiler will issue the warning "Empty compound statement." when compiling the following code:
boolean bob;

try
{
     //fancy code here
}
catch
{
} //warning here

If you want to suppress this error, you can call Global::exceptionTextFallThrough() method.  This method does absolutely nothing (right click and go to definition to see for yourself), but it does satisfy the compiler enough to remove the warning.

boolean bob;

try
{
     //fancy code here
}
catch
{
     //This does nothing but suppress the warning
      Global::exceptionTextFallThrough();
}


Comments