Premature termination of C# code without error or exception

I

Ian Sykes

I have a C# program which terminates prematurely, with no error or
exception being raised, the termination point varying with what
diagnostic code is present. The termination point appears to be
consistent between runs when the source code is not changed &
recompiled between runs.

The code is multi-threaded but I am debugging outside Visual Studio
..Net, i.e. without using any debugger.

Can anyone offer any insight into this type of problem?

Thanks in advance,

Ian
 
D

Dilip Krishnan

Id say a start would be to use good logging ;)

Ian said:
I have a C# program which terminates prematurely, with no error or
exception being raised, the termination point varying with what
diagnostic code is present. The termination point appears to be
consistent between runs when the source code is not changed &
recompiled between runs.

The code is multi-threaded but I am debugging outside Visual Studio
..Net, i.e. without using any debugger.

Can anyone offer any insight into this type of problem?

Thanks in advance,

Ian
 
I

Ian Sykes

It seems fairly certain that the cause of the "premature" termination
of my child thread was the normal termination of my main thread due to
the use of System.Threading.ThreadPool.QueueUserWorkItem() to create
the child thread.

Note that if QueueUserWorkItem() is not used, it is possible to spawn
threads that will keep running even if the main thread exits.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top