I’m writing a .NET Application using Remoting. I have a .Net client written in C# that connects to a server(also written in C#) The Server runs as a windows service and implements some remote objects for the client. One of those uses the EntireX .NetWrapper V 7.3.3 for our Mainframe connection.
Everything works, until it doesn't. What I mean is instead of getting useful error messages on the client I keep getting exceptions that the Xexception is not serializable. So I created a wrapper and everywhere that I can think of that can possibly throw an Xexcpetion is wrapped in a try/catch to grab the Xeception, wrap it and re-throw. but I must be missing something because it's still giving me that error.
Am I wrapping it correctly? Here is the code for my wrapper
namespace FAStorage.EntireX
{
/// <remark>
/// serializable exception class
/// - custom [Serializable] version of XException
/// </remark>
[Serializable]
public class WrapperException : ApplicationException
{
private int code_val;
//private String message_val;
//private Exception inner_val;
/// <summary> Entirex Error Code Number - internal </summary>
public int errorCode { get { return code_val; } }
/// <summary>
/// Constructor - "copys" an XException to this [Serializable] form
/// </summary>
/// <param>XException to "copy"</param>
public WrapperException( XException e ) : base(e.Message, e.InnerException)
{
code_val = e.errorCode;
//message_val = "There was an error see the Inner Exception for details.";
//base.Message = "There was an error see the Inner Exception for details.";
//inner_val = e.InnerException;
}
/// <summary> stores an exception with a default message </summary>
/// <param>Exception to encapsulate</param>
public WrapperException( Exception e )
: base("There was an error see the Inner Exception for details.", e)
{ }
/// <summary> stores an exception with a custom message </summary>
/// <param>Error Message</param>
/// <param>Exception to encapsulate</param>
public WrapperException( String MyMessage, Exception e )
: base(MyMessage, e)
{ }
//{ init(MyMessage, e); }
/// <summary> Stores an exception with custom message and error code </summary>
/// <param>Error Code Number</param>
/// <param>Error Message</param>
/// <param>Exception to encapsulate</param>
public WrapperException( int mycode, String MyMessage, Exception e )
: base(MyMessage, e)
{ code_val = mycode; }
/// <summary> Serialization Function </summary>
/// <param></param>
/// <param></param>
protected WrapperException( SerializationInfo info,
StreamingContext context )
: base(info, context)
{ }
/// <summary>
/// Creates And Returns a String Representation of the current Exception
/// </summary>
/// <returns>A string representation of the current exception.</returns>
public override String ToString() { return Message; }
}
}
Thanks in advance for any help.