Array member treated as null even though it is not.

I have a Block[] Blocks, and the class Block contains a string Name.

I also have a Dictionary<string,int> Names, in which the index of a block in the blocks array is stored with that block’s name as the key.

in a loop meant to populate the dictionary using the block array:
i get an error, saying that the field ‘key’ cannot be null
Here is a screenshot from Visual Studio:

can you Debug.Log i before you populate the disctionary? Also did you initialize the Dictionary somewhere else using new keyword?