title: StackTrace class methods not working in release mode
body: <p>below is my piece of code which i am using to log my error details.</p>
  
  <pre><code>StackTrace sTrace = new StackTrace(true);
  string functionname = Environment.NewLine + " MethodName - " + sTrace.GetFrame(1).GetMethod().Name;
  string classname = Environment.NewLine + " File Path - " + sTrace.GetFrame(1).GetFileName() + Environment.NewLine + " Line No. - " + sTrace.GetFrame(1).GetFileLineNumber() + Environment.NewLine + " ClassName - " + sTrace.GetFrame(1).GetMethod().ReflectedType.Name + Environment.NewLine + " DateTime - " + DateTime.Now.ToString();
  WriteLine(string.Concat("ERROR: ", errMsg, classname, functionname,
                                   Environment.NewLine));
  </code></pre>
  
  <p>this works perfect in debug mode, but in relese mode, i am getting function name and class name as blank, Line Number (sTrace.GetFrame(1).GetFileLineNumber()) as 0.</p>
  
  <p>is there any other best way to get function name, class name, and line number from where error originated.</p>
  
  <p>thanks in advance.</p>