473,322 Members | 1,425 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Console application failing to catch errors

Hi all

I have a console application that runs every night via a scheduled task,
there is a try-catch block in my Main class, whenever an error is caught it
is written to a log file and then emailed to several people. The
application is run using a domain service account, if the program is
successful it emails this result fine.

The problem is, the catch doesn't seem to perform correctly if the program
fails, all I end up with is an entry in the event-log with almost
meaningless error details.

My only thought was that maybe these errors are occurring in my
multi-threaded calls (there are a few).

Is there any reason why the catch would fail? I'm running out of ideas.

Thanks
Kev
Apr 25 '07 #1
6 2010
Hi Kev,

Perhaps you don't have permission on the log file and the application is
bombing out before the sending mail portion of the program is sent.
--
Regards
Lee Alexander
www.feedghost.com
An RSS Reader for Vista & XP
Synchronize, search, tag and share.

"Mantorok" <no**@none.comwrote in message
news:f0*********@newsfeed.th.ifl.net...
Hi all

I have a console application that runs every night via a scheduled task,
there is a try-catch block in my Main class, whenever an error is caught
it is written to a log file and then emailed to several people. The
application is run using a domain service account, if the program is
successful it emails this result fine.

The problem is, the catch doesn't seem to perform correctly if the program
fails, all I end up with is an entry in the event-log with almost
meaningless error details.

My only thought was that maybe these errors are occurring in my
multi-threaded calls (there are a few).

Is there any reason why the catch would fail? I'm running out of ideas.

Thanks
Kev

Apr 25 '07 #2
On Wed, 25 Apr 2007 10:43:49 +0100, "Mantorok" <no**@none.comwrote:
>My only thought was that maybe these errors are occurring in my
multi-threaded calls (there are a few).
Quite possibly. If you're doing stuff in worker threads you need to
have an exception handler on each worker thread that either logs the
error or communicates the error back to the main thread. If a worker
thread fails due to an exception it won't communicate anything to the
main thread by default, it will simply shut down.
--
http://www.kynosarges.de
Apr 25 '07 #3

"Chris Nahr" <di******@kynosarges.dewrote in message
news:td********************************@4ax.com...
On Wed, 25 Apr 2007 10:43:49 +0100, "Mantorok" <no**@none.comwrote:
>>My only thought was that maybe these errors are occurring in my
multi-threaded calls (there are a few).

Quite possibly. If you're doing stuff in worker threads you need to
have an exception handler on each worker thread that either logs the
error or communicates the error back to the main thread. If a worker
thread fails due to an exception it won't communicate anything to the
main thread by default, it will simply shut down.
I'm pretty sure that's the problem, how do you catch exceptions from
additional threads?

Thanks
Kev
Apr 25 '07 #4
Permissions is ok as the log file is being written to before-hand.

Kev

"Lee Alexander" <lee@feedghost_dot_comwrote in message
news:uo**************@TK2MSFTNGP05.phx.gbl...
Hi Kev,

Perhaps you don't have permission on the log file and the application is
bombing out before the sending mail portion of the program is sent.
--
Regards
Lee Alexander
www.feedghost.com
An RSS Reader for Vista & XP
Synchronize, search, tag and share.

"Mantorok" <no**@none.comwrote in message
news:f0*********@newsfeed.th.ifl.net...
>Hi all

I have a console application that runs every night via a scheduled task,
there is a try-catch block in my Main class, whenever an error is caught
it is written to a log file and then emailed to several people. The
application is run using a domain service account, if the program is
successful it emails this result fine.

The problem is, the catch doesn't seem to perform correctly if the
program fails, all I end up with is an entry in the event-log with almost
meaningless error details.

My only thought was that maybe these errors are occurring in my
multi-threaded calls (there are a few).

Is there any reason why the catch would fail? I'm running out of ideas.

Thanks
Kev


Apr 25 '07 #5

"Chris Nahr" <di******@kynosarges.dewrote in message
news:td********************************@4ax.com...
On Wed, 25 Apr 2007 10:43:49 +0100, "Mantorok" <no**@none.comwrote:
>>My only thought was that maybe these errors are occurring in my
multi-threaded calls (there are a few).

Quite possibly. If you're doing stuff in worker threads you need to
have an exception handler on each worker thread that either logs the
error or communicates the error back to the main thread. If a worker
thread fails due to an exception it won't communicate anything to the
main thread by default, it will simply shut down.
It is that, I'm now handling my exceptions inside the appropriate threads
and it's working now.

Thanks
Kev
Apr 25 '07 #6
On Wed, 25 Apr 2007 14:54:33 +0100, "Mantorok" <no**@none.comwrote:
>I'm pretty sure that's the problem, how do you catch exceptions from
additional threads?
In the same way as usual, just make sure the exception handler runs on
the thread in question...
--
http://www.kynosarges.de
Apr 25 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Job Lot | last post by:
How can I terminate console application in Try…Catch…Finally…End Try block so that code in Finally gets executed. If I use End statement Finally does not get executed. Following is my code...
0
by: Bryan Olson | last post by:
New and improved! Love Python's stack-tracing error messages, but hate the way GUI applications throw the messages away and crash silently? Here's a module to show Python error messages that...
17
by: MumboJumbo | last post by:
Hi I have a really basic question hopefully some can help me with: Can you write a (i.e. one) C# project that works from the cmd line and gui? I seems if i write a GUI app it can't write to...
3
by: Dean Slindee | last post by:
I have a exception handling class that could be called from either a windows project app or a console project app. Is there any way for this class to determine which type of app called it without...
5
by: Nak | last post by:
Hi there, I have a very simple console application that I'm trying to handle the thread exception on, as I understand it there is no Application object available to a console application, so I...
0
by: Mythran | last post by:
I can draw onto the console window where I want using a mixture of API calls and the System.Drawing namespace (.Net 1.1). I am trying to install hooks for the window to catch a resize or another...
1
by: John Wright | last post by:
I am running a console application that connects to an Access database (8 million rows) and converts it to a text file and then cleans and compacts the database. When it runs I get the following...
0
by: asadikhan | last post by:
I need to call a console app (dtexec) from a windows service in a client/server architecture. I have the application setup so that the client application is called with a package name, which makes...
0
by: Stephen Thomas | last post by:
Hi there I wonder if any one has encountered this problem or can suggest what is wrong. I am trying the a procedure from the msn site but get the following message: Error 1 The type or...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.