Calls to PowerScript from .NET functions are not supported

You cannot call a .NET method inside a conditional code block if that method calls back into PowerScript functions.