Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

TagHelperOutputExtensions.RemoveRange() does not handle its attributes parameter safely #2491

Closed
@dougbu

Description

@dougbu

the following code:

var attributes = tagHelperOutput.Attributes
    .Where(item => item.Name.StartsWith("route-", StringComparison.OrdinalIgnoreCase));
tagHelperOutput.RemoveRange(attributes);

throws an InvalidOperationException with Message == "Collection was modified; enumeration operation may not execute."

RemoveRange() should use ToArray() or ToList() to avoid such issues in its for loop.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions