From ecc72d391547c80b02b3e6a6bd2b71379d00dd5d Mon Sep 17 00:00:00 2001 From: Ben Maurer Date: Tue, 7 Dec 2004 03:21:58 +0000 Subject: [PATCH] 2004-12-06 Ben Maurer * Exception.cs: Prevent stringifying the type name on the ctor. this gets called a few times on every execution to create a nullref exception. svn path=/trunk/mcs/; revision=37278 --- mcs/class/corlib/System/ChangeLog | 6 ++++++ mcs/class/corlib/System/Exception.cs | 15 ++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/mcs/class/corlib/System/ChangeLog b/mcs/class/corlib/System/ChangeLog index 440e22d8e1e..dc173485c2f 100644 --- a/mcs/class/corlib/System/ChangeLog +++ b/mcs/class/corlib/System/ChangeLog @@ -1,3 +1,9 @@ +2004-12-06 Ben Maurer + + * Exception.cs: Prevent stringifying the type name on the + ctor. this gets called a few times on every execution to create a + nullref exception. + 2004-12-06 Martin Baulig * Decimal.cs: Decimal constant support has been merged into GMCS, diff --git a/mcs/class/corlib/System/Exception.cs b/mcs/class/corlib/System/Exception.cs index caa3f707467..90464de4ee4 100644 --- a/mcs/class/corlib/System/Exception.cs +++ b/mcs/class/corlib/System/Exception.cs @@ -50,24 +50,19 @@ namespace System string message; string help_link; string class_name; - string stack_trace = null; - string remote_stack_trace = ""; - int remote_stack_index = 0; + string stack_trace; + string remote_stack_trace; + int remote_stack_index; int hresult = unchecked ((int)0x80004005); string source; public Exception () { - inner_exception = null; - message = null; - class_name = GetType().FullName; } public Exception (string msg) { - inner_exception = null; message = msg; - class_name = GetType().FullName; } protected Exception (SerializationInfo info, StreamingContext sc) @@ -90,7 +85,6 @@ namespace System { inner_exception = e; message = msg; - class_name = GetType().FullName; } public Exception InnerException { @@ -183,6 +177,9 @@ namespace System public virtual void GetObjectData (SerializationInfo info, StreamingContext context) { + if (class_name == null) + class_name = GetType ().FullName; + info.AddValue ("ClassName", class_name); info.AddValue ("Message", message); info.AddValue ("InnerException", inner_exception); -- 2.25.1