Click here to Skip to main content
15,908,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,
Please help!!!! I have a function that I am calling to automate processing of invoices. Most of the times this function works without issues but from time to time it hangs. i.e.
Here is the function:
C#
public void ProcessInvoices()
        {
            bool rt = true;
            try
            {
                rt = CaptureAllInvoices();
                if (rt)
                {

                        Write2ErrLog("------Email Invoices Started-" + DateTime.Now);
                        this.EmailInvoices();
                        Write2ErrLog("------Email Invoices Completed-" + DateTime.Now);


                        Write2ErrLog("------Email Single Invoices Started-" + DateTime.Now);
                        this.EmailSingleInvoices();
                        Write2ErrLog("------Email Single Invoices Completed-" + DateTime.Now);

                        Write2ErrLog("------Fax Invoices Started-" + DateTime.Now);
                        this.FaxInvoices(false);
                        Write2ErrLog("------Fax Invoices Completed-" + DateTime.Now);

                }
            }
            catch (Exception ex)
            {
                Write2ErrLog("---------Error in Process invoices: " + ex.Message);
            }
        }

So it gets to this.EmailInvoices() and starts processing email but stops on the first one and doesn't move to the next function call.

Please advice on an approach I can take to troubleshoot this issue. I use try catch in all my functions but nothing is being caught.

Thanks in advance

Sam
Posted
Updated 28-Jan-13 9:42am
v2
Comments
DinoRondelly 28-Jan-13 15:43pm    
Where is the code thats in this.EmailInvoices()?
Saamir 28-Jan-13 15:49pm    
it's long code that processes one invoice at a time by generating an invoice, attaching to an email and then emailing. Then loops to another invoice
DinoRondelly 28-Jan-13 15:51pm    
And you are sure its not getting "hung up" in there?

Have you stepped through the code and seen it hung up?
Saamir 28-Jan-13 15:56pm    
Haven't done that, this function will work if I try it again for the same data output. This is a random behavior.
DinoRondelly 28-Jan-13 15:59pm    
I would suggest stepping through it until it fails, its going to be hard if not impossible to determine the problem with the code sample you have provided.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900