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

Popular posts from this blog

SQL Reporting Services - Viewer broken in Non-IE Browsers: FIX

Dynamics AX 2012 - Visual Studio Team Services Custom Work Item Fields Break Version Control (Error TF237121)

Dynamics AX SysFileDeployment Framework - Deploy files automatically (using resources) to the client on login