"method never used" warning in public interfaces

Hi ReSharpies,

we are building a library used by other software in our company. To use classes and member we are offering interface classes. Unfortunately ReSharper shows warnings (when configured so in the inspection severity) for those public members in those interfaces. How can we change that behavior? (No, we don't to turn of that code inspection!!!)

Thanks Andy

Comment actions Permalink

Hello Andy
     You need to "tell" ReSharper that your interface classes and methods can be used outside your solution. That is, you need to mark your interface classes with a special 'UsedImplicitlyAttribute'. In order to have that attribute in your solution:
     1. Open ReSharper > Options > Code Inspection > Code Annotations and press 'Copy default implementation to clipboard' button
     2. Create a new code file, paste the implementation and put it into desired namespace
     3. Open ReSharper > Options > Code Inspection > Code Annotations and select your namespace in the 'Default annotations namespace' list

     Let me know if this helps. Thank you!

Andrey Serebryansky

Support Engineer

JetBrains, Inc


"Develop with pleasure!"
Comment actions Permalink

Hello Andrey,

I did all you asked me for, but R# (Version 5 !!!) doesn't care for it!

Greets Andy


Please sign in to leave a comment.