How is this causing an endless loop?

偶尔善良 提交于 2019-12-04 08:42:43
LB2

Here is what's likely going on (at this point is a theory until OP can confirm):

The thing that starts the problem...

The issue that starts the infinite loop chain is likely objCon.Open(); in Exhibit D. There is probably some issue with connecting to the database, and the Open() call, as it should, throws an exception. This of course get caught in the local catch that is immediately following that line.

The local catch calls SSCS.ExceptionHandler which is shown in Update 1. It looks benign, but in it hides the culprit's accomplice by the name GetFormTitle which is shown in Update 2.

Where things take a turn for the worse...

GetFormTitle has a very interesting piece of code:

User person = new User();
person.getUserFromTable();

... which most likely is a model retrieving user info from the database (where else).

And so the infinite loop is created...

Well, to get User from database, one needs a connection, which most likely causes DBConnection.GetInstance() to be called, which gets to objCon.Open(); which starts the new cycle, and thus an infinite loop is created (ingeniously, without using any of language's built-in looping mechanisms, to be duly noted).

To confirm:

OP: Please put very plain (meaning no calls to GetFormTitle, please) MessageBoxes in the GetFormTitle, and if the above theory is right, you'll see it in the path of execution.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!