csharp / excel interop / lock / stack overflow

  • Thread starter Thread starter Grzegorz Kaczor
  • Start date Start date
G

Grzegorz Kaczor

Hello,

I encountered a strange problem. I've got a Windows application written
in C# that fails with StackOverflowException when assigning to a
property that is defined in superclass (the property is defined virtual
but has not been implemented in subclass). The property performs a
lock(this) before changing the real attribute value.

More details:
the property is of an enum type, defined in superclass, virtual
Both getter and setter are wrapped in lock(this)
In subclass I have a code section (also locked with lock(this)) that
assigns a value to the property. This causes repeatedly
StackOverflowException. When I assign manually to the real attribute
value, everything is OK. I tried to change the lock object (from this to
some attribute of the superclass) and result is same.

I use Excel 2003 Interop API. Maybe this matters...

What can be wrong?

Thanks,
Grzegorz Kaczor
 
Forget it. I'm really sorry for bothering you. The property in getter
and setter referred to itself and not the real attribute.

I should have checked it more carefully.

Sorry once more.

Regards,
Grzegorz Kaczor
 
Back
Top