{"id":7510,"date":"2024-02-24T11:23:01","date_gmt":"2024-02-24T11:23:01","guid":{"rendered":"https:\/\/rakhesh.com\/?p=7510"},"modified":"2024-02-24T11:23:01","modified_gmt":"2024-02-24T11:23:01","slug":"bicep-stuck-on-registering-commands-in-vs-code","status":"publish","type":"post","link":"https:\/\/rakhesh.com\/azure\/bicep-stuck-on-registering-commands-in-vs-code\/","title":{"rendered":"Bicep stuck on ‘Registering commands’ in VS Code"},"content":{"rendered":"

Had to work with Bicep today and VS Code was stuck on this for some reason:<\/p>\n

\"\"<\/p>\n

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:<\/p>\n

\"\"<\/p>\n

But the other error refused to go away. Expanding the details didn’t show anything useful either.<\/p>\n

\"\"<\/p>\n

So I clicked View (in the menubar) and Output:<\/p>\n

\"\"<\/p>\n

And in the pane that opened, went to Bicep:<\/p>\n

\"\"<\/p>\n

Here’s what the output showed:<\/p>\n

2024-02-24T10:31:37.294Z info: Current log level: debug.\r\n2024-02-24T10:31:37.297Z info: Acquiring dotnet runtime...\r\n2024-02-24T10:31:37.297Z info: Found config for 'dotnetAcquisitionExtension.existingDotnetPath': {\"extensionId\":\"ms-azuretools.vscode-bicep\",\"path\":\"\/usr\/local\/share\/dotnet\/dotnet\"}\r\n2024-02-24T10:31:37.312Z debug: Found dotnet command at '\/usr\/local\/share\/dotnet\/dotnet'.\r\n2024-02-24T10:31:37.312Z info: Launching Bicep language service...\r\n2024-02-24T10:31:37.313Z debug: Found language server at '\/Users\/xxx\/.vscode\/extensions\/ms-azuretools.vscode-bicep-0.25.53\/bicepLanguageServer\/Bicep.LangServer.dll'.\r\nYou must install or update .NET to run this application.\r\n\r\nApp: \/Users\/rakhesh\/.vscode\/extensions\/ms-azuretools.vscode-bicep-0.25.53\/bicepLanguageServer\/Bicep.LangServer.dll\r\nArchitecture: arm64\r\nFramework: 'Microsoft.NETCore.App', version '8.0.0' (arm64)\r\n.NET location: \/usr\/local\/share\/dotnet\/\r\n\r\nThe following frameworks were found:\r\n  6.0.10 at [\/usr\/local\/share\/dotnet\/shared\/Microsoft.NETCore.App]\r\n  6.0.11 at [\/usr\/local\/share\/dotnet\/shared\/Microsoft.NETCore.App]\r\n  6.0.12 at [\/usr\/local\/share\/dotnet\/shared\/Microsoft.NETCore.App]\r\n  6.0.13 at [\/usr\/local\/share\/dotnet\/shared\/Microsoft.NETCore.App]\r\n  6.0.14 at [\/usr\/local\/share\/dotnet\/shared\/Microsoft.NETCore.App]\r\n  6.0.16 at [\/usr\/local\/share\/dotnet\/shared\/Microsoft.NETCore.App]\r\n  6.0.18 at [\/usr\/local\/share\/dotnet\/shared\/Microsoft.NETCore.App]\r\n  7.0.0 at [\/usr\/local\/share\/dotnet\/shared\/Microsoft.NETCore.App]\r\n  7.0.1 at [\/usr\/local\/share\/dotnet\/shared\/Microsoft.NETCore.App]\r\n  7.0.2 at [\/usr\/local\/share\/dotnet\/shared\/Microsoft.NETCore.App]\r\n  7.0.3 at [\/usr\/local\/share\/dotnet\/shared\/Microsoft.NETCore.App]\r\n  7.0.5 at [\/usr\/local\/share\/dotnet\/shared\/Microsoft.NETCore.App]\r\n  7.0.7 at [\/usr\/local\/share\/dotnet\/shared\/Microsoft.NETCore.App]\r\n\r\nLearn about framework resolution:\r\nhttps:\/\/aka.ms\/dotnet\/app-launch-failed\r\n\r\nTo install missing framework, download:\r\nhttps:\/\/aka.ms\/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.0&arch=arm64&rid=osx.14-arm64\r\n<\/pre>\n

It couldn’t find .NET? That doesn’t make sense. I am pretty sure I have dotnet installed. Use dotnet --list-sdks<\/code> to see the list of installed SDKs and dotnet --list-runtimes<\/code> for the list of runtimes. And dotnet \u2014info<\/code> for everything. Here’s the output of the latter:<\/p>\n

$ dotnet --info\r\n.NET SDK:\r\n Version:           8.0.101\r\n Commit:            6eceda187b\r\n Workload version:  8.0.100-manifests.2fd734c4\r\n\r\nRuntime Environment:\r\n OS Name:     Mac OS X\r\n OS Version:  14.2\r\n OS Platform: Darwin\r\n RID:         osx-arm64\r\n Base Path:   \/opt\/homebrew\/Cellar\/dotnet\/8.0.1\/libexec\/sdk\/8.0.101\/\r\n\r\n.NET workloads installed:\r\n Workload version: 8.0.100-manifests.2fd734c4\r\nThere are no installed workloads to display.\r\n\r\nHost:\r\n  Version:      8.0.1\r\n  Architecture: arm64\r\n  Commit:       bf5e279d92\r\n\r\n.NET SDKs installed:\r\n  8.0.101 [\/opt\/homebrew\/Cellar\/dotnet\/8.0.1\/libexec\/sdk]\r\n\r\n.NET runtimes installed:\r\n  Microsoft.AspNetCore.App 8.0.1 [\/opt\/homebrew\/Cellar\/dotnet\/8.0.1\/libexec\/shared\/Microsoft.AspNetCore.App]\r\n  Microsoft.NETCore.App 8.0.1 [\/opt\/homebrew\/Cellar\/dotnet\/8.0.1\/libexec\/shared\/Microsoft.NETCore.App]\r\n\r\nOther architectures found:\r\n  x64   [\/usr\/local\/share\/dotnet\/x64]\r\n\r\nEnvironment variables:\r\n  DOTNET_ROOT       [\/opt\/homebrew\/Cellar\/dotnet\/8.0.1\/libexec]\r\n\r\nglobal.json file:\r\n  Not found\r\n\r\nLearn more:\r\n  https:\/\/aka.ms\/dotnet\/info\r\n\r\nDownload .NET:\r\n  https:\/\/aka.ms\/dotnet\/download<\/pre>\n

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

I remembered overriding some paths in the pas<\/a>t 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:<\/p>\n

    \"dotnetAcquisitionExtension.existingDotnetPath\": [\r\n        {\r\n            \"extensionId\": \"ms-azuretools.vscode-bicep\", \r\n            \"path\": \"\/usr\/local\/share\/dotnet\/dotnet\"\r\n        },\r\n        {\r\n            \"extensionId\": \"msazurermtools.azurerm-vscode-tools\", \r\n            \"path\": \"\/usr\/local\/share\/dotnet\/dotnet\"\r\n        }\r\n    ],<\/pre>\n

So I removed that, restarted VS Code, and now there’s no errors!<\/p>\n

I am a bit concerned though, coz the output log now shows this:<\/p>\n

2024-02-24T10:56:04.909Z info: Current log level: debug.\r\n2024-02-24T10:56:04.911Z info: Acquiring dotnet runtime...\r\n2024-02-24T10:56:07.303Z debug: Found dotnet command at '\/Users\/xxx\/Library\/Application Support\/Code\/User\/globalStorage\/ms-dotnettools.vscode-dotnet-runtime\/.dotnet\/8.0.2~arm64\/dotnet'.\r\n2024-02-24T10:56:07.303Z info: Launching Bicep language service...\r\n2024-02-24T10:56:07.303Z debug: Found language server at '\/Users\/xxx\/.vscode\/extensions\/ms-azuretools.vscode-bicep-0.25.53\/bicepLanguageServer\/Bicep.LangServer.dll'.\r\n2024-02-24T10:56:07.820Z info: Bicep language service started.\r\n[Info  - 10:56:07] Running on processId 64657<\/pre>\n

Is it downloading its own version of the runtime and using that? Sounds like it.<\/p>\n

The latest version of dotnet<\/a> 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<\/code> is a link to the current version in the Cellar ..\/Cellar\/dotnet\/8.0.1\/bin\/dotnet<\/code>.<\/p>\n

I’d like to keep things consistent, so I added the snippet I removed back… but with the correct path.<\/p>\n

    \"dotnetAcquisitionExtension.existingDotnetPath\": [\r\n        {\r\n            \"extensionId\": \"ms-azuretools.vscode-bicep\", \r\n            \"path\": \"\/opt\/homebrew\/bin\/dotnet\"\r\n        },\r\n        {\r\n            \"extensionId\": \"msazurermtools.azurerm-vscode-tools\", \r\n            \"path\": \"\/opt\/homebrew\/bin\/dotnet\"\r\n        }\r\n    ],<\/pre>\n

Restarted VS Code, and now it’s happy and uses the correct path.<\/p>\n

2024-02-24T11:19:02.103Z info: Current log level: debug.\r\n2024-02-24T11:19:02.105Z info: Acquiring dotnet runtime...\r\n2024-02-24T11:19:02.106Z info: Found config for 'dotnetAcquisitionExtension.existingDotnetPath': {\"extensionId\":\"ms-azuretools.vscode-bicep\",\"path\":\"\/opt\/homebrew\/bin\/dotnet\"}\r\n2024-02-24T11:19:02.117Z debug: Found dotnet command at '\/opt\/homebrew\/bin\/dotnet'.\r\n2024-02-24T11:19:02.117Z info: Launching Bicep language service...\r\n2024-02-24T11:19:02.117Z debug: Found language server at '\/Users\/xxx\/.vscode\/extensions\/ms-azuretools.vscode-bicep-0.25.53\/bicepLanguageServer\/Bicep.LangServer.dll'.\r\n2024-02-24T11:19:03.347Z info: Bicep language service started.\r\n[Info  - 11:19:03] Running on processId 70847\r\n<\/pre>\n

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<\/code>\u00a0and brew install dotnet@7<\/code> etc.<\/p>\n","protected":false},"excerpt":{"rendered":"

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 … Continue reading Bicep stuck on ‘Registering commands’ in VS Code<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[887],"tags":[1041,845,1042],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts\/7510"}],"collection":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/comments?post=7510"}],"version-history":[{"count":1,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts\/7510\/revisions"}],"predecessor-version":[{"id":7516,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts\/7510\/revisions\/7516"}],"wp:attachment":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/media?parent=7510"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/categories?post=7510"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/tags?post=7510"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}