Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error acquiring .NET Core tooling (multiple issues) #318

Closed
hlee-gs1us opened this issue Oct 7, 2019 · 22 comments
Closed

Error acquiring .NET Core tooling (multiple issues) #318

hlee-gs1us opened this issue Oct 7, 2019 · 22 comments

Comments

@hlee-gs1us
Copy link

I have a deploy project (.deployproj file) that was created in visual studio and includes ARM templates. I get the following error when I open the project folder.

Downloading .NET Core tooling version(s) 2.2.5 ...... Error!
Failed to download .NET Core tooling 2.2.5:
/home/ha/.vscode/extensions/msazurermtools.azurerm-vscode-tools-0.7.0/assets/install scripts/dotnet-install.sh: line 147: VERSION_ID: unbound variable
/home/ha/.vscode/extensions/msazurermtools.azurerm-vscode-tools-0.7.0/assets/install scripts/dotnet-install.sh: line 205: VERSION_ID: unbound variable
/home/ha/.vscode/extensions/msazurermtools.azurerm-vscode-tools-0.7.0/assets/install scripts/dotnet-install.sh: line 147: VERSION_ID: unbound variable
/home/ha/.vscode/extensions/msazurermtools.azurerm-vscode-tools-0.7.0/assets/install scripts/dotnet-install.sh: line 147: VERSION_ID: unbound variable


Error: /home/ha/.vscode/extensions/msazurermtools.azurerm-vscode-tools-0.7.0/assets/install scripts/dotnet-install.sh: line 147: VERSION_ID: unbound variable
/home/ha/.vscode/extensions/msazurermtools.azurerm-vscode-tools-0.7.0/assets/install scripts/dotnet-install.sh: line 205: VERSION_ID: unbound variable
/home/ha/.vscode/extensions/msazurermtools.azurerm-vscode-tools-0.7.0/assets/install scripts/dotnet-install.sh: line 147: VERSION_ID: unbound variable
/home/ha/.vscode/extensions/msazurermtools.azurerm-vscode-tools-0.7.0/assets/install scripts/dotnet-install.sh: line 147: VERSION_ID: unbound variable

vscode version information

Version: 1.38.1
Commit: b37e54c98e1a74ba89e03073e5a3761284e3ffb0
Date: 2019-09-11T13:30:08.229Z
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Linux x64 5.3.1-arch1-1-ARCH

@brwilkinson
Copy link

brwilkinson commented Oct 7, 2019

+1 on windows. vscode insiders.

Version: 1.39.0-insider (system setup)
Commit: 601e3e0762ac93e03cfef8336be8223bf32754e1
Date: 2019-09-30T07:41:01.671Z
Electron: 6.0.9
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.18990

Downloading .NET Core tooling version(s) 2.2.5 ... Done!
.NET Core 2.2.5 executable path: c:\Users\<user>\AppData\Roaming\Code - Insiders\User\globalStorage\msazurermtools.azurerm-vscode-tools\.dotnet\2.2.5\dotnet.exe

Error: Unexpected path returned for .net core: c:\Users\<user>\AppData\Roaming\Code - Insiders\User\globalStorage\msazurermtools.azurerm-vscode-tools\.dotnet\2.2.5\dotnet.exe

I have dotnet.exe already in my path.

gcm dotnet

CommandType Name       Version      Source
----------- ----       -------      ------
Application dotnet.exe 3.0.27912.14 C:\Program Files\dotnet\dotnet.exe

@StephenWeatherford
Copy link
Contributor

@brwilkinson Can you tell me if a dir on "c:\Users<user>\AppData\Roaming\Code - Insiders\User\globalStorage\msazurermtools.azurerm-vscode-tools.dotnet\2.2.5\dotnet.exe" succeeds? The extension seems to think that the file doesn't exist or that it's a folder.

@brwilkinson
Copy link

@stephenatwork

No it doesn't exist..

image

In fact there is only a single file in that whole tree

image

@brwilkinson
Copy link

I restarted the extension here are the logs..

Action: acquireDotnet
Error type: Error
Error Message: Unexpected path returned for .net core: c:\Users\benwilk\AppData\Roaming\Code - Insiders\User\globalStorage\msazurermtools.azurerm-vscode-tools.dotnet\2.2.5\dotnet.exe

