R
randy1200
Visual Studio 2005, C# WinForms application:
Here’s the question: How can I increase the standard 1 MB stack size of the
UI thread in a C# WinForms application?
Here’s why I ask:
I’ve inherited some code that at the view (User Interface) layer kicks off a
background worker thread. At the service layer (think CAB service layer),
there’s quite a lot of the following:
worker.ReportProgress(n, new string[] { cat, mesg });
The _BackgroundWorker_ProgressChanged() event gets these events, and does a
large amount of string processing. When the user chooses to process all
available data, the _ProgressChanged() event eventually throws a
StackOverflow exception with the following in the details section:
"Cannot evaluate expression because the current thread is in a stack
overflow state."
If I take the string processing out of the _ProgressChanged() event, I don’t
get the StackOverflow, so I’m pretty confident that I’ve isolated the
problem. Increasing the stack size if definitely a temp fix, but something I
need to consider in the short term.
Thanks,
Randy
Here’s the question: How can I increase the standard 1 MB stack size of the
UI thread in a C# WinForms application?
Here’s why I ask:
I’ve inherited some code that at the view (User Interface) layer kicks off a
background worker thread. At the service layer (think CAB service layer),
there’s quite a lot of the following:
worker.ReportProgress(n, new string[] { cat, mesg });
The _BackgroundWorker_ProgressChanged() event gets these events, and does a
large amount of string processing. When the user chooses to process all
available data, the _ProgressChanged() event eventually throws a
StackOverflow exception with the following in the details section:
"Cannot evaluate expression because the current thread is in a stack
overflow state."
If I take the string processing out of the _ProgressChanged() event, I don’t
get the StackOverflow, so I’m pretty confident that I’ve isolated the
problem. Increasing the stack size if definitely a temp fix, but something I
need to consider in the short term.
Thanks,
Randy