You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A type is exported from someType.bicep and is explicitly imported into consumer.bicep
There is an output in someType.bicep that uses the exported type
The output has the same name as the exported type
When compiled using az bicep build -f .\consumer.bicep the compiler throws an unhandled exception:
Unhandled exception. System.InvalidOperationException: Sequence contains more than one element
at System.Linq.ThrowHelper.ThrowMoreThanOneElementException()
at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1, Boolean& )
at System.Linq.Enumerable.Single[TSource](IEnumerable`1)
at Bicep.Core.Emit.CompileTimeImports.ImportClosureInfo.FindSymbolNamed(String nameOfSymbolSought, SemanticModel model)
at Bicep.Core.Emit.CompileTimeImports.ImportClosureInfo.CalculateImportClosure(SemanticModel model, IntraTemplateSymbolicReferenceFactory referenceFactory)
at Bicep.Core.Emit.CompileTimeImports.ImportClosureInfo.Calculate(SemanticModel model)
at Bicep.Core.Emit.EmitterContext.<>c__DisplayClass1_0.<.ctor>b__0()
at System.Lazy`1.PublicationOnlyViaFactory(LazyHelper)
at System.Lazy`1.CreateValue()
at System.Lazy`1.get_Value()
at Bicep.Core.Emit.EmitterContext.get_ImportClosureInfo()
at Bicep.Core.Emit.TemplateWriter.GenerateTemplateWithoutHash(PositionTrackingJsonTextWriter jsonWriter)
at Bicep.Core.Emit.TemplateWriter.Write(SourceAwareJsonTextWriter writer)
at Bicep.Core.Emit.TemplateEmitter.<>c__DisplayClass8_0.<Emit>b__0()
at Bicep.Core.Emit.TemplateEmitter.EmitOrFail(Func`1 write)
at Bicep.Core.Emit.TemplateEmitter.Emit(TextWriter textWriter)
at Bicep.Core.Emit.CompilationEmitter.Template(SemanticModel model)
at Bicep.Core.Emit.CompilationEmitter.Template()
at Bicep.Cli.Services.OutputWriter.TemplateToFile(Compilation compilation, Uri outputUri)
at Bicep.Cli.Commands.BuildCommand.RunAsync(BuildArguments 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)
To Reproduce
someType.bicep
@export()
typesomeType = {}
outputsomeTypesomeType = {}
// output st someType = {} // this works!
consumer.bicep
import {someType} from'someType.bicep'
run
az bicep build -f consumer.bicep
Additional context
For anyone else facing this error there are a number of options:
Use import * as st from 'someType.bicep'
Ensure the name of the output does not match the name of the type e.g. output st someType = {}
I imagine the second option is best advised
The text was updated successfully, but these errors were encountered:
Bicep version
Bicep CLI version 0.32.4 (b326faa)
Describe the bug
Scenario:
When compiled using
az bicep build -f .\consumer.bicep
the compiler throws an unhandled exception:To Reproduce
someType.bicep
consumer.bicep
run
Additional context
For anyone else facing this error there are a number of options:
import * as st from 'someType.bicep'
output st someType = {}
I imagine the second option is best advised
The text was updated successfully, but these errors were encountered: