title: How do you change default stack size for managed executable.net
body: <p>We have discovered that one of our auto generated assemblies is throwing a StackOverflowException on new(). This class has (bear with me please) 400+ simple properties that are  initialised (most by default(string) etc) in a constructor.</p>
  
  <p>We notice that its fine on 64 bits but on 32 bits it goes bang!</p>
  
  <p>We need to test if it's reasonable for our use case to create a larger default stack to give us breathing room while we reengineer the code generator. </p>
  
  <p>We would esp. interested in solutions that involve app.config if possible. But I'm a realist so anything would be good.</p>
  
  <p>Re reasons for the the stack over flow. We've narrowed the error down the constructor in question. My first impressions were also of the type of infinite recursion. However we've reproduced the error using a  3 line console app that :</p>
  
  <ul>
  <li>creates an empty instance of class.    </li>
  <li>calls a non static method (Clone) on the class who first job is to create and empty instance ready pass the properties into. </li>
  </ul>
  
  <p>It goes bang as it hits the second constructor.</p>
  
  <p>now debugging through with the .net source code we see that the the stack overflow is in the  Guid.NewGuid() which is passed as the second parameter to the constructor. The actual line of code is the call to the native CoCreateGuid() call. </p>
  
  <p><strong>So while it could be a bug in CoCreateGuid(), we want to eliminate our code from the problem. My first thought is to increase the size of the stack massively and see if this error reoccurs. Then, since I think we can control all use cases, is replace the constructor with object initialisation -  think this can relieve the pressure on the stack.</strong> </p>
  
  <p><em>Nb. We can stop the error from happening by removing just on int property from the class.</em> </p>