Skip to content

[BUG] Exception "Cannot cast Newtonsoft.Json.Linq.JProperty to Newtonsoft.Json.Linq.JToken." when analyzing template using AVM module #388

@ChrisLGardner

Description

@ChrisLGardner

Describe the bug

We've got some bicep that makes use of the container-registry AVM module and when running it through the template analyzer (using the AzDO security task) we get the following exception "Cannot cast Newtonsoft.Json.Linq.JProperty to Newtonsoft.Json.Linq.JToken". I'm not sure what part of the AVM module is causing this and I don't know enough about how this tool works to properly debug what might be going on here.

This happens whether I try to analyze the bicep file or the built json file.

Expected behavior

Bicep is analyzed and reports back an errors/warnings without throwing an exception.

Reproduction Steps

I've been able to get the exception when using just this as the bicep:

module acr 'br/public:avm/res/container-registry/registry:0.7.0' = {
  name: 'testing'
  params: {
    name: 'testing'
  }
}

Environment

TemplateAnalyzer version 0.8.0 when run in AzDO or latest of main when run locally
.net version is 8.0.405
IDE is VS Code 1.96.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions