Stackoverflow Exception in a simple dialog

后端 未结 2 689
终归单人心
终归单人心 2021-01-26 12:05

Hello i am getting an Stackoverflow Exception in this two dialog. Dialog A is being called from a main dialog class. Dialog A have a choice to go to Dialog A

2条回答
  •  长发绾君心
    2021-01-26 12:36

    In Visual Studio you can check your call stack and you will know where is the exact problem in your StackOverflowException.

    If DialogA is the base class of DialogA_child then in your DialogA_child's constructor and your base class constructor will be calling themselfs recursively.

    So your call stack should look like this:

    1. DialogA constructor add new DialogA_child
    2. DialogA_child calls base(so DialogA constructor)
    3. DialogA constructor add new DialogA_child
    4. DialogA_child calls base(so DialogA constructor)
    5. ...

提交回复
热议问题