Closed
Description
Bicep version
v0.34.1
Describe the bug
Running az bicep lint --file
on this file https://github.com/Azure/ARO-HCP/blob/main/dev-infrastructure/templates/dev-automation-account.bicep
Result in the following error
ERROR: Unhandled exception. System.NotSupportedException: The specified pattern with RegexOptions.NonBacktracking could result in an automata as large as '1305' nodes, which is larger than the configured limit of '1000'.
That file is actually rather simple. I suspect the long strings may cause this issue with a recently introduced regex?
This did not happen on previous version 0.33.93
To Reproduce
See above
Additional context
Full stack trace
CMD-LOG-LINE-BEGIN 38699 | 2025-03-21 10:45:04,411 | INFO | az_command_data_logger | command args: bicep lint --file {}
CMD-LOG-LINE-BEGIN 38699 | 2025-03-21 10:45:06,487 | ERROR | az_command_data_logger | Unhandled exception. System.NotSupportedException: The specified pattern with RegexOptions.NonBacktracking could result in an automata as large as '1305' nodes, which is larger than the configured limit of '1000'.
at System.Text.RegularExpressions.Symbolic.SymbolicRegexRunnerFactory..ctor(RegexTree, RegexOptions, TimeSpan)
at System.Text.RegularExpressions.Regex..ctor(String, RegexOptions, TimeSpan, CultureInfo)
at System.Text.RegularExpressions.RegexCache.GetOrAdd(String, RegexOptions, TimeSpan)
at System.Text.RegularExpressions.Regex.IsMatch(String, String , RegexOptions)
at Bicep.Core.TypeSystem.TypeHelper.MatchesPattern(String pattern, String value)
at Bicep.Core.TypeSystem.TypeValidator.NarrowStringAssignmentType(TypeValidatorConfig config, SyntaxBase expression, TypeSymbol expressionType, StringType targetType)
at Bicep.Core.TypeSystem.TypeValidator.NarrowType(TypeValidatorConfig config, SyntaxBase expression, TypeSymbol expressionType, TypeSymbol targetType)
at Bicep.Core.TypeSystem.TypeValidator.NarrowObjectAssignmentType(TypeValidatorConfig config, SyntaxBase expression, TypeSymbol expressionType, ObjectType targetType)
at Bicep.Core.TypeSystem.TypeValidator.NarrowType(TypeValidatorConfig config, SyntaxBase expression, TypeSymbol expressionType, TypeSymbol targetType)
at Bicep.Core.TypeSystem.TypeValidator.NarrowType(TypeValidatorConfig config, SyntaxBase expression, TypeSymbol targetType)
at Bicep.Core.TypeSystem.TypeValidator.NarrowType(TypeValidatorConfig config, SyntaxBase expression, TypeSymbol expressionType, TypeSymbol targetType)
at Bicep.Core.TypeSystem.TypeValidator.NarrowType(TypeValidatorConfig config, SyntaxBase expression, TypeSymbol targetType)
at Bicep.Core.TypeSystem.TypeValidator.NarrowTypeAndCollectDiagnostics(ITypeManager typeManager, IBinder binder, IDiagnosticLookup parsingErrorLookup, IDiagnosticWriter diagnosticWriter, SyntaxBase expression, TypeSymbol targetType, Boolean isResourceDeclaration)
at Bicep.Core.TypeSystem.TypeAssignmentVisitor.<>c__DisplayClass24_0.<VisitResourceDeclarationSyntax>b__0(IDiagnosticWriter diagnostics)
at Bicep.Core.TypeSystem.TypeAssignmentVisitor.<>c__DisplayClass18_0.<AssignTypeWithDiagnostics>b__0()
at Bicep.Core.TypeSystem.TypeAssignmentVisitor.<>c__DisplayClass16_0.<AssignTypeWithCaching>b__0(SyntaxBase key)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey, Func`2)
at Bicep.Core.TypeSystem.TypeAssignmentVisitor.AssignTypeWithCaching(SyntaxBase syntax, Func`1 assignFunc)
at Bicep.Core.TypeSystem.TypeAssignmentVisitor.AssignTypeWithDiagnostics(SyntaxBase syntax, Func`2 assignFunc)
at Bicep.Core.TypeSystem.TypeAssignmentVisitor.VisitResourceDeclarationSyntax(ResourceDeclarationSyntax syntax)
at Bicep.Core.Syntax.ResourceDeclarationSyntax.Accept(ISyntaxVisitor visitor)
at Bicep.Core.Syntax.SyntaxVisitor.VisitInternal(SyntaxBase node)
at Bicep.Core.Syntax.SyntaxVisitor.Visit(SyntaxBase node)
at Bicep.Core.TypeSystem.TypeAssignmentVisitor.GetTypeAssignment(SyntaxBase syntax)
at Bicep.Core.TypeSystem.TypeAssignmentVisitor.GetTypeInfo(SyntaxBase syntax)
at Bicep.Core.TypeSystem.TypeManager.GetTypeInfo(SyntaxBase syntax)
at Bicep.Core.Semantics.DeclaredSymbol.get_Type()
at Bicep.Core.Semantics.ResourceSymbol.get_Descendants()+MoveNext()
at Bicep.Core.Semantics.SymbolVisitor.VisitDescendants(Symbol symbol)
at Bicep.Core.Semantics.SymbolVisitor.VisitResourceSymbol(ResourceSymbol symbol)
at Bicep.Core.Semantics.SemanticDiagnosticVisitor.VisitResourceSymbol(ResourceSymbol symbol)
at Bicep.Core.Semantics.ResourceSymbol.Accept(SymbolVisitor visitor)
at Bicep.Core.Semantics.SymbolVisitor.VisitInternal(Symbol node)
at Bicep.Core.Semantics.SymbolVisitor.Visit(Symbol node)
at Bicep.Core.Semantics.SymbolVisitor.VisitDescendants(Symbol symbol)
at Bicep.Core.Semantics.SymbolVisitor.VisitFileSymbol(FileSymbol symbol)
at Bicep.Core.Semantics.SemanticDiagnosticVisitor.VisitFileSymbol(FileSymbol symbol)
at Bicep.Core.Semantics.FileSymbol.Accept(SymbolVisitor visitor)
at Bicep.Core.Semantics.SymbolVisitor.VisitInternal(Symbol node)
at Bicep.Core.Semantics.SymbolVisitor.Visit(Symbol node)
at Bicep.Core.Semantics.SemanticModel.GetSemanticDiagnostics()
at Bicep.Core.Semantics.SemanticModel.AssembleDiagnostics()
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper, Boolean)
at System.Lazy`1.CreateValue()
at System.Lazy`1.get_Value()
at Bicep.Core.Semantics.SemanticModel.HasErrors()
at Bicep.Core.TypeSystem.TypeAssignmentVisitor.<>c__DisplayClass26_0.<VisitModuleDeclarationSyntax>b__0(IDiagnosticWriter diagnostics)
at Bicep.Core.TypeSystem.TypeAssignmentVisitor.<>c__DisplayClass18_0.<AssignTypeWithDiagnostics>b__0()
at Bicep.Core.TypeSystem.TypeAssignmentVisitor.<>c__DisplayClass16_0.<AssignTypeWithCaching>b__0(SyntaxBase key)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey, Func`2)
at Bicep.Core.TypeSystem.TypeAssignmentVisitor.AssignTypeWithCaching(SyntaxBase syntax, Func`1 assignFunc)
at Bicep.Core.TypeSystem.TypeAssignmentVisitor.AssignTypeWithDiagnostics(SyntaxBase syntax, Func`2 assignFunc)
at Bicep.Core.TypeSystem.TypeAssignmentVisitor.VisitModuleDeclarationSyntax(ModuleDeclarationSyntax syntax)
at Bicep.Core.Syntax.ModuleDeclarationSyntax.Accept(ISyntaxVisitor visitor)
at Bicep.Core.Syntax.SyntaxVisitor.VisitInternal(SyntaxBase node)
at Bicep.Core.Syntax.SyntaxVisitor.Visit(SyntaxBase node)
at Bicep.Core.TypeSystem.TypeAssignmentVisitor.GetTypeAssignment(SyntaxBase syntax)
at Bicep.Core.TypeSystem.TypeAssignmentVisitor.GetTypeInfo(SyntaxBase syntax)
at Bicep.Core.TypeSystem.TypeManager.GetTypeInfo(SyntaxBase syntax)
at Bicep.Core.Semantics.DeclaredSymbol.get_Type()
at Bicep.Core.Semantics.ModuleSymbol.get_Descendants()+MoveNext()
at Bicep.Core.Semantics.SymbolVisitor.VisitDescendants(Symbol symbol)
at Bicep.Core.Semantics.SymbolVisitor.VisitModuleSymbol(ModuleSymbol symbol)
at Bicep.Core.Semantics.SemanticDiagnosticVisitor.VisitModuleSymbol(ModuleSymbol symbol)
at Bicep.Core.Semantics.ModuleSymbol.Accept(SymbolVisitor visitor)
at Bicep.Core.Semantics.SymbolVisitor.VisitInternal(Symbol node)
at Bicep.Core.Semantics.SymbolVisitor.Visit(Symbol node)
at Bicep.Core.Semantics.SymbolVisitor.VisitDescendants(Symbol symbol)
at Bicep.Core.Semantics.SymbolVisitor.VisitFileSymbol(FileSymbol symbol)
at Bicep.Core.Semantics.SemanticDiagnosticVisitor.VisitFileSymbol(FileSymbol symbol)
at Bicep.Core.Semantics.FileSymbol.Accept(SymbolVisitor visitor)
at Bicep.Core.Semantics.SymbolVisitor.VisitInternal(Symbol node)
at Bicep.Core.Semantics.SymbolVisitor.Visit(Symbol node)
at Bicep.Core.Semantics.SemanticModel.GetSemanticDiagnostics()
at Bicep.Core.Semantics.SemanticModel.AssembleDiagnostics()
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper, Boolean)
at System.Lazy`1.CreateValue()
at System.Lazy`1.get_Value()
at Bicep.Core.Semantics.SemanticModel.GetAllDiagnostics()
at Bicep.Core.Semantics.Compilation.<GetAllDiagnosticsByBicepFile>b__25_1(BicepSourceFile bicepFile)
at System.Collections.Immutable.ImmutableDictionary.<>c__DisplayClass9_0`3.<ToImmutableDictionary>b__0(TSource element)
at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
at System.Collections.Immutable.ImmutableDictionary`2.AddRange(IEnumerable`1, MutationInput, KeyCollisionBehavior )
at System.Collections.Immutable.ImmutableDictionary`2.AddRange(IEnumerable`1, Boolean)
at System.Collections.Immutable.ImmutableDictionary`2.AddRange(IEnumerable`1 )
at System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary[TSource,TKey,TValue](IEnumerable`1, Func`2, Func`2, IEqualityComparer`1 , IEqualityComparer`1 )
at System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary[TSource,TKey,TValue](IEnumerable`1, Func`2, Func`2)
at Bicep.Core.Semantics.Compilation.GetAllDiagnosticsByBicepFile()
at Bicep.Cli.Logging.DiagnosticLogger.LogDiagnostics(DiagnosticOptions options, Compilation compilation)
at Bicep.Cli.Commands.LintCommand.Lint(Uri inputUri, Boolean noRestore, Nullable`1 diagnosticsFormat)
at Bicep.Cli.Commands.LintCommand.RunAsync(LintArguments args)
at Bicep.Cli.Program.RunAsync(String[] args, CancellationToken cancellationToken)
at Bicep.Cli.Program.<>c__DisplayClass3_0.<<Main>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Bicep.Cli.Program.RunWithCancellationAsync(Func`2 runFunc)
at Bicep.Cli.Program.Main(String[] args)
at Bicep.Cli.Program.<Main>(String[] args)
CMD-LOG-LINE-BEGIN 38699 | 2025-03-21 10:45:06,488 | INFO | az_command_data_logger | exit code: 1
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done