AL icon indicating copy to clipboard operation
AL copied to clipboard

Stack error

Open GedasB opened this issue 7 years ago • 7 comments

Any ideas why error comes when i do package, and how to resolve it? error: Processing of message 'al/createPackage' failed with error: 'Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space.'

Thanks

GedasB avatar Mar 25 '18 11:03 GedasB

Does the server event viewer has more?

kalberes avatar Mar 26 '18 17:03 kalberes

No. Event viewer has nothing but output in vs code shows as attached. I thought i have too many objects and removed almost half, but still have error.

Error.txt

GedasB avatar Mar 26 '18 17:03 GedasB

Looks like the c# generator gets into a recursive call triggering a stack overflow around an else calling the same method that has an if/else.

kalberes avatar Mar 26 '18 17:03 kalberes

Could you confirm us if you have somewhere over 50 if statements nested one within the other?

doivosevic avatar Mar 27 '18 05:03 doivosevic

Not "if" but more than 1000 lines "case" statement. And yes, i've commented it and now i can make package. Code is as attached. Could issue be resolved on your side i compiler/package code or i need to split NAV code? How max case statements can be in one loop?

Case.txt

GedasB avatar Mar 27 '18 06:03 GedasB

I think the best is to refactor. On the how much case statements we allow, we do not(yet) have a threshold. We are just bound by the .net framework' default stack size allocation in the implementation of our generators.

kalberes avatar Mar 27 '18 10:03 kalberes

OK. Redesigned by split "case" to 500 lines - it works. So probably not so big issue. Just would be nice to have "clear" error in compiler.

GedasB avatar Apr 03 '18 17:04 GedasB

We have addressed this issue and the fix will be available in an upcoming release.

EmilDamsbo avatar Sep 19 '23 12:09 EmilDamsbo