I know sometimes innerException is null
So the following might fail:
repEvent.InnerException = ex.InnerException.Message;
Is ther
class MyException : Exception
{
private const string AMP = "\r\nInnerException: ";
public override string Message
{
get
{
return this.InnerException != null ? base.Message + AMP + this.InnerException.Message : base.Message;
}
}
public override string StackTrace
{
get
{
return this.InnerException != null ? base.StackTrace + AMP + this.InnerException.StackTrace : base.StackTrace;
}
}
}
That's funny, I can't find anything wrong with Exception.GetBaseException()?
repEvent.InnerException = ex.GetBaseException().Message;