title: Set C# Property that has no Setter
body: <p>In C#, there is the <code>Exception</code> class. For the purposes of testing, I would like to be able to set its <code>StackTrace</code> property to arbitrary strings. <code>StackTrace</code> has no setter, so my first attempt was to try using reflection:</p>
  
  <pre><code>Exception instance = new Exception("Testing");
  PropertyInfo propertyInfo = typeof(Exception).GetProperty("StackTrace");
  propertyInfo.SetValue(instance, "Sample StackTrace value", null);
  </code></pre>
  
  <p>This yields the runtime error:</p>
  
  <p><code>System.ArgumentException : Property set method not found.</code></p>
  
  <p>Is there any way I could set the <code>StackTrace</code> property? More generally, is there a way to set a property that lacks a setter?</p>