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

Cannot download OmniSharp behind proxy/firewall #579

Closed
weinand opened this issue Jul 18, 2016 · 22 comments
Closed

Cannot download OmniSharp behind proxy/firewall #579

weinand opened this issue Jul 18, 2016 · 22 comments

Comments

@weinand
Copy link

weinand commented Jul 18, 2016

From @TheBlueSky on July 18, 2016 4:37

Hello everyone,

I'm not sure if this is a VS Code or OmniSharp issue, so feel free to move it to the right repository if necessary.

When I open a .Net project, I get the following in Output window:

[INFO] Starting OmniSharp at 'c:\Users\xyz\Documents\My Web Sites\SomeProject'...
[INFO] Installing to C:\Users\xyz\.vscode\extensions\ms-vscode.csharp-1.2.2\.omnisharp
[INFO] Attempting to download omnisharp-1.9-beta11-win-x64-net451.zip...

And it gets stuck there. Nothing is downloaded and my project doesn't have any kind of Intellisense (obviously).

Maybe this is relevant, and maybe not, but at work, we are behind a firewall and a proxy server (from Fortinet) that does strange stuff. One of which is using its own certificate for all HTTPS requests, which I faced an issue with when using an application that require a valid certificate signed by trusted CA, or an application that uses certificate pinning technique.

  • VSCode Version: Code 1.3.1 (e6b4afa53e9c0f54edef1673de9001e9f0f547ae, 2016-07-12T13:35:06.227Z)
  • OS Version: Windows_NT ia32 6.3.9600

Steps to Reproduce:

  1. Go behind our proxy.
  2. Open a .Net project :)

Copied from original issue: microsoft/vscode#9427

@DustinCampbell
Copy link
Member

Hi @TheBlueSky, have specified your proxy settings within VS Code?

@TheBlueSky
Copy link

No. The kind of firewall/proxy that we have in the company does not require specifying proxy settings. You come in the morning, login to the firewall/proxy, and that's all.

I started to face this issue only after v1.0 of .Net Core/ASP.Net Core (not sure what the corresponding OmniSharp or VS Code versions were). Haven't faced this issue during DNX days.

My memory isn't clear whether I tested it with ASP.Net Core RC2 or not; I just know it never worked after v1.0.

@DustinCampbell
Copy link
Member

The extension just uses your default proxy settings unless you specified something different. I assume other operations work? For example, dotnet restore on a new .NET Core project at the command line?

@DustinCampbell DustinCampbell changed the title Cannot download OmniSharp Cannot download OmniSharp behind proxy/firewall Jul 21, 2016
@TheBlueSky
Copy link

Yes, dotnet restore works from command line, whether using Command Prompt or VS Code terminal. From the VS Code Command Palette however, it doesn't; I'm getting "OmniSharp server is not running."

@DustinCampbell
Copy link
Member

Yes, the VS Code command palette uses OmniSharp to determine which projects to run dotnet restore on. I'd like to dig into the proxy issue deeper, but I think there's an additional problem that will keep this from working in the meantime. It appears that you're on 32-bit Windows, correct? Unfortunately, at the moment, the OmniSharp language server only supports 64-bit Windows.

@TheBlueSky
Copy link

At work, I'm using Windows 8.1 Pro 64-bit... at least this is what Windows reports :)

@DustinCampbell
Copy link
Member

Great! In that case, try the following workaround to get things working:

  1. Download and unzip "omnisharp-win-x64-net451.zip" from the latest OmniSharp release.
  2. In Visual Studio Code, select File->Preferences-> User Settings.
  3. In user.settings, add the following:
"csharp.omnisharp": "C:/Path/To/The/OmniSharp/You/Unzipped/OmniSharp.exe"
  1. Restart Visual Studio Code.

Now, try opening a .NET Core project and ensure that things are working.

@TheBlueSky
Copy link

Thanks @DustinCampbell.

So, this worked, as a workaround. Do we know the root cause of the issue? If not, what can I help with?

@DustinCampbell
Copy link
Member

Nope, I don't know the root cause, but it smells like a proxy issue. I'm glad you're up and running for now though.

@DustinCampbell
Copy link
Member

We've done a lot of work to improve this in the latest release to respect http.proxy and http.proxyStrictSSL values. With #958, I'm hopefully that our last issues with this should be addressed. Let me know if you experience this problem with the latest release (1.5.2).

