Skip to main content

I am getting a Stack Overflow exceptions in my Managed COBOL project. I read an article regarding this problem on the Micro Focus Community forum at the following link: /cobol/visualcobol/w/wikiid-120/30624/diagnose-and-fix-stack-overflow-exceptions-in-visual-cobol-managed-code-programs

I experienced this problem a couple of weeks ago and manage to circumvent it by changing the code. But I am getting it again and it is happening in complex nested code that I cannot easily change.


Based on the articles, it seems all that may be required is that I increase the stack size allocation. These are the following steps a tried as instructed by the article in order to increase stack space:
1) Enable mixed-mode debugging in the project property
2) Attempted to do a stack analysis using the ā€œ.load sosā€ extension but it did not recognize the ā€œ.load sosā€ command.


I am using Micro Focus VISUAL COBOL 5.0  with patch update 10 and Microsoft Visual Studio Community 2019 Version 16.6.2 S.

I am getting a Stack Overflow exceptions in my Managed COBOL project. I read an article regarding this problem on the Micro Focus Community forum at the following link: /cobol/visualcobol/w/wikiid-120/30624/diagnose-and-fix-stack-overflow-exceptions-in-visual-cobol-managed-code-programs

I experienced this problem a couple of weeks ago and manage to circumvent it by changing the code. But I am getting it again and it is happening in complex nested code that I cannot easily change.


Based on the articles, it seems all that may be required is that I increase the stack size allocation. These are the following steps a tried as instructed by the article in order to increase stack space:
1) Enable mixed-mode debugging in the project property
2) Attempted to do a stack analysis using the ā€œ.load sosā€ extension but it did not recognize the ā€œ.load sosā€ command.


I am using Micro Focus VISUAL COBOL 5.0  with patch update 10 and Microsoft Visual Studio Community 2019 Version 16.6.2 S.

Hi Alex, unfortunately the SoS debugger extension is not supported in recent versions of Visual Studio. It will still be supported in WinDBG so you could use that as an alternative.


Hi Alex, unfortunately the SoS debugger extension is not supported in recent versions of Visual Studio. It will still be supported in WinDBG so you could use that as an alternative.

I solved this problem by adding ā€˜ILSTACKSIZE(99097152)’ in the ā€˜ Additional directives’ under Project/Properties/COBOL. What this did is essentially increased the stack space. The original articles I included in this thread suggested this as a possible solution but I somehow missed it. I re-read the article again and that is when I notice that I had not tried this solution.