How to catch that error - Error executing code: Overflow in internal run stack.

Hello,

I’m building FromTreeControl (similar to BOMDesigner) recursively. And if I drop item in itself the tree is builded till debugger opens with that error Error executing code: Overflow in internal run stack.

I want to show better user message like “You can’t add this item on this node - it cause infinite loop”.

Any suggestions?

You shouldn’t just display a nicer message - you should avoid such a serious error as stack overflow. Therefore you need to add an additional to avoid infinite recursion. Just check if it isn’t the same item.

Hello,

I can’t just check if item is the same, because it is possible to drop item 3 levels below same item and it will overflow again.

If you can’t check it using your current implementation, you’ll have to prepare a better implementation that can do that.