WF Designer re-hosting System.StackOverflowException
I need help with re-hosted designer of WF4. It should be used for design very complex workflow but there is limit of the nested activities. (It's around 40th nested activities in one branch). If is that limit exceeded, an System.StackOverflowException occurred in PresentationCore.dll.
Is there any way, how to increase limit for System.StackOverflowException?
Here is the code example for download. After building and executing application, move the scrollbars to last activity with number 40 and exception should occur.
I can run it without error and scroll to the very bottom - though it does get a bit slow - (64 bit machine, 16 gb memory).
You can allocate stack size on creation of a new thread, but I don't know how you could change the size for the default UI thread in your application...and if you can I'm not sure it'd be a good idea.
Besides, increasing the limit is only hiding the overall issue - which is why you need this in the first place - is anyone really going to nest 40 layers of complexity in a workflow? It would be completely unwieldy and incredibly difficult to support. Couldn't the logic be split into sub workflows, etc?
I solved the problem by increasing the size of the stack by using utility EDITBIN from VisualStudio
editbin /STACK:6291456 "WpfApplication1.exe"
Unfortunately it doesn't work in VisualStudio by adding into Post-Build section in project properties. So I'd created the bat file, which is necessary to execute after build.