/// <summary>
		/// Generates a nice textual stack trace
		/// </summary>
		public static string StackTraceDump(StackTraceElement[] elements)
		{
			StringBuilder builder = new StringBuilder();
			if (elements != null) 
			{
				foreach (StackTraceElement e in elements) 
				{
					builder.Append("\n " + e.ClassName + "." + e.MethodName + "(" + e.FileName + ":" + e.LineNumber + ")");
				}
			}
			return builder.ToString();
		}
 public void PrintStackTrace(TextWriter writer)
 {
     writer.WriteLine(exceptionClass + ": " + message);
     for (int i = 0; i < stackTraceElements.Length; i++)
     {
         StackTraceElement element = stackTraceElements[i];
         writer.WriteLine("    at " + element.ClassName + "." + element.MethodName + "(" + element.FileName + ":" + element.LineNumber + ")");
     }
     if (cause != null)
     {
         writer.WriteLine("Nested Exception:");
         cause.PrintStackTrace(writer);
     }
 }
 protected virtual BrokerError LooseUnmarshalBrokerError(
     OpenWireFormat wireFormat,
     BinaryReader dataIn)
 {
     if (dataIn.ReadBoolean())
     {
         BrokerError answer = new BrokerError();
         
         answer.ExceptionClass = LooseUnmarshalString(dataIn);
         answer.Message = LooseUnmarshalString(dataIn);
         if (wireFormat.StackTraceEnabled)
         {
             short length = dataIn.ReadInt16();
             StackTraceElement[] stackTrace = new StackTraceElement[length];
             for (int i = 0; i < stackTrace.Length; i++)
             {
                 StackTraceElement element = new StackTraceElement();
                 element.ClassName = LooseUnmarshalString(dataIn);
                 element.MethodName = LooseUnmarshalString(dataIn);
                 element.FileName = LooseUnmarshalString(dataIn);
                 element.LineNumber = dataIn.ReadInt32();
                 stackTrace[i] = element;
             }
             answer.StackTraceElements = stackTrace;
             answer.Cause = LooseUnmarshalBrokerError(wireFormat, dataIn);
         }
         return answer;
     }
     else
     {
         return null;
     }
 }