Version: 0.7.0
OS: win32
Product: Visual Studio Code - Insiders
Product Version: 1.39.0-insider
Language: en

Call Stack
extension.bundle.js:127:132087extension.bundle.js:127:132087
o extension.bundle.js:127:127702
propagateAslWrapper async-listener/index.js:504:23
glue.js:188:31async-listener/glue.js:188:31
index.js:541:70async-listener/index.js:541:70
glue.js:188:31async-listener/glue.js:188:31

@StephenWeatherford
Copy link
Contributor

Can you try F1 -> "Azure Resource Manager Tools: Uninstall dotnet core for this extension", then restart vscode?

@StephenWeatherford
Copy link
Contributor

@hlee-gs1us Can you try the attached version and see if it works? You'll need to unzip, then use F1 -> Install from VSIX...

azurerm-vscode-tools-0.7.1-alpha.zip

If this doesn't work, I'll need to know:

  1. You Linux distro
  2. If running the script directly from https://dot.net/v1/dotnet-install.sh works.

Thanks!

@brwilkinson
Copy link

Stopping ARM Template Language Server...
Language server stopped
Uninstalling local dotnet core from extension...
Done.

Then on restart ...


Using dotnet core from c:\Users\<user>\AppData\Roaming\Code - Insiders\User\globalStorage\msazurermtools.azurerm-vscode-tools\.dotnet\2.2.5\dotnet.exe
Starting ARM Template Language Server at c:\Users\<user>\.vscode-insiders\extensions\msazurermtools.azurerm-vscode-tools-0.7.0\languageServer\Microsoft.ArmLanguageServer.dll
Language server nuget version: 3.0.0-preview.19473.6
Client options:
{
  "documentSelector": [
    {
      "language": "arm-template",
      "scheme": "file"
    }
  ],
  "diagnosticCollectionName": "ARM Template Language Server diagnostics",
  "revealOutputChannelOn": 3
}
Server options:
{
  "run": {
    "command": "c:\\Users\\<user>\\AppData\\Roaming\\Code - Insiders\\User\\globalStorage\\msazurermtools.azurerm-vscode-tools\\.dotnet\\2.2.5\\dotnet.exe",
    "args": [
      "c:\\Users\\<user>\\.vscode-insiders\\extensions\\msazurermtools.azurerm-vscode-tools-0.7.0\\languageServer\\Microsoft.ArmLanguageServer.dll",
      "--logLevel",
      "Warning"
    ],
    "options": {
      "shell": false
    }
  },
  "debug": {
    "command": "c:\\Users\\<user>\\AppData\\Roaming\\Code - Insiders\\User\\globalStorage\\msazurermtools.azurerm-vscode-tools\\.dotnet\\2.2.5\\dotnet.exe",
    "args": [
      "c:\\Users\\<user>\\.vscode-insiders\\extensions\\msazurermtools.azurerm-vscode-tools-0.7.0\\languageServer\\Microsoft.ArmLanguageServer.dll",
      "--logLevel",
      "Warning"
    ],
    "options": {
      "shell": false
    }
  }
}

The (217) files from the extension have now been populated ... in the child directory tree, .. including dotnet.exe

ls 'c:\Users\<user>\AppData\Roaming\Code - Insiders\User\globalStorage\msazurermtools.azurerm-vscode-tools' -file -Recurse | measure


Count    : 217

So I guess that workaround fixed my issue.

@brwilkinson
Copy link

p.s. apologies if this is a separate issue from the linux issue, I figured they maybe related, otherwise I would have opened a new issue.

Let me know if there are any old logs to see why the initial update failed to download the .net components in the first place.

@StephenWeatherford
Copy link
Contributor

@brwilkinson No problem, glad that worked out for you.

@hlee-gs1us
Copy link
Author

@StephenWeatherford - Sorry about my silence. I tried 0.7.1-alpha and had the same result.

I use arch linux.

If I run dotnet-install.sh, it works with the similar unbound VERSION_ID error. It installs sdk 2.1.802.

I realized that the dotnet-install.sh script sources /etc/os-release to get VERSION_ID, but arch linux does not define that variable.

$ cat /etc/os-release 
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="0;36"
HOME_URL="https://www.archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
LOGO=archlinux

@hlee-gs1us
Copy link
Author

I tried adding a line to /etc/os-release and it worked.

VERSION_ID=0

So, it looks like the issue needs to be filed for dotnet-install.sh.

@StephenWeatherford
Copy link
Contributor

Weird, will do that, thanks!

@brwilkinson
Copy link

brwilkinson commented Nov 9, 2019

I am still seeing this error with new installs.. I have also seen the same with working with many of my customers.

So just in case any of this is helpful.

Repro steps:

  1. install the ARM tools
  2. the error below shows up.

Action: acquireDotnet
Error type: Error

Error Message: Unexpected path returned for .net core: c:\Users\<user>\AppData\Roaming\Code - Insiders\User\globalStorage\msazurermtools.azurerm-vscode-tools\.dotnet\2.2.5\dotnet.exe

Version: 0.8.2
OS: win32
Product: Visual Studio Code - Insiders
Product Version: 1.41.0-insider
Language: en

--

Also this is what actually is in the directory..

tree "c:\Users\<user>\AppData\Roaming\Code - Insiders\User\globalStorage\msazurermtools.azurerm-vscode-tools\.dotnet\2.2.5\shared"

Folder PATH listing for volume OS
Volume serial number is A414-F210
C:\USERS\<usesr>\APPDATA\ROAMING\CODE - INSIDERS\USER\GLOBALSTORAGE\MSAZURERMTOOLS.AZURERM-VSCODE-TOOLS\.DOTNET\2.2.5\SHARED
└───Microsoft.NETCore.App
    └───2.2.5

This workaround does work:
F1 > Azure Resource Manager Tools: Uninstall dotnet core for this extension

Call Stack
extension.bundle.js:1:505822extension.bundle.js:1:505822
o extension.bundle.js:1:500821

@StephenWeatherford
Copy link
Contributor

Trying to get a handle on these acquire dotnet issues. Is this error message from above correct?

Error Message: Unexpected path returned for .net core: c:\Users\AppData\Roaming\Code - Insiders\User\globalStorage*msazurermtools.azurerm-vscode-tools.dotnet*\2.2.5\dotnet.exe

I.e., is there really no backslash before ".dotnet"?

@brwilkinson
Copy link

brwilkinson commented Nov 18, 2019

@StephenWeatherford

In the error when it tries to install, there is no slash... where there should be a .dotnet

I guess this regex?

https://github.com/microsoft/vscode-azurearmtools/blob/master/src/languageclient/startArmLanguageServer.ts#L181

@StephenWeatherford
Copy link
Contributor

Never mind, I see in the original markdown that there is a slash, apparently markdown is interpreting the "." as an escaped period.

@StephenWeatherford
Copy link
Contributor

Clue: the install script bails and says ".NET Core Runtime version 2.2.5 is already installed." if the 2.2.5 folder already exists, even if there's nothing in it. That explains why uninstalling works around this issue but restarting vscode does not. Will change to make sure any existing folder is deleted

@brwilkinson
Copy link

@StephenWeatherford okay yeah I updated the post to be a code snippet so it didn't interpret the error message.

@StephenWeatherford
Copy link
Contributor

Thanks. BTW, you can use the new azureResourceManagerTools.languageServer.dotnetExePath setting to point to an existing dotnet.exe instead of us downloading it.

@StephenWeatherford StephenWeatherford changed the title Error acquiring .NET Core tooling! Error acquiring .NET Core tooling (multiple issues) Feb 6, 2020
@neilpeterson neilpeterson modified the milestones: 0.10.0, 0.9.1 Apr 7, 2020
@StephenWeatherford StephenWeatherford removed this from the 0.9.1 milestone Apr 7, 2020
@neilpeterson neilpeterson added this to the 0.9.1 milestone Apr 7, 2020
@StephenWeatherford
Copy link
Contributor

@brwilkinson Sorry for the long delay. We've changed our architecture since we last spoke. Does this still repro for you? Thanks.

@brwilkinson
Copy link

@StephenWeatherford

To test. . . I commented out the following.. which I now to default to in my profile... then restarted VSCode.

// "azureResourceManagerTools.languageServer.dotnetExePath": "C:\\Program Files\\dotnet\\dotnet.exe",

when I look at the logs . . it shows that the DOTNET was successfully installed.

So I assume the issue is resolved. Also I have not seen this with any customers in the past several months.

@StephenWeatherford
Copy link
Contributor

Great! Thanks for letting us know!

@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants