I am posting this question because the existing forum references to StackOverflowException, while informative, aren't exactly relevant to the current scenario that I am encountering.
I have been developing an application for my employer that I recently created an MSI for and installed on the Company's Citrix server farm. When I launched the application via Citrix Workspace, it came up successfully. However, when I clicked on a specific button to instantiate one of the application's Windows forms, a StackOverflowException occurred. This was a surprise, as the StackOverFlowException was not being thrown on my development machine and never has. I have been developing this application for over a year.
There are three (3) servers in the Company's Citrix server farm. The StackOverFlowException occurs on two (2) of them, but not the third. I have verified this by logging into each server and running the compiled application directly.
Since debugging the error is not an option on the Citrix servers, I added dialog windows to the application code and created a modified executable which I then used on the Citrix servers in question.
Using that approach, I was able to pinpoint the statement where the exception was thrown. It was thrown at the point where form's New constructor was called:
So, I looked at the code for the constructor. Placing a couple more dialog boxes in the code and rerunning the application, I was able to determine that the exception occurred during the call to InitializeComponent:
The Windows form in question is a very large form with a multitude of controls including several TabControls, TreeViews and multiple SplitContainers (some of which are nested).
Not surprisingly, InitializeComponent is a very large routine; too large to post in this thread; otherwise I would have done so.
I dont see any recursion within the New constructor or InitializeComponent. Moreover, what is perplexing here is why the SystemStackOverFlowException is occurring on two of the three servers but not the third.
If anyone has any ideas I would like to hear them. Any suggestions and/or insights would, of course, be greatly appreciated.
My development machine is using VS2017 (.Net Framework 4.8.1) on Windows 10.
The three (3) Citrix servers in our server farm are all on Windows 2008 Server R2. They all have .NET Frameworks 4.8.1 installed.