dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 671 forks source link

.Net Core on VSCode having diff behavior than VS for Mac #1558

Open weinand opened 7 years ago

weinand commented 7 years ago

From @galvesribeiro on June 8, 2017 18:13

When making an HTTP request using Azure SDK in a given application, it throw:

---> System.Net.Http.CurlException: Failure when receiving data from the peer
   at System.Net.Http.CurlHandler.ThrowIfCURLEError(CURLcode error)
   at System.Net.Http.CurlHandler.MultiAgent.FinishRequest(StrongToWeakReference`1 easyWrapper, CURLcode messageResult)
--- End of inner exception stack trace ---

I've reach Azure SDK team and we had debuged it (original issue here https://github.com/Azure/azure-sdk-for-net/issues/3312).

The problem only happen if the application is running on VSCode. If I run using VS for Mac, it works flawless.

That initially led us to think that VSCode was using some different dotnet SDK version than the one installed into the system. I removed completely dotnet SDK and VSCode (including any related hidden folder from $HOME) and the behavior still there.

Can someone point me to the right direction?

PS: For MSFT buddies, that is happening in an internal project so if you need more details and code sample, ping me on Skype for Business and we can talk offline.

Thank you, Gutemberg

Copied from original issue: Microsoft/vscode#28250

weinand commented 7 years ago

From @galvesribeiro on June 8, 2017 18:37

As an extra note, if you run the project on OSX using dotnet run (no IDE involved) the application run properly... In other words, the problem only happen while running from VSCode.

weinand commented 7 years ago

.Net Core functionality is not a built-in feature of VS Code but comes through an extension. As a courtesy I will move this issue to the correct repository.

DustinCampbell commented 7 years ago

@galvesribeiro: To clarify, are you seeing this when running under the debugger?

galvesribeiro commented 7 years ago

@DustinCampbell yep, I do.

Like I said, VS for Mac (debugging) and just dotnet run don't fall in the problem. Only when debugging on VSCode...

DustinCampbell commented 7 years ago

Thanks! I just wanted to figure out who to ping. :smile:

cc @gregg-miskelly, @caslan

gregg-miskelly commented 7 years ago

@galvesribeiro try this:

  1. Open a terminal
  2. cd to the directory of your cwd property in your launch.json
  3. Export any environment variables your launch.json sets
  4. Run: dotnet <path-to-your-app-dll>

Do you see the problem?

galvesribeiro commented 7 years ago

"cwd": "${workspaceRoot}"

And no, the problem doesn't happen...

gregg-miskelly commented 7 years ago

Do you see the problem with 'Debug->Start Without Debugging (Ctrl-F5)' from VS Code?

galvesribeiro commented 7 years ago

Yes, I tried that as well and the exception happens.

gregg-miskelly commented 7 years ago

The only theory I can think of is there is some sort of security or environment context that is flowing from the fact that your app is now a child process of VS Code instead of Terminal.

Do you see the same problem if you use the VS Code integrated terminal? If not, how about if you configure a task.json task which launhes your app?

weinand commented 7 years ago

VS Code tries to propagate the environment variables to the debug adapter or the integrated terminal.

You could try to run the program in VS Code's integrated terminal and see whether this makes a difference.

galvesribeiro commented 7 years ago

Hum... I'll try to do that with the terminal and report back as soon as I got to my PC.