Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ToString()

override string System.Exception.ToString ( )
inlineinherited

Definition at line 384 of file Exception.cs.

385 {
386 string className = GetClassName();
387 string message = Message;
388 string text = _innerException?.ToString() ?? "";
389 string exception_EndOfInnerExceptionStack = SR.Exception_EndOfInnerExceptionStack;
390 string stackTrace = StackTrace;
391 int num = className.Length;
392 checked
393 {
394 if (!string.IsNullOrEmpty(message))
395 {
396 num += 2 + message.Length;
397 }
398 if (_innerException != null)
399 {
400 num += "\r\n".Length + " ---> ".Length + text.Length + "\r\n".Length + 3 + exception_EndOfInnerExceptionStack.Length;
401 }
402 if (stackTrace != null)
403 {
404 num += "\r\n".Length + stackTrace.Length;
405 }
406 string text2 = string.FastAllocateString(num);
407 Span<char> dest2 = new Span<char>(ref text2.GetRawStringData(), text2.Length);
409 if (!string.IsNullOrEmpty(message))
410 {
411 Write(": ", ref dest2);
412 Write(message, ref dest2);
413 }
414 if (_innerException != null)
415 {
416 Write("\r\n", ref dest2);
417 Write(" ---> ", ref dest2);
419 Write("\r\n", ref dest2);
420 Write(" ", ref dest2);
422 }
423 if (stackTrace != null)
424 {
425 Write("\r\n", ref dest2);
427 }
428 return text2;
429 }
430 static void Write(string source, ref Span<char> dest)
431 {
432 source.CopyTo(dest);
433 dest = dest.Slice(source.Length);
434 }
435 }
override string ToString()
Definition Exception.cs:384
virtual ? string StackTrace
Definition Exception.cs:143
readonly Exception _innerException
Definition Exception.cs:51
virtual string Message
Definition Exception.cs:100
string GetClassName()
Definition Exception.cs:343

References System.Exception._innerException, System.Runtime.Serialization.Dictionary, System.SR.Exception_EndOfInnerExceptionStack, System.Exception.GetClassName(), System.Exception.Message, System.source, System.Exception.StackTrace, System.text, and System.Exception.ToString().

Referenced by System.Net.HttpRequestStream.BeginReadCore(), System.Net.HttpResponseStream.BeginWriteCore(), System.Transactions.TransactionState.ChangeStateTransactionAborted(), System.Reflection.ReflectionTypeLoadException.CreateString(), System.Threading.Tasks.Dataflow.Internal.DataflowEtwProvider.DataflowBlockCompleted(), Terraria.Program.DisplayException(), System.Net.HttpResponseStream.DisposeCore(), Terraria.TimeLogger.DrawException(), ReLogic.Content.ContentRejectionAssetReaderException.GetReason(), System.Exception.GetStackTrace(), System.Diagnostics.Metrics.MetricsEventSource.CommandHandler.LogError(), System.Diagnostics.Metrics.MetricsEventSource.CommandHandler.OnEventCommand(), Terraria.Utilities.CrashWatcher.PrintException(), System.Net.HttpRequestStream.ReadCore(), System.Transactions.TransactionManager.Reenlist(), System.Exception.SetCurrentStackTrace(), System.Runtime.InteropServices.ExternalException.ToString(), System.Exception.ToString(), and System.Net.HttpResponseStream.WriteCore().