'GetApiResponse returns null

We have the following code snippet that processes eCheck charge via Authorize.net (using their SDK for .NET Framework). Every once in a while, the "response" stays null after all the retries. No error code is returned. Does anyone have an idea why this happens and how to fix it?

        var request = new createTransactionRequest {transactionRequest = transactionRequest};
        var controller = new createTransactionController(request);
        controller.Execute();
        var response = controller.GetApiResponse();
        short retryCount = 2;
        short i = 0;
        while(response == null && i < retryCount)
        {
            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(2));
            response = controller.GetApiResponse();
            i++;
        }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source