I have a code that is checking something if it's not null. It works like Code Contracts (They doesn't work in my project so I use my own implementation).
So for example my test method is:
public static void IsNotNull<T>(this T obj, string argName = null) where T : class
if (obj != null)
if (argName == null)
throw new ArgumentNullException();
throw new ArgumentNullException(argName);
then I call it somewhere:
foreach (T value in source) // working with source
and resharper warns "Possible NullReferenceException". I don't want to turn off this check but I also don't want to get spammed by this message. I tried to apply Code Annotations, but they doesn't work. I want to say "Hey, R#, this code doesn't enumerate collection so don't worry about this call".