I have the following code on the server:
if (actualRowCount > maxRows)
{
    throw new DomainException("OverMaxRowLimitException",
        new OverMaxRowLimitException(string.Format(MaxRowsMessage,
        actualRowCount, maxRows)));
}
This creates a new DomainException with the InnerException property set. I've verified that this is set in the debugger.
The custom exception is defined thus:
public class OverMaxRowLimitException : Exception
{
    public OverMaxRowLimitException(string message)
    {
        this.Message = message;
    }
    public new string Message { get; set; }
}
This is supposed to return a sensible error message to the client so the user can be told there are too many rows. So in the load complete handler we'd like to have:
if (result.HasError)
{
    ShowError(result.Error.InnerException.Message);
}
Unfortunately, the InnerException property is null. So all we have to check is the text of the outer exception message which isn't being transferred to the client properly either.
It has been suggested that I need:
<customErrors mode="Off" />
in the web config file. I've tried this and it doesn't work.
It's also been suggested that I need:
[KnownType(typeof(OverMaxRowLimitException))]
on the data contract. Now unless I've put this in the wrong place, this also doesn't work.
I've also tried adding [Serializable] to the custom exception and replacing it with the general Exception. Neither of these worked either.
So, why is the InnerException property null. What am I missing?