473,396 Members | 2,151 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,396 software developers and data experts.

Exception weirdness

Hi all,

I'm trying to debug a program I have.

I have a windows service that has a timer which goes off to check for
some files and process them. The event called to handle the Elaspsed
event is as such:

private void ProcessFiles( object sender, ElapsedEventArgs e ) {
string[] files;
int x;

timer.Enabled = false;

files = Directory.GetFiles( DeliveryPath, "*.xml" );

for( int i = 0 ; !Environment.HasShutdownStarted && !IsPaused && i <
files.Length ; i += 1 ) {
ProcessFile( files[ i ] );
x = 1;
}

timer.Enabled = true;
}

private void ProcessFile( string fileName ) {
try {
// Do processing
}
catch( Exception e ) {
// Handle error (do some logging)
}
finally {
// Do some cleanup
}

return;
}

The odd thing is that the exception fires in ProcessFile, all the code
for the handler runs as well as the Finally block.. but the debugger
never goes to the return; line and its as if I hit Continue. The timer
doesn't go off anymore, nor does the loop finish processing. The
process continues to run, but nothing more happens.

Any ideas?

Nov 17 '05 #1
2 1133
Does your exception handler generate any exception? That would cause
all the problems you described. You won't hit the return statement and
the timer won't go off again because you turn it on only after the loop
completes, which it never will. And if IIRC, the CLR swallows
exceptions that happen on threadpool threads (like yours), so you'd
never notice it either.

Regards
Senthil

Nov 17 '05 #2
Senthil,

It didn't seem to be.. but after I added some exception handlers to
methods called within the catch{} block, things seem to be working.

I guess that was my problem.. I expected exceptions in a catch{} block
to be raised, not swallowed somewhere.

Andy

Nov 17 '05 #3

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

Similar topics

1
by: Andrew Straw | last post by:
I'm running into trouble when calling a 3rd party library (the Intel IPP library to do some fast math on a P4 processor). This is on debian linux 2.6.7 using python 2.3.4. I've been using Pyrex...
5
by: David Thielen | last post by:
Hi; I am creating png files in my ASP .NET app. When I am running under Windows 2003/IIS 6, the file is not given the security permissions it should have. It does not have any permission for...
4
by: CharlesA | last post by:
Hi folks, I'm working on code from Herb Schildt's book in which he says that an exception can be thrown by one method and caught by another class ExcTest { public static void genException() {...
7
by: Chris | last post by:
Hello all... I have a program with the following structure (all classes mentioned are of my own creation, and none of the classes contain try or catch blocks): - main() consists of a large...
2
by: JYA | last post by:
Hi. I was writing an xmltv parser using python when I faced some weirdness that I couldn't explain. What I'm doing, is read an xml file, create another dom object and copy the element from...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.