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

Add support for VSCode Remote scenarios #99

Closed
tintoy opened this issue Jun 24, 2022 · 29 comments
Closed

Add support for VSCode Remote scenarios #99

tintoy opened this issue Jun 24, 2022 · 29 comments

Comments

@tintoy
Copy link
Owner

tintoy commented Jun 24, 2022

See https://code.visualstudio.com/api/advanced-topics/remote-extensions and https://code.visualstudio.com/api/advanced-topics/extension-host for details

@tintoy tintoy self-assigned this Jun 24, 2022
tintoy added a commit that referenced this issue Jun 25, 2022
This will cause VS Code to always run it where the workspace files are (i.e. remote, if connected remotely).

#99
tintoy added a commit that referenced this issue Jun 25, 2022
@tintoy tintoy changed the title Add extension / language-server support for VSCode Remote scenarios Add support for VSCode Remote scenarios Jun 25, 2022
@tintoy
Copy link
Owner Author

tintoy commented Jun 29, 2022

Published v0.4.4 of MSBuild Project Tools extension to the gallery.

@geniuskamo - here is the Codespace-enabled repository I've been testing with: https://github.com/tintoy/msbuild-project-tools-codespace-demo

@geniuskamo
Copy link

Thank you @tintoy

@geniuskamo
Copy link

Published v0.4.4 of MSBuild Project Tools extension to the gallery.

@geniuskamo - here is the Codespace-enabled repository I've been testing with: https://github.com/tintoy/msbuild-project-tools-codespace-demo

How do I use this ?

@loligans
Copy link

I'm also trying to run this, I'm using v0.4.5 inside a Dev Container. The language server doesn't appear to be working for me

@loligans
Copy link

image
This is what I see inside the dev tools

@tintoy
Copy link
Owner Author

tintoy commented Aug 10, 2022

Are you on the latest version of the extension?

There is a setting to turn up the log level for MSBuild Project Tools - can you try setting that to “Verbose” and trying again?

@tintoy
Copy link
Owner Author

tintoy commented Aug 10, 2022

"msbuildProjectTools.logging.level": {

@loligans
Copy link

I tried setting the logging level to verbose for the devcontainer.json and also the .vscode settings.json. It did not give any additional output other than what I screenshotted above. I am connecting to the dev container using VSCode's built in ssh client if that matters

@loligans
Copy link

image

@tintoy
Copy link
Owner Author

tintoy commented Aug 10, 2022

Hmm - I can’t say I’ve seen that one before. I’ll have a look tonight after work and see if I can reproduce the problem.

Just out of curiosity, what is the output of dotnet --info when run in that container?

@loligans
Copy link

The extension is executing within the container. My VSCode instance on the laptop is connecting to that container.

From Container

.NET SDK (reflecting any global.json):
 Version:   6.0.301
 Commit:    43f9b18481

Runtime Environment:
 OS Name:     debian
 OS Version:  11
 OS Platform: Linux
 RID:         debian.11-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.301/

Host (useful for support):
  Version: 6.0.6
  Commit:  7cca709db2

.NET SDKs installed:
  6.0.301 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

From Container Host

.NET SDK (reflecting any global.json):
 Version:   6.0.106
 Commit:    4f1e0330de

Runtime Environment:
 OS Name:     arch
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.106/

Host (useful for support):
  Version: 6.0.6
  Commit:  7cca709db2

.NET SDKs installed:
  6.0.106 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

From Host (my laptop)

.NET SDK (reflecting any global.json):
 Version:   6.0.107
 Commit:    f6ec7508e3

Runtime Environment:
 OS Name:     arch
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.107/

global.json file:
  Not found

Host:
  Version:      6.0.7
  Architecture: x64
  Commit:       0ec02c8c96

.NET SDKs installed:
  6.0.107 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.NETCore.App 6.0.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Download .NET:
  https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info

@tintoy
Copy link
Owner Author

tintoy commented Aug 10, 2022

Sorry, one last question - what version of the extension is VSCode showing (both local and remote)?

@loligans
Copy link

Both local and remote have v0.4.5 installed

@tintoy
Copy link
Owner Author

tintoy commented Aug 10, 2022

Ok - it looks like it’s failing because there is no global.json section in the output (because the section names are localised, we have to count them in order to find the one we want). Interestingly, the output from your local machine does include this section but the container does not.

If you add a global.json file to the solution directory you’re accessing in the container, does the output then include that section?

I’m trying to work out whether we have to somehow guess if that section is present or not…

@tintoy
Copy link
Owner Author

tintoy commented Aug 10, 2022

Ok, it looks like they finally added support for directly listing SDKs and runtime versions:

https://docs.microsoft.com/en-us/dotnet/core/install/how-to-detect-installed-versions?pivots=os-windows#check-sdk-versions

I’ll have a go at switching over to using this instead of parsing the output of dotnet --info (previously, this was the only way to discover SDK versions and their containing directories)…

@loligans
Copy link

If you create a pre-release I could test your change in my container

@tintoy
Copy link
Owner Author

tintoy commented Aug 11, 2022

Sure no problem - will let you know as soon as I have something to test 🙂

@tintoy
Copy link
Owner Author

tintoy commented Aug 12, 2022

Sorry, am still working on this - work has been a little hectic this week 🙂

Should be ready soon.

@tintoy
Copy link
Owner Author

tintoy commented Aug 12, 2022

@loligans - can you try this build? I think the extension should now have a better chance at handling various forms of output from the dotnet command-line tool, but the .NET-side code in the language server itself may still have issues.

@loligans
Copy link

Yes, how can I install it into my container? I don't see a new version when I choose "Install Another Version" in the extension settings

@loligans
Copy link

loligans commented Aug 12, 2022

I tried going back to v0.4.4 and the language server works again. I will still try your build when it becomes available :)

@tintoy
Copy link
Owner Author

tintoy commented Aug 12, 2022

Sorry, it's been a long day - I meant to upload the package as an attachment to that comment 😂

msbuild-project-tools-0.4.6-dev.zip

You may need to explicitly uninstall the extension version from the marketplace before you install from the VSIX package (Extensions -> Install from VSIX) and, afterwards, you can do the reverse to go back to automatic updates.

@loligans
Copy link

Haha no problem! I just tested your fix and its working!

@tintoy
Copy link
Owner Author

tintoy commented Aug 12, 2022

Great - thanks for testing! I’ll make sure nothing else is broken and then publish a new version of the extension to the gallery.

tintoy added a commit to tintoy/msbuild-project-tools-server that referenced this issue Aug 13, 2022
tintoy added a commit to tintoy/msbuild-project-tools-server that referenced this issue Aug 13, 2022
tintoy added a commit that referenced this issue Aug 13, 2022
@tintoy
Copy link
Owner Author

tintoy commented Aug 13, 2022

Published v0.4.6 of the extension to the gallery (the .NET-side language server implementation is also more robust now).

@tintoy tintoy closed this as completed Aug 13, 2022
@loligans
Copy link

Latest version running in the container gives me this exception:

Starting MSBuild language service...
Failed to start the MSBuild language server.
Error: Command failed: "/usr/bin/dotnet" "/home/loligans/.vscode-server/extensions/tintoy.msbuild-project-tools-0.4.6/out/language-server/MSBuildProjectTools.LanguageServer.Host.dll" --probe
System.ArgumentException: '' is not a valid version string. (Parameter 'value')
   at NuGet.Versioning.SemanticVersion.Parse(String value)
   at MSBuildProjectTools.LanguageServer.Utilities.DotNetRuntimeInfo.ParseDotNetVersionOutput(TextReader dotnetVersionOutput) in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Common\Utilities\DotNetRuntimeInfo.cs:line 140
   at MSBuildProjectTools.LanguageServer.Utilities.DotNetRuntimeInfo.GetCurrent(String baseDirectory, ILogger logger) in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Common\Utilities\DotNetRuntimeInfo.cs:line 69
   at MSBuildProjectTools.LanguageServer.Utilities.MSBuildHelper.DiscoverMSBuildEngine(String baseDirectory, ILogger logger) in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Common\Utilities\MSBuildHelper.cs:line 96
   at MSBuildProjectTools.LanguageServer.Program.Main() in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer\Program.cs:line 39

System.ArgumentException: '' is not a valid version string. (Parameter 'value')
   at NuGet.Versioning.SemanticVersion.Parse(String value)
   at MSBuildProjectTools.LanguageServer.Utilities.DotNetRuntimeInfo.ParseDotNetVersionOutput(TextReader dotnetVersionOutput) in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Common\Utilities\DotNetRuntimeInfo.cs:line 140
   at MSBuildProjectTools.LanguageServer.Utilities.DotNetRuntimeInfo.GetCurrent(String baseDirectory, ILogger logger) in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Common\Utilities\DotNetRuntimeInfo.cs:line 69
   at MSBuildProjectTools.LanguageServer.Utilities.MSBuildHelper.DiscoverMSBuildEngine(String baseDirectory, ILogger logger) in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer.Common\Utilities\MSBuildHelper.cs:line 96
   at MSBuildProjectTools.LanguageServer.Program.Main() in D:\Development\github\tintoy\msbuild-project-tools-vscode\lib\server\src\LanguageServer\Program.cs:line 39

@loligans
Copy link

I think I spoke too soon, sorry. I simply rebuilt the container and it started working again. I appreciate your awesome work by supporting this extension! If you had a sponsor link for the project where I could donate to support, I would definitely like to do that

@tintoy
Copy link
Owner Author

tintoy commented Aug 13, 2022

What do you get when you run dotnet --version in the container?

@tintoy
Copy link
Owner Author

tintoy commented Aug 13, 2022

All good, I'm just relieved that it's working for you 🙂

I'll try to improve the error message though.

tintoy added a commit to tintoy/msbuild-project-tools-server that referenced this issue Aug 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants