Is there a way in C# to start a process with a certain stack size?
In this thread they show a PoC that you can use Editbin.exe to modify the default stack size of the thread that enters main: http://bytes.com/topic/c-sharp/answers/229335-stack-size
and if you spawn new threads, there's an API for it: http://msdn.microsoft.com/en-us/library/ms149581.aspx
You cannot start a process with a particular stack size because processes don't have stacks. Threads have stacks.
I don't believe there's a way to start a process and to tell it that it should start its threads with a particular stack size.
A down-voting fest, I hesitate to post. But Henrik is right, the very first thread is started by Windows when it launches the EXE. It does a whole bunch of work, loading the CLR is one of its duties. And it runs the Main() method in your program.
The .NET framework gives very few options to configure that thread. Only the [MTAThread] and [STAThread] attributes on the Main() method makes a difference, they affect how the CLR calls the CoInitializeEx() API function.
The stack size of the thread is in fact configurable. It is one of the fields in the PE32 file format, the format used in Windows for executable images. Usually the C# or VB.NET compiler is responsible for generating that file, neither have an option to set the initial thread stack size. Bit of an oversight. They use defaults, one megabyte for a 32-bit EXE, four megabytes for a 64-bit EXE (Platform Target = x64).
Changing that value is possible, you can run the Editbin.exe utility to modify the EXE file, use the /STACK command line option. You'll want to do this in a post-build step. Beware that this is incompatible with strong names or signing with a certificate since it modifies the EXE file.
It isn't a real problem btw, if you need a thread with a lot of stack space then you create one yourself in the Main() method.