Skip to content

BUG on CC0008 and CC0009 (ObjectInitializer) when used with collection #501

@giggio

Description

@giggio

CC0008 will be incorrectly raised in this code:

var ys = new System.Collections.Generic.List<int> { 4 };
ys.Capacity = 3;

CC0009 will be incorrectly raised in this code:

new System.Collections.Generic.List<int> ys;
ys = new System.Collections.Generic.List<int> { 4 };
ys.Capacity = 3;

This will cause an error on the code fix, but the problem is with the analyzer, which is not checking initialization with a collection initializer.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions