using System; using System.Security.Permissions; namespace Csla.Server { /// /// This exception is returned from the /// CallMethod method in the server-side DataPortal /// and contains the exception thrown by the /// underlying business object method that was /// being invoked. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")] [Serializable()] public class CallMethodException : Exception { private string _innerStackTrace; /// /// Get the stack trace from the original /// exception. /// /// /// /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object,System.Object)")] public override string StackTrace { get { return string.Format("{0}{1}{2}", _innerStackTrace, Environment.NewLine, base.StackTrace); } } /// /// Creates an instance of the object. /// /// Message text describing the exception. /// Inner exception object. public CallMethodException(string message, Exception ex) : base(message, ex) { _innerStackTrace = ex.StackTrace; } /// /// Creates an instance of the object for deserialization. /// /// Serialization info. /// Serialiation context. protected CallMethodException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { _innerStackTrace = info.GetString("_innerStackTrace"); } /// /// Serializes the object. /// /// Serialization info. /// Serialization context. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods")] [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.SerializationFormatter)] public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { base.GetObjectData(info, context); info.AddValue("_innerStackTrace", _innerStackTrace); } } }