I have generic exception class like this:
public class DuplicateException<TEntity> : Exception
{
public TEntity Entity { get; set; }
}
And I have non-generic method which might throw constructed generic exception:
void Save()
{
throw new DuplicateException<SomeEntity>();
}
This method may throw this generic exception but only of this one constructed type DuplicateException<SomeEntity>
and it cannot throw this exception with some other type parameter instead of SomeEntity
.
Now I want to specify this fact in xml-comment for Save
method. This article describes a little bit how to comment methods with generic exception and I've tried these two alternatives:
1) Inserts by defauly by autocomplete in VS:
/// <exception cref="DuplicateException{TEntity}" />
2) Replaced TEntity
with SomeEntity
/// <exception cref="DuplicateException{SomeEntity}" />
But in both cases output XML still states that this method might throw generic non-constructed type which doesn't mention SomeEntity
at all:
<exception cref="T:MyNameSpace.DuplicateException`1" />