Stackoverflow exception in C# NT Service

  • Thread starter Thread starter TDOR
  • Start date Start date
T

TDOR

I have started a nt service project in VS2003,
added a timer from the toolbox, and set the timer to
trigger every 20 secs. The method that the timer
calls has among others these lines:

ArrayList x = new ArrayList();
for (...) {
x.add(new someobject(...));
}

Once I add an object reference to the arraylist then
i get a stackoverflow exception. The object I add
is part of a datamodel, it only contains a few
properties, but no methods with any actual code.
The for-loop usually only runs one iteration.

Anyone know why this could be happening?
 
TDOR said:
I have started a nt service project in VS2003,
added a timer from the toolbox, and set the timer to
trigger every 20 secs. The method that the timer
calls has among others these lines:

ArrayList x = new ArrayList();
for (...) {
x.add(new someobject(...));
}

Once I add an object reference to the arraylist then
i get a stackoverflow exception. The object I add
is part of a datamodel, it only contains a few
properties, but no methods with any actual code.
The for-loop usually only runs one iteration.

Anyone know why this could be happening?

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
 
Back
Top