ServiceAlreadyRegisteredException
Represents the exception the container throws when a registration process fails due to service duplication.
Occurs when the container is configured with ThrowException.
using System;
using System.Runtime.Serialization;
namespace Stashbox.Exceptions
{
[Serializable]
public class ServiceAlreadyRegisteredException : Exception
{
public Type Type { get; }
public ServiceAlreadyRegisteredException(Type type, Exception innerException = null)
: base("The type " + type.FullName + " is already registered.", innerException)
{
Type = type;
}
protected ServiceAlreadyRegisteredException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}