Nullreference when adding tags to resources C#

Hi everyone,

Whenever I try to execute a synthesis of the following block:

            new ResourceGroup(this, "azurm_resource_group", new ResourceGroupConfig
                Name = _nameGenerator.GetResNames()["RgName"],
                Location = _nameGenerator.Region,
                Tags = { { "application", "test" } }

I get an System.NullReferenceException. This issue is only related to Tags as when I remove the inner brackets of tags (leaving only Tags = {}) it compiles.

How are the Tags supposed to be used?

Thank you!

Hi there,

I think it should be an array:

Tags = new [] {

Thank you for the reply, sadly, the Tags expects a type of IDictionary:

Hence my initial attempt at a Dictionary-esque approach.
FIXED: It was missing the new Dictionary<string, string> before it’s contents!

Tags = new Dictionary<string, string> { { "application", "test" } }