ReSharper 2026.1 Help

Code inspection: Possibly missing comma before indexer initializer

This inspection reports suspicious code inside an object initializer that looks like an indexer initializer was accidentally attached to the previous member initializer. In practice, this usually means a comma is missing before the next indexer initializer.

Example

var container = new Container { Map = new Dictionary<int, string> { [0] = "zero" }[1] = "one" };

This is parsed as an assignment to the result of an element access expression, which is usually not what was intended.

How to fix it

There is no dedicated quick-fix for this inspection. Add the missing comma so the second indexer initializer becomes a separate initializer entry.

var container = new Container { Map = new Dictionary<int, string> { [0] = "zero" }, [1] = "one" };
01 April 2026