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

Docker extension not recognising c# extension version when generating .NET docker files #2867

Closed
dpwdec opened this issue Apr 12, 2021 · 13 comments · Fixed by #2871
Closed

Comments

@dpwdec
Copy link

dpwdec commented Apr 12, 2021

When I used the Add Docker Files to Workspace... utility I get an error message that says:

Cannot generate Dockerfiles for a .NET project unless version 1.23.9 or higher of the C# extension is installed.

I assume this is referring to the Microsoft C# extension for vscode. I have restarted my computer and vscode. I believe both the Docker and C# extensions are installed and updated to their most recent version however I still get this error.

Please let me know if you need me to provide you with further information.

@bwateratmsft
Copy link
Collaborator

Can you check the extensions tab and see what version of the C# extension you have?

@pecigonzalo
Copy link

Im facing the same issue, version is 1.23.11

@bwateratmsft
Copy link
Collaborator

bwateratmsft commented Apr 12, 2021

Strange. Does the issue persist if you restart VSCode @pecigonzalo? Are you using a remote session?

@pecigonzalo
Copy link

Yes it does. I'm indeed using a remote session to WSL2, I suspect that might be the culprit, maybe some bug in checking the remote/local version?

I manually edited the file as a test, inverted the > check and it "works" now.

@dpwdec
Copy link
Author

dpwdec commented Apr 12, 2021

When I list my extensions with versions using dotnet --list-extensions --show-versions I get ms-dotnettools.csharp@1.23.11 for the c# tools.

I am not using a remote desktop or WSL working directly on a mac and have reproduced this on two separate mac machines.

@bwateratmsft
Copy link
Collaborator

bwateratmsft commented Apr 12, 2021

I manually edited the file as a test, inverted the > check and it "works" now.

@pecigonzalo As in, this check? I'd be very interested in what VSCode is giving for cSharpExtension.packageJSON.version there.

@bwateratmsft
Copy link
Collaborator

🤦‍♂️ I realized what's wrong. That < is exactly the problem, it doesn't actually mean what you'd expect. SemVer should be using .lt(), instead. I'm guessing it's doing string comparison; considering strings, '1.23.9' is equal to '1.23.9'--so it passed our initial testing--but '1.23.11' is less than '1.23.9' (alphabetically, i.e. how strings get compared).

@bwateratmsft bwateratmsft self-assigned this Apr 12, 2021
@pecigonzalo
Copy link

I manually edited the file as a test, inverted the > check and it "works" now.

@pecigonzalo As in, this check? I'd be very interested in what VSCode is giving for cSharpExtension.packageJSON.version there.

Yep, exactly that one. It was in the minified JS so I just inverted the symbol, although I could have replaced with just false.

@pecigonzalo
Copy link

pecigonzalo commented Apr 12, 2021

🤦‍♂️ I realized what's wrong. That < is exactly the problem, it doesn't actually mean what you'd expect. SemVer should be using .lt(), instead. I'm guessing it's doing string comparison; considering strings, '1.23.9' is equal to '1.23.9'--so it passed our initial testing--but '1.23.11' is less than '1.23.9' (alphabetically, i.e. how strings get compared).

Yeah, that sounds about right. 🎉 Nice find.

@bwateratmsft
Copy link
Collaborator

@pecigonzalo @dpwdec As a workaround, you can install C# extension 1.23.9 specifically, add the Dockerfiles, and then update back to 1.23.11+.

  1. image
  2. Add Dockerfiles
  3. image

I'm going to get a fix out ASAP.

@bwateratmsft
Copy link
Collaborator

Ok, I just released an update to the Docker extension a few seconds ago. This issue is now fixed in 1.12.1. Sorry for the headache @dpwdec, @pecigonzalo, and thanks for helping me figure it out!

@pecigonzalo
Copy link

pecigonzalo commented Apr 12, 2021 via email

@dpwdec
Copy link
Author

dpwdec commented Apr 13, 2021

@bwateratmsft Yeah, it's working for me now as well. Thank you so much for fixing it so promptly.

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

Successfully merging a pull request may close this issue.

3 participants