Bicep stuck on ‘Registering commands’ in VS Code

Had to work with Bicep today and VS Code was stuck on this for some reason:

Actually, prior to this it was also throwing an error about being unable to decompile something from my clipboard. I didn’t capture that error, but that went away once I unticked this setting:

But the other error refused to go away. Expanding the details didn’t show anything useful either.

So I clicked View (in the menubar) and Output:

And in the pane that opened, went to Bicep:

Here’s what the output showed:

It couldn’t find .NET? That doesn’t make sense. I am pretty sure I have dotnet installed. Use dotnet --list-sdks to see the list of installed SDKs and dotnet --list-runtimes for the list of runtimes. And dotnet —info for everything. Here’s the output of the latter:

One thing though, they all seem to be installed under /opt/homebrew/Cellar, while the output from the Bicep extension above was looking at /usr/local/share/dotnet/. That path is present in the output of dotnet -info too, but as the x64 architecture. I was on my arm64 Mac though. Could that be the issue?

I remembered overriding some paths in the past and that’s when I was on my Intel iMac, so maybe that’s the reason? That time I had added the following to my VS Code settings file:

So I removed that, restarted VS Code, and now there’s no errors!

I am a bit concerned though, coz the output log now shows this:

Is it downloading its own version of the runtime and using that? Sounds like it.

The latest version of dotnet as of this blog post is 8.0.2 released on 15th Feb. Looks like Homebrew doesn’t know of it, as my system is still on 8.0.1. On my laptop /opt/homebrew/bin/dotnet is a link to the current version in the Cellar ../Cellar/dotnet/8.0.1/bin/dotnet.

I’d like to keep things consistent, so I added the snippet I removed back… but with the correct path.

Restarted VS Code, and now it’s happy and uses the correct path.

One last thing, more as a note for myself. On macOS, with Homebrew, it is possible to install multiple versions of dotnet via brew install dotnet@8 and brew install dotnet@7 etc.