bicep icon indicating copy to clipboard operation
bicep copied to clipboard

brm crashes on startup with "Names and aliases cannot contain whitespace" (VerboseOption) regression since 0.44.1

Open Kasper-Bizzkit opened this issue 4 months ago • 0 comments

Bicep version Azure.Bicep.RegistryModuleTool (brm) 0.44.1 → 0.45.15. Last working: 0.43.8.

Describe the bug Since 0.44.1, brm throws a TypeInitializationException during root-command construction, before any subcommand runs. Because the failure is in GlobalOptions, every invocation aborts: brm generate, brm --version, and brm --help all fail identically, making the tool unusable for regenerating registry modules. The inner exception is from System.CommandLine: VerboseOption's constructor passes the description string "Show verbose information" where the current API expects an alias, and aliases can't contain whitespace. This matches the System.CommandLine migration introduced in 0.44.1.

To Reproduce

dotnet new tool-manifest
dotnet tool install azure.bicep.registrymoduletool --version 0.45.15
dotnet brm --version   # crashes; so do --help and generate

Pinning back to 0.43.8 makes all of them work again.

Additional context Stack trace:

Unhandled exception. System.TypeInitializationException: The type initializer for 'Bicep.RegistryModuleTool.Options.GlobalOptions' threw an exception.
 ---> System.ArgumentException: Names and aliases cannot contain whitespace: "Show verbose information" (Parameter 'alias')
   at System.CommandLine.Symbol.ThrowIfEmptyOrWithWhitespaces(...)
   at System.CommandLine.Option..ctor(String name, String[] aliases)
   at Bicep.RegistryModuleTool.Options.VerboseOption..ctor()
   at Bicep.RegistryModuleTool.Options.GlobalOptions..cctor()
   ...
   at Bicep.RegistryModuleTool.Program.BuildRootCommand(IServiceProvider services)
   at Bicep.RegistryModuleTool.Program.Main(String[] args)

Likely fix: in VerboseOption, set "Show verbose information" via the option's Description property rather than as a constructor alias (the new Option(name, description) → new Option(name, params string[] aliases) signature change); review other options for the same pattern.

Environment: Ubuntu 24.04.1 (WSL2/Win11), .NET SDK 10.0.110, installed as a .NET local tool. Verified broken on 0.44.1 / 0.45.6 / 0.45.15; works on 0.43.8.

Kasper-Bizzkit avatar Jul 17 '26 06:07 Kasper-Bizzkit