# Attribute exception

**URL:** <https://discuss.hangfire.io/t/attribute-exception/5110>\
**Category:** bug?\
**Tags:** hangfire-pro\
**Created:** [August 24, 2018, 12:28pm UTC](https://discuss.hangfire.io/t/attribute-exception/5110 "2018-08-24T12:28:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hmahajan1](https://avatars.discourse-cdn.com/v4/letter/h/76d3ee/32.png) [@hmahajan1](https://discuss.hangfire.io/u/hmahajan1)\
**Post date:** [August 24, 2018, 12:28pm UTC](https://discuss.hangfire.io/t/attribute-exception/5110/1 "2018-08-24T12:28:47Z")

</div>

I have an Interface  
public Interface IInterface  
{  
[AutomaticRetry(Attempts =0)]  
void MethodA();  
}  
}  
and MyClass is implementing this Interface.  
Using Rhinomocks I am trying to Unit test this MethodA but get an exception error:  
at Hangfire.AutomaticRetryAttribute…ctor()  
at System.RuntimeTypeHandle.CreateCaInstance(RuntimeType type, IRuntimeMethodInfo ctor)  
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)  
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, Boolean inherit)  
at System.Reflection.RuntimeMethodInfo.GetCustomAttributes(Boolean inherit)  
at Castle.DynamicProxy.Generators.BaseProxyGenerator.ReplicateNonInheritableAttributes(MethodInfo method, MethodEmitter emitter)  
at Castle.DynamicProxy.Generators.BaseProxyGenerator.ImplementMethod(ClassEmitter emitter, FieldReference interceptorsField, FieldReference[] mixinFields, MethodToGenerate method, Dictionary2 method2Emitter)…

Exception thrown: ‘System.TypeInitializationException’ in Hangfire.Core.dll  
Additional information: The type initializer for ‘Hangfire.AutomaticRetryAttribute’ threw an exception.  
Hangfire.Core.dll version is 1.6.17.0
