I know sometimes innerException is null
So the following might fail:
repEvent.InnerException = ex.InnerException.Message;
Is ther
Sometimes also InnerException has an InnerException, so you can use a recursive function for it:
public string GetInnerException(Exception ex)
{
if (ex.InnerException != null)
{
return string.Format("{0} > {1} ", ex.InnerException.Message, GetInnerException(ex.InnerException));
}
return string.Empty;
}