Skip to content
This repository was archived by the owner on May 21, 2022. It is now read-only.
This repository was archived by the owner on May 21, 2022. It is now read-only.

Resharper warning "Possible multiple enumeration of IEnumerable" when validating enumerable parameters #3

@TAGC

Description

@TAGC

I've been using this library for my guard clauses for a while, and I quite like it. However, I've recently started using R# and it's causing me to see (and have to suppress) a number of warnings about potential multiple enumerations when I'm using validations like Raise.ArgumentNullException.IfIsNull(someEnumerableParameter);

This is easy to fix - all that's needed is to add [NoEnumeration] from JetBrains.Annotations to any parameters in externally-accessible methods that can accept enumerable parameters, e.g.

public void IfIsNull<TArg>([NoEnumeration] TArg argument)
{
    if (ReferenceEquals(argument, null))
    {
        throw new ArgumentNullException();
    }
}

I'd do this myself and submit a pull request, but for some reason your project literally crashes Visual Studio 2017 every time I try to open it (not sure what's up with that).

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions