SBX - Search With Button

SBX - Forum Post Title

Data source delete() method gets called infinitely

Microsoft Dynamics AX Forum

Amit Das asked a question on 14 Sep 2018 6:18 AM

Question Status

Suggested Answer

Hello all,

I have a weird issue with form. I have a form named X. It has almost similar design of PurchTable form. So, as usual form X also have datasources for its header and lines.

Now, when I mark more than one record on the line grid and try to delete, the form goes to "Not responding" state. And apparently no line gets deleted. But it works fine for one record.

I have debugged the form. I have found that the debugger hits the Line datasource > delete() and keeps on running that method again and again and never comes out of it.  

Can anyone of you tell me what may be the reason of such behavior of the system?  What should I follow to fix this issue? 

Thanks in advance!

Reply
Martin Dráb responded on 14 Sep 2018 6:23 AM

What's the call stack of the repeated calls of delete()?

Reply
Amit Das responded on 14 Sep 2018 6:36 AM

The calls stack is as follows:

\Forms\X\Datasources\PurchLine\Methods\delete

\Classes\FormDataSource\deleteMarked

\Classes\FormRun\task

\Forms\X\Methods\task

\Classes\SysSetupFormRun\task

However, debugger doesn't come out of  Datasources\PurchLine\Methods\delete() . It keeps on running from line 1 of this method through last line.

Reply
Crispin John Augustine responded on 14 Sep 2018 6:39 AM
My Badges

do you have task method overridden in the form? and some Code calling delete inside presumably?

Reply
Amit Das responded on 14 Sep 2018 6:51 AM

Hi Crispin,

Yes, task method in form is overridden. But delete() is not being called explicitly from any of this flow.

Reply
Nikolaos Mäenpää responded on 14 Sep 2018 6:53 AM
Suggested Answer

If you put breakpoint in the task method, what is the call stack then? Seems like something a bit farther away might be causing this.

Reply
Crispin John Augustine responded on 14 Sep 2018 7:24 AM
My Badges

just for test's sake, can you remove the overridden Task method, and run the form again?

It will be interesting to see, if the error still persists.

Reply
Amit Das responded on 14 Sep 2018 7:40 AM

Hi Crispin,

I have tried that. Unfortunately there is no change in behavior.

Reply
Amit Das responded on 14 Sep 2018 8:15 AM

After further investigation, I can notice the debugger goes to table delete() only once. And rest of the time the super() in datasource > delete() doesn't even hit table > delete().

Reply
Nikolaos Mäenpää responded on 14 Sep 2018 8:18 AM

What about the delete actions in your tables? Do you have some?

Reply
Amit Das responded on 14 Sep 2018 8:52 AM

Hi Nikolaos, it is actually PurchLine table. So, it has many deleteActions which are standard tables.

Reply
Crispin John Augustine responded on 14 Sep 2018 8:56 AM
My Badges

in that case, I'll remove the datasource delete method, and test again..

also try Clearing all usage data connected to this form/table.

Reply
Nikolaos Mäenpää responded on 14 Sep 2018 9:06 AM
Suggested Answer

I already asked: "If you put breakpoint in the task method, what is the call stack then? Seems like something a bit farther away might be causing this."

Did you look into this?

Reply
Amit Das responded on 17 Sep 2018 8:07 AM

I could rectify the problem. Someone had called active() from the data source delete() method which was probable reason of this weird behavior of the system. I have just removed that code and now this is working perfect.

Thank you all for your support! :)

Reply
Nikolaos Mäenpää responded on 14 Sep 2018 6:53 AM
Suggested Answer

If you put breakpoint in the task method, what is the call stack then? Seems like something a bit farther away might be causing this.

Reply
Nikolaos Mäenpää responded on 14 Sep 2018 9:06 AM
Suggested Answer

I already asked: "If you put breakpoint in the task method, what is the call stack then? Seems like something a bit farther away might be causing this."

Did you look into this?

Reply

SBX - Two Col Forum

SBX - Migrated JS