Click here to Skip to main content
15,892,965 members

Function hangs when called from a windows service

Saamir asked:

Open original thread
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
Tags: C#, Threads

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



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