@TheBlueSky
Copy link

@DustinCampbell, unfortunately, this didn't address the issue and OmniSharp is still unable to get the required dependencies/packages... it's the only thing that doesn't work in VS Code behind our firewall, I mean from the options I tried; e.g.; updating VS Code itself, updating its extensions, dotnet restore, and maybe couple of others.

OmniSharp error

@DustinCampbell
Copy link
Member

Do you set the http.proxyStrictSSL setting in VS Code? We recently addressed another issue where we were properly passing the value of this setting if http.proxy wasn't set as well. This addressed a similar-looking issue: #957. Would you willing to give a build of the extension with that fix a try?

  1. Open Visual Studio Code and select View->Extensions to display the Extensions Pane.
  2. In the Extensions pane, clear the little gear icon for the C# extension and select "Uninstall". Confirm Visual Studio Code's prompts and allow it to reload.
  3. Download the latest beta .vsix here.
  4. In the Extensions pane, click the [...] in the top-right corner and select "Install from VSIX...". Locate the .vsix you just download and click "Open".
  5. Allow Visual Studio Code to reload and open your project.

Let me know if the downloads work for you now.

@gregg-miskelly
Copy link
Contributor

If that still doesn't address it, I wonder if we need a way to add additional root certs like in nodejs/node#3742

@DustinCampbell
Copy link
Member

If that doesn't address it, we should push hard for this: microsoft/vscode#6929. 😄

@TheBlueSky
Copy link

@DustinCampbell, happy to announce that 1.5.3 fixed it. I updated the extension this morning and finally saw the long-awaited message Finished 😄

And by the way, I am supporting microsoft/vscode#6929 as well :)

@DustinCampbell
Copy link
Member

Glad to hear it! Fantastic!

@OliverLeitner
Copy link

OliverLeitner commented May 29, 2017

i can confirm this problem still exists:


Updating C# dependencies...
Platform: win32, x86_64

Downloading package 'OmniSharp (.NET 4.6 / x64)' failed (error code '407')
Failed at stage: downloadPackages
407

Finished

my settings.json:


// Platzieren Sie Ihre Einstellungen in dieser Datei, um die Standardeinstellungen zu überschreiben.
{
    "http.proxyStrictSSL": false,
    "http.proxy": "http://companydomain%5Cusername:[email protected]:8080/",
    "https.proxy": "http://companydomain%5Cusername:[email protected]:8080/",
    "csharp.omnisharp": "D:/omnisharp/omnisharp-win-x64-net46/OmniSharp.exe"
}

i have also tried installing manually via vsix files (even different versions to see if the problem still consists...)

i am unsure if it works or not, as its still giving the error as shown above...

could someone tell me how id find out if omnisharp net 4.6.x integration works?

should there be a debugger showing up for .net 4.x in the list of debuggers if it works?

im a bit confused...

thanks for any kind of help with this...

@fizxmike
Copy link

fizxmike commented Jun 2, 2018

This worked for me (in VS Code settings file):

{
    "http.proxyStrictSSL": false,
    "http.proxy": "http://username:[email protected]:8080/"
}

@UrmaGurd
Copy link

UrmaGurd commented May 7, 2019

This worked for me (in VS Code settings file):

{
    "http.proxyStrictSSL": false,
    "http.proxy": "http://username:[email protected]:8080/"
}

Unfortunately this doesn't work for me. Our proxy doesn't need username password so it's just:

    "http.proxyStrictSSL": false,
    "http.proxy": "https://proxy._companydomain_.com:9090",

And as said above, this is the ONLY thing I can't access or download from within Visual Studio behind our corporate firewall.

@TheBeardedLlama
Copy link

Yep this is still an issue.

The environment variables used by vs code and everything else, seem to be ignored by this particular extension

@gkalnytskyi
Copy link

gkalnytskyi commented Oct 8, 2019

Can you suggest a workaround?
I got archives listed in package.json for windows and unzipped them to their respective directories, but when I open folder with a .Net project the ms-vscode.csharp extension still wants to download the Omnisharp archive.

How can I signal to this extension that Omnisharp has been installed manually?

@SheepReaper
Copy link

omnisharp should respect
"http.proxyAuthorization": "Basic base64encoded(user:password)"
in settings.json

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