❔ Stack Overflow error while trying to deserialize xml file

Heres the error:
Stack overflow.
Repeat 104785 times:
--------------------------------
at XMLTank..ctor()
--------------------------------
at Application.Main(System.String[])
Stack overflow.
Repeat 104785 times:
--------------------------------
at XMLTank..ctor()
--------------------------------
at Application.Main(System.String[])
Here's the code: https://pastes.io/6vc7rqsgqs
2 Replies
Angius
Angius15mo ago
Calling the constructor of XMLTank will call XMLTank xo = new XMLTank() which will call the constructor of XMLTank which will call XMLTank xo = new XMLTank() which will call the constructor of XMLTank which will call the constructor of XMLTank which will call XMLTank xo = new XMLTank() which will call the constructor of XMLTank which will call the constructor of XMLTank which will call XMLTank xo = new XMLTank() which will call the constructor of XMLTank which will call the constructor of XMLTank which will call XMLTank xo = new XMLTank() which will call the constructor of XMLTank ... Ad infinitum It seems to me like the XMLTank xo = new XMLTank() line isn't even needed You never use the xo variable
